|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.mina.util.BaseThreadPool
public abstract class BaseThreadPool
A base implementation of Thread-pooling filters. This filter forwards events to its thread pool. This is an implementation of Leader/Followers thread pool by Douglas C. Schmidt et al.
| Nested Class Summary | |
|---|---|
protected static class |
BaseThreadPool.SessionBuffer
|
| Field Summary | |
|---|---|
static int |
DEFAULT_KEEP_ALIVE_TIME
Default keep-alive time of thread pool (1 min). |
static int |
DEFAULT_MAXIMUM_POOL_SIZE
Default maximum size of thread pool (2G). |
| Constructor Summary | |
|---|---|
BaseThreadPool(java.lang.String threadNamePrefix)
Creates a new instance with default thread pool settings. |
|
| Method Summary | |
|---|---|
protected BaseThreadPool.SessionBuffer |
fetchSessionBuffer(Queue unfetchedSessionBuffers)
Implement this method to fetch (or pop) a BaseThreadPool.SessionBuffer from
the given unfetchedSessionBuffers. |
protected void |
fireEvent(java.lang.Object nextFilter,
Session session,
EventType type,
java.lang.Object data)
|
int |
getKeepAliveTime()
Returns the keep-alive time until the thread suicides after it became idle (milliseconds unit). |
int |
getMaximumPoolSize()
Returns the maximum size of the thread pool. |
int |
getPoolSize()
Returns the number of threads in the thread pool. |
java.lang.String |
getThreadNamePrefix()
|
protected abstract void |
processEvent(java.lang.Object nextFilter,
Session session,
EventType type,
java.lang.Object data)
Implement this method to forward events to nextFilter. |
void |
setKeepAliveTime(int keepAliveTime)
Sets the keep-alive time until the thread suicides after it became idle (milliseconds unit). |
void |
setMaximumPoolSize(int maximumPoolSize)
Sets the maximum size of the thread pool. |
void |
start()
Starts thread pool threads and starts forwarding events to them. |
void |
stop()
Stops all thread pool threads. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAXIMUM_POOL_SIZE
public static final int DEFAULT_KEEP_ALIVE_TIME
| Constructor Detail |
|---|
public BaseThreadPool(java.lang.String threadNamePrefix)
start() method to start threads actually.
threadNamePrefix - the prefix of the thread names this pool will create.| Method Detail |
|---|
public java.lang.String getThreadNamePrefix()
public int getPoolSize()
ThreadPool
getPoolSize in interface ThreadPoolpublic int getMaximumPoolSize()
ThreadPool
getMaximumPoolSize in interface ThreadPoolpublic int getKeepAliveTime()
ThreadPool
getKeepAliveTime in interface ThreadPoolpublic void setMaximumPoolSize(int maximumPoolSize)
ThreadPool
setMaximumPoolSize in interface ThreadPoolpublic void setKeepAliveTime(int keepAliveTime)
ThreadPool
setKeepAliveTime in interface ThreadPoolpublic void start()
ThreadPool
start in interface ThreadPoolpublic void stop()
ThreadPool
stop in interface ThreadPool
protected void fireEvent(java.lang.Object nextFilter,
Session session,
EventType type,
java.lang.Object data)
protected abstract void processEvent(java.lang.Object nextFilter,
Session session,
EventType type,
java.lang.Object data)
protected BaseThreadPool.SessionBuffer fetchSessionBuffer(Queue unfetchedSessionBuffers)
BaseThreadPool.SessionBuffer from
the given unfetchedSessionBuffers. The default implementation
simply pops the buffer from it. You could prioritize the fetch order.
BaseThreadPool.SessionBuffer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||