|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(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(Object nextFilter,
Session session,
EventType type,
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. |
String |
getThreadNamePrefix()
|
protected abstract void |
processEvent(Object nextFilter,
Session session,
EventType type,
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(String threadNamePrefix)
start()
method to start threads actually.
threadNamePrefix
- the prefix of the thread names this pool will create.Method Detail |
---|
public String getThreadNamePrefix()
public int getPoolSize()
ThreadPool
getPoolSize
in interface ThreadPool
public int getMaximumPoolSize()
ThreadPool
getMaximumPoolSize
in interface ThreadPool
public int getKeepAliveTime()
ThreadPool
getKeepAliveTime
in interface ThreadPool
public void setMaximumPoolSize(int maximumPoolSize)
ThreadPool
setMaximumPoolSize
in interface ThreadPool
public void setKeepAliveTime(int keepAliveTime)
ThreadPool
setKeepAliveTime
in interface ThreadPool
public void start()
ThreadPool
start
in interface ThreadPool
public void stop()
ThreadPool
stop
in interface ThreadPool
protected void fireEvent(Object nextFilter, Session session, EventType type, Object data)
protected abstract void processEvent(Object nextFilter, Session session, EventType type, 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 |