org.springframework.web.context.request.async.TimeoutCallableProcessingInterceptor Java Examples

The following examples show how to use org.springframework.web.context.request.async.TimeoutCallableProcessingInterceptor. 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 Project: download-using-streaming-response-body   Author: swathisprasad   File: AsyncConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public CallableProcessingInterceptor callableProcessingInterceptor() {
    return new TimeoutCallableProcessingInterceptor() {
        @Override
        public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
            log.error("timeout!");
            return super.handleTimeout(request, task);
        }
    };
}
 
Example #2
Source Project: FATE-Serving   Author: FederatedAI   File: WebConfigration.java    License: 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 Project: BlogManagePlatform   Author: Frodez   File: WebMvcConfig.java    License: 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 Project: FATE-Serving   Author: FederatedAI   File: WebConfigration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public TimeoutCallableProcessingInterceptor timeoutCallableProcessingInterceptor() {
    return new TimeoutCallableProcessingInterceptor();
}
 
Example #5
Source Project: redis-manager   Author: ngbdf   File: SystemConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public TimeoutCallableProcessingInterceptor timeoutInterceptor() {
    return new TimeoutCallableProcessingInterceptor();
}
 
Example #6
Source Project: nakadi   Author: zalando   File: WebConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public TimeoutCallableProcessingInterceptor timeoutInterceptor() {
    return new TimeoutCallableProcessingInterceptor();
}