public interface RRemoteService
RRemoteService remoteService = redisson.getRemoteService();
// register remote service before any remote invocation
remoteService.register(SomeServiceInterface.class, someServiceImpl);
2. Client side instance. Invokes method remotely.
RRemoteService remoteService = redisson.getRemoteService();
SomeServiceInterface service = remoteService.get(SomeServiceInterface.class);
String result = service.doSomeStuff(1L, "secondParam", new AnyParam());
There are two timeouts during execution:
Acknowledge (Ack) timeout.Client side instance waits for acknowledge message from Server side instance.
If acknowledge has not been received by Client side instance then RemoteServiceAckTimeoutException
will be thrown.
And next invocation attempt can be made.
If acknowledge has not been received Client side instance but Server side instance has received invocation message already.
In this case invocation will be skipped, due to ack timeout checking by Server side instance.
Execution timeout. Client side instance received acknowledge message. If it hasn't received any result or error
from server side during execution timeout then RemoteServiceTimeoutException
will be thrown.Modifier and Type | Method and Description |
---|---|
<T> T |
get(Class<T> remoteInterface)
Get remote service object for remote invocations.
|
<T> T |
get(Class<T> remoteInterface,
long executionTimeout,
TimeUnit executionTimeUnit)
Get remote service object for remote invocations
with specified invocation timeout.
|
<T> T |
get(Class<T> remoteInterface,
long executionTimeout,
TimeUnit executionTimeUnit,
long ackTimeout,
TimeUnit ackTimeUnit)
Get remote service object for remote invocations
with specified invocation and ack timeouts
This method is a shortcut for
get(remoteInterface, RemoteInvocationOptions.defaults()
.expectAckWithin(ackTimeout, ackTimeUnit)
.expectResultWithin(executionTimeout, executionTimeUnit))
|
<T> T |
get(Class<T> remoteInterface,
RemoteInvocationOptions options)
Get remote service object for remote invocations
with the specified options
Note that when using the noResult() option,
it is expected that the invoked method returns void,
or else IllegalArgumentException will be thrown.
|
<T> void |
register(Class<T> remoteInterface,
T object)
Register remote service with single executor
|
<T> void |
register(Class<T> remoteInterface,
T object,
int executorsAmount)
Register remote service with custom executors amount
|
<T> void register(Class<T> remoteInterface, T object)
remoteInterface
- object
- <T> void register(Class<T> remoteInterface, T object, int executorsAmount)
remoteInterface
- object
- executorsAmount
- <T> T get(Class<T> remoteInterface)
get(remoteInterface, RemoteInvocationOptions.defaults())
remoteInterface
- RemoteInvocationOptions.defaults()
,
get(Class, RemoteInvocationOptions)
<T> T get(Class<T> remoteInterface, long executionTimeout, TimeUnit executionTimeUnit)
get(remoteInterface, RemoteInvocationOptions.defaults() .expectResultWithin(executionTimeout, executionTimeUnit))
remoteInterface
- executionTimeout
- - invocation timeoutexecutionTimeUnit
- RemoteInvocationOptions.defaults()
,
get(Class, RemoteInvocationOptions)
<T> T get(Class<T> remoteInterface, long executionTimeout, TimeUnit executionTimeUnit, long ackTimeout, TimeUnit ackTimeUnit)
get(remoteInterface, RemoteInvocationOptions.defaults() .expectAckWithin(ackTimeout, ackTimeUnit) .expectResultWithin(executionTimeout, executionTimeUnit))
remoteInterface
- executionTimeout
- - invocation timeoutexecutionTimeUnit
- ackTimeout
- - ack timeoutackTimeUnit
- RemoteInvocationOptions
,
get(Class, RemoteInvocationOptions)
<T> T get(Class<T> remoteInterface, RemoteInvocationOptions options)
RemoteInvocationOptions
Copyright © 2014–2016. All rights reserved.