当前位置: 首页>>代码示例>>Java>>正文


Java AsyncUncaughtExceptionHandler类代码示例

本文整理汇总了Java中org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler的典型用法代码示例。如果您正苦于以下问题:Java AsyncUncaughtExceptionHandler类的具体用法?Java AsyncUncaughtExceptionHandler怎么用?Java AsyncUncaughtExceptionHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AsyncUncaughtExceptionHandler类属于org.springframework.aop.interceptor包,在下文中一共展示了AsyncUncaughtExceptionHandler类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
	return (Throwable ex, Method method, Object... params) -> {
		String errorBuilder = "Async execution error on method:" + method.toString() + " with parameters:"
				+ Arrays.toString(params);
		log.error(errorBuilder);
	};
}
 
开发者ID:shilongdai,项目名称:LSChatServer,代码行数:9,代码来源:ApplicationRootContext.java

示例2: AsyncAnnotationAdvisor

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
/**
 * Create a new {@code AsyncAnnotationAdvisor} for the given task executor.
 * @param executor the task executor to use for asynchronous methods
 * (can be {@code null} to trigger default executor resolution)
 * @param exceptionHandler the {@link AsyncUncaughtExceptionHandler} to use to
 * handle unexpected exception thrown by asynchronous method executions
 * @see AnnotationAsyncExecutionInterceptor#getDefaultExecutor(BeanFactory)
 */
@SuppressWarnings("unchecked")
public AsyncAnnotationAdvisor(Executor executor, AsyncUncaughtExceptionHandler exceptionHandler) {
	Set<Class<? extends Annotation>> asyncAnnotationTypes = new LinkedHashSet<Class<? extends Annotation>>(2);
	asyncAnnotationTypes.add(Async.class);
	try {
		asyncAnnotationTypes.add((Class<? extends Annotation>)
				ClassUtils.forName("javax.ejb.Asynchronous", AsyncAnnotationAdvisor.class.getClassLoader()));
	}
	catch (ClassNotFoundException ex) {
		// If EJB 3.1 API not present, simply ignore.
	}
	if (exceptionHandler != null) {
		this.exceptionHandler = exceptionHandler;
	}
	else {
		this.exceptionHandler = new SimpleAsyncUncaughtExceptionHandler();
	}
	this.advice = buildAdvice(executor, this.exceptionHandler);
	this.pointcut = buildPointcut(asyncAnnotationTypes);
}
 
开发者ID:txazo,项目名称:spring,代码行数:29,代码来源:AsyncAnnotationAdvisor.java

示例3: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Bean
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
    AsyncUncaughtExceptionHandler asyncUncaughtExceptionHandler = (ex, method, params) -> {
        Logger log = LoggerFactory.getLogger(AsyncUncaughtExceptionHandler.class);

        log.error("Async Exception**************************************************************");
        log.error("method happen: {}", method);
        log.error("method params: {}", params);
        log.error("Exception class: {}", ex.getClass().getName());
        log.error("ex.getMessage(): {}", ex.getMessage());
        log.error("**************************************************************");
    };
    return asyncUncaughtExceptionHandler;
}
 
开发者ID:finefuture,项目名称:data-migration,代码行数:15,代码来源:TaskExecutorConfiguration.java

示例4: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
	return new AsyncUncaughtExceptionHandler() {

		@Override
		public void handleUncaughtException(Throwable ex, Method method, Object... params) {
			StringBuilder errorBuilder = new StringBuilder("Async execution error on method:")
					.append(method.toString()).append(" with parameters:").append(Arrays.toString(params));
			log.error(errorBuilder.toString());
		}
	};
}
 
开发者ID:shilongdai,项目名称:bookManager,代码行数:13,代码来源:RootApplicationContextConfig.java

示例5: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
    return new AsyncUncaughtExceptionHandler() {
        @Override
        public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
            logger.error(SpringConf.class.getName(), throwable);
        }
    };
}
 
开发者ID:darkfireworld,项目名称:java-fast-framework,代码行数:10,代码来源:SpringConf.java

示例6: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler()
{
    // In case any @Async methods return "void" and not a "Future", this exception handler will handle those cases since the caller has not way to access
    // the exception without a "Future". Just use an out-of-the-box Spring handler that logs those exceptions.
    return new SimpleAsyncUncaughtExceptionHandler();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:8,代码来源:CoreSpringModuleConfig.java

示例7: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
	return (throwable, method, objects) -> logger.error("Exception thrown in @Async Method " + method.getName(),
			throwable);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:6,代码来源:SkipperServerConfiguration.java

示例8: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
    return new SimpleAsyncUncaughtExceptionHandler();
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:5,代码来源:AsyncConfiguration.java

示例9: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
    return new ExceptionHandler();
}
 
开发者ID:jython234,项目名称:nectar-server,代码行数:5,代码来源:AsyncConfig.java

示例10: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
    return null;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:5,代码来源:AsyncConfiguration.java

示例11: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
	return new AsyncExceptionHandler();
}
 
开发者ID:italia,项目名称:daf-replicate-ingestion,代码行数:5,代码来源:AsyncConfig.java

示例12: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
  return new CustomAsyncExceptionHandler();
}
 
开发者ID:stefanstaniAIM,项目名称:IPPR2016,代码行数:5,代码来源:SpringAsyncConfig.java

示例13: getAsyncUncaughtExceptionHandler

import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; //导入依赖的package包/类
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
    return new AsyncExceptionHandler();
}
 
开发者ID:TulevaEE,项目名称:onboarding-service,代码行数:5,代码来源:AsyncConfiguration.java


注:本文中的org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。