diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java index 38f439348..9443a5a27 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java @@ -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; }