ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/50] incubator-ignite git commit: # IGNITE-709 Create TcpClientDiscoverySpi automatically for nodes in client mode.
Date Fri, 29 May 2015 12:46:27 GMT
# IGNITE-709 Create TcpClientDiscoverySpi automatically for nodes in client mode.


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

Branch: refs/heads/ignite-929
Commit: 97e6bd341796a60a047571d3e3741219ccad67bd
Parents: 87fa310
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Mon May 25 15:12:25 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Mon May 25 15:12:25 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/IgnitionEx.java   | 19 +++++++++++++++----
 .../ignite/internal/GridReleaseTypeSelfTest.java |  2 ++
 .../GridDiscoveryManagerAliveCacheSelfTest.java  |  5 ++++-
 ...cpClientDiscoveryMarshallerCheckSelfTest.java |  2 ++
 .../tcp/TcpClientDiscoverySpiSelfTest.java       |  2 ++
 .../tcp/TcpDiscoveryConcurrentStartTest.java     |  2 ++
 .../tcp/TcpDiscoveryMultiThreadedTest.java       |  2 ++
 7 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index abd55c6..4f246e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1747,6 +1747,13 @@ public class IgnitionEx {
                 myCfg.setFileSystemConfiguration(clone);
             }
 
+            if (myCfg.isClientMode() == null || !myCfg.isClientMode()) {
+                if (myCfg.getDiscoverySpi() instanceof TcpClientDiscoverySpi) {
+                    throw new IgniteCheckedException("TcpClientDiscoverySpi can be used in
client mode only, you " +
+                        "have to set IgniteConfiguration#isClientMode to 'true'");
+                }
+            }
+
             initializeDefaultSpi(myCfg);
 
             initializeDefaultCacheConfiguration(myCfg);
@@ -1811,11 +1818,15 @@ public class IgnitionEx {
          * @param cfg Ignite configuration.
          */
         private void initializeDefaultSpi(IgniteConfiguration cfg) {
-            if (cfg.getDiscoverySpi() == null)
-                cfg.setDiscoverySpi(new TcpDiscoverySpi());
+            if (cfg.getDiscoverySpi() == null) {
+                if (cfg.isClientMode() != null && cfg.isClientMode())
+                    cfg.setDiscoverySpi(new TcpClientDiscoverySpi());
+                else
+                    cfg.setDiscoverySpi(new TcpDiscoverySpi());
+            }
 
-            if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpi) {
-                TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+            if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpiAdapter) {
+                TcpDiscoverySpiAdapter tcpDisco = (TcpDiscoverySpiAdapter)cfg.getDiscoverySpi();
 
                 if (tcpDisco.getIpFinder() == null)
                     tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
index 4733ae5..b2374fb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
@@ -55,6 +55,8 @@ public class GridReleaseTypeSelfTest extends GridCommonAbstractTest {
                     attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, nodeVer);
                 }
             };
+
+            cfg.setClientMode(true);
         }
         else {
             discoSpi = new TcpDiscoverySpi() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index 55d4d80..0af90c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -91,8 +91,11 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
 
         TcpDiscoverySpiAdapter disc;
 
-        if (clientMode && ((gridName.charAt(gridName.length() - 1) - '0') & 1)
!= 0)
+        if (clientMode && ((gridName.charAt(gridName.length() - 1) - '0') & 1)
!= 0) {
             disc = new TcpClientDiscoverySpi();
+
+            cfg.setClientMode(true);
+        }
         else {
             TcpDiscoverySpi srvDisc = new TcpDiscoverySpi();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
index ad61755..a2dee89 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
@@ -47,6 +47,8 @@ public class TcpClientDiscoveryMarshallerCheckSelfTest extends GridCommonAbstrac
         else {
             discoSpi = new TcpClientDiscoverySpi();
 
+            cfg.setClientMode(true);
+
             cfg.setMarshaller(new OptimizedMarshaller());
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index 727d505..8157d59 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -118,6 +118,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest
{
         else if (gridName.startsWith("client")) {
             disco = new TestTcpClientDiscovery();
 
+            cfg.setClientMode(true);
+
             TcpDiscoveryVmIpFinder ipFinder;
 
             if (clientIpFinder != null)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryConcurrentStartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryConcurrentStartTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryConcurrentStartTest.java
index 67566a8..d8512e3 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryConcurrentStartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryConcurrentStartTest.java
@@ -52,6 +52,8 @@ public class TcpDiscoveryConcurrentStartTest extends GridCommonAbstractTest
{
 
         cfg.setCacheConfiguration();
 
+        cfg.setClientMode(client);
+
         return cfg;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/97e6bd34/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index a2d8276..6509a6d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -75,6 +75,8 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest
{
 
             spi.setIpFinder(ipFinder);
 
+            cfg.setClientMode(true);
+
             cfg.setDiscoverySpi(spi);
         }
         else {


Mime
View raw message