public class UCPTaskManagerImpl extends Object implements TaskManager
Modifier and Type | Field and Description |
---|---|
static int |
THREAD_POOL_CORE_SIZE |
static int |
THREAD_POOL_KEEP_ALIVE_TIME |
static int |
THREAD_POOL_MAX_SIZE |
static int |
THREAD_POOL_QUEUE_SIZE |
Constructor and Description |
---|
UCPTaskManagerImpl() |
Modifier and Type | Method and Description |
---|---|
protected RejectedExecutionHandler |
getUCPTaskRejectionHandler() |
ExecutorService |
getUCPThreadPool() |
boolean |
isRunning()
Checks if manager is running.
|
void |
start()
Starts task manager and prepares it to work.
|
void |
stop()
Shuts task manager down and cleans everything up.
|
<T> TaskHandle<T> |
submitTask(Task<T> task)
Submits a task for execution.
|
<T> TaskHandle<T> |
submitToDedicatedThread(Task<T> task)
The method is used to submit critical tasks to the task manager, which
would need to be executed using dedicated threads instead of delegating it
to the thread pool.The tasks that have implemented the isCritical method
to return true will be executed here.
|
<T> TaskHandle<T> |
submitToWTP(Task<T> task)
The method is used execute the tasks that can be given to the thread pool
for execution.The tasks that have implemented the isCritical method
to return false will be executed using this method.
|
public static final int THREAD_POOL_MAX_SIZE
public static final int THREAD_POOL_CORE_SIZE
public static final int THREAD_POOL_QUEUE_SIZE
public static final int THREAD_POOL_KEEP_ALIVE_TIME
public void start()
start
in interface TaskManager
public boolean isRunning()
TaskManager
isRunning
in interface TaskManager
public void stop()
stop
in interface TaskManager
public <T> TaskHandle<T> submitTask(Task<T> task)
submitTask
in interface TaskManager
task
- task to execute.public <T> TaskHandle<T> submitToDedicatedThread(Task<T> task)
task
- which needs to be executedpublic <T> TaskHandle<T> submitToWTP(Task<T> task)
task
- which needs to be executedpublic ExecutorService getUCPThreadPool()
protected RejectedExecutionHandler getUCPTaskRejectionHandler()
Copyright © 2008, 2017, Oracle. All rights reserved.