Merge branch 'master' of github.com:redisson/redisson

pull/709/head
Nikita 8 years ago
commit b8581bf0a3

@ -441,6 +441,8 @@ public class Config {
* all listeners of <code>RTopic</code>, * all listeners of <code>RTopic</code>,
* <code>RRemoteService</code> invocation handlers * <code>RRemoteService</code> invocation handlers
* and <code>RExecutorService</code> tasks. * and <code>RExecutorService</code> tasks.
* <p>
* The caller is responsible for closing the ExecutorService.
* *
* @param executor object * @param executor object
* @return config * @return config
@ -463,6 +465,8 @@ public class Config {
* <p> * <p>
* Only {@link io.netty.channel.epoll.EpollEventLoopGroup} or * Only {@link io.netty.channel.epoll.EpollEventLoopGroup} or
* {@link io.netty.channel.nio.NioEventLoopGroup} can be used. * {@link io.netty.channel.nio.NioEventLoopGroup} can be used.
* <p>
* The caller is responsible for closing the EventLoopGroup.
* *
* @param eventLoopGroup object * @param eventLoopGroup object
* @return config * @return config

@ -147,6 +147,10 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
private final AsyncSemaphore freePubSubLock = new AsyncSemaphore(1); private final AsyncSemaphore freePubSubLock = new AsyncSemaphore(1);
private final boolean sharedEventLoopGroup;
private final boolean sharedExecutor;
{ {
for (int i = 0; i < locks.length; i++) { for (int i = 0; i < locks.length; i++) {
locks[i] = new AsyncSemaphore(1); locks[i] = new AsyncSemaphore(1);
@ -198,6 +202,8 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
this.codec = cfg.getCodec(); this.codec = cfg.getCodec();
this.shutdownPromise = newPromise(); this.shutdownPromise = newPromise();
this.sharedEventLoopGroup = cfg.getEventLoopGroup() != null;
this.sharedExecutor = cfg.getExecutor() != null;
} }
public boolean isClusterMode() { public boolean isClusterMode() {
@ -740,13 +746,18 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
} }
timer.stop(); timer.stop();
executor.shutdown(); if (!sharedExecutor) {
try { executor.shutdown();
executor.awaitTermination(timeout, unit); try {
} catch (InterruptedException e) { executor.awaitTermination(timeout, unit);
Thread.currentThread().interrupt(); } catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
if (!sharedEventLoopGroup) {
group.shutdownGracefully(quietPeriod, timeout, unit).syncUninterruptibly();
} }
group.shutdownGracefully(quietPeriod, timeout, unit).syncUninterruptibly();
} }
@Override @Override

Loading…
Cancel
Save