當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。