IGNITE-45 - Fixed JavaDoc

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/135fe35d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/135fe35d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/135fe35d

Branch: refs/heads/ignite-497-stick
Commit: 135fe35d41cf85e65cc4c62f07999bcc89b31bf3
Parents: 902998c
Author: Valentin Kulichenko <vkuliche...@gridgain.com>
Authored: Sun Mar 22 23:06:30 2015 -0700
Committer: Valentin Kulichenko <vkuliche...@gridgain.com>
Committed: Sun Mar 22 23:06:30 2015 -0700

----------------------------------------------------------------------
 .../store/dummy/CacheDummyStoreExample.java     | 56 ++++++++++++++------
 .../hibernate/CacheHibernateStoreExample.java   | 56 ++++++++++++++------
 .../store/jdbc/CacheJdbcStoreExample.java       | 56 ++++++++++++++------
 3 files changed, 117 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/135fe35d/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
index 7ee0ff7..6cc9760 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
@@ -75,34 +75,56 @@ public class CacheDummyStoreExample {
             cacheCfg.setWriteThrough(true);
 
             try (IgniteCache<Long, Person> cache = 
ignite.getOrCreateCache(cacheCfg)) {
-                long start = System.currentTimeMillis();
+                // Make initial cache loading from persistent store. This is a
+                // distributed operation and will call 
CacheStore.loadCache(...)
+                // method on all nodes in topology.
+                loadCache(cache);
+
+                // Start transaction and execute several cache operations with
+                // read/write-through to persistent store.
+                executeTransaction(cache);
+            }
+        }
+    }
 
-                // Start loading cache from persistent store on all caching 
nodes.
-                cache.loadCache(null, ENTRY_COUNT);
+    /**
+     * Makes initial cache loading.
+     *
+     * @param cache Cache to load.
+     */
+    private static void loadCache(IgniteCache<Long, Person> cache) {
+        long start = System.currentTimeMillis();
 
-                long end = System.currentTimeMillis();
+        // Start loading cache from persistent store on all caching nodes.
+        cache.loadCache(null, ENTRY_COUNT);
 
-                System.out.println(">>> Loaded " + cache.size() + " keys with 
backups in " + (end - start) + "ms.");
+        long end = System.currentTimeMillis();
 
-                // Start transaction and make several operations with 
write/read-through.
-                try (Transaction tx = ignite.transactions().txStart()) {
-                    Person val = cache.get(id);
+        System.out.println(">>> Loaded " + cache.size() + " keys with backups 
in " + (end - start) + "ms.");
+    }
 
-                    System.out.println("Read value: " + val);
+    /**
+     * Executes transaction with read/write-through to persistent store.
+     *
+     * @param cache Cache to execute transaction on.
+     */
+    private static void executeTransaction(IgniteCache<Long, Person> cache) {
+        try (Transaction tx = Ignition.ignite().transactions().txStart()) {
+            Person val = cache.get(id);
 
-                    val = cache.getAndPut(id, new Person(id, "Isaac", 
"Newton"));
+            System.out.println("Read value: " + val);
 
-                    System.out.println("Overwrote old value: " + val);
+            val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
 
-                    val = cache.get(id);
+            System.out.println("Overwrote old value: " + val);
 
-                    System.out.println("Read value: " + val);
+            val = cache.get(id);
 
-                    tx.commit();
-                }
+            System.out.println("Read value: " + val);
 
-                System.out.println("Read value after commit: " + 
cache.get(id));
-            }
+            tx.commit();
         }
+
+        System.out.println("Read value after commit: " + cache.get(id));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/135fe35d/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
index af28d68..00b698d 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -75,34 +75,56 @@ public class CacheHibernateStoreExample {
             cacheCfg.setWriteThrough(true);
 
             try (IgniteCache<Long, Person> cache = 
ignite.getOrCreateCache(cacheCfg)) {
-                long start = System.currentTimeMillis();
+                // Make initial cache loading from persistent store. This is a
+                // distributed operation and will call 
CacheStore.loadCache(...)
+                // method on all nodes in topology.
+                loadCache(cache);
+
+                // Start transaction and execute several cache operations with
+                // read/write-through to persistent store.
+                executeTransaction(cache);
+            }
+        }
+    }
 
-                // Start loading cache from persistent store on all caching 
nodes.
-                cache.loadCache(null, ENTRY_COUNT);
+    /**
+     * Makes initial cache loading.
+     *
+     * @param cache Cache to load.
+     */
+    private static void loadCache(IgniteCache<Long, Person> cache) {
+        long start = System.currentTimeMillis();
 
-                long end = System.currentTimeMillis();
+        // Start loading cache from persistent store on all caching nodes.
+        cache.loadCache(null, ENTRY_COUNT);
 
-                System.out.println(">>> Loaded " + cache.size() + " keys with 
backups in " + (end - start) + "ms.");
+        long end = System.currentTimeMillis();
 
-                // Start transaction and make several operations with 
write/read-through.
-                try (Transaction tx = ignite.transactions().txStart()) {
-                    Person val = cache.get(id);
+        System.out.println(">>> Loaded " + cache.size() + " keys with backups 
in " + (end - start) + "ms.");
+    }
 
-                    System.out.println("Read value: " + val);
+    /**
+     * Executes transaction with read/write-through to persistent store.
+     *
+     * @param cache Cache to execute transaction on.
+     */
+    private static void executeTransaction(IgniteCache<Long, Person> cache) {
+        try (Transaction tx = Ignition.ignite().transactions().txStart()) {
+            Person val = cache.get(id);
 
-                    val = cache.getAndPut(id, new Person(id, "Isaac", 
"Newton"));
+            System.out.println("Read value: " + val);
 
-                    System.out.println("Overwrote old value: " + val);
+            val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
 
-                    val = cache.get(id);
+            System.out.println("Overwrote old value: " + val);
 
-                    System.out.println("Read value: " + val);
+            val = cache.get(id);
 
-                    tx.commit();
-                }
+            System.out.println("Read value: " + val);
 
-                System.out.println("Read value after commit: " + 
cache.get(id));
-            }
+            tx.commit();
         }
+
+        System.out.println("Read value after commit: " + cache.get(id));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/135fe35d/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
index a65e41b..0df624a 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
@@ -75,34 +75,56 @@ public class CacheJdbcStoreExample {
             cacheCfg.setWriteThrough(true);
 
             try (IgniteCache<Long, Person> cache = 
ignite.getOrCreateCache(cacheCfg)) {
-                long start = System.currentTimeMillis();
+                // Make initial cache loading from persistent store. This is a
+                // distributed operation and will call 
CacheStore.loadCache(...)
+                // method on all nodes in topology.
+                loadCache(cache);
+
+                // Start transaction and execute several cache operations with
+                // read/write-through to persistent store.
+                executeTransaction(cache);
+            }
+        }
+    }
 
-                // Start loading cache from persistent store on all caching 
nodes.
-                cache.loadCache(null, ENTRY_COUNT);
+    /**
+     * Makes initial cache loading.
+     *
+     * @param cache Cache to load.
+     */
+    private static void loadCache(IgniteCache<Long, Person> cache) {
+        long start = System.currentTimeMillis();
 
-                long end = System.currentTimeMillis();
+        // Start loading cache from persistent store on all caching nodes.
+        cache.loadCache(null, ENTRY_COUNT);
 
-                System.out.println(">>> Loaded " + cache.size() + " keys with 
backups in " + (end - start) + "ms.");
+        long end = System.currentTimeMillis();
 
-                // Start transaction and make several operations with 
write/read-through.
-                try (Transaction tx = ignite.transactions().txStart()) {
-                    Person val = cache.get(id);
+        System.out.println(">>> Loaded " + cache.size() + " keys with backups 
in " + (end - start) + "ms.");
+    }
 
-                    System.out.println("Read value: " + val);
+    /**
+     * Executes transaction with read/write-through to persistent store.
+     *
+     * @param cache Cache to execute transaction on.
+     */
+    private static void executeTransaction(IgniteCache<Long, Person> cache) {
+        try (Transaction tx = Ignition.ignite().transactions().txStart()) {
+            Person val = cache.get(id);
 
-                    val = cache.getAndPut(id, new Person(id, "Isaac", 
"Newton"));
+            System.out.println("Read value: " + val);
 
-                    System.out.println("Overwrote old value: " + val);
+            val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
 
-                    val = cache.get(id);
+            System.out.println("Overwrote old value: " + val);
 
-                    System.out.println("Read value: " + val);
+            val = cache.get(id);
 
-                    tx.commit();
-                }
+            System.out.println("Read value: " + val);
 
-                System.out.println("Read value after commit: " + 
cache.get(id));
-            }
+            tx.commit();
         }
+
+        System.out.println("Read value after commit: " + cache.get(id));
     }
 }

Reply via email to