ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: test
Date Tue, 27 Dec 2016 15:27:21 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1.8.2-balance dc038fca6 -> 7f4d15329


test


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

Branch: refs/heads/ignite-1.8.2-balance
Commit: 7f4d153291a3885c16cc45f35de518426c1f0f6f
Parents: dc038fc
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Dec 27 18:26:58 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Dec 27 18:26:58 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/nio/GridNioServer.java | 30 ++++++++++++++++----
 .../communication/tcp/TcpCommunicationSpi.java  |  4 +--
 2 files changed, 27 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4d1532/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 11c1ea9..91188da 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
@@ -275,7 +275,7 @@ public class GridNioServer<T> {
         GridNioMessageWriterFactory writerFactory,
         IgnitePredicate<Message> skipRecoveryPred,
         IgniteBiInClosure<GridNioSession, Integer> msgQueueLsnr,
-        boolean balancing,
+        Balancer balancing,
         GridNioFilter... filters
     ) throws IgniteCheckedException {
         if (port != -1)
@@ -359,10 +359,25 @@ public class GridNioServer<T> {
 
         IgniteRunnable balancer0 = null;
 
-        if (balancing && balancePeriod > 0) {
+        if (balancing != null && balancePeriod > 0) {
             boolean rndBalance = IgniteSystemProperties.getBoolean(IGNITE_IO_BALANCE_RANDOM_BALANCE,
false);
 
-            balancer0 = rndBalance ? new RandomBalancer() : new SizeBasedBalancer2(balancePeriod);
+            if (rndBalance)
+                balancer0 = new RandomBalancer();
+            else {
+                switch (balancing) {
+                    case SIZE1:
+                        balancer0 = new SizeBasedBalancer(balancePeriod);
+                        break;
+
+                    case SIZE2:
+                        balancer0 = new SizeBasedBalancer2(balancePeriod);
+                        break;
+
+                    default:
+                        throw new IllegalArgumentException("Balancer: " + balancing);
+                }
+            }
 
             log.info("Balancer: " + balancer0.getClass().getSimpleName());
         }
@@ -3049,6 +3064,11 @@ public class GridNioServer<T> {
         }
     }
 
+    public static enum Balancer {
+        SIZE1,
+        SIZE2
+    }
+
     /**
      * Constructs a new instance of {@link GridNioServer}.
      */
@@ -3127,7 +3147,7 @@ public class GridNioServer<T> {
         private long selectorSpins;
 
         /** NIO sessions balancing flag. */
-        private boolean balancing;
+        private Balancer balancing;
 
         /**
          * Finishes building the instance.
@@ -3174,7 +3194,7 @@ public class GridNioServer<T> {
          * @param balancing NIO sessions balancing flag.
          * @return This for chaining.
          */
-        public Builder<T> balancing(boolean balancing) {
+        public Builder<T> balancing(Balancer balancing) {
             this.balancing = balancing;
 
             return this;

http://git-wip-us.apache.org/repos/asf/ignite/blob/7f4d1532/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 02b976a..0a8dfac 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -2057,7 +2057,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         .writerFactory(writerFactory)
                         .skipRecoveryPredicate(skipRecoveryPred)
                         .messageQueueSizeListener(queueSizeMonitor)
-                        .balancing(true) // Current balancing logic assumes separate in/out
connections.
+                        .balancing(usePairedConnections ? GridNioServer.Balancer.SIZE1 :
GridNioServer.Balancer.SIZE2)
                         .build();
 
                 boundTcpPort = port;
@@ -2066,7 +2066,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 if (log.isInfoEnabled())
                     log.info("Successfully bound communication NIO server to TCP port " +
                         "[port=" + boundTcpPort + ", locHost=" + locHost + ", selectorsCnt="
+ selectorsCnt +
-                        ", selectorSpins=" + srvr.selectorSpins() + ']');
+                        ", selectorSpins=" + srvr.selectorSpins() + ", pairedConnections="
+ usePairedConnections + ']');
 
                 srvr.idleTimeout(idleConnTimeout);
 


Mime
View raw message