Fixed - Redisson.shutdown blocks calling thread. #2306

pull/2323/head
Nikita Koksharov 6 years ago
parent 9e9fdfe884
commit 0487fd9c40

@ -311,13 +311,6 @@ public final class RedisClient {
} }
public RFuture<Void> shutdownAsync() { public RFuture<Void> shutdownAsync() {
for (Channel channel : channels) {
RedisConnection connection = RedisConnection.getFrom(channel);
if (connection != null) {
connection.closeAsync();
}
}
final RPromise<Void> result = new RedissonPromise<Void>(); final RPromise<Void> result = new RedissonPromise<Void>();
ChannelGroupFuture channelsFuture = channels.newCloseFuture(); ChannelGroupFuture channelsFuture = channels.newCloseFuture();
channelsFuture.addListener(new FutureListener<Void>() { channelsFuture.addListener(new FutureListener<Void>() {
@ -364,6 +357,13 @@ public final class RedisClient {
} }
}); });
for (Channel channel : channels) {
RedisConnection connection = RedisConnection.getFrom(channel);
if (connection != null) {
connection.closeAsync();
}
}
return result; return result;
} }

@ -255,11 +255,9 @@ public class RedisConnection implements RedisCommands {
if (command != null && command.isBlockingCommand()) { if (command != null && command.isBlockingCommand()) {
channel.close(); channel.close();
} else { } else {
RFuture<Void> f = async(RedisCommands.QUIT); RFuture<Void> f = async(redisClient.getConfig().getCommandTimeout(), RedisCommands.QUIT);
f.onComplete((res, e) -> { f.onComplete((res, e) -> {
if (e != null) {
channel.close(); channel.close();
}
}); });
} }
} }

Loading…
Cancel
Save