package cn.com.poc.common.pool;

import cn.com.yict.framemax.core.exception.BusinessException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 公共线程池，任务异常处理
 *
 * @author alex.yao
 * @date 2026/1/15
 */
public class CommonThreadPoolExceptionHandler implements Thread.UncaughtExceptionHandler {

    private static final Logger logger = LoggerFactory.getLogger(CommonThreadPoolExceptionHandler.class);

    @Override
    public void uncaughtException(Thread t, Throwable e) {
        logger.error("线程：{} , 线程池任务执行异常: {}", t.getName(), e.getMessage(), e);
        throw new BusinessException(e.getMessage());
    }
}
