From 900eb05356900b7054e616194fc7ef14e5fe4289 Mon Sep 17 00:00:00 2001 From: jianbin Date: Thu, 2 Jan 2025 15:58:02 +0800 Subject: [PATCH] ut fix --- .../org/apache/seata/core/rpc/netty/NettyServerBootstrap.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/seata/core/rpc/netty/NettyServerBootstrap.java b/core/src/main/java/org/apache/seata/core/rpc/netty/NettyServerBootstrap.java index 610f66deecb..0817cbaabae 100644 --- a/core/src/main/java/org/apache/seata/core/rpc/netty/NettyServerBootstrap.java +++ b/core/src/main/java/org/apache/seata/core/rpc/netty/NettyServerBootstrap.java @@ -37,6 +37,7 @@ import org.apache.seata.common.metadata.Instance; import org.apache.seata.common.metadata.Node; import org.apache.seata.common.thread.NamedThreadFactory; +import org.apache.seata.common.util.StringUtils; import org.apache.seata.config.ConfigurationFactory; import org.apache.seata.core.rpc.RemotingBootstrap; import org.apache.seata.discovery.registry.MultiRegistryFactory; @@ -173,7 +174,7 @@ public void initChannel(SocketChannel ch) { this.serverBootstrap.bind(port).sync(); LOGGER.info("Server started, service listen port: {}", getListenPort()); Instance instance = Instance.getInstance(); - if (instance.getTransaction() == null) { + if (instance.getTransaction() == null || StringUtils.isBlank(instance.getTransaction().getHost())) { Instance.getInstance().setTransaction(new Node.Endpoint(XID.getIpAddress(), XID.getPort(), "netty")); } for (RegistryService registryService : MultiRegistryFactory.getInstances()) {