public class ThreadRenamingSchedulerService extends ThreadRenamingSubmitterScheduler implements SchedulerService
SchedulerService and wraps all supplied tasks in a
ThreadRenamingRunnable. This allows you to make a pool where all tasks submitted
inside it have the threads named in an identifiable way.| Constructor and Description |
|---|
ThreadRenamingSchedulerService(SchedulerService scheduler,
java.lang.String threadName,
boolean replace)
Constructs a new
ThreadRenamingSchedulerService, wrapping a supplied
SchedulerService. |
| Modifier and Type | Method and Description |
|---|---|
int |
getActiveTaskCount()
Call to check how many tasks are currently being executed in this scheduler.
|
int |
getQueuedTaskCount()
Returns how many tasks are either waiting to be executed, or are scheduled to be executed at
a future point.
|
int |
getWaitingForExecutionTaskCount()
Returns how many tasks are either waiting to be executed.
|
boolean |
isShutdown()
Function to check if the thread pool is currently accepting and handling tasks.
|
boolean |
remove(java.util.concurrent.Callable<?> task)
Removes the callable task from the execution queue.
|
boolean |
remove(java.lang.Runnable task)
Removes the runnable task from the execution queue.
|
scheduleAtFixedRate, scheduleWithFixedDelayschedule, submitScheduled, submitScheduledexecute, submit, submitequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitschedule, scheduleAtFixedRate, scheduleWithFixedDelay, submitScheduled, submitScheduled, submitScheduledsubmit, submit, submitpublic ThreadRenamingSchedulerService(SchedulerService scheduler, java.lang.String threadName, boolean replace)
ThreadRenamingSchedulerService, wrapping a supplied
SchedulerService. If /replace is false the thread will be named such
that threadName[originalThreadName].scheduler - SchedulerService to wrap and send executions tothreadName - Thread name prefix, or replaced namereplace - If true the original name wont be included in the thread namepublic boolean remove(java.lang.Runnable task)
SchedulerServiceNote that this call has high guarantees on the ability to remove the task (as in a complete guarantee). But while this is being invoked, it will reduce the throughput of execution, so should NOT be used extremely frequently.
For non-recurring tasks using a future and calling
Future.cancel(boolean) can be a better solution.
remove in interface SchedulerServicetask - The original runnable provided to the executortrue if the runnable was found and removedpublic boolean remove(java.util.concurrent.Callable<?> task)
SchedulerServiceNote that this call has high guarantees on the ability to remove the task (as in a complete guarantee). But while this is being invoked, it will reduce the throughput of execution, so should NOT be used extremely frequently.
For non-recurring tasks using a future and calling
Future.cancel(boolean) can be a better solution.
remove in interface SchedulerServicetask - The original callable provided to the executortrue if the callable was found and removedpublic int getActiveTaskCount()
SchedulerServicegetActiveTaskCount in interface SchedulerServicepublic int getQueuedTaskCount()
SchedulerServiceSchedulerService.getWaitingForExecutionTaskCount().getQueuedTaskCount in interface SchedulerServicepublic int getWaitingForExecutionTaskCount()
SchedulerServicegetWaitingForExecutionTaskCount in interface SchedulerServicepublic boolean isShutdown()
SchedulerServiceisShutdown in interface SchedulerServicetrue if thread pool is running