public abstract class AbstractAgiServer extends Object
| Constructor and Description |
|---|
AbstractAgiServer() |
AbstractAgiServer(AgiChannelFactory agiChannelFactory)
Creates a new AbstractAgiServer with the given channel factory.
|
| Modifier and Type | Method and Description |
|---|---|
protected ThreadPoolExecutor |
createPool()
Creates a new ThreadPoolExecutor to serve the AGI requests.
|
protected void |
execute(Runnable command)
Execute the runnable using the configured ThreadPoolExecutor obtained
from
getPool(). |
protected void |
finalize() |
protected AgiChannelFactory |
getAgiChannelFactory()
Returns the AgiChannelFactory to use for creating new AgiChannel
instances.
|
protected MappingStrategy |
getMappingStrategy() |
int |
getMaximumPoolSize()
Returns the maximum number of worker threads in the thread pool.
|
int |
getPoolActiveTaskCount()
Returns the approximate number of AgiConnectionHandler threads that are
actively executing tasks.
|
int |
getPoolActiveThreadCount() |
int |
getPoolSize()
Returns the default number of worker threads in the thread pool.
|
protected void |
handleException(String message,
Exception e) |
protected boolean |
isDie() |
void |
setMappingStrategy(MappingStrategy mappingStrategy)
Sets the strategy to use for mapping AgiRequests to AgiScripts that serve
them.
|
void |
setMaximumPoolSize(int maximumPoolSize)
Sets the maximum number of worker threads in the thread pool.
|
void |
setPoolSize(int poolSize)
Sets the default number of worker threads in the thread pool.
|
protected void |
shutdown() |
public AbstractAgiServer()
public AbstractAgiServer(AgiChannelFactory agiChannelFactory)
agiChannelFactory - the AgiChannelFactory to use for creating new
AgiChannel instances.protected AgiChannelFactory getAgiChannelFactory()
public int getPoolSize()
public void setPoolSize(int poolSize)
poolSize - the size of the worker thread pool.IllegalArgumentException - if the new pool size is negativeThreadPoolExecutor.setCorePoolSize(int)public int getMaximumPoolSize()
public void setMaximumPoolSize(int maximumPoolSize)
maximumPoolSize - the maximum size of the worker thread pool.IllegalArgumentException - if maximumPoolSize is less than current
pool size or less than or equal to 0.ThreadPoolExecutor.setMaximumPoolSize(int)public void setMappingStrategy(MappingStrategy mappingStrategy)
mappingStrategy - the mapping strategy to use.protected MappingStrategy getMappingStrategy()
protected boolean isDie()
protected void shutdown()
protected void finalize()
throws Throwable
protected void execute(Runnable command) throws RejectedExecutionException
getPool().command - the command to run.RejectedExecutionException - if the runnable can't be executedpublic int getPoolActiveTaskCount()
public int getPoolActiveThreadCount()
protected ThreadPoolExecutor createPool()
You can override this method to change this behavior. For example you can use a cached pool with
return Executors.newCachedThreadPool(new DaemonThreadFactory());
setPoolSize(int),
setMaximumPoolSize(int)Copyright © 2004–2022. All rights reserved.