|
||||||||||
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.
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 | |
---|---|
protected |
BaseThreadPool()
Creates a new instance with default thread pool settings. |
Method Summary | |
---|---|
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. |
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 |
---|
protected BaseThreadPool()
start()
method to start threads actually.
Method Detail |
---|
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |