You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2021/11/22 17:42:24 UTC

[ignite-3] branch ignite-15307 updated: wip propagate bootstrap factory

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch ignite-15307
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/ignite-15307 by this push:
     new a894afa  wip propagate bootstrap factory
a894afa is described below

commit a894afa5057bdc59fe4ac1289f75d2e363dcd477
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Nov 22 20:38:55 2021 +0300

    wip propagate bootstrap factory
---
 .../ignite/network/ClusterServiceFactory.java      |  5 +++--
 .../ignite/utils/ClusterServiceTestUtils.java      |  4 ++--
 .../internal/network/netty/ConnectionManager.java  |  4 +---
 .../scalecube/ScaleCubeClusterServiceFactory.java  | 10 ++++++++--
 .../org/apache/ignite/internal/app/IgniteImpl.java | 23 +++++++++++++++++-----
 5 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/modules/network-api/src/main/java/org/apache/ignite/network/ClusterServiceFactory.java b/modules/network-api/src/main/java/org/apache/ignite/network/ClusterServiceFactory.java
index 46dfb9c..42c9ab7 100644
--- a/modules/network-api/src/main/java/org/apache/ignite/network/ClusterServiceFactory.java
+++ b/modules/network-api/src/main/java/org/apache/ignite/network/ClusterServiceFactory.java
@@ -28,10 +28,11 @@ public interface ClusterServiceFactory {
      *
      * @param context              Cluster context.
      * @param networkConfiguration Network configuration.
+     * @param nettyBootstrapFactory
      * @return New cluster service.
      */
     ClusterService createClusterService(
             ClusterLocalConfiguration context,
-            NetworkConfiguration networkConfiguration
-    );
+            NetworkConfiguration networkConfiguration,
+            NettyBootstrapFactory nettyBootstrapFactory);
 }
diff --git a/modules/network/src/integrationTest/java/org/apache/ignite/utils/ClusterServiceTestUtils.java b/modules/network/src/integrationTest/java/org/apache/ignite/utils/ClusterServiceTestUtils.java
index f0a8703..59d8e49 100644
--- a/modules/network/src/integrationTest/java/org/apache/ignite/utils/ClusterServiceTestUtils.java
+++ b/modules/network/src/integrationTest/java/org/apache/ignite/utils/ClusterServiceTestUtils.java
@@ -74,8 +74,8 @@ public class ClusterServiceTestUtils {
         
         var clusterSvc = clusterSvcFactory.createClusterService(
                 ctx,
-                nodeConfigurationMgr.configurationRegistry().getConfiguration(NetworkConfiguration.KEY)
-        );
+                nodeConfigurationMgr.configurationRegistry().getConfiguration(NetworkConfiguration.KEY),
+                nettyBootstrapFactory);
         
         assert nodeFinder instanceof StaticNodeFinder : "Only StaticNodeFinder is supported at the moment";
         
diff --git a/modules/network/src/main/java/org/apache/ignite/internal/network/netty/ConnectionManager.java b/modules/network/src/main/java/org/apache/ignite/internal/network/netty/ConnectionManager.java
index efdb12e..34e2cd8 100644
--- a/modules/network/src/main/java/org/apache/ignite/internal/network/netty/ConnectionManager.java
+++ b/modules/network/src/main/java/org/apache/ignite/internal/network/netty/ConnectionManager.java
@@ -117,9 +117,7 @@ public class ConnectionManager {
                 serverHandshakeManagerFactory,
                 this::onNewIncomingChannel,
                 this::onMessage,
-                serializationRegistry,
-                bossGroup,
-                workerGroup
+                serializationRegistry
         );
         this.clientBootstrap = createClientBootstrap(clientWorkerGroup, networkConfiguration.outbound());
     }
diff --git a/modules/network/src/main/java/org/apache/ignite/network/scalecube/ScaleCubeClusterServiceFactory.java b/modules/network/src/main/java/org/apache/ignite/network/scalecube/ScaleCubeClusterServiceFactory.java
index 7e420c6..e9c0d14 100644
--- a/modules/network/src/main/java/org/apache/ignite/network/scalecube/ScaleCubeClusterServiceFactory.java
+++ b/modules/network/src/main/java/org/apache/ignite/network/scalecube/ScaleCubeClusterServiceFactory.java
@@ -38,6 +38,7 @@ import org.apache.ignite.network.AbstractClusterService;
 import org.apache.ignite.network.ClusterLocalConfiguration;
 import org.apache.ignite.network.ClusterService;
 import org.apache.ignite.network.ClusterServiceFactory;
+import org.apache.ignite.network.NettyBootstrapFactory;
 import org.apache.ignite.network.NetworkAddress;
 import org.apache.ignite.network.NodeFinder;
 import org.apache.ignite.network.NodeFinderFactory;
@@ -49,7 +50,11 @@ import org.apache.ignite.network.serialization.MessageSerializationRegistry;
 public class ScaleCubeClusterServiceFactory implements ClusterServiceFactory {
     /** {@inheritDoc} */
     @Override
-    public ClusterService createClusterService(ClusterLocalConfiguration context, NetworkConfiguration networkConfiguration) {
+    public ClusterService createClusterService(
+            ClusterLocalConfiguration context,
+            NetworkConfiguration networkConfiguration,
+            NettyBootstrapFactory nettyBootstrapFactory
+    ) {
         var topologyService = new ScaleCubeTopologyService();
 
         var messagingService = new ScaleCubeMessagingService();
@@ -77,7 +82,8 @@ public class ScaleCubeClusterServiceFactory implements ClusterServiceFactory {
                         registry,
                         consistentId,
                         () -> new RecoveryServerHandshakeManager(launchId, consistentId, messageFactory),
-                        () -> new RecoveryClientHandshakeManager(launchId, consistentId, messageFactory)
+                        () -> new RecoveryClientHandshakeManager(launchId, consistentId, messageFactory),
+                        nettyBootstrapFactory
                 );
 
                 var transport = new ScaleCubeDirectMarshallerTransport(connectionMgr, topologyService, messageFactory);
diff --git a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
index 7d3f6cd..f58bb8d 100644
--- a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
+++ b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
@@ -68,6 +68,7 @@ import org.apache.ignite.lang.NodeStoppingException;
 import org.apache.ignite.network.ClusterLocalConfiguration;
 import org.apache.ignite.network.ClusterService;
 import org.apache.ignite.network.MessageSerializationRegistryImpl;
+import org.apache.ignite.network.NettyBootstrapFactory;
 import org.apache.ignite.network.scalecube.ScaleCubeClusterServiceFactory;
 import org.apache.ignite.rest.RestModule;
 import org.apache.ignite.table.manager.IgniteTables;
@@ -108,6 +109,9 @@ public class IgniteImpl implements Ignite {
 
     /** Cluster service (cluster network manager). */
     private final ClusterService clusterSvc;
+    
+    /** Netty bootstrap factory. */
+    private final NettyBootstrapFactory nettyBootstrapFactory;
 
     /** Raft manager. */
     private final Loza raftMgr;
@@ -162,13 +166,22 @@ public class IgniteImpl implements Ignite {
                 List.of(),
                 List.of()
         );
+    
+        NetworkConfiguration networkConfiguration = nodeCfgMgr.configurationRegistry().getConfiguration(NetworkConfiguration.KEY);
+        
+        ClusterLocalConfiguration clusterLocalConfiguration = new ClusterLocalConfiguration(
+                name,
+                new MessageSerializationRegistryImpl()
+        );
+        
+        var consistentId = clusterLocalConfiguration.getName();
+        
+        nettyBootstrapFactory = new NettyBootstrapFactory(networkConfiguration.value(), consistentId);
 
         clusterSvc = new ScaleCubeClusterServiceFactory().createClusterService(
-                new ClusterLocalConfiguration(
-                        name,
-                        new MessageSerializationRegistryImpl()
-                ),
-                nodeCfgMgr.configurationRegistry().getConfiguration(NetworkConfiguration.KEY)
+                clusterLocalConfiguration,
+                networkConfiguration,
+                nettyBootstrapFactory
         );
 
         raftMgr = new Loza(clusterSvc, workDir);