Java Code Examples for org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer#registerCallableInterceptors()

The following examples show how to use org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer#registerCallableInterceptors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AsyncConfiguration.java    From download-using-streaming-response-body with MIT License 5 votes vote down vote up
/** Configure async support for Spring MVC. */
@Bean
public WebMvcConfigurer webMvcConfigurerConfigurer(AsyncTaskExecutor taskExecutor, CallableProcessingInterceptor callableProcessingInterceptor) {
    return new WebMvcConfigurer() {
        @Override
        public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
            configurer.setDefaultTimeout(360000).setTaskExecutor(taskExecutor);
            configurer.registerCallableInterceptors(callableProcessingInterceptor);
            WebMvcConfigurer.super.configureAsyncSupport(configurer);
        }
    };
}
 
Example 2
Source File: WebConfigration.java    From FATE-Serving with Apache License 2.0 5 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(coreSize>0?coreSize:processors);
    executor.setMaxPoolSize(maxSize>0?maxSize:2*processors);
    executor.setThreadNamePrefix("ProxyAsync");
    executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
    executor.initialize();
    configurer.setTaskExecutor(executor);
    configurer.setDefaultTimeout(timeout);
    configurer.registerCallableInterceptors(new TimeoutCallableProcessingInterceptor());
}
 
Example 3
Source File: WebMvcConfig.java    From BlogManagePlatform with Apache License 2.0 5 votes vote down vote up
/**
 * 配置异步
 * @author Frodez
 * @date 2019-05-10
 */
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	configurer.setTaskExecutor(asyncConfig.getAsyncExecutor());
	configurer.setDefaultTimeout(asyncConfig.getProperties().getTimeout());
	configurer.registerCallableInterceptors(new TimeoutCallableProcessingInterceptor());
	configurer.registerDeferredResultInterceptors(new TimeoutDeferredResultProcessingInterceptor());
}
 
Example 4
Source File: AsyncControllerJavaConfigTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	configurer.registerCallableInterceptors(callableInterceptor());
}
 
Example 5
Source File: AsyncControllerJavaConfigTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	configurer.registerCallableInterceptors(callableInterceptor());
}
 
Example 6
Source File: SystemConfig.java    From redis-manager with Apache License 2.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
    configurer.setDefaultTimeout(FIVE_MINUTES);
    configurer.registerCallableInterceptors(timeoutInterceptor());
}
 
Example 7
Source File: AsyncControllerJavaConfigTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	configurer.registerCallableInterceptors(callableInterceptor());
}
 
Example 8
Source File: WebConfig.java    From nakadi with MIT License 4 votes vote down vote up
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
    configurer.setDefaultTimeout(nakadiStreamTimeout);
    configurer.registerCallableInterceptors(timeoutInterceptor());
}