ignite-1093

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

Branch: refs/heads/ignite-1093
Commit: 6a733ef9165096f4c75e71874938cfc83a6998f8
Parents: db72f53
Author: Anton Vinogradov <vinogradov.an...@gmail.com>
Authored: Tue Aug 11 19:15:03 2015 +0300
Committer: Anton Vinogradov <vinogradov.an...@gmail.com>
Committed: Tue Aug 11 19:15:03 2015 +0300

----------------------------------------------------------------------
 .../dht/preloader/GridDhtPartitionDemander.java | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a733ef9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index fca9f53..30a04c0 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -120,6 +120,50 @@ public class GridDhtPartitionDemander {
      *
      */
     void start() {
+        int rebalanceOrder = cctx.config().getRebalanceOrder();
+
+        if (!CU.isMarshallerCache(cctx.name())) {
+            if (log.isDebugEnabled())
+                log.debug("Waiting for marshaller cache preload [cacheName=" + 
cctx.name() + ']');
+
+            try {
+                
cctx.kernalContext().cache().marshallerCache().preloader().syncFuture().get();
+            }
+            catch (IgniteInterruptedCheckedException ignored) {
+                if (log.isDebugEnabled())
+                    log.debug("Failed to wait for marshaller cache preload 
future (grid is stopping): " +
+                        "[cacheName=" + cctx.name() + ']');
+
+                return;
+            }
+            catch (IgniteCheckedException e) {
+                throw new Error("Ordered preload future should never fail: " + 
e.getMessage(), e);
+            }
+        }
+
+        if (rebalanceOrder > 0) {
+            IgniteInternalFuture<?> fut = 
cctx.kernalContext().cache().orderedPreloadFuture(rebalanceOrder);
+
+            try {
+                if (fut != null) {
+                    if (log.isDebugEnabled())
+                        log.debug("Waiting for dependant caches rebalance 
[cacheName=" + cctx.name() +
+                            ", rebalanceOrder=" + rebalanceOrder + ']');
+
+                    fut.get();
+                }
+            }
+            catch (IgniteInterruptedCheckedException ignored) {
+                if (log.isDebugEnabled())
+                    log.debug("Failed to wait for ordered rebalance future 
(grid is stopping): " +
+                        "[cacheName=" + cctx.name() + ", rebalanceOrder=" + 
rebalanceOrder + ']');
+
+                return;
+            }
+            catch (IgniteCheckedException e) {
+                throw new Error("Ordered rebalance future should never fail: " 
+ e.getMessage(), e);
+            }
+        }
     }
 
     /**

Reply via email to