fix : Modify the thread pool information passed to the server to ensure that the server can access the Netty server rather than the web server#(1187) #(812)

pull/1206/head
pizihao 2 years ago
parent 88ae840891
commit 619b2da733

@ -72,7 +72,7 @@ public class IdentifyUtil {
port = customerNetwork[1];
} else {
ip = inetUtil.findFirstNonLoopBackHostInfo().getIpAddress();
port = environment.getProperty("server.port", "8080");
port = environment.getProperty("spring.dynamic.thread-pool.local-server-port", "16691");
}
String identify = ip
+ ":"

@ -26,12 +26,14 @@ import cn.hippo4j.rpc.handler.NettyServerTakeHandler;
import cn.hippo4j.rpc.server.NettyServerConnection;
import cn.hippo4j.rpc.server.Server;
import cn.hippo4j.rpc.support.NettyServerSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class NettyServerConfiguration implements ApplicationRunner, EnvironmentAware {
@ -51,6 +53,9 @@ public class NettyServerConfiguration implements ApplicationRunner, EnvironmentA
try (
NettyServerConnection connection = new NettyServerConnection(handler);
Server server = new NettyServerSupport(serverPort, connection, classes)) {
if (log.isInfoEnabled()) {
log.info("Netty server started, binding to port {}", serverPort.getPort());
}
server.bind();
}
}

Loading…
Cancel
Save