# ignite-sprint-5 fixed TopologyVersionAwareJob
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d3cb5c4e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d3cb5c4e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d3cb5c4e Branch: refs/heads/ignite-816 Commit: d3cb5c4e42632c6d9b92d9a84749f2732d00f6e5 Parents: 4929c7d Author: sboikov <sboi...@gridgain.com> Authored: Fri May 22 09:02:27 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Fri May 22 09:02:27 2015 +0300 ---------------------------------------------------------------------- .../internal/processors/cache/GridCacheAdapter.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d3cb5c4e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 8d7b135..d390037 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -5510,7 +5510,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V /** {@inheritDoc} */ @Nullable @Override public final Object execute() { - waitAffinityReadyFuture(); + if (!waitAffinityReadyFuture()) + return null; IgniteInternalCache cache = ((IgniteKernal)ignite).context().cache().cache(cacheName); @@ -5525,8 +5526,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V /** * Holds (suspends) job execution until our cache version becomes equal to remote cache's version. + * + * @return {@code True} if topology check passed. */ - private void waitAffinityReadyFuture() { + private boolean waitAffinityReadyFuture() { GridCacheProcessor cacheProc = ((IgniteKernal)ignite).context().cache(); AffinityTopologyVersion locTopVer = cacheProc.context().exchange().readyAffinityVersion(); @@ -5535,15 +5538,20 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V IgniteInternalFuture<?> fut = cacheProc.context().exchange().affinityReadyFuture(topVer); if (fut != null && !fut.isDone()) { + jobCtx.holdcc(); + fut.listen(new CI1<IgniteInternalFuture<?>>() { - @Override public void apply(IgniteInternalFuture<?> t) { + @Override + public void apply(IgniteInternalFuture<?> t) { jobCtx.callcc(); } }); - jobCtx.holdcc(); + return false; } } + + return true; } }