You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/04/10 10:11:45 UTC
ignite git commit: IGNITE-3477 - Fixing marshaller context locking
test
Repository: ignite
Updated Branches:
refs/heads/ignite-3477-master bdf4e1e95 -> 99faf1b3b
IGNITE-3477 - Fixing marshaller context locking test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/99faf1b3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/99faf1b3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/99faf1b3
Branch: refs/heads/ignite-3477-master
Commit: 99faf1b3b24f5b1d0b3e414fa40ec311a5d294ee
Parents: bdf4e1e
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Apr 10 13:12:07 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Apr 10 13:12:07 2017 +0300
----------------------------------------------------------------------
.../MarshallerContextLockingSelfTest.java | 33 ++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99faf1b3/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
index 0e278f3..0496382 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
@@ -20,14 +20,17 @@ package org.apache.ignite.internal;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
import org.apache.ignite.internal.processors.marshaller.MarshallerMappingTransport;
import org.apache.ignite.internal.processors.pool.PoolProcessor;
+import org.apache.ignite.internal.util.lang.GridPlainRunnable;
import org.apache.ignite.testframework.GridTestClassLoader;
import org.apache.ignite.testframework.junits.GridTestKernalContext;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -45,6 +48,9 @@ public class MarshallerContextLockingSelfTest extends GridCommonAbstractTest {
/** */
private GridTestKernalContext ctx;
+ /** */
+ private static final int THREADS = 4;
+
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
innerLog = new InnerLogger();
@@ -58,7 +64,7 @@ public class MarshallerContextLockingSelfTest extends GridCommonAbstractTest {
}
};
- ctx.setSystemExecutorService(Executors.newFixedThreadPool(12));
+ ctx.setSystemExecutorService(Executors.newFixedThreadPool(THREADS));
ctx.add(new PoolProcessor(ctx));
ctx.add(new GridClosureProcessor(ctx));
@@ -90,7 +96,30 @@ public class MarshallerContextLockingSelfTest extends GridCommonAbstractTest {
return null;
}
- }, 4);
+ }, THREADS);
+
+ final CountDownLatch arrive = new CountDownLatch(THREADS);
+
+ // Wait for all pending tasks in closure processor to complete.
+ for (int i = 0; i < THREADS; i++) {
+ ctx.closure().runLocalSafe(new GridPlainRunnable() {
+ @Override
+ public void run() {
+ arrive.countDown();
+
+ try {
+ arrive.await();
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+
+ throw new IgniteInterruptedException(e);
+ }
+ }
+ }, true);
+ }
+
+ arrive.await();
assertTrue(InternalExecutor.counter.get() == 0);