648540858
2023-08-03 a01086fe1c0accccf8ee5f98e601a6b14f0cf152
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.conf;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
@@ -45,7 +46,6 @@
     * @return
     */
    public void startCron(String key, Runnable task, int cycleForCatalog) {
        System.out.println(cycleForCatalog);
        ScheduledFuture<?> future = futureMap.get(key);
        if (future != null) {
            if (future.isCancelled()) {
@@ -101,7 +101,7 @@
    public boolean stop(String key) {
        boolean result = false;
        if (futureMap.get(key) != null && !futureMap.get(key).isCancelled() && !futureMap.get(key).isDone()) {
        if (!ObjectUtils.isEmpty(futureMap.get(key)) && !futureMap.get(key).isCancelled() && !futureMap.get(key).isDone()) {
            result = futureMap.get(key).cancel(false);
            futureMap.remove(key);
            runnableMap.remove(key);