@@ -94,16 +94,20 @@ class ClusterConnectionProvider implements LettuceConnectionProvider, RedisClien
|
||||
}
|
||||
|
||||
if (connectionType.equals(StatefulRedisPubSubConnection.class)) {
|
||||
return client.connectPubSubAsync(codec).thenApply(connectionType::cast);
|
||||
|
||||
return client.connectPubSubAsync(codec) //
|
||||
.thenApply(connectionType::cast);
|
||||
}
|
||||
|
||||
if (StatefulRedisClusterConnection.class.isAssignableFrom(connectionType)
|
||||
|| connectionType.equals(StatefulConnection.class)) {
|
||||
|
||||
return client.connectAsync(codec).thenApply(conn -> {
|
||||
readFrom.ifPresent(conn::setReadFrom);
|
||||
return connectionType.cast(conn);
|
||||
});
|
||||
return client.connectAsync(codec) //
|
||||
.thenApply(connection -> {
|
||||
|
||||
readFrom.ifPresent(connection::setReadFrom);
|
||||
return connectionType.cast(connection);
|
||||
});
|
||||
}
|
||||
|
||||
return LettuceFutureUtils
|
||||
|
||||
@@ -276,6 +276,7 @@ public class LettuceConnectionFactory
|
||||
this.reactiveConnectionProvider = createConnectionProvider(client, LettuceReactiveRedisConnection.CODEC);
|
||||
|
||||
if (isClusterAware()) {
|
||||
|
||||
this.clusterCommandExecutor = new ClusterCommandExecutor(
|
||||
new LettuceClusterTopologyProvider((RedisClusterClient) client),
|
||||
new LettuceClusterConnection.LettuceClusterNodeResourceProvider(this.connectionProvider),
|
||||
|
||||
@@ -36,15 +36,15 @@ class LettuceFutureUtils {
|
||||
* exceptionally} given {@link Throwable}. This utility method allows exceptionally future creation with a single
|
||||
* invocation.
|
||||
*
|
||||
* @param t must not be {@literal null}.
|
||||
* @param throwable must not be {@literal null}.
|
||||
* @return the completed {@link CompletableFuture future}.
|
||||
*/
|
||||
static <T> CompletableFuture<T> failed(Throwable t) {
|
||||
static <T> CompletableFuture<T> failed(Throwable throwable) {
|
||||
|
||||
Assert.notNull(t, "Throwable must not be null!");
|
||||
Assert.notNull(throwable, "Throwable must not be null!");
|
||||
|
||||
CompletableFuture<T> future = new CompletableFuture<>();
|
||||
future.completeExceptionally(t);
|
||||
future.completeExceptionally(throwable);
|
||||
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ class LettucePoolingConnectionProvider implements LettuceConnectionProvider, Red
|
||||
CompletableFuture<StatefulConnection<?, ?>> acquire = pool.acquire();
|
||||
|
||||
inProgressAsyncPoolRef.put(acquire, pool);
|
||||
return acquire.whenComplete((conn, e) -> {
|
||||
return acquire.whenComplete((connection, e) -> {
|
||||
|
||||
inProgressAsyncPoolRef.remove(acquire);
|
||||
|
||||
if (conn != null) {
|
||||
asyncPoolRef.put(conn, pool);
|
||||
if (connection != null) {
|
||||
asyncPoolRef.put(connection, pool);
|
||||
}
|
||||
}).thenApply(connectionType::cast);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user