Class ConstantSpeculativeExecutionPolicy

    • Constructor Detail

      • ConstantSpeculativeExecutionPolicy

        public ConstantSpeculativeExecutionPolicy​(long constantDelayMillis,
                                                  int maxSpeculativeExecutions)
        Builds a new instance.
        Parameters:
        constantDelayMillis - the delay between each speculative execution. Must be >= 0. A zero delay means it should immediately send `maxSpeculativeExecutions` requests along with the original request.
        maxSpeculativeExecutions - the number of speculative executions. Must be strictly positive.
        Throws:
        IllegalArgumentException - if one of the arguments does not respect the preconditions above.
    • Method Detail

      • getMaxSpeculativeExecutions

        @Beta
        public int getMaxSpeculativeExecutions()
        The number of speculative executions this policy schedules for a request, as specified at instantiation. This does not include the initial, normal request.
        Returns:
        the number of speculative executions, always strictly positive.
      • getConstantDelayMillis

        @Beta
        public long getConstantDelayMillis()
        The delay between each speculative execution, as specified at instantiation. Zero means all executions are sent immediately, along with the original request.
        Returns:
        the delay in milliseconds, never negative.
      • close

        public void close()
        Description copied from interface: SpeculativeExecutionPolicy
        Gets invoked at cluster shutdown.

        This gives the policy the opportunity to perform some cleanup, for instance stop threads that it might have started.

        Specified by:
        close in interface SpeculativeExecutionPolicy