Package io.mangoo.services
Class ConcurrentService
- java.lang.Object
-
- io.mangoo.services.ConcurrentService
-
public class ConcurrentService extends Object
- Author:
- svenkubiak
-
-
Constructor Summary
Constructors Constructor Description ConcurrentService(Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(Runnable runnable)Executes the given command at some time in the future.voidshutdown()<T> Future<T>submit(Runnable runnable, T result)Submits a Runnable task for execution and returns a Future representing that task.<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.
-
-
-
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 submitresult- 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()
-
-