From 309af6dde84d1d034bd689e723041850c277e743 Mon Sep 17 00:00:00 2001 From: Tihomir Mateev Date: Mon, 30 Dec 2024 15:43:38 +0200 Subject: [PATCH] Restore public contracts --- pom.xml | 2 +- .../core/AbstractRedisAsyncCommands.java | 1 + ...RedisAdvancedClusterAsyncCommandsImpl.java | 1 - ...isAdvancedClusterReactiveCommandsImpl.java | 3 +- .../core/cluster/RedisClusterClient.java | 36 +++++++++++++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 0ef48460c2..0a9502a105 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ io.lettuce lettuce-core - 6.5.0.BUILD-SNAPSHOT + 6.5.2.BUILD-SNAPSHOT jar Lettuce diff --git a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java index 54d5f26d1f..48ebae4ed7 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java @@ -102,6 +102,7 @@ public AbstractRedisAsyncCommands(StatefulConnection connection, RedisCode this.commandBuilder = new RedisCommandBuilder<>(codec); this.jsonCommandBuilder = new RedisJsonCommandBuilder<>(codec, parser); } + /** * Initialize a new instance. * diff --git a/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java b/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java index e21dcd3975..840a6ef1ff 100644 --- a/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java +++ b/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterAsyncCommandsImpl.java @@ -136,7 +136,6 @@ public RedisAdvancedClusterAsyncCommandsImpl(StatefulRedisClusterConnection clientSetname(K name) { diff --git a/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java b/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java index 81f2ed9c8d..0fa184b37d 100644 --- a/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java +++ b/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java @@ -96,7 +96,8 @@ public RedisAdvancedClusterReactiveCommandsImpl(StatefulRedisClusterConnectionIm * {@link #RedisAdvancedClusterReactiveCommandsImpl(StatefulRedisClusterConnection, RedisCodec, Mono)}. */ @Deprecated - public RedisAdvancedClusterReactiveCommandsImpl(StatefulRedisClusterConnectionImpl connection, RedisCodec codec) { + public RedisAdvancedClusterReactiveCommandsImpl(StatefulRedisClusterConnectionImpl connection, + RedisCodec codec) { super(connection, codec); this.codec = codec; } diff --git a/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java b/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java index 577689cecc..c5ef64c708 100644 --- a/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java +++ b/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java @@ -586,6 +586,24 @@ protected StatefulRedisConnectionImpl newStatefulRedisConnection(Re return new StatefulRedisConnectionImpl<>(channelWriter, pushHandler, codec, timeout, parser); } + /** + * Create a new instance of {@link StatefulRedisConnectionImpl} or a subclass. + *

+ * Subclasses of {@link RedisClusterClient} may override that method. + * + * @param channelWriter the channel writer + * @param pushHandler the handler for push notifications + * @param codec codec + * @param timeout default timeout + * @param Key-Type + * @param Value Type + * @return new instance of StatefulRedisConnectionImpl + */ + protected StatefulRedisConnectionImpl newStatefulRedisConnection(RedisChannelWriter channelWriter, + PushHandler pushHandler, RedisCodec codec, Duration timeout) { + return new StatefulRedisConnectionImpl<>(channelWriter, pushHandler, codec, timeout); + } + /** * Create a pub/sub connection to a redis socket address. * @@ -712,6 +730,24 @@ protected StatefulRedisClusterConnectionImpl newStatefulRedisCluste return new StatefulRedisClusterConnectionImpl(channelWriter, pushHandler, codec, timeout, parser); } + /** + * Create a new instance of {@link StatefulRedisClusterConnectionImpl} or a subclass. + *

+ * Subclasses of {@link RedisClusterClient} may override that method. + * + * @param channelWriter the channel writer + * @param pushHandler the handler for push notifications + * @param codec codec + * @param timeout default timeout + * @param Key-Type + * @param Value Type + * @return new instance of StatefulRedisClusterConnectionImpl + */ + protected StatefulRedisClusterConnectionImpl newStatefulRedisClusterConnection( + RedisChannelWriter channelWriter, ClusterPushHandler pushHandler, RedisCodec codec, Duration timeout) { + return new StatefulRedisClusterConnectionImpl(channelWriter, pushHandler, codec, timeout); + } + private Mono connect(Mono socketAddressSupplier, DefaultEndpoint endpoint, StatefulRedisClusterConnectionImpl connection, Supplier commandHandlerSupplier) {