You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/06/11 03:03:49 UTC

[17/26] incubator-ignite git commit: # sprint-5 minor

# sprint-5 minor


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

Branch: refs/heads/ignite-484-1
Commit: 2b056f0bfea7efced660ccb47e7dfd5968e137d8
Parents: eeae5b7
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jun 10 14:04:03 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jun 10 14:04:03 2015 +0300

----------------------------------------------------------------------
 .../client/memcache/MemcacheRestExample.java    | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b056f0b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
index 877dadd..a15afd7 100644
--- a/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
@@ -85,22 +85,22 @@ public class MemcacheRestExample {
             // Check that cache is empty.
             System.out.println(">>> Current cache size: " + cache.size() + " (expected: 0).");
 
-            // Create atomic long.
-            IgniteAtomicLong l = ignite.atomicLong("atomicLong", 10, true);
-
-            // Increment atomic long by 5 using Memcache client.
-            if (client.incr("atomicLong", 5, 0) == 15)
-                System.out.println(">>> Successfully incremented atomic long by 5.");
-
-            // Increment atomic long using Ignite API and check that value is correct.
-            System.out.println(">>> New atomic long value: " + l.incrementAndGet() + " (expected: 16).");
-
-            // Decrement atomic long by 3 using Memcache client.
-            if (client.decr("atomicLong", 3, 0) == 13)
-                System.out.println(">>> Successfully decremented atomic long by 3.");
-
-            // Decrement atomic long using Ignite API and check that value is correct.
-            System.out.println(">>> New atomic long value: " + l.decrementAndGet() + " (expected: 12).");
+            // Create atomic long and close it after test is done.
+            try (IgniteAtomicLong l = ignite.atomicLong("atomicLong", 10, true)) {
+                // Increment atomic long by 5 using Memcache client.
+                if (client.incr("atomicLong", 5, 0) == 15)
+                    System.out.println(">>> Successfully incremented atomic long by 5.");
+
+                // Increment atomic long using Ignite API and check that value is correct.
+                System.out.println(">>> New atomic long value: " + l.incrementAndGet() + " (expected: 16).");
+
+                // Decrement atomic long by 3 using Memcache client.
+                if (client.decr("atomicLong", 3, 0) == 13)
+                    System.out.println(">>> Successfully decremented atomic long by 3.");
+
+                // Decrement atomic long using Ignite API and check that value is correct.
+                System.out.println(">>> New atomic long value: " + l.decrementAndGet() + " (expected: 12).");
+            }
         }
         finally {
             if (client != null)