本文整理汇总了Java中org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer类的典型用法代码示例。如果您正苦于以下问题:Java AsyncSupportConfigurer类的具体用法?Java AsyncSupportConfigurer怎么用?Java AsyncSupportConfigurer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AsyncSupportConfigurer类属于org.springframework.web.servlet.config.annotation包,在下文中一共展示了AsyncSupportConfigurer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(2);
executor.setQueueCapacity(DOWNLOAD_QUEUE_SIZE);
executor.setThreadNamePrefix("AsyncTaskExecutor-");
executor.initialize();
configurer.setTaskExecutor(executor);
}
示例2: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
// initial timeout
configurer.setDefaultTimeout(6000);
configurer.registerDeferredResultInterceptors(new DeferredResultProcessingInterceptorAdapter() {
@Override
public <T> boolean handleTimeout(NativeWebRequest req, DeferredResult<T> result) {
return result.setErrorResult(new DiscoveryAsyncTimeoutException());
}
});
}
示例3: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
configurer.registerDeferredResultInterceptors(
new DeferredResultProcessingInterceptorAdapter() {
@Override
public <T> boolean handleTimeout(final NativeWebRequest request, final DeferredResult<T> result) {
log.error("timeout request...");
result.setErrorResult(new RuntimeException());
return false;
}
});
}
示例4: webMvcConfigurerAdapter
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Bean
public WebMvcConfigurerAdapter webMvcConfigurerAdapter(AsyncTaskExecutor asyncTaskExecutor) {
return new WebMvcConfigurerAdapter() {
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setTaskExecutor(asyncTaskExecutor);
super.configureAsyncSupport(configurer);
}
};
}
示例5: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
Long timeout = this.mvcProperties.getAsync().getRequestTimeout();
if (timeout != null) {
configurer.setDefaultTimeout(timeout);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:WebMvcAutoConfiguration.java
示例6: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer){
if(asyncTaskExecutor!=null){
configurer.setTaskExecutor(asyncTaskExecutor);
}
if(mvcAsyncProperties!=null){
configurer.setDefaultTimeout(mvcAsyncProperties.getTimeout());
}
}
示例7: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
if (asyncRequestTimeout != null) {
configurer.setDefaultTimeout(asyncRequestTimeout);
}
}
示例8: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.registerCallableInterceptors(callableInterceptor());
}
示例9: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setDefaultTimeout(-1);
configurer.setTaskExecutor(asyncTaskExecutor());
}
示例10: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.registerDeferredResultInterceptors(new ReadListenerDeferredResultProcessingInterceptor());
}
示例11: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
configurer.setDefaultTimeout(nakadiStreamTimeout);
configurer.registerCallableInterceptors(timeoutInterceptor());
}
示例12: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setTaskExecutor(getAsyncExecutor());
}
示例13: configureAsyncSupport
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; //导入依赖的package包/类
@Override
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
configurer.setTaskExecutor(new SimpleAsyncTaskExecutor());
}