Skip to content

Commit

Permalink
Merge branch '2.x' into feature/saga-com
Browse files Browse the repository at this point in the history
  • Loading branch information
wt-better committed Mar 16, 2024
2 parents 49a549e + 06ca3ff commit 1ba12a3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public NettyRemotingServer(ThreadPoolExecutor messageExecutor) {
super(messageExecutor, new NettyServerConfig());
}

public NettyRemotingServer(ThreadPoolExecutor messageExecutor, NettyServerConfig nettyServerConfig) {
super(messageExecutor, nettyServerConfig);
}

/**
* Sets transactionMessageHandler.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public NettyServerBootstrap(NettyServerConfig nettyServerConfig) {
new NamedThreadFactory(nettyServerConfig.getWorkerThreadPrefix(),
nettyServerConfig.getServerWorkerThreads()));
}

if (nettyServerConfig.getServerListenPort() > 0) {
setListenPort(nettyServerConfig.getServerListenPort());
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class NettyServerConfig extends NettyBaseConfig {
ConfigurationKeys.TRANSPORT_PREFIX + "writeBufferHighWaterMark", String.valueOf(67108864)));
private int writeBufferLowWaterMark = Integer.parseInt(System.getProperty(
ConfigurationKeys.TRANSPORT_PREFIX + "writeBufferLowWaterMark", String.valueOf(1048576)));
private static final int DEFAULT_LISTEN_PORT = 8091;
private int serverListenPort = 0;
private static final long RPC_TC_REQUEST_TIMEOUT = CONFIG.getLong(ConfigurationKeys.RPC_TC_REQUEST_TIMEOUT, DEFAULT_RPC_TC_REQUEST_TIMEOUT);
private int serverChannelMaxIdleTimeSeconds = Integer.parseInt(System.getProperty(
ConfigurationKeys.TRANSPORT_PREFIX + "serverChannelMaxIdleTimeSeconds", String.valueOf(30)));
Expand Down Expand Up @@ -217,8 +217,12 @@ public void setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
*
* @return the listen port
*/
public int getDefaultListenPort() {
return DEFAULT_LISTEN_PORT;
public int getServerListenPort() {
return serverListenPort;
}

public void setServerListenPort(int port){
this.serverListenPort = port;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.seata.common.util.NetUtil;
import org.apache.seata.core.rpc.ShutdownHook;
import org.apache.seata.core.rpc.netty.NettyRemotingServer;
import org.apache.seata.core.rpc.netty.NettyServerConfig;
import org.apache.seata.server.ParameterParser;
import org.apache.seata.server.UUIDGenerator;
import org.apache.seata.server.coordinator.DefaultCoordinator;
Expand Down Expand Up @@ -55,14 +56,17 @@ public void run() {
//initialize the metrics
MetricsManager.get().init();

nettyServer = new NettyRemotingServer(workingThreads);
NettyServerConfig nettyServerConfig = new NettyServerConfig();
nettyServerConfig.setServerListenPort(8091);
nettyServer = new NettyRemotingServer(workingThreads, nettyServerConfig);
UUIDGenerator.init(parameterParser.getServerNode());
//log store mode : file、db
SessionHolder.init();

DefaultCoordinator coordinator = DefaultCoordinator.getInstance(nettyServer);
coordinator.init();
nettyServer.setHandler(coordinator);

// register ShutdownHook
ShutdownHook.getInstance().addDisposable(coordinator);

Expand Down

0 comments on commit 1ba12a3

Please sign in to comment.