if (timeoutThreadPool == null)
{
int maxNumberThreads = MAX_NUM_TIMEOUT_THREADS_DEFAULT;
int maxTimeoutQueueSize = -1;
BasicThreadPool pool = new BasicThreadPool("HTTP timeout");
log.debug(this + " created new simulated timeout thread pool: " + pool);
Object param = configuration.get(MAX_NUM_TIMEOUT_THREADS);
if (param instanceof String)
{
try
{
maxNumberThreads = Integer.parseInt((String) param);
}
catch (NumberFormatException e)
{
log.warn("maxNumberThreads parameter has invalid format: " + param);
}
}
else if (param != null)
{
log.warn("maxNumberThreads parameter must be a string in integer format: " + param);
}
param = configuration.get(MAX_TIMEOUT_QUEUE_SIZE);
if (param instanceof String)
{
try
{
maxTimeoutQueueSize = Integer.parseInt((String) param);
}
catch (NumberFormatException e)
{
log.warn("maxTimeoutQueueSize parameter has invalid format: " + param);
}
}
else if (param != null)
{
log.warn("maxTimeoutQueueSize parameter must be a string in integer format: " + param);
}
pool.setMaximumPoolSize(maxNumberThreads);
if (maxTimeoutQueueSize > 0)
{
pool.setMaximumQueueSize(maxTimeoutQueueSize);
}
pool.setBlockingMode(BlockingMode.RUN);
timeoutThreadPool = pool;
}
}
return timeoutThreadPool;