hasOwnGroup status prop added to RedisClient

pull/382/head
Nikita 9 years ago
parent 87c67b1115
commit 3cac42263b

@ -47,9 +47,11 @@ public class RedisClient {
private final ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE); private final ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
private final long timeout; private final long timeout;
private boolean hasOwnGroup;
public RedisClient(String host, int port) { public RedisClient(String host, int port) {
this(new NioEventLoopGroup(), NioSocketChannel.class, host, port, 60 * 1000); this(new NioEventLoopGroup(), NioSocketChannel.class, host, port, 60 * 1000);
hasOwnGroup = true;
} }
public RedisClient(EventLoopGroup group, Class<? extends SocketChannel> socketChannelClass, String host, int port, int timeout) { public RedisClient(EventLoopGroup group, Class<? extends SocketChannel> socketChannelClass, String host, int port, int timeout) {
@ -138,7 +140,9 @@ public class RedisClient {
public void shutdown() { public void shutdown() {
shutdownAsync().syncUninterruptibly(); shutdownAsync().syncUninterruptibly();
bootstrap.group().shutdownGracefully(); if (hasOwnGroup) {
bootstrap.group().shutdownGracefully();
}
} }
public ChannelGroupFuture shutdownAsync() { public ChannelGroupFuture shutdownAsync() {

Loading…
Cancel
Save