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 19:01:54 UTC
[ignite-3] branch ignite-15307 updated: Fix NettyBootstrapFactory: read config on demand, pass NetworkConfiguration
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 7a5c60b Fix NettyBootstrapFactory: read config on demand, pass NetworkConfiguration
7a5c60b is described below
commit 7a5c60b19030d57f94a5ccce060a0b8e0859a4c9
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Nov 22 22:01:46 2021 +0300
Fix NettyBootstrapFactory: read config on demand, pass NetworkConfiguration
---
.../ignite/internal/network/netty/ItConnectionManagerTest.java | 2 +-
.../internal/network/recovery/ItRecoveryHandshakeTest.java | 4 ++--
.../java/org/apache/ignite/network/NettyBootstrapFactory.java | 10 +++++-----
.../network/scalecube/ScaleCubeClusterServiceFactory.java | 4 +++-
.../apache/ignite/internal/network/netty/NettyServerTest.java | 4 ++--
.../main/java/org/apache/ignite/internal/app/IgniteImpl.java | 2 +-
6 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java b/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java
index 79a4971..649406c 100644
--- a/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java
+++ b/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/netty/ItConnectionManagerTest.java
@@ -335,7 +335,7 @@ public class ItConnectionManagerTest {
NetworkView cfg = networkConfiguration.value();
- NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(cfg, consistentId);
+ NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
bootstrapFactory.start();
var manager = new ConnectionManager(
diff --git a/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/recovery/ItRecoveryHandshakeTest.java b/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/recovery/ItRecoveryHandshakeTest.java
index 4f7c9c5..8323f7e 100644
--- a/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/recovery/ItRecoveryHandshakeTest.java
+++ b/modules/network/src/integrationTest/java/org/apache/ignite/internal/network/recovery/ItRecoveryHandshakeTest.java
@@ -405,7 +405,7 @@ public class ItRecoveryHandshakeTest {
NetworkView cfg = networkConfiguration.value();
- NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(cfg, consistentId);
+ NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
bootstrapFactory.start();
var manager = new ConnectionManager(
@@ -442,7 +442,7 @@ public class ItRecoveryHandshakeTest {
NetworkView cfg = networkConfiguration.value();
- NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(cfg, consistentId);
+ NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
bootstrapFactory.start();
var manager = new ConnectionManager(
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 4108651..2b1ee4c 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
@@ -25,7 +25,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.configuration.schemas.network.InboundView;
-import org.apache.ignite.configuration.schemas.network.NetworkView;
+import org.apache.ignite.configuration.schemas.network.NetworkConfiguration;
import org.apache.ignite.configuration.schemas.network.OutboundView;
import org.apache.ignite.internal.manager.IgniteComponent;
import org.apache.ignite.internal.network.netty.NamedNioEventLoopGroup;
@@ -35,7 +35,7 @@ import org.apache.ignite.internal.network.netty.NamedNioEventLoopGroup;
*/
public class NettyBootstrapFactory implements IgniteComponent {
/** Network configuration. */
- private final NetworkView networkConfiguration;
+ private final NetworkConfiguration networkConfiguration;
/** Prefix for event loop group names. */
private final String eventLoopGroupNamePrefix;
@@ -56,7 +56,7 @@ public class NettyBootstrapFactory implements IgniteComponent {
* @param eventLoopGroupNamePrefix Prefix for event loop group names.
*/
public NettyBootstrapFactory(
- NetworkView networkConfiguration,
+ NetworkConfiguration networkConfiguration,
String eventLoopGroupNamePrefix
) {
assert eventLoopGroupNamePrefix != null;
@@ -72,7 +72,7 @@ public class NettyBootstrapFactory implements IgniteComponent {
* @return Bootstrap.
*/
public Bootstrap createClientBootstrap() {
- OutboundView clientConfiguration = networkConfiguration.outbound();
+ OutboundView clientConfiguration = networkConfiguration.value().outbound();
Bootstrap clientBootstrap = new Bootstrap();
clientBootstrap.group(clientWorkerGroup)
@@ -91,7 +91,7 @@ public class NettyBootstrapFactory implements IgniteComponent {
* @return Bootstrap.
*/
public ServerBootstrap createServerBootstrap() {
- InboundView inboundConfiguration = networkConfiguration.inbound();
+ InboundView inboundConfiguration = networkConfiguration.value().inbound();
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup)
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 32f7fb5..1880ec0 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
@@ -53,7 +53,9 @@ public class ScaleCubeClusterServiceFactory implements ClusterServiceFactory {
public ClusterService createClusterService(ClusterLocalConfiguration context, NetworkConfiguration networkConfiguration) {
final String consistentId = context.getName();
- var nettyBootstrapFactory = new NettyBootstrapFactory(networkConfiguration.value(), consistentId);
+ // TOOD: How do we stop it? This method is only used from tests, we should remove it?
+ var nettyBootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
+ nettyBootstrapFactory.start();
return createClusterService(context, networkConfiguration, nettyBootstrapFactory);
}
diff --git a/modules/network/src/test/java/org/apache/ignite/internal/network/netty/NettyServerTest.java b/modules/network/src/test/java/org/apache/ignite/internal/network/netty/NettyServerTest.java
index d4bea83..ceaa0cf 100644
--- a/modules/network/src/test/java/org/apache/ignite/internal/network/netty/NettyServerTest.java
+++ b/modules/network/src/test/java/org/apache/ignite/internal/network/netty/NettyServerTest.java
@@ -172,7 +172,7 @@ public class NettyServerTest {
}
});
- bootstrapFactory = new NettyBootstrapFactory(serverCfg.value(), "");
+ bootstrapFactory = new NettyBootstrapFactory(serverCfg, "");
bootstrapFactory.start();
server = new NettyServer(
@@ -240,7 +240,7 @@ public class NettyServerTest {
* @return NettyServer.
*/
private NettyServer getServer(boolean shouldStart) {
- bootstrapFactory = new NettyBootstrapFactory(serverCfg.value(), "");
+ bootstrapFactory = new NettyBootstrapFactory(serverCfg, "");
bootstrapFactory.start();
var server = new NettyServer(
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 f93ee54..c8c0fec 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
@@ -176,7 +176,7 @@ public class IgniteImpl implements Ignite {
var consistentId = clusterLocalConfiguration.getName();
- nettyBootstrapFactory = new NettyBootstrapFactory(networkConfiguration.value(), consistentId);
+ nettyBootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
clusterSvc = new ScaleCubeClusterServiceFactory().createClusterService(
clusterLocalConfiguration,