Spring事件发布
https://blog.youkuaiyun.com/root_zhb/article/details/125633188
开启新的线程
ThreadFactory threadFactory = (new ThreadFactoryBuilder()).setNameFormat("xhcs-roll-back-%d").build();
ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 10, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(1), threadFactory);
//异步处理
executor.execute(()->{
//业务代码
});
new Thread("集团共享线程") {
@Override
public void run() {
//业务代码
}
}.start();
其他资料(非异步)
事务提交后,做其他的事情
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override
public void afterCommit() {
try {
} catch (Exception e) { }
}});
事务回滚,同时记录异常信息
https://blog.youkuaiyun.com/root_zhb/article/details/125996541