Package org.redisson

Class RedissonRemoteService

java.lang.Object
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
  • Constructor Details

  • Method Details

    • getRequestTasksMapName

      public String getRequestTasksMapName(Class<?> remoteInterface)
    • addAsync

      protected CompletableFuture<Boolean> addAsync(String requestQueueName, RemoteServiceRequest request, RemotePromise<Object> result)
      Specified by:
      addAsync in class BaseRemoteService
    • removeAsync

      protected CompletableFuture<Boolean> removeAsync(String requestQueueName, String taskId)
      Specified by:
      removeAsync in class BaseRemoteService
    • register

      public <T> void register(Class<T> remoteInterface, T object)
      Description copied from interface: RRemoteService
      Register remote service with single worker
      Specified by:
      register in interface RRemoteService
      Type Parameters:
      T - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
    • deregister

      public <T> void deregister(Class<T> remoteInterface)
      Description copied from interface: RRemoteService
      Deregister all workers for remote service
      Specified by:
      deregister in interface RRemoteService
      Type Parameters:
      T - type of remote service
      Parameters:
      remoteInterface - - remote service interface
    • getPendingInvocations

      public int getPendingInvocations(Class<?> remoteInterface)
      Description copied from interface: RRemoteService
      Returns pending invocations amount for handling in free workers.
      Specified by:
      getPendingInvocations in interface RRemoteService
      Parameters:
      remoteInterface - - remote service interface
      Returns:
      invocations amount
    • getPendingInvocationsAsync

      public RFuture<Integer> getPendingInvocationsAsync(Class<?> remoteInterface)
      Description copied from interface: RRemoteService
      Returns pending invocations amount for handling in free workers.
      Specified by:
      getPendingInvocationsAsync in interface RRemoteService
      Parameters:
      remoteInterface - - remote service interface
      Returns:
      invocations amount
    • getFreeWorkers

      public int getFreeWorkers(Class<?> remoteInterface)
      Description copied from interface: RRemoteService
      Returns free workers amount available for invocations
      Specified by:
      getFreeWorkers in interface RRemoteService
      Parameters:
      remoteInterface - - remote service interface
      Returns:
      workers amount
    • register

      public <T> void register(Class<T> remoteInterface, T object, int workers)
      Description copied from interface: RRemoteService
      Register remote service with custom workers amount
      Specified by:
      register in interface RRemoteService
      Type Parameters:
      T - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      workers - - workers amount
    • register

      public <T> void register(Class<T> remoteInterface, T object, int workers, ExecutorService executor)
      Description copied from interface: RRemoteService
      Register remote service with custom workers amount and executor for running them
      Specified by:
      register in interface RRemoteService
      Type Parameters:
      T - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      workers - - workers amount
      executor - - executor service used to invoke methods
    • tryExecute

      public <T> boolean tryExecute(Class<T> remoteInterface, T object, long timeout, TimeUnit timeUnit) throws InterruptedException
      Description copied from interface: RRemoteService
      Tries to execute one awaiting remote request. Waits up to timeout if necessary until remote request became available.
      Specified by:
      tryExecute in interface RRemoteService
      Type Parameters:
      T - - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      timeout - - maximum wait time until remote request became available
      timeUnit - - time unit
      Returns:
      true if method was successfully executed and false if timeout reached before execution
      Throws:
      InterruptedException - - if the thread is interrupted
    • tryExecute

      public <T> boolean tryExecute(Class<T> remoteInterface, T object, ExecutorService executorService, long timeout, TimeUnit timeUnit) throws InterruptedException
      Description copied from interface: RRemoteService
      Tries to execute one awaiting remote request. Waits up to timeout if necessary until remote request became available.
      Specified by:
      tryExecute in interface RRemoteService
      Type Parameters:
      T - - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      executorService - - executor service used to invoke methods
      timeout - - maximum wait time until remote request became available
      timeUnit - - time unit
      Returns:
      true if method was successfully executed and false if timeout reached before execution
      Throws:
      InterruptedException - - if the thread is interrupted
    • tryExecuteAsync

      public <T> RFuture<Boolean> tryExecuteAsync(Class<T> remoteInterface, T object, long timeout, TimeUnit timeUnit)
      Description copied from interface: RRemoteService
      Tries to execute one awaiting remote request. Waits up to timeout if necessary until remote request became available.
      Specified by:
      tryExecuteAsync in interface RRemoteService
      Type Parameters:
      T - - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      timeout - - maximum wait time until remote request became available
      timeUnit - - time unit
      Returns:
      true if method was successfully executed and false if timeout reached before execution
    • tryExecuteAsync

      public <T> RFuture<Boolean> tryExecuteAsync(Class<T> remoteInterface, T object, ExecutorService executor, long timeout, TimeUnit timeUnit)
      Description copied from interface: RRemoteService
      Tries to execute one awaiting remote request. Waits up to timeout if necessary until remote request became available.
      Specified by:
      tryExecuteAsync in interface RRemoteService
      Type Parameters:
      T - - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      executor - - executor service used to invoke methods
      timeout - - maximum wait time until remote request became available
      timeUnit - - time unit
      Returns:
      true if method was successfully executed and false if timeout reached before execution
    • tryExecuteAsync

      public <T> RFuture<Boolean> tryExecuteAsync(Class<T> remoteInterface, T object)
      Description copied from interface: RRemoteService
      Tries to execute one awaiting remote request.
      Specified by:
      tryExecuteAsync in interface RRemoteService
      Type Parameters:
      T - - type of remote service
      Parameters:
      remoteInterface - - remote service interface
      object - - remote service object
      Returns:
      true if method was successfully executed and false if timeout reached before execution
    • invokeMethod

      protected <T> void invokeMethod(RemoteServiceRequest request, RemoteServiceMethod method, CompletableFuture<RemoteServiceCancelRequest> cancelRequestFuture, CompletableFuture<RRemoteServiceResponse> responsePromise)
    • getTask

      protected RFuture<RemoteServiceRequest> getTask(String requestId, RMap<String,RemoteServiceRequest> tasks)