|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.thread.AbstractExecutor
org.norther.tammi.core.thread.DefaultThreadedExecutor
org.norther.tammi.core.thread.DefaultPooledExecutor
public class DefaultPooledExecutor
A default implementation of PooledExecutor.
| Nested Class Summary | |
|---|---|
static class |
DefaultPooledExecutor.AbortPolicy
A handler for rejected tasks that aborts the rejected task. |
static class |
DefaultPooledExecutor.CallerRunsPolicy
A handler for rejected tasks that runs the rejected task directly in the calling thread of the execute method. |
static class |
DefaultPooledExecutor.DiscardOldestPolicy
A handler for rejected tasks that discards the oldest unhandled request and then retries execute. |
static class |
DefaultPooledExecutor.DiscardPolicy
A handler for rejected tasks that silently discards the rejected task. |
static class |
DefaultPooledExecutor.QueuePolicy
A handler for rejected tasks that queues the rejected task. |
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultPooledExecutor(int capacity)
Constructs a new pooled executor. |
|
| Method Summary | |
|---|---|
int |
getCorePoolSize()
Gets the number of threads to cache (default = 0). |
long |
getKeepAliveTime()
Gets the number of milliseconds to keep alive threads exceeding the number of core threads waiting for new commands. |
int |
getLargestPoolSize()
Gets the largest number of active threads in the pool ever. |
int |
getMaxPoolSize()
Gets the maximum number of threads to simultaneously execute. |
int |
getPoolSize()
Gets the current number of active threads in the pool. |
int |
getQueueCapacity()
Gets the queue capacity of the executor. |
RejectedExecutionHandler |
getRejectedExecutionHandler()
Gets the rejected execution handler. |
protected ExecutorService |
newExecutor()
Creates the implementation of the executor. |
int |
prestartAllCoreThreads()
Creates and starts the core threads in the pool. |
boolean |
prestartCoreThread()
Creates and starts a new core thread in the pool. |
void |
purge()
Purges cancelled tasks from the queue. |
boolean |
remove(Runnable task)
Removes the specified task. |
void |
setCorePoolSize(int size)
Set the number of threads to cache. |
void |
setKeepAliveTime(long msecs)
Sets the number of milliseconds to keep alive threads exceeding the number of core threads waiting for new commands. |
void |
setMaxPoolSize(int size)
Sets the maximum number of threads to use. |
void |
setRejectedExecutionHandler(RejectedExecutionHandler handler)
Sets the rejected execution handler. |
| Methods inherited from class org.norther.tammi.core.thread.DefaultThreadedExecutor |
|---|
getExecutor, getThreadFactoryName, handleNotification, postmanaged, setThreadFactoryName, unmanaged |
| Methods inherited from class org.norther.tammi.core.thread.AbstractExecutor |
|---|
awaitTermination, execute, getActiveCount, getCompletedTaskCount, getTaskCount, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isStarted, isTerminated, shutdown, shutdownNow, start, stop, submit, submit, submit |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.core.thread.ThreadedExecutor |
|---|
getThreadFactoryName, setThreadFactoryName |
| Methods inherited from interface org.norther.tammi.core.thread.Executor |
|---|
getActiveCount, getCompletedTaskCount, getTaskCount |
| Methods inherited from interface java.util.concurrent.ExecutorService |
|---|
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit |
| Methods inherited from interface java.util.concurrent.Executor |
|---|
execute |
| Methods inherited from interface org.norther.tammi.core.base.Startable |
|---|
isStarted, start, stop |
| Constructor Detail |
|---|
public DefaultPooledExecutor(int capacity)
capacity - the capacity of a command queue.| Method Detail |
|---|
public int getQueueCapacity()
PooledExecutor
getQueueCapacity in interface PooledExecutorpublic long getKeepAliveTime()
PooledExecutor
getKeepAliveTime in interface PooledExecutorpublic void setKeepAliveTime(long msecs)
PooledExecutor
setKeepAliveTime in interface PooledExecutormsecs - the keep alive time in msecs.public int getMaxPoolSize()
PooledExecutor
getMaxPoolSize in interface PooledExecutorpublic void setMaxPoolSize(int size)
PooledExecutor
setMaxPoolSize in interface PooledExecutorsize - the max pool size or -1 for unlimited.public int getCorePoolSize()
PooledExecutor
getCorePoolSize in interface PooledExecutorpublic void setCorePoolSize(int size)
PooledExecutor
setCorePoolSize in interface PooledExecutorsize - the core pool size.public int getPoolSize()
PooledExecutor
getPoolSize in interface PooledExecutorpublic int getLargestPoolSize()
PooledExecutor
getLargestPoolSize in interface PooledExecutorpublic RejectedExecutionHandler getRejectedExecutionHandler()
PooledExecutor
getRejectedExecutionHandler in interface PooledExecutorpublic void setRejectedExecutionHandler(RejectedExecutionHandler handler)
PooledExecutor
setRejectedExecutionHandler in interface PooledExecutorhandler - the handler to apply.public boolean prestartCoreThread()
PooledExecutor
prestartCoreThread in interface PooledExecutorpublic int prestartAllCoreThreads()
PooledExecutor
prestartAllCoreThreads in interface PooledExecutorpublic void purge()
PooledExecutor
purge in interface PooledExecutorpublic boolean remove(Runnable task)
PooledExecutor
remove in interface PooledExecutortask - the task.
protected ExecutorService newExecutor()
AbstractExecutor
newExecutor in class DefaultThreadedExecutor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||