Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-746-debug d63ded410 -> 785211d53


# ignite-746-debug


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

Branch: refs/heads/ignite-746-debug
Commit: 785211d5311341130f0fb5ef92c820d4865a440d
Parents: d63ded4
Author: sboikov <[email protected]>
Authored: Wed Apr 15 12:21:51 2015 +0300
Committer: sboikov <[email protected]>
Committed: Wed Apr 15 12:21:51 2015 +0300

----------------------------------------------------------------------
 ...eAtomicInvalidPartitionHandlingSelfTest.java | 166 ++++++++++++-------
 1 file changed, 108 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785211d5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 22cd609..a2a7183 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.plugin.extensions.communication.*;
@@ -237,93 +238,142 @@ public class 
GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
             System.err.println("FINISHED PUTS");
 
             // Start put threads.
+//            IgniteInternalFuture<?> fut = multithreadedAsync(new 
Callable<Object>() {
+//                @Override public Object call() throws Exception {
+//                    Random rnd = new Random();
+//
+//                    while (!done.get()) {
+//                        int cnt = rnd.nextInt(5);
+//
+//                        boolean put = cnt < 2;
+//
+//                        Map<Integer, Integer> upd = null;
+//
+//                        int key = 0;
+//
+//                        if (put) {
+//                            key = rnd.nextInt(range);
+//
+//                            int val = rnd.nextInt();
+//
+//                            TestDebugLog.addEntryMessage(key, val, "put");
+//
+//                            asyncCache.put(key, val);
+//                        }
+//                        else {
+//                            upd = new TreeMap<>();
+//
+//                            for (int i = 0; i < cnt; i++) {
+//                                key = rnd.nextInt(range);
+//                                int val = rnd.nextInt();
+//
+//                                upd.put(key, val);
+//
+//                                TestDebugLog.addEntryMessage(key, val, 
"putAll");
+//                            }
+//
+//                            asyncCache.putAll(upd);
+//                        }
+//
+//                        try {
+//                            asyncCache.future().get(30_000);
+//                        }
+//                        catch (IgniteFutureTimeoutException e) {
+//                            TestDebugLog.addMessage("update timeout, put: " 
+ put);
+//
+//                            TestDebugLog.printMessages(false);
+//
+//                            System.exit(22);
+//                        }
+//                        catch (CachePartialUpdateException ignored) {
+//                            // No-op.
+//                        }
+//                        catch (IgniteException e) {
+//                            if 
(e.hasCause(CacheAtomicUpdateTimeoutCheckedException.class)) {
+//                                TestDebugLog.addMessage("atomic update 
timeout, put: " + put);
+//
+//                                TestDebugLog.printMessages(false);
+//
+//                                System.exit(22);
+//                            }
+//
+//                            if 
(!e.hasCause(CachePartialUpdateCheckedException.class))
+//                                throw e;
+//                        }
+//                    }
+//
+//                    return null;
+//                }
+//            }, 4, "update-thread");
             IgniteInternalFuture<?> fut = multithreadedAsync(new 
Callable<Object>() {
                 @Override public Object call() throws Exception {
                     Random rnd = new Random();
 
-                    while (!done.get()) {
-                        int cnt = rnd.nextInt(5);
+                    try {
+                        while (!done.get()) {
+                            int cnt = rnd.nextInt(5);
 
-                        TestDebugLog.clear();
+                            boolean put = cnt < 2;
 
-                        boolean put = cnt < 2;
+                            Map<Integer, Integer> upd = null;
 
-                        Map<Integer, Integer> upd = null;
+                            int key = 0;
 
-                        int key = 0;
+                            if (put) {
+                                key = rnd.nextInt(range);
 
-                        if (put) {
-                            key = rnd.nextInt(range);
+                                int val = rnd.nextInt();
 
-                            int val = rnd.nextInt();
+                                TestDebugLog.addEntryMessage(key, val, "put");
 
-                            TestDebugLog.addEntryMessage(key, val, "put");
+                                cache.put(key, val);
+                            }
+                            else {
+                                upd = new TreeMap<>();
 
-                            asyncCache.put(key, val);
-                        }
-                        else {
-                            upd = new TreeMap<>();
+                                for (int i = 0; i < cnt; i++) {
+                                    key = rnd.nextInt(range);
+                                    int val = rnd.nextInt();
 
-                            for (int i = 0; i < cnt; i++) {
-                                key = rnd.nextInt(range);
-                                int val = rnd.nextInt();
+                                    upd.put(key, val);
 
-                                upd.put(key, val);
+                                    TestDebugLog.addEntryMessage(key, val, 
"putAll");
+                                }
 
-                                TestDebugLog.addEntryMessage(key, val, 
"putAll");
+                                cache.putAll(upd);
                             }
-
-                            asyncCache.putAll(upd);
                         }
+                    }
+                    catch (CachePartialUpdateException e) {
 
-                        try {
-                            asyncCache.future().get(30_000);
-                        }
-                        catch (IgniteFutureTimeoutException e) {
-                            TestDebugLog.addMessage("update timeout, put: " + 
put);
+                    }
+                    catch (CacheAtomicUpdateTimeoutException e) {
+                        e.printStackTrace();
 
-                            /*
-                            if (upd != null) {
-                                for (Object key0 : upd.keySet())
-                                    TestDebugLog.printKeyMessages(false, key0);
-                            }
-                            else
-                                TestDebugLog.printKeyMessages(false, key);
-                                */
+                        TestDebugLog.addMessage("atomic update timeout");
 
-                            TestDebugLog.printMessages(false);
+                        TestDebugLog.printMessages(false);
 
-                            System.exit(22);
-                        }
-                        catch (CachePartialUpdateException ignored) {
-                            // No-op.
-                        }
-                        catch (IgniteException e) {
-                            if 
(e.hasCause(CacheAtomicUpdateTimeoutCheckedException.class)) {
-                                TestDebugLog.addMessage("atomic update 
timeout, put: " + put);
-
-                            /*
-                            if (upd != null) {
-                                for (Object key0 : upd.keySet())
-                                    TestDebugLog.printKeyMessages(false, key0);
-                            }
-                            else
-                                TestDebugLog.printKeyMessages(false, key);
-                                */
+                        System.exit(22);
 
-                                TestDebugLog.printMessages(false);
+                    }
+                    catch (Exception e) {
+                        if (X.hasCause(e, 
CacheAtomicUpdateTimeoutCheckedException.class)) {
+                            e.printStackTrace();
 
-                                System.exit(22);
-                            }
+                            TestDebugLog.addMessage("atomic update timeout2");
 
-                            if 
(!e.hasCause(CachePartialUpdateCheckedException.class))
-                                throw e;
+                            TestDebugLog.printMessages(false);
+
+                            System.exit(22);
                         }
+
+                        throw e;
                     }
 
                     return null;
                 }
-            }, 1, "update-thread");
+            }, 4, "update-thread");
 
             Random rnd = new Random();
 

Reply via email to