diff --git a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerControllerTest.java b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerControllerTest.java index 6b0b62d3940fb12d1f8e2e626ee1281355d1b957..9246d6f208f7b110d7d608c41c31a536c361d6c6 100644 --- a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerControllerTest.java +++ b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerControllerTest.java @@ -22,11 +22,15 @@ import com.alibaba.rocketmq.remoting.netty.NettyClientConfig; import com.alibaba.rocketmq.remoting.netty.NettyServerConfig; import com.alibaba.rocketmq.store.config.MessageStoreConfig; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author shtykh_roman */ public class BrokerControllerTest { + protected Logger logger = LoggerFactory.getLogger(BrokerControllerTest.class); + private static final int RESTART_NUM = 3; /** @@ -44,10 +48,13 @@ public class BrokerControllerTest { new NettyClientConfig(), // new MessageStoreConfig()); boolean initResult = brokerController.initialize(); - System.out.println("initialize " + initResult); + logger.info("Broker is initialized " + initResult); + brokerController.start(); + logger.info("Broker is started"); brokerController.shutdown(); + logger.info("Broker is stopped"); } } } diff --git a/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/ha/HAService.java b/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/ha/HAService.java index 5f9375320b287fec0858f18066355b3ee16d9503..075252cb3a63a35b80b5fa951f8a4fde1eff4276 100644 --- a/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/ha/HAService.java +++ b/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/ha/HAService.java @@ -173,7 +173,7 @@ public class HAService { class AcceptSocketService extends ServiceThread { private ServerSocketChannel serverSocketChannel; private Selector selector; - private SocketAddress socketAddressListen; + private final SocketAddress socketAddressListen; public AcceptSocketService(final int port) { @@ -194,7 +194,8 @@ public class HAService { public void shutdown(final boolean interrupt) { super.shutdown(interrupt); try { - serverSocketChannel.close(); + this.serverSocketChannel.close(); + this.selector.close(); } catch (IOException e) { log.error("AcceptSocketService shutdown exception", e);