Package org.redisson
Class RedissonRemoteService
-
- org.redisson.remote.BaseRemoteService
-
- org.redisson.RedissonRemoteService
-
- All Implemented Interfaces:
RRemoteService
- Direct Known Subclasses:
RedissonExecutorRemoteService
public class RedissonRemoteService extends BaseRemoteService implements RRemoteService
- Author:
- Nikita Koksharov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RedissonRemoteService.Entry
-
Field Summary
-
Fields inherited from class org.redisson.remote.BaseRemoteService
cancelRequestMapName, cancelResponseMapName, codec, commandExecutor, executorId, name, responseQueueName
-
-
Constructor Summary
Constructors Constructor Description RedissonRemoteService(Codec codec, name, CommandAsyncExecutor commandExecutor, executorId, <,ResponseEntry> responses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected >
requestQueueName, RemoteServiceRequest request, > result)
<T> void
<T> remoteInterface)
Deregister all workers for remote serviceint
<?> remoteInterface)
Returns free workers amount available for invocationsint
<?> remoteInterface)
Returns pending invocations amount for handling in free workers.>
<?> remoteInterface)
Returns pending invocations amount for handling in free workers.<?> remoteInterface)
protected RFuture<RemoteServiceRequest>
requestId, ,RemoteServiceRequest> tasks)
protected <T> void
invokeMethod(RemoteServiceRequest request, RemoteServiceMethod method, RFuture<RemoteServiceCancelRequest> cancelRequestFuture, RPromise<RRemoteServiceResponse> responsePromise)
<T> void
<T> remoteInterface, T object)
Register remote service with single worker<T> void
<T> remoteInterface, T object, int workers)
Register remote service with custom workers amount<T> void
<T> remoteInterface, T object, int workers, executor)
Register remote service with custom workers amount and executor for running themprotected >
requestQueueName, RequestId taskId)
<T> boolean
<T> remoteInterface, T object, long timeout, timeUnit)
Tries to execute one awaiting remote request.<T> boolean
<T> remoteInterface, T object, executorService, long timeout, timeUnit)
Tries to execute one awaiting remote request.<T> >
<T> remoteInterface, T object)
Tries to execute one awaiting remote request.<T> >
<T> remoteInterface, T object, long timeout, timeUnit)
Tries to execute one awaiting remote request.<T> >
<T> remoteInterface, T object, executor, long timeout, timeUnit)
Tries to execute one awaiting remote request.-
Methods inherited from class org.redisson.remote.BaseRemoteService
encode, generateRequestId, get, get, get, get, getAckName, getAckName, getMap, getMethodSignature, getRequestQueueName, getResponseQueueName, getTimeout, scheduleCheck
-
Methods inherited from interface org.redisson.api.RRemoteService
get, get, get, get
-
-
-
-
Constructor Detail
-
RedissonRemoteService
public RedissonRemoteService(Codec codec, name, CommandAsyncExecutor commandExecutor, executorId, <,ResponseEntry> responses)
-
-
Method Detail
-
getRequestTasksMapName
public getRequestTasksMapName(<?> remoteInterface)
-
addAsync
protected > addAsync( requestQueueName, RemoteServiceRequest request, > result)
- Specified by:
addAsync
in classBaseRemoteService
-
removeAsync
protected > removeAsync( requestQueueName, RequestId taskId)
- Specified by:
removeAsync
in classBaseRemoteService
-
register
public <T> void register(<T> remoteInterface, T object)
Description copied from interface:RRemoteService
Register remote service with single worker- Specified by:
register
in interfaceRRemoteService
- Type Parameters:
T
- type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service object
-
deregister
public <T> void deregister(<T> remoteInterface)
Description copied from interface:RRemoteService
Deregister all workers for remote service- Specified by:
deregister
in interfaceRRemoteService
- Type Parameters:
T
- type of remote service- Parameters:
remoteInterface
- - remote service interface
-
getPendingInvocations
public int getPendingInvocations(<?> remoteInterface)
Description copied from interface:RRemoteService
Returns pending invocations amount for handling in free workers.- Specified by:
getPendingInvocations
in interfaceRRemoteService
- Parameters:
remoteInterface
- - remote service interface- Returns:
- invocations amount
-
getPendingInvocationsAsync
public > getPendingInvocationsAsync(<?> remoteInterface)
Description copied from interface:RRemoteService
Returns pending invocations amount for handling in free workers.- Specified by:
getPendingInvocationsAsync
in interfaceRRemoteService
- Parameters:
remoteInterface
- - remote service interface- Returns:
- invocations amount
-
getFreeWorkers
public int getFreeWorkers(<?> remoteInterface)
Description copied from interface:RRemoteService
Returns free workers amount available for invocations- Specified by:
getFreeWorkers
in interfaceRRemoteService
- Parameters:
remoteInterface
- - remote service interface- Returns:
- workers amount
-
register
public <T> void register(<T> remoteInterface, T object, int workers)
Description copied from interface:RRemoteService
Register remote service with custom workers amount- Specified by:
register
in interfaceRRemoteService
- Type Parameters:
T
- type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service objectworkers
- - workers amount
-
register
public <T> void register(<T> remoteInterface, T object, int workers, executor)
Description copied from interface:RRemoteService
Register remote service with custom workers amount and executor for running them- Specified by:
register
in interfaceRRemoteService
- Type Parameters:
T
- type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service objectworkers
- - workers amountexecutor
- - executor service used to invoke methods
-
tryExecute
public <T> boolean tryExecute(<T> remoteInterface, T object, long timeout, timeUnit) throws
Description copied from interface:RRemoteService
Tries to execute one awaiting remote request. Waits up totimeout
if necessary until remote request became available.- Specified by:
tryExecute
in interfaceRRemoteService
- Type Parameters:
T
- - type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service objecttimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unit- Returns:
true
if method was successfully executed andfalse
if timeout reached before execution- Throws:
- - if the thread is interrupted
-
tryExecute
public <T> boolean tryExecute(<T> remoteInterface, T object, executorService, long timeout, timeUnit) throws
Description copied from interface:RRemoteService
Tries to execute one awaiting remote request. Waits up totimeout
if necessary until remote request became available.- Specified by:
tryExecute
in interfaceRRemoteService
- Type Parameters:
T
- - type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service objectexecutorService
- - executor service used to invoke methodstimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unit- Returns:
true
if method was successfully executed andfalse
if timeout reached before execution- Throws:
- - if the thread is interrupted
-
tryExecuteAsync
public <T> > tryExecuteAsync(<T> remoteInterface, T object, long timeout, timeUnit)
Description copied from interface:RRemoteService
Tries to execute one awaiting remote request. Waits up totimeout
if necessary until remote request became available.- Specified by:
tryExecuteAsync
in interfaceRRemoteService
- Type Parameters:
T
- - type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service objecttimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unit- Returns:
true
if method was successfully executed andfalse
if timeout reached before execution
-
tryExecuteAsync
public <T> > tryExecuteAsync(<T> remoteInterface, T object, executor, long timeout, timeUnit)
Description copied from interface:RRemoteService
Tries to execute one awaiting remote request. Waits up totimeout
if necessary until remote request became available.- Specified by:
tryExecuteAsync
in interfaceRRemoteService
- Type Parameters:
T
- - type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service objectexecutor
- - executor service used to invoke methodstimeout
- - maximum wait time until remote request became availabletimeUnit
- - time unit- Returns:
true
if method was successfully executed andfalse
if timeout reached before execution
-
tryExecuteAsync
public <T> > tryExecuteAsync(<T> remoteInterface, T object)
Description copied from interface:RRemoteService
Tries to execute one awaiting remote request.- Specified by:
tryExecuteAsync
in interfaceRRemoteService
- Type Parameters:
T
- - type of remote service- Parameters:
remoteInterface
- - remote service interfaceobject
- - remote service object- Returns:
true
if method was successfully executed andfalse
if timeout reached before execution
-
invokeMethod
protected <T> void invokeMethod(RemoteServiceRequest request, RemoteServiceMethod method, RFuture<RemoteServiceCancelRequest> cancelRequestFuture, RPromise<RRemoteServiceResponse> responsePromise)
-
getTask
protected requestId, ,RemoteServiceRequest> tasks)
-
-