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:49:03 UTC
[ignite-3] 01/02: wip propagate bootstrap factory, remove ClusterServiceFactory interface
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
commit 8b7cad1a9c8c32c97811eae6294e0740a3044995
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Nov 22 20:47:10 2021 +0300
wip propagate bootstrap factory, remove ClusterServiceFactory interface
---
.../ignite/network/ClusterServiceFactory.java | 38 ----------------------
.../internal/network/netty/ConnectionManager.java | 14 ++++----
.../ignite/network/NettyBootstrapFactory.java | 4 +++
.../scalecube/ScaleCubeClusterServiceFactory.java | 6 ++--
.../org/apache/ignite/internal/app/IgniteImpl.java | 10 +++---
5 files changed, 18 insertions(+), 54 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
deleted file mode 100644
index 42c9ab7..0000000
--- a/modules/network-api/src/main/java/org/apache/ignite/network/ClusterServiceFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.network;
-
-import org.apache.ignite.configuration.schemas.network.NetworkConfiguration;
-
-/**
- * Cluster service factory.
- */
-public interface ClusterServiceFactory {
- /**
- * Creates a new {@link ClusterService} using the provided context. The created network will not be in the "started" state.
- *
- * @param context Cluster context.
- * @param networkConfiguration Network configuration.
- * @param nettyBootstrapFactory
- * @return New cluster service.
- */
- ClusterService createClusterService(
- ClusterLocalConfiguration context,
- NetworkConfiguration networkConfiguration,
- NettyBootstrapFactory nettyBootstrapFactory);
-}
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 34e2cd8..0b51cd8 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
@@ -57,8 +57,8 @@ public class ConnectionManager {
/** Latest version of the direct marshalling protocol. */
public static final byte DIRECT_PROTOCOL_VERSION = 1;
- /** Bootstrap factory. */
- private final NettyBootstrapFactory bootstrapFactory;
+ /** Client bootstrap. */
+ private final Bootstrap clientBootstrap;
/** Server. */
private final NettyServer server;
@@ -109,17 +109,17 @@ public class ConnectionManager {
this.consistentId = consistentId;
this.clientHandshakeManagerFactory = clientHandshakeManagerFactory;
- this.bootstrapFactory = bootstrapFactory;
-
this.server = new NettyServer(
consistentId,
networkConfiguration,
serverHandshakeManagerFactory,
this::onNewIncomingChannel,
this::onMessage,
- serializationRegistry
+ serializationRegistry,
+ bootstrapFactory
);
- this.clientBootstrap = createClientBootstrap(clientWorkerGroup, networkConfiguration.outbound());
+
+ this.clientBootstrap = bootstrapFactory.createClientBootstrap();
}
/**
@@ -271,8 +271,6 @@ public class ConnectionManager {
try {
stopFut.join();
- // TODO: IGNITE-14538 quietPeriod and timeout should be configurable.
- clientWorkerGroup.shutdownGracefully(0L, 15, TimeUnit.SECONDS).sync();
} catch (Exception e) {
LOG.warn("Failed to stop the ConnectionManager: {}", e.getMessage());
}
diff --git a/modules/network/src/main/java/org/apache/ignite/network/NettyBootstrapFactory.java b/modules/network/src/main/java/org/apache/ignite/network/NettyBootstrapFactory.java
index 2c2b852..4995802 100644
--- a/modules/network/src/main/java/org/apache/ignite/network/NettyBootstrapFactory.java
+++ b/modules/network/src/main/java/org/apache/ignite/network/NettyBootstrapFactory.java
@@ -62,6 +62,10 @@ public class NettyBootstrapFactory {
bossGroup = NamedNioEventLoopGroup.create(consistentId + "-srv-accept");
workerGroup = NamedNioEventLoopGroup.create(consistentId + "-srv-worker");
clientWorkerGroup = NamedNioEventLoopGroup.create(consistentId + "-client");
+
+ // TODO: When do we stop everything?
+ // TODO: IGNITE-14538 quietPeriod and timeout should be configurable.
+ // clientWorkerGroup.shutdownGracefully(0L, 15, TimeUnit.SECONDS).sync();
}
/**
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 e9c0d14..65dbaff 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
@@ -37,7 +37,6 @@ import org.apache.ignite.internal.network.recovery.RecoveryServerHandshakeManage
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;
@@ -45,11 +44,10 @@ import org.apache.ignite.network.NodeFinderFactory;
import org.apache.ignite.network.serialization.MessageSerializationRegistry;
/**
- * {@link ClusterServiceFactory} implementation that uses ScaleCube for messaging and topology services.
+ * ScaleCube cluster service factory for messaging and topology services.
*/
-public class ScaleCubeClusterServiceFactory implements ClusterServiceFactory {
+public class ScaleCubeClusterServiceFactory {
/** {@inheritDoc} */
- @Override
public ClusterService createClusterService(
ClusterLocalConfiguration context,
NetworkConfiguration networkConfiguration,
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 f58bb8d..a31356a 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
@@ -231,10 +231,12 @@ public class IgniteImpl implements Ignite {
restModule = new RestModule(nodeCfgMgr, clusterCfgMgr);
- // TODO: Create a common class to hold EventLoopGroup, and create all bootstraps.
- // - Put it into network-api
- // - Inject where needed
- clientHandlerModule = new ClientHandlerModule(qryEngine, distributedTblMgr, nodeCfgMgr.configurationRegistry(), null);
+ clientHandlerModule = new ClientHandlerModule(
+ qryEngine,
+ distributedTblMgr,
+ nodeCfgMgr.configurationRegistry(),
+ nettyBootstrapFactory
+ );
}
/**