Package io.inugami.commons.threads
Class ThreadsExecutorService
- java.lang.Object
-
- io.inugami.commons.threads.ThreadsExecutorService
-
- All Implemented Interfaces:
LifecycleBootstrap
public class ThreadsExecutorService extends Object implements LifecycleBootstrap
ThreadsExecutorService- Since:
- 13 janv. 2017
-
-
Constructor Summary
Constructors Constructor Description ThreadsExecutorService(String name, int maxThreads)
ThreadsExecutorService(String name, int maxThreads, boolean deamon)
ThreadsExecutorService(String name, int maxThreads, boolean deamon, Long timeout)
-
Method Summary
-
-
-
Method Detail
-
run
public <T> List<CompletableFuture<T>> run(List<Callable<T>> tasks)
-
run
public <T> List<CompletableFuture<T>> run(List<Callable<T>> tasks, BiConsumer<T,Callable<T>> onDone)
-
run
public <T> List<CompletableFuture<T>> run(List<Callable<T>> tasks, BiConsumer<T,Callable<T>> onDone, BiConsumer<Exception,Callable<T>> onError)
-
runAndGrab
public <T> List<T> runAndGrab(List<Callable<T>> tasks, long timeout) throws TechnicalException
- Throws:
TechnicalException
-
runAndGrab
public <T> List<T> runAndGrab(List<Callable<T>> tasks, BiConsumer<T,Callable<T>> onDone, long timeout) throws TechnicalException
- Throws:
TechnicalException
-
runAndGrab
public <T> List<T> runAndGrab(List<Callable<T>> tasks, BiConsumer<T,Callable<T>> onDone, BiConsumer<Exception,Callable<T>> onError, long timeout) throws TechnicalException
- Throws:
TechnicalException
-
waitting
public <T> void waitting(List<CompletableFuture<T>> futures, long timeout) throws TechnicalException
- Throws:
TechnicalException
-
buildFuture
public <T> CompletableFuture<T> buildFuture(Callable<T> taskToProcess)
-
buildFuture
public <T> CompletableFuture<T> buildFuture(Callable<T> taskToProcess, BiConsumer<T,Callable<T>> onDone)
-
buildFuture
public <T> CompletableFuture<T> buildFuture(Callable<T> taskToProcess, BiConsumer<T,Callable<T>> onDone, BiConsumer<Exception,Callable<T>> onError)
-
submit
public <T> Future<T> submit(String name, Callable<T> task, TaskFinishListener listener)
-
submit
public <T> Future<T> submit(String name, Callable<T> task, TaskFinishListener finishListner, TaskStartListener startListner)
-
start
public void start()
- Specified by:
start
in interfaceLifecycleBootstrap
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceLifecycleBootstrap
-
getExecutor
public ExecutorService getExecutor()
-
-