Fix resource disposal ordering in LettuceConnectionFactory.
We now close the cluster command executor before cleaning up the connection pools so that we first release all held connections before pruning the connection pools. Previously, the pools were pruned first leading to an attempt to return the connection held by the cluster command executor causing a PoolException. Closes #2330
This commit is contained in:
@@ -345,6 +345,15 @@ public class LettuceConnectionFactory
|
||||
|
||||
resetConnection();
|
||||
|
||||
if (clusterCommandExecutor != null) {
|
||||
|
||||
try {
|
||||
clusterCommandExecutor.destroy();
|
||||
} catch (Exception ex) {
|
||||
log.warn("Cannot properly close cluster command executor", ex);
|
||||
}
|
||||
}
|
||||
|
||||
dispose(connectionProvider);
|
||||
dispose(reactiveConnectionProvider);
|
||||
|
||||
@@ -360,15 +369,6 @@ public class LettuceConnectionFactory
|
||||
}
|
||||
}
|
||||
|
||||
if (clusterCommandExecutor != null) {
|
||||
|
||||
try {
|
||||
clusterCommandExecutor.destroy();
|
||||
} catch (Exception ex) {
|
||||
log.warn("Cannot properly close cluster command executor", ex);
|
||||
}
|
||||
}
|
||||
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user