Class AbstractListeningExecutorService

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected <T> <T>  runnable, T value)
      Returns a RunnableFuture for the given runnable and default value.
      protected <T> <T> <T> callable)
      Returns a RunnableFuture for the given callable task.
      ListenableFuture<?>  task)
      Submits a Runnable task for execution and returns a Future representing that task.
      <T> ListenableFuture<T>  task, T result)
      Submits a Runnable task for execution and returns a Future representing that task.
      <T> ListenableFuture<T> <T> task)
      Submits a value-returning task for execution and returns a Future representing the pending results of the task.
      • Methods inherited from class java.util.concurrent.

        , , ,
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
      • Methods inherited from interface java.util.concurrent.

      • Methods inherited from interface java.util.concurrent.

        , , , , , ,
    • Method Detail

      • newTaskFor

        protected final <T> <T>  runnable,
                                                         T value)
        Description copied from class: 
        Returns a RunnableFuture for the given runnable and default value.
        Overrides:
         in class 
        Type Parameters:
        T - the type of the given value
        Parameters:
        runnable - the runnable task being wrapped
        value - the default value for the returned future
        Returns:
        a RunnableFuture which, when run, will run the underlying runnable and which, as a Future, will yield the given value as its result and provide for cancellation of the underlying task
        Since:
        19.0 (present with return type ListenableFutureTask since 14.0)
      • newTaskFor

        protected final <T> <T> <T> callable)
        Description copied from class: 
        Returns a RunnableFuture for the given callable task.
        Overrides:
         in class 
        Type Parameters:
        T - the type of the callable's result
        Parameters:
        callable - the callable task being wrapped
        Returns:
        a RunnableFuture which, when run, will call the underlying callable and which, as a Future, will yield the callable's result as its result and provide for cancellation of the underlying task
        Since:
        19.0 (present with return type ListenableFutureTask since 14.0)
      • submit

        public  task)
        Description copied from interface: 
        Submits a Runnable task for execution and returns a Future representing that task. The Future's get method will return null upon successful completion.
        Specified by:
         in interface 
        Specified by:
        submit in interface ListeningExecutorService
        Overrides:
         in class 
        Parameters:
        task - the task to submit
        Returns:
        a Future representing pending completion of the task
      • submit

        public <T>  task,
                                               T result)
        Description copied from interface: 
        Submits a Runnable task for execution and returns a Future representing that task. The Future's get method will return the given result upon successful completion.
        Specified by:
         in interface 
        Specified by:
        submit in interface ListeningExecutorService
        Overrides:
         in class 
        Type Parameters:
        T - the type of the result
        Parameters:
        task - the task to submit
        result - the result to return
        Returns:
        a Future representing pending completion of the task
      • submit

        public <T> <T> task)
        Description copied from interface: 
        Submits a value-returning task for execution and returns a Future representing the pending results of the task. The Future's get method will return the task's result upon successful completion.

        If you would like to immediately block waiting for a task, you can use constructions of the form result = exec.submit(aCallable).get();

        Note: The class includes a set of methods that can convert some other common closure-like objects, for example, to form so they can be submitted.

        Specified by:
         in interface 
        Specified by:
        submit in interface ListeningExecutorService
        Overrides:
         in class 
        Type Parameters:
        T - the type of the task's result
        Parameters:
        task - the task to submit
        Returns:
        a Future representing pending completion of the task