Class ConcurrentService


  • public class ConcurrentService
    extends Object
    Author:
    svenkubiak
    • Constructor Detail

      • ConcurrentService

        @Inject
        public ConcurrentService​(Config config)
    • Method Detail

      • submit

        public <T> Future<T> submit​(Callable<T> callable)
        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.
        Type Parameters:
        T - JavaDoc requires this (just ignore it)
        Parameters:
        callable - The callable to submit
        Returns:
        a Future representing pending completion of the task
      • submit

        public <T> Future<T> submit​(Runnable runnable,
                                    T result)
        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.
        Type Parameters:
        T - JavaDoc requires this (just ignore it)
        Parameters:
        runnable - the task to submit
        result - the result to return
        Returns:
        a Future representing pending completion of the task
      • execute

        public void execute​(Runnable runnable)
        Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.
        Parameters:
        runnable - the runnable task
      • shutdown

        public void shutdown()