}
}
}
private void parseBlockingBoundedQueueThreadPool(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException {
ThreadPoolConfigurationBuilder builder = new ThreadPoolConfigurationBuilder(holder.getGlobalConfigurationBuilder());
String name = null;
String threadFactoryName = null;
int maxThreads = 0;
int coreThreads = 0;
int queueLength = 0;
long keepAlive = 0;
for (int i = 0; i < reader.getAttributeCount(); i++) {
ParseUtils.requireNoNamespaceAttribute(reader, i);
String value = replaceProperties(reader.getAttributeValue(i));
Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case NAME: {
name = value;
break;
}
case THREAD_FACTORY: {
threadFactoryName = value;
break;
}
case CORE_THREADS: {
coreThreads = Integer.valueOf(value);
break;
}
case MAX_THREADS: {
maxThreads = Integer.valueOf(value);
break;
}
case QUEUE_LENGTH: {
queueLength = Integer.valueOf(value);
break;
}
case KEEP_ALIVE_TIME: {
keepAlive = Long.valueOf(value);
break;
}
default: {
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
ThreadPoolExecutorFactory factory = new BlockingThreadPoolExecutorFactory(
maxThreads, coreThreads, queueLength, keepAlive);
builder.threadPoolFactory(factory);
// Keep track of the thread pool to thread factory name mapping,
// and wait until all threads section has been processed to link the
// actual thread factories with the thread pools.
threadPoolToThreadFactory.put(name, threadFactoryName);