Class 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();
     
    See Also:
    RRemoteService.get(Class, RemoteInvocationOptions), Serialized Form
    • 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 - - timeout
        timeUnit - - 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 - - timeout
        timeUnit - - timeout unit
        Returns:
        RemoteInvocationOptions object
      • noResult

        public RemoteInvocationOptions noResult()
        Specifies to not wait for result
        Returns:
        RemoteInvocationOptions object