Example usage for org.springframework.integration.context IntegrationProperties TASK_SCHEDULER_POOL_SIZE

List of usage examples for org.springframework.integration.context IntegrationProperties TASK_SCHEDULER_POOL_SIZE

Introduction

In this page you can find the example usage for org.springframework.integration.context IntegrationProperties TASK_SCHEDULER_POOL_SIZE.

Prototype

String TASK_SCHEDULER_POOL_SIZE

To view the source code for org.springframework.integration.context IntegrationProperties TASK_SCHEDULER_POOL_SIZE.

Click Source Link

Document

Specifies the value of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler#poolSize for the taskScheduler bean initialized by the Integration infrastructure.

Usage

From source file:org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor.java

/**
 * Register a TaskScheduler in the given BeanDefinitionRegistry.
 */// w w  w . ja va2 s .c om
private void registerTaskScheduler(BeanDefinitionRegistry registry) {
    if (this.logger.isInfoEnabled()) {
        this.logger.info("No bean named '" + IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME
                + "' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.");
    }
    BeanDefinition scheduler = BeanDefinitionBuilder.genericBeanDefinition(ThreadPoolTaskScheduler.class)
            .addPropertyValue("poolSize",
                    IntegrationProperties.getExpressionFor(IntegrationProperties.TASK_SCHEDULER_POOL_SIZE))
            .addPropertyValue("threadNamePrefix", "task-scheduler-")
            .addPropertyValue("rejectedExecutionHandler", new CallerRunsPolicy())
            .addPropertyValue("errorHandler", new RootBeanDefinition(MessagePublishingErrorHandler.class))
            .getBeanDefinition();

    registry.registerBeanDefinition(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME, scheduler);
}