public class RedissonRemoteService extends BaseRemoteService implements RRemoteService
Modifier and Type | Class and Description |
---|---|
static class |
RedissonRemoteService.Entry |
cancelRequestMapName, cancelResponseMapName, codec, commandExecutor, executorId, name, responseQueueName
Constructor and Description |
---|
RedissonRemoteService(Codec codec,
String name,
CommandAsyncExecutor commandExecutor,
String executorId,
ConcurrentMap<String,ResponseEntry> responses) |
Modifier and Type | Method and Description |
---|---|
protected RFuture<Boolean> |
addAsync(String requestQueueName,
RemoteServiceRequest request,
RemotePromise<Object> result) |
<T> void |
deregister(Class<T> remoteInterface)
Deregister all workers for remote service
|
int |
getFreeWorkers(Class<?> remoteInterface)
Returns free workers amount available for invocations
|
int |
getPendingInvocations(Class<?> remoteInterface)
Returns pending invocations amount for handling in free workers.
|
RFuture<Integer> |
getPendingInvocationsAsync(Class<?> remoteInterface)
Returns pending invocations amount for handling in free workers.
|
String |
getRequestTasksMapName(Class<?> remoteInterface) |
protected RFuture<RemoteServiceRequest> |
getTask(String requestId,
RMap<String,RemoteServiceRequest> tasks) |
protected <T> void |
invokeMethod(RemoteServiceRequest request,
RemoteServiceMethod method,
RFuture<RemoteServiceCancelRequest> cancelRequestFuture,
RPromise<RRemoteServiceResponse> responsePromise) |
<T> void |
register(Class<T> remoteInterface,
T object)
Register remote service with single worker
|
<T> void |
register(Class<T> remoteInterface,
T object,
int workers)
Register remote service with custom workers amount
|
<T> void |
register(Class<T> remoteInterface,
T object,
int workers,
ExecutorService executor)
Register remote service with custom workers amount
and executor for running them
|
protected RFuture<Boolean> |
removeAsync(String requestQueueName,
RequestId taskId) |
<T> boolean |
tryExecute(Class<T> remoteInterface,
T object,
ExecutorService executorService,
long timeout,
TimeUnit timeUnit)
Tries to execute one awaiting remote request.
|
<T> boolean |
tryExecute(Class<T> remoteInterface,
T object,
long timeout,
TimeUnit timeUnit)
Tries to execute one awaiting remote request.
|
<T> RFuture<Boolean> |
tryExecuteAsync(Class<T> remoteInterface,
T object)
Tries to execute one awaiting remote request.
|
<T> RFuture<Boolean> |
tryExecuteAsync(Class<T> remoteInterface,
T object,
ExecutorService executor,
long timeout,
TimeUnit timeUnit)
Tries to execute one awaiting remote request.
|
<T> RFuture<Boolean> |
tryExecuteAsync(Class<T> remoteInterface,
T object,
long timeout,
TimeUnit timeUnit)
Tries to execute one awaiting remote request.
|
encode, generateRequestId, get, get, get, get, getAckName, getAckName, getMap, getMethodSignature, getRequestQueueName, getResponseQueueName, getTimeout, scheduleCheck
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, get, get, get
public RedissonRemoteService(Codec codec, String name, CommandAsyncExecutor commandExecutor, String executorId, ConcurrentMap<String,ResponseEntry> responses)
protected RFuture<Boolean> addAsync(String requestQueueName, RemoteServiceRequest request, RemotePromise<Object> result)
addAsync
in class BaseRemoteService
protected RFuture<Boolean> removeAsync(String requestQueueName, RequestId taskId)
removeAsync
in class BaseRemoteService
public <T> void register(Class<T> remoteInterface, T object)
RRemoteService
register
in interface RRemoteService
T
- type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objectpublic <T> void deregister(Class<T> remoteInterface)
RRemoteService
deregister
in interface RRemoteService
T
- type of remote serviceremoteInterface
- - remote service interfacepublic int getPendingInvocations(Class<?> remoteInterface)
RRemoteService
getPendingInvocations
in interface RRemoteService
remoteInterface
- - remote service interfacepublic RFuture<Integer> getPendingInvocationsAsync(Class<?> remoteInterface)
RRemoteService
getPendingInvocationsAsync
in interface RRemoteService
remoteInterface
- - remote service interfacepublic int getFreeWorkers(Class<?> remoteInterface)
RRemoteService
getFreeWorkers
in interface RRemoteService
remoteInterface
- - remote service interfacepublic <T> void register(Class<T> remoteInterface, T object, int workers)
RRemoteService
register
in interface RRemoteService
T
- type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objectworkers
- - workers amountpublic <T> void register(Class<T> remoteInterface, T object, int workers, ExecutorService executor)
RRemoteService
register
in interface RRemoteService
T
- type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objectworkers
- - workers amountexecutor
- - executor service used to invoke methodspublic <T> boolean tryExecute(Class<T> remoteInterface, T object, long timeout, TimeUnit timeUnit) throws InterruptedException
RRemoteService
timeout
if necessary until remote request became available.tryExecute
in interface RRemoteService
T
- - type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objecttimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unittrue
if method was successfully executed and
false
if timeout reached before executionInterruptedException
- - if the thread is interruptedpublic <T> boolean tryExecute(Class<T> remoteInterface, T object, ExecutorService executorService, long timeout, TimeUnit timeUnit) throws InterruptedException
RRemoteService
timeout
if necessary until remote request became available.tryExecute
in interface RRemoteService
T
- - type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objectexecutorService
- - executor service used to invoke methodstimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unittrue
if method was successfully executed and
false
if timeout reached before executionInterruptedException
- - if the thread is interruptedpublic <T> RFuture<Boolean> tryExecuteAsync(Class<T> remoteInterface, T object, long timeout, TimeUnit timeUnit)
RRemoteService
timeout
if necessary until remote request became available.tryExecuteAsync
in interface RRemoteService
T
- - type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objecttimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unittrue
if method was successfully executed and
false
if timeout reached before executionpublic <T> RFuture<Boolean> tryExecuteAsync(Class<T> remoteInterface, T object, ExecutorService executor, long timeout, TimeUnit timeUnit)
RRemoteService
timeout
if necessary until remote request became available.tryExecuteAsync
in interface RRemoteService
T
- - type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objectexecutor
- - executor service used to invoke methodstimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unittrue
if method was successfully executed and
false
if timeout reached before executionpublic <T> RFuture<Boolean> tryExecuteAsync(Class<T> remoteInterface, T object)
RRemoteService
tryExecuteAsync
in interface RRemoteService
T
- - type of remote serviceremoteInterface
- - remote service interfaceobject
- - remote service objecttrue
if method was successfully executed and
false
if timeout reached before executionprotected <T> void invokeMethod(RemoteServiceRequest request, RemoteServiceMethod method, RFuture<RemoteServiceCancelRequest> cancelRequestFuture, RPromise<RRemoteServiceResponse> responsePromise)
protected RFuture<RemoteServiceRequest> getTask(String requestId, RMap<String,RemoteServiceRequest> tasks)
Copyright © 2014–2020 Redisson. All rights reserved.