| | |
| | | package cn.flightfeather.supervision.common.executor |
| | | |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.socket.WebSocketSendMessageUtil |
| | | import org.springframework.stereotype.Component |
| | | import java.util.concurrent.ConcurrentHashMap |
| | | import java.util.concurrent.Executors |
| | |
| | | throw BizException("无法重复创建任务") |
| | | } |
| | | } |
| | | val t = BgTask(type, id, name, task) |
| | | val t = BgTask(type, id, name, task) { status -> |
| | | // 发送消息 |
| | | WebSocketSendMessageUtil.sendBgTaskMessage(status) |
| | | } |
| | | taskSet[id] = t |
| | | return t |
| | | } |
| | |
| | | } |
| | | } else { |
| | | task.ready() |
| | | task.future = executorService.submit { task.execute() } |
| | | task.future = executorService.submit { |
| | | task.execute() |
| | | } |
| | | return task |
| | | } |
| | | } |