src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt
@@ -1,6 +1,5 @@ package cn.flightfeather.supervision.common.executor import org.springframework.scheduling.annotation.Async import java.time.LocalDateTime import java.util.concurrent.Future @@ -22,8 +21,13 @@ } fun execute() { try { val res = task() if (res) success() else fail() } catch (e: Exception) { fail() taskStatus.extra = e.message } } fun success() { @@ -39,9 +43,9 @@ fun shutdown() { if (future?.isCancelled == false && !future!!.isDone) { future!!.cancel(true) } taskStatus.status = TaskStatus.SHUTDOWN complete() } } fun complete() {