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 946126a0a..58d96a465 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 @@ -364,6 +364,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); @@ -379,15 +388,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; }