DATAREDIS-721 - Polishing.

Original Pull Request: #315
This commit is contained in:
Christoph Strobl
2018-11-30 10:30:36 +01:00
parent b496aab2fb
commit c8bfc71678
4 changed files with 17 additions and 12 deletions

View File

@@ -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

View File

@@ -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),

View File

@@ -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;
}

View File

@@ -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);
}