| | |
| | | package com.panzhihua.auth.manager; |
| | | |
| | | import com.panzhihua.common.utlis.SpringUtils; |
| | | import com.panzhihua.common.utlis.Threads; |
| | | |
| | | import java.util.TimerTask; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import com.panzhihua.common.utlis.SpringUtils; |
| | | import com.panzhihua.common.utlis.Threads; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | **/ |
| | | public class AsyncManagerNew { |
| | | |
| | | private static AsyncManagerNew me = new AsyncManagerNew(); |
| | | /** |
| | | * 操作延迟10毫秒 |
| | | */ |
| | | private final int OPERATE_DELAY_TIME = 10; |
| | | |
| | | /** |
| | | * 异步操作任务调度线程池 |
| | | */ |
| | |
| | | */ |
| | | private AsyncManagerNew(){} |
| | | |
| | | private static AsyncManagerNew me = new AsyncManagerNew(); |
| | | |
| | | public static AsyncManagerNew me() |
| | | { |
| | | public static AsyncManagerNew me() { |
| | | return me; |
| | | } |
| | | |
| | | /** |
| | | * 执行任务 |
| | | * |
| | | * @param task 任务 |
| | | * @param task |
| | | * 任务 |
| | | */ |
| | | public void execute(TimerTask task) |
| | | { |
| | | public void execute(TimerTask task) { |
| | | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 停止任务线程池 |
| | | */ |
| | | public void shutdown() |
| | | { |
| | | public void shutdown() { |
| | | Threads.shutdownAndAwaitTermination(executor); |
| | | } |
| | | } |