Class TrustedListenableFutureTask<V>

    • Constructor Detail

      • TrustedListenableFutureTask

        TrustedListenableFutureTask​(java.util.concurrent.Callable<V> callable)
    • Method Detail

      • create

        static <V> TrustedListenableFutureTask<V> create​(java.util.concurrent.Callable<V> callable)
        Creates a ListenableFutureTask that will upon running, execute the given Callable.
        Parameters:
        callable - the callable task
      • create

        static <V> TrustedListenableFutureTask<V> create​(java.lang.Runnable runnable,
                                                         @Nullable
                                                         V result)
        Creates a ListenableFutureTask that will upon running, execute the given Runnable, and arrange that get will return the given result on successful completion.
        Parameters:
        runnable - the runnable task
        result - the result to return on successful completion. If you don't need a particular result, consider using constructions of the form: ListenableFuture<?> f = ListenableFutureTask.create(runnable, null)
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Specified by:
        run in interface java.util.concurrent.RunnableFuture<V>
      • afterDone

        protected void afterDone()
        Description copied from class: AbstractFuture
        Callback method that is called exactly once after the future is completed.

        If AbstractFuture.interruptTask() is also run during completion, AbstractFuture.afterDone() runs after it.

        The default implementation of this method in AbstractFuture does nothing. This is intended for very lightweight cleanup work, for example, timing statistics or clearing fields. If your task does anything heavier consider, just using a listener with an executor.

        Overrides:
        afterDone in class AbstractFuture<V>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object