| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // Source code recreated from a .class file by IntelliJ IDEA
- // (powered by Fernflower decompiler)
- //
- package com.gct.tools.etlcamelhuge.camelconfig;
- import java.lang.reflect.Method;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.core.task.AsyncTaskExecutor;
- import org.springframework.scheduling.annotation.AsyncConfigurer;
- import org.springframework.scheduling.annotation.EnableAsync;
- import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
- @Configuration
- @EnableAsync
- public class AsyncConfiguration implements AsyncConfigurer {
- public AsyncConfiguration() {
- }
- @Bean
- public AsyncTaskExecutor asyncTaskExecutor() {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setCorePoolSize(8);
- executor.setMaxPoolSize(8);
- return executor;
- }
- public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
- return new LogAsyncUncaughtExceptionHandler();
- }
- class LogAsyncUncaughtExceptionHandler implements AsyncUncaughtExceptionHandler {
- LogAsyncUncaughtExceptionHandler() {
- }
- public void handleUncaughtException(Throwable ex, Method method, Object... params) {
- String paramLog = "";
- int i = 0;
- for(Object param : params) {
- paramLog = paramLog + "param:" + i + "=>" + param.toString() + " ";
- }
- Logger log = LoggerFactory.getLogger(this.getClass());
- log.error("Method:{} run error,Exception Message:{},StackTrace:{},input params:{}", new Object[]{method.getName(), ex.getMessage(), ex.getStackTrace(), paramLog});
- }
- }
- }
|