You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/11/03 13:24:56 UTC

[17/18] ignite git commit: 1093

1093


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

Branch: refs/heads/ignite-1093-3
Commit: 5ae676ac7f93ec1e2b3f54ac3ad0c5f8a5c493f1
Parents: 948d3fd
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 3 15:12:39 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 3 15:12:39 2015 +0300

----------------------------------------------------------------------
 .../GridCachePartitionExchangeManager.java      | 27 ++++++++++----------
 .../ignite/internal/util/nio/GridNioServer.java |  2 --
 2 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5ae676ac/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 6ca4717..e8f1a61 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.NavigableMap;
@@ -142,7 +141,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     private GridFutureAdapter<?> reconnectExchangeFut;
 
     /** */
-    private final Queue<Callable<Boolean>> rebalancingQueue = new ConcurrentLinkedDeque8<>();
+    private final Queue<Callable<Boolean>> rebalanceQ = new ConcurrentLinkedDeque8<>();
 
     /**
      * Partition map futures.
@@ -1278,7 +1277,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                     }
 
                     if (assignsMap != null) {
-                        rebalancingQueue.clear();
+                        int size = assignsMap.size();
+
+                        rebalanceQ.clear();
 
                         NavigableMap<Integer, List<Integer>> orderMap = new TreeMap<>();
 
@@ -1290,20 +1291,20 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                             int order = cacheCtx.config().getRebalanceOrder();
 
                             if (orderMap.get(order) == null)
-                                orderMap.put(order, new LinkedList<Integer>());
+                                orderMap.put(order, new ArrayList<Integer>(size));
 
                             orderMap.get(order).add(cacheId);
                         }
 
-                        Callable<Boolean> marsR = null;
-                        LinkedList<Callable<Boolean>> orderedRs = new LinkedList<>();
+                        Callable<Boolean> marshR = null;
+                        List<Callable<Boolean>> orderedRs = new ArrayList<>(size);
 
                         //Ordered rebalance scheduling.
                         for (Integer order : orderMap.keySet()) {
                             for (Integer cacheId : orderMap.get(order)) {
                                 GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
 
-                                List<String> waitList = new LinkedList<>();
+                                List<String> waitList = new ArrayList<>(size - 1);
 
                                 for (List<Integer> cIds : orderMap.headMap(order).values()) {
                                     for (Integer cId : cIds) {
@@ -1319,7 +1320,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                                         ", waitList=" + waitList.toString() + "]");
 
                                     if (cacheId == CU.cacheId(GridCacheUtils.MARSH_CACHE_NAME))
-                                        marsR = r;
+                                        marshR = r;
                                     else
                                         orderedRs.add(r);
                                 }
@@ -1329,15 +1330,15 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                         if (asyncStartFut != null)
                             asyncStartFut.get(); // Wait for thread stop.
 
-                        rebalancingQueue.addAll(orderedRs);
+                        rebalanceQ.addAll(orderedRs);
 
-                        if (marsR != null || !rebalancingQueue.isEmpty()) {
+                        if (marshR != null || !rebalanceQ.isEmpty()) {
                             if (futQ.isEmpty()) {
                                 U.log(log, "Starting caches rebalancing [top=" + exchFut.topologyVersion() + "]");
 
-                                if (marsR != null)
+                                if (marshR != null)
                                     try {
-                                        marsR.call(); //Marshaller cache rebalancing launches in sync way.
+                                        marshR.call(); //Marshaller cache rebalancing launches in sync way.
                                     }
                                     catch (Exception ex) {
                                         if (log.isDebugEnabled())
@@ -1354,7 +1355,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                                     @Override public Boolean call() {
                                         try {
                                             while (true) {
-                                                Callable<Boolean> r = rebalancingQueue.poll();
+                                                Callable<Boolean> r = rebalanceQ.poll();
 
                                                 if (r == null)
                                                     return false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ae676ac/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 183838b..1824339 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -525,8 +525,6 @@ public class GridNioServer<T> {
         assert ses instanceof GridSelectorNioSessionImpl;
         assert op == NioOperation.PAUSE_READ || op == NioOperation.RESUME_READ;
 
-        U.log(log, "Pausing reads");
-
         GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
 
         if (impl.closed())