Package org.redisson.api
Class RemoteInvocationOptions
- java.lang.Object
-
- org.redisson.api.RemoteInvocationOptions
-
- All Implemented Interfaces:
Serializable
public final class RemoteInvocationOptions extends Object implements Serializable
RRemoteService invocation options. Used to tune how RRemoteService will behave in regard to the remote invocations acknowledgement and execution timeout.Examples:
// 1 second ack timeout and 30 seconds execution timeout RemoteInvocationOptions options = RemoteInvocationOptions.defaults(); // no ack but 30 seconds execution timeout RemoteInvocationOptions options = RemoteInvocationOptions.defaults() .noAck(); // 1 second ack timeout then forget the result RemoteInvocationOptions options = RemoteInvocationOptions.defaults() .noResult(); // 1 minute ack timeout then forget about the result RemoteInvocationOptions options = RemoteInvocationOptions.defaults() .expectAckWithin(1, TimeUnit.MINUTES) .noResult(); // no ack and forget about the result (fire and forget) RemoteInvocationOptions options = RemoteInvocationOptions.defaults() .noAck() .noResult();
-
-
Constructor Summary
Constructors Constructor Description RemoteInvocationOptions(RemoteInvocationOptions copy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RemoteInvocationOptions
defaults()
Creates a new instance of RemoteInvocationOptions with opinionated defaults.RemoteInvocationOptions
expectAckWithin(long ackTimeoutInMillis)
Defines ACK timeoutRemoteInvocationOptions
expectAckWithin(long ackTimeout, TimeUnit timeUnit)
Defines ACK timeoutRemoteInvocationOptions
expectResultWithin(long executionTimeoutInMillis)
Defines execution timeoutRemoteInvocationOptions
expectResultWithin(long executionTimeout, TimeUnit timeUnit)
Defines execution timeoutLong
getAckTimeoutInMillis()
Long
getExecutionTimeoutInMillis()
boolean
isAckExpected()
boolean
isResultExpected()
RemoteInvocationOptions
noAck()
Specifies to not wait for ACK replyRemoteInvocationOptions
noResult()
Specifies to not wait for resultString
toString()
-
-
-
Constructor Detail
-
RemoteInvocationOptions
public RemoteInvocationOptions(RemoteInvocationOptions copy)
-
-
Method Detail
-
defaults
public static RemoteInvocationOptions defaults()
Creates a new instance of RemoteInvocationOptions with opinionated defaults.This is equivalent to:
new RemoteInvocationOptions() .expectAckWithin(1, TimeUnit.SECONDS) .expectResultWithin(30, TimeUnit.SECONDS)
- Returns:
- RemoteInvocationOptions object
-
getAckTimeoutInMillis
public Long getAckTimeoutInMillis()
-
getExecutionTimeoutInMillis
public Long getExecutionTimeoutInMillis()
-
isAckExpected
public boolean isAckExpected()
-
isResultExpected
public boolean isResultExpected()
-
expectAckWithin
public RemoteInvocationOptions expectAckWithin(long ackTimeoutInMillis)
Defines ACK timeout- Parameters:
ackTimeoutInMillis
- - timeout in milliseconds- Returns:
- RemoteInvocationOptions object
-
expectAckWithin
public RemoteInvocationOptions expectAckWithin(long ackTimeout, TimeUnit timeUnit)
Defines ACK timeout- Parameters:
ackTimeout
- - timeouttimeUnit
- - timeout unit- Returns:
- RemoteInvocationOptions object
-
noAck
public RemoteInvocationOptions noAck()
Specifies to not wait for ACK reply- Returns:
- RemoteInvocationOptions object
-
expectResultWithin
public RemoteInvocationOptions expectResultWithin(long executionTimeoutInMillis)
Defines execution timeout- Parameters:
executionTimeoutInMillis
- - timeout in milliseconds- Returns:
- RemoteInvocationOptions object
-
expectResultWithin
public RemoteInvocationOptions expectResultWithin(long executionTimeout, TimeUnit timeUnit)
Defines execution timeout- Parameters:
executionTimeout
- - timeouttimeUnit
- - timeout unit- Returns:
- RemoteInvocationOptions object
-
noResult
public RemoteInvocationOptions noResult()
Specifies to not wait for result- Returns:
- RemoteInvocationOptions object
-
-