Skip to content

Commit

Permalink
Polishing #629
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Oct 17, 2017
1 parent ae142f3 commit 37c9f14
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/lettuce/core/AbstractRedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void setDefaultTimeout(Duration timeout) {
*
* @param timeout Default connection timeout.
* @param unit Unit of time for the timeout.
* @deprecated since 5.0, use {@link #setDefaultTimeout(long, TimeUnit)}.
* @deprecated since 5.0, use {@link #setDefaultTimeout(Duration)}.
*/
@Deprecated
public void setDefaultTimeout(long timeout, TimeUnit unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FutureSyncInvocationHandler extends AbstractInvocationHandler {
private final Object asyncApi;
private final MethodTranslator translator;

public FutureSyncInvocationHandler(StatefulConnection<?, ?> connection, Object asyncApi, Class<?>[] interfaces) {
FutureSyncInvocationHandler(StatefulConnection<?, ?> connection, Object asyncApi, Class<?>[] interfaces) {
this.connection = connection;
this.asyncApi = asyncApi;
this.translator = MethodTranslator.of(asyncApi.getClass(), interfaces);
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/io/lettuce/core/RedisException.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class RedisException extends RuntimeException {

/**
* Create a {@code RedisException} with the specified detail message.
*
*
* @param msg the detail message.
*/
public RedisException(String msg) {
Expand All @@ -35,18 +35,17 @@ public RedisException(String msg) {

/**
* Create a {@code RedisException} with the specified detail message and nested exception.
*
*
* @param msg the detail message.
* @param cause the nested exception.
*/
public RedisException(String msg, Throwable e) {
super(msg, e);
public RedisException(String msg, Throwable cause) {
super(msg, cause);
}

/**
* Create a {@code RedisException} with the specified nested exception.
*
* @param msg the detail message.
*
* @param cause the nested exception.
*/
public RedisException(Throwable cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class ClusterNodeEndpoint extends DefaultEndpoint {
/**
* Initialize a new instance that handles commands from the supplied queue.
*
* @param clientOptions client options for this connection
* @param clientResources client resources for this connection
* @param clientOptions client options for this connection.
* @param clientResources client resources for this connection.
* @param clusterChannelWriter top-most channel writer.
*/
public ClusterNodeEndpoint(ClientOptions clientOptions, ClientResources clientResources,
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/io/lettuce/core/masterslave/MasterSlave.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ private static <K, V> StatefulRedisMasterSlaveConnection<K, V> connectSentinel(R
StatefulRedisMasterSlaveConnectionImpl<K, V> connection = new StatefulRedisMasterSlaveConnectionImpl<>(channelWriter,
codec, redisURI.getTimeout());

connection.setOptions(redisClient.getOptions());

Runnable runnable = () -> {
try {

Expand Down Expand Up @@ -224,6 +226,8 @@ private static <K, V> StatefulRedisMasterSlaveConnection<K, V> connectMasterSlav
StatefulRedisMasterSlaveConnectionImpl<K, V> connection = new StatefulRedisMasterSlaveConnectionImpl<>(
channelWriter, codec, redisURI.getTimeout());

connection.setOptions(redisClient.getOptions());

return connection;

} catch (RuntimeException e) {
Expand Down Expand Up @@ -260,6 +264,8 @@ private static <K, V> StatefulRedisMasterSlaveConnection<K, V> connectStaticMast
StatefulRedisMasterSlaveConnectionImpl<K, V> connection = new StatefulRedisMasterSlaveConnectionImpl<>(
channelWriter, codec, seedNode.getTimeout());

connection.setOptions(redisClient.getOptions());

return connection;

} catch (RuntimeException e) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/io/lettuce/core/protocol/CompleteableCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,20 @@
import java.util.function.Consumer;

/**
* Extension to commands that provide registration of command completion callbacks. Completion callbacks allow execution of
* tasks after successive, failed or any completion outcome. A callback must be non-blocking. Callback registration gives no
* guarantee over callback ordering.
*
* @author Mark Paluch
*/
public interface CompleteableCommand<T> {

/**
* Register a command callback for command completion that notifies the callback with the command result or the failure
* resulting from command completion.
*
* @param action must not be {@literal null}.
*/
void onComplete(Consumer<? super T> action);

}

0 comments on commit 37c9f14

Please sign in to comment.