记录操作日志或则发送邮件等功能,可以通过异步调用的方式,不影响主程序的执行

ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(() -> {
// 这里写需要异步调用的代码,比如异步记录操作日志或者发送邮件等功能。
});
posted @ 2024-04-11 09:29  勇敢-的心  阅读(2)  评论(0编辑  收藏  举报