|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.concurrent.tasks.ThreadPoolTaskService
public class ThreadPoolTaskService
A TaskService
implementation which makes use of a ThreadPoolExecutor
to execute
tasks on a number of background threads.
Constructor Summary | |
---|---|
ThreadPoolTaskService(String name)
|
Method Summary | ||
---|---|---|
void |
addTaskListener(TaskListener l)
Add a listener to receive notifications about the activities of this task service. |
|
int |
getActiveTaskCount()
|
|
int |
getCorePoolSize()
|
|
static ThreadPoolTaskService |
getDefault()
|
|
TaskExecutor<Object> |
getExecutor()
Get a TaskExecutor scoped for the current thread. |
|
|
getExecutor(TaskScope<R> scope)
Create a TaskExecutor for the given TaskScope . |
|
|
getExecutor(TaskScope<R> scope,
int priority)
Create a TaskExecutor for the given TaskScope . |
|
int |
getMaximumPoolSize()
|
|
int |
getQueuedTaskCount()
|
|
void |
removeTaskListener(TaskListener l)
Remove a listener previously installed to receive notifications about the activities of this task service. |
|
void |
setCorePoolSize(int corePoolSize)
|
|
static void |
setExecutorManager(ExecutorManager executorManager)
|
|
void |
setMaximumPoolSize(int maximumPoolSize)
|
|
void |
shutdown()
|
|
static void |
shutdownDefault()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadPoolTaskService(String name)
Method Detail |
---|
public static ThreadPoolTaskService getDefault()
public static void setExecutorManager(ExecutorManager executorManager)
public static void shutdownDefault()
public void addTaskListener(TaskListener l)
TaskService
addTaskListener
in interface TaskService
l
- the listenerpublic int getActiveTaskCount()
public int getCorePoolSize()
ThreadPoolExecutor.getCorePoolSize()
public TaskExecutor<Object> getExecutor()
TaskExecutor
scoped for the current thread. If no scope for the current thread
exists, a new scope is created. The scope inherits the current thread's priority.
getExecutor
in interface TaskService
public <R> TaskExecutor<R> getExecutor(TaskScope<R> scope)
TaskService
TaskExecutor
for the given TaskScope
. Tasks will be executed with the
default priority.
getExecutor
in interface TaskService
public <R> TaskExecutor<R> getExecutor(TaskScope<R> scope, int priority)
TaskService
TaskExecutor
for the given TaskScope
. Tasks will be executed with the
given priority.
getExecutor
in interface TaskService
public int getMaximumPoolSize()
ThreadPoolExecutor.getMaximumPoolSize()
public int getQueuedTaskCount()
public void removeTaskListener(TaskListener l)
TaskService
removeTaskListener
in interface TaskService
l
- the listenerpublic void setCorePoolSize(int corePoolSize)
corePoolSize
- ThreadPoolExecutor.setCorePoolSize(int)
public void setMaximumPoolSize(int maximumPoolSize)
maximumPoolSize
- ThreadPoolExecutor.setMaximumPoolSize(int)
public void shutdown()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |