org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer Java Examples

The following examples show how to use org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer. 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: BootMvcConfigurerAdapter.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer){
	if(asyncTaskExecutor!=null){
		configurer.setTaskExecutor(asyncTaskExecutor);
	}
	if(mvcAsyncProperties!=null){
		configurer.setDefaultTimeout(mvcAsyncProperties.getTimeout());
	}
}
 
Example #2
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 #3
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 #4
Source File: SpringMvcWebConfig.java    From Hands-On-High-Performance-with-Spring-5 with MIT License 5 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	ThreadPoolTaskExecutor t = new ThreadPoolTaskExecutor();
       t.setCorePoolSize(10);
       t.setMaxPoolSize(100);
       t.setThreadNamePrefix("BankAccountSync");
       t.initialize();
       configurer.setTaskExecutor(t);
}
 
Example #5
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 #6
Source File: DvAutoConfiguration.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Bean
protected WebMvcConfigurer webMvcConfigurer() {
    return new WebMvcConfigurer() {
        @Override
        @SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // false positive
        public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
            configurer.setTaskExecutor(getAsyncExecutor());
        }
    };
}
 
Example #7
Source File: MolgenisWebAppConfig.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
  configurer.setDefaultTimeout(60L * 1000L);
  configurer.setTaskExecutor(asyncTaskExecutor());
}
 
Example #8
Source File: StandaloneMockMvcBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	if (asyncRequestTimeout != null) {
		configurer.setDefaultTimeout(asyncRequestTimeout);
	}
}
 
Example #9
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());
}
 
Example #10
Source File: WebConfig.java    From nio-multipart with Apache License 2.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
    configurer.registerDeferredResultInterceptors(new ReadListenerDeferredResultProcessingInterceptor());
}
 
Example #11
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 #12
Source File: StandaloneMockMvcBuilder.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	if (asyncRequestTimeout != null) {
		configurer.setDefaultTimeout(asyncRequestTimeout);
	}
}
 
Example #13
Source File: WebConfiguration.java    From servicecomb-pack with Apache License 2.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer asyncSupportConfigurer) {
  //compatible with spring-webmvc 4.x from spring boot 1.x
}
 
Example #14
Source File: AppConfig.java    From spring-boot-ddd with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
    configurer.setTaskExecutor(appExecutor());
}
 
Example #15
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 #16
Source File: FilterRegister.java    From jfilter with Apache License 2.0 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
    // Do nothing
}
 
Example #17
Source File: ScmWebMvcConfigurer.java    From super-cloudops with Apache License 2.0 4 votes vote down vote up
/**
 * Configure asynchronous support, set up a work-threads pool for
 * asynchronous execution of business logic, and set the default timeout
 * time to 60 seconds
 */
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	configurer.setTaskExecutor(executor);
	configurer.setDefaultTimeout(config.getLongPollTimeout());
}
 
Example #18
Source File: SpringBootAdminServer.java    From Cleanstone with MIT License 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
    configurer.setTaskExecutor(new ConcurrentTaskExecutor(Executors.newFixedThreadPool(5)));
}
 
Example #19
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 #20
Source File: StandaloneMockMvcBuilder.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
	if (asyncRequestTimeout != null) {
		configurer.setDefaultTimeout(asyncRequestTimeout);
	}
}
 
Example #21
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 #22
Source File: Pulsar.java    From Milkomeda with MIT License 3 votes vote down vote up
/**
 * 自定义配置的异步支持
 *
 * @param configurer       配置对象
 * @param corePoolSize     核心池大小
 * @param maxPoolSize      最大线程池数
 * @param queueCapacity    队列容量
 * @param keepAliveSeconds 线程保存存活时间
 * @param timeout          超时时间,ms
 * @deprecated since 1.16.0,因为SpringBoot 2.1.0版本开始默认已装配
 */
public void configure(AsyncSupportConfigurer configurer, int corePoolSize, int maxPoolSize, int queueCapacity, int keepAliveSeconds, long timeout) {
    // 默认超时时间
    configurer.setDefaultTimeout(timeout);
    ThreadUtil.configTaskExecutor(applicationTaskExecutor, "pulsar-", corePoolSize, maxPoolSize, queueCapacity, keepAliveSeconds);
    configurer.setTaskExecutor(applicationTaskExecutor);
}
 
Example #23
Source File: Pulsar.java    From Milkomeda with MIT License 2 votes vote down vote up
/**
 * 配置默认的Spring MVC异步支持
 *
 * @param configurer 配置对象
 * @param timeout    超时时间,ms
 * @deprecated since 1.16.0,因为SpringBoot 2.1.0版本开始默认已装配
 */
public void configure(AsyncSupportConfigurer configurer, long timeout) {
    configure(configurer, 5, 10, 200, 100, timeout);
}