public class ExecutorFacade extends Object implements Thread.UncaughtExceptionHandler, ThreadFactory
Executors.defaultThreadFactory() if the managed one
was not available.
The implementation also provides metrics about number of thread in pool and number of active threads.
| Constructor and Description |
|---|
ExecutorFacade(SessionConfiguration conf)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
Thread |
newThread(Runnable r)
This method creates new thread from pool and add namespace to the thread
name.
|
ScheduledFuture<?> |
scheduleAtFixedRate(Runnable task,
long initialDelay,
long period,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first after the
given initial delay, and subsequently with the given period; that is
executions will commence after
initialDelay then
initialDelay+period, then initialDelay + 2 * period, and so
on. |
void |
shutdown()
Called to shutdown the executor and finish all submitted tasks.
|
Future<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future representing
that task.
|
void |
uncaughtException(Thread t,
Throwable e)
The method will log uncaught exceptions that occurred during thread
execution.
|
public ExecutorFacade(SessionConfiguration conf)
conf - namespace for metricspublic Thread newThread(Runnable r)
newThread in interface ThreadFactorypublic Future<?> submit(Runnable task)
get method will return null upon
successful completion.task - the task to submitRejectedExecutionException - if the task cannot be scheduled for executionNullPointerException - if the task is nullpublic ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long period, TimeUnit unit)
initialDelay then
initialDelay+period, then initialDelay + 2 * period, and so
on. If any execution of the task encounters an exception, subsequent
executions are suppressed. Otherwise, the task will only terminate via
cancellation or termination of the executor. If any execution of this task
takes longer than its period, then subsequent executions may start late,
but will not concurrently execute.task - the task to executeinitialDelay - the time to delay first executionperiod - the period between successive executionsunit - the time unit of the initialDelay and period parametersget() method will throw an exception upon
cancellationRejectedExecutionException - if the task cannot be scheduled for executionNullPointerException - if command is nullIllegalArgumentException - if period less than or equal to zeropublic void uncaughtException(Thread t, Throwable e)
uncaughtException in interface Thread.UncaughtExceptionHandlerpublic void shutdown()
Copyright © 2018 Amadeus s.a.s.. All rights reserved.