Skip to content

Commit

Permalink
Synchronize ClientResources shutdown in client shutdown #475
Browse files Browse the repository at this point in the history
Synchronize on the ClientResources.close()-Future when shutting down a redis client instance via AbstractRedisClient.shutdown(…). Previously the close future was not used to synchronize shutdown which might leave running threads after leaving AbstractRedisClient.shutdown(…).

Client shutdown may take longer because of synchronization. The client may be shut down faster by calling the appropriate shutdown method with the desired timeout/quiet period.
  • Loading branch information
mp911de committed Mar 14, 2017
1 parent 02b9ffd commit d00f767
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/lambdaworks/redis/AbstractRedisClient.java
Expand Up @@ -390,7 +390,8 @@ public void shutdown(long quietPeriod, long timeout, TimeUnit timeUnit) {
}

if (!sharedResources) {
clientResources.shutdown(quietPeriod, timeout, timeUnit);
Future<?> groupCloseFuture = clientResources.shutdown(quietPeriod, timeout, timeUnit);
closeFutures.add(groupCloseFuture);
} else {
for (EventLoopGroup eventExecutors : eventLoopGroups.values()) {
Future<?> groupCloseFuture = clientResources.eventLoopGroupProvider().release(eventExecutors, quietPeriod,
Expand Down

0 comments on commit d00f767

Please sign in to comment.