| Class | Description |
|---|---|
| CaughtExecutorThreadFactory |
A thread-factory that sets some thread parameters if non-null:
Name
Priority
Uncaught exception handler
|
| ExecutorResult |
A bean that wrappes a thread result, composed by a ExecutorService,
a Future list and another ExecutorResult list for timeouted threads.
|
| ScheduledCaughtExecutorService |
A
ScheduledThreadPoolExecutor that can additionally perform actions after thread has completed normally. |
| ThreadBuilder |
Useful structure for thread creation in the following scenarios:
Timeout
The thread will be active only until the timeout be fired. |
| ThreadUtil |
Useful structure for handling the current thread.
|
ThreadUtil
Useful structure for handling the current thread.
ThreadUtil.sleepUnchecked(1000);
final URL url = ThreadUtil.getCurrentThreadResource("path");
final InputStream is = ThreadUtil.getCurrentThreadResourceAsStream("path");
ThreadBuilder
Useful structure for thread creation
final ExecutorService thread = ThreadBuilder
.newBuilder() //New object to build a new thread.
.setTimeout(4000) //The thread will be canceled after four seconds.
.setAfterExecuteConsumer(afterExecuteConsumer) //A consumer will be called after thread execution.
.setUncaughtExceptionConsumer(throwableConsumer) //A consumer will be called after any exception thrown.
.start();