Repository: incubator-ignite Updated Branches: refs/heads/ignite-gg-10186 52491c673 -> 4b0d53ecb
# ignite-gg-10186 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4b0d53ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4b0d53ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4b0d53ec Branch: refs/heads/ignite-gg-10186 Commit: 4b0d53ecb62033601b5cda6bc16c18e97babc33a Parents: 52491c6 Author: sboikov <sboi...@gridgain.com> Authored: Wed May 6 12:34:26 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Wed May 6 12:34:26 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheProcessor.java | 2 +- .../processors/cache/CacheGetFromJobTest.java | 37 ++++++++------------ 2 files changed, 16 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b0d53ec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index a288cef..d22d224 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -125,7 +125,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { private Marshaller marshaller = new JdkMarshaller(); /** Count down latch for caches. */ - private CountDownLatch cacheStartedLatch = new CountDownLatch(1); + private final CountDownLatch cacheStartedLatch = new CountDownLatch(1); /** * @param ctx Kernal context. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b0d53ec/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java index 60ef4eb..5859bec 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; -import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; @@ -28,36 +27,19 @@ import org.apache.ignite.testframework.*; import java.util.concurrent.atomic.*; /** - * Job try to get cache. + * Job tries to get cache during topology change. */ public class CacheGetFromJobTest extends GridCacheAbstractSelfTest { - private static final String CACHE_NAME = null; /** {@inheritDoc} */ @Override protected int gridCount() { return 1; } /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - startGrid(); - - super.beforeTest(); - } - - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { stopAllGrids(); } - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { - CacheConfiguration cfg = super.cacheConfiguration(gridName); - - cfg.setName(CACHE_NAME); - - return cfg; - } - /** * @throws Exception If failed. */ @@ -72,7 +54,7 @@ public class CacheGetFromJobTest extends GridCacheAbstractSelfTest { try { for (int i = 0; i < 5; i++) { - info("Topology change " + i); + info("Topology change: " + i); startGrid(id.getAndIncrement()); } @@ -85,9 +67,16 @@ public class CacheGetFromJobTest extends GridCacheAbstractSelfTest { } }, 3, "topology-change-thread"); - while (!fut.isDone()) + int cntr = 0; + + while (!fut.isDone()) { grid(0).compute().broadcast(new TestJob()); + cntr++; + } + + log.info("Job execution count: " + cntr); + Exception err0 = err.get(); if (err0 != null) @@ -109,7 +98,11 @@ public class CacheGetFromJobTest extends GridCacheAbstractSelfTest { /** {@inheritDoc} */ @Override public Object call() throws Exception { - assert ignite.cache(CACHE_NAME) != null; + IgniteCache cache = ignite.cache(null); + + assertNotNull(cache); + + assertEquals(0, cache.localSize()); return null; }