提交 b5afe91d 编写于 作者: S shroman 提交者: Willem Jiang

ROCKETMQ-2 Closed the selector.

上级 774101da
...@@ -22,11 +22,15 @@ import com.alibaba.rocketmq.remoting.netty.NettyClientConfig; ...@@ -22,11 +22,15 @@ import com.alibaba.rocketmq.remoting.netty.NettyClientConfig;
import com.alibaba.rocketmq.remoting.netty.NettyServerConfig; import com.alibaba.rocketmq.remoting.netty.NettyServerConfig;
import com.alibaba.rocketmq.store.config.MessageStoreConfig; import com.alibaba.rocketmq.store.config.MessageStoreConfig;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* @author shtykh_roman * @author shtykh_roman
*/ */
public class BrokerControllerTest { public class BrokerControllerTest {
protected Logger logger = LoggerFactory.getLogger(BrokerControllerTest.class);
private static final int RESTART_NUM = 3; private static final int RESTART_NUM = 3;
/** /**
...@@ -44,10 +48,13 @@ public class BrokerControllerTest { ...@@ -44,10 +48,13 @@ public class BrokerControllerTest {
new NettyClientConfig(), // new NettyClientConfig(), //
new MessageStoreConfig()); new MessageStoreConfig());
boolean initResult = brokerController.initialize(); boolean initResult = brokerController.initialize();
System.out.println("initialize " + initResult); logger.info("Broker is initialized " + initResult);
brokerController.start(); brokerController.start();
logger.info("Broker is started");
brokerController.shutdown(); brokerController.shutdown();
logger.info("Broker is stopped");
} }
} }
} }
...@@ -173,7 +173,7 @@ public class HAService { ...@@ -173,7 +173,7 @@ public class HAService {
class AcceptSocketService extends ServiceThread { class AcceptSocketService extends ServiceThread {
private ServerSocketChannel serverSocketChannel; private ServerSocketChannel serverSocketChannel;
private Selector selector; private Selector selector;
private SocketAddress socketAddressListen; private final SocketAddress socketAddressListen;
public AcceptSocketService(final int port) { public AcceptSocketService(final int port) {
...@@ -194,7 +194,8 @@ public class HAService { ...@@ -194,7 +194,8 @@ public class HAService {
public void shutdown(final boolean interrupt) { public void shutdown(final boolean interrupt) {
super.shutdown(interrupt); super.shutdown(interrupt);
try { try {
serverSocketChannel.close(); this.serverSocketChannel.close();
this.selector.close();
} }
catch (IOException e) { catch (IOException e) {
log.error("AcceptSocketService shutdown exception", e); log.error("AcceptSocketService shutdown exception", e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册