Search in sources :

Example 1 with ThreadPoolBuilderAdapter

use of org.infinispan.configuration.global.ThreadPoolBuilderAdapter in project infinispan by infinispan.

the class Parser method createThreadPoolConfiguration.

private ThreadPoolConfiguration createThreadPoolConfiguration(String threadPoolName, String componentName, ConfigurationBuilderHolder holder) {
    ThreadsConfigurationBuilder threads = holder.getGlobalConfigurationBuilder().threads();
    ThreadPoolBuilderAdapter threadPool = threads.getThreadPool(threadPoolName);
    if (threadPool == null)
        throw CONFIG.undefinedThreadPoolName(threadPoolName);
    ThreadPoolConfiguration threadPoolConfiguration = threadPool.asThreadPoolConfigurationBuilder();
    boolean isNonBlocking = threadPoolConfiguration.threadPoolFactory().createsNonBlockingThreads();
    if (NON_BLOCKING_EXECUTOR.equals(componentName) && !isNonBlocking) {
        throw CONFIG.threadPoolFactoryIsBlocking(threadPoolName, componentName);
    }
    DefaultThreadFactory threadFactory = threadPoolConfiguration.threadFactory();
    if (threadFactory != null) {
        threadFactory.setComponent(shortened(componentName));
    }
    return threadPoolConfiguration;
}
Also used : DefaultThreadFactory(org.infinispan.factories.threads.DefaultThreadFactory) ThreadPoolConfiguration(org.infinispan.configuration.global.ThreadPoolConfiguration) ThreadsConfigurationBuilder(org.infinispan.configuration.global.ThreadsConfigurationBuilder) ThreadPoolBuilderAdapter(org.infinispan.configuration.global.ThreadPoolBuilderAdapter)

Aggregations

ThreadPoolBuilderAdapter (org.infinispan.configuration.global.ThreadPoolBuilderAdapter)1 ThreadPoolConfiguration (org.infinispan.configuration.global.ThreadPoolConfiguration)1 ThreadsConfigurationBuilder (org.infinispan.configuration.global.ThreadsConfigurationBuilder)1 DefaultThreadFactory (org.infinispan.factories.threads.DefaultThreadFactory)1