Ignite-5075
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7622c577 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7622c577 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7622c577 Branch: refs/heads/ignite-5075 Commit: 7622c577e6a26aee981b876d221c96c6424f4236 Parents: 919ad1a Author: Igor Seliverstov <[email protected]> Authored: Thu May 11 10:43:08 2017 +0300 Committer: Igor Seliverstov <[email protected]> Committed: Thu May 11 10:43:08 2017 +0300 ---------------------------------------------------------------------- .../ignite/internal/processors/cache/GridCacheProcessor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7622c577/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 84e3532..2f06d0d 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 @@ -843,6 +843,8 @@ public class GridCacheProcessor extends GridProcessorAdapter { final AffinityTopologyVersion startTopVer = new AffinityTopologyVersion(ctx.discovery().localJoinEvent().topologyVersion(), 0); + final List<IgniteInternalFuture> syncFuts = new ArrayList<>(caches.size()); + sharedCtx.forAllCaches(new CIX1<GridCacheContext>() { @Override public void applyx(GridCacheContext cctx) throws IgniteCheckedException { CacheConfiguration cfg = cctx.config(); @@ -853,11 +855,15 @@ public class GridCacheProcessor extends GridProcessorAdapter { CacheMode cacheMode = cfg.getCacheMode(); if (cacheMode == REPLICATED || (cacheMode == PARTITIONED && cfg.getRebalanceDelay() >= 0)) - cctx.preloader().syncFuture().get(); + // Need to wait outside to avoid a deadlock + syncFuts.add(cctx.preloader().syncFuture()); } } }); + for (int i = 0, size = syncFuts.size(); i < size; i++) + syncFuts.get(i).get(); + assert ctx.config().isDaemon() || caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started"; if (!ctx.clientNode() && !ctx.isDaemon())
