Class AbstractSubmitterScheduler

    • Constructor Detail

      • AbstractSubmitterScheduler

        public AbstractSubmitterScheduler()
    • Method Detail

      • schedule

        public void schedule​(java.lang.Runnable task,
                             long delayInMs)
        Description copied from interface: SubmitterScheduler
        Schedule a one time task with a given delay.
        Specified by:
        schedule in interface SubmitterScheduler
        Parameters:
        task - runnable to execute
        delayInMs - time in milliseconds to wait to execute task
      • submitScheduled

        public <T> ListenableFuture<T> submitScheduled​(java.lang.Runnable task,
                                                       T result,
                                                       long delayInMs)
        Description copied from interface: SubmitterScheduler
        Schedule a task with a given delay. The Future.get() method will return the provided result once the runnable has completed.
        Specified by:
        submitScheduled in interface SubmitterScheduler
        Type Parameters:
        T - type of result returned from the future
        Parameters:
        task - runnable to execute
        result - result to be returned from resulting future .get() when runnable completes
        delayInMs - time in milliseconds to wait to execute task
        Returns:
        a future to know when the task has completed
      • submitScheduled

        public <T> ListenableFuture<T> submitScheduled​(java.util.concurrent.Callable<T> task,
                                                       long delayInMs)
        Description copied from interface: SubmitterScheduler
        Schedule a Callable with a given delay. This is needed when a result needs to be consumed from the callable.
        Specified by:
        submitScheduled in interface SubmitterScheduler
        Type Parameters:
        T - type of result returned from the future
        Parameters:
        task - callable to be executed
        delayInMs - time in milliseconds to wait to execute task
        Returns:
        a future to know when the task has completed and get the result of the callable