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

pull/709/head
Nikita 8 years ago
commit b8581bf0a3

@ -440,7 +440,9 @@ public class Config {
* Use external ExecutorService. ExecutorService processes
* all listeners of <code>RTopic</code>,
* <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
* @return config
@ -463,6 +465,8 @@ public class Config {
* <p>
* Only {@link io.netty.channel.epoll.EpollEventLoopGroup} or
* {@link io.netty.channel.nio.NioEventLoopGroup} can be used.
* <p>
* The caller is responsible for closing the EventLoopGroup.
*
* @param eventLoopGroup object
* @return config

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

Loading…
Cancel
Save