package com.sunzee.utils;


import com.hboxs.serialport.SerialPortSendQueue;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ScheduledFuture;

public class TimerUtil {
    /**
     * 关闭定时器
     *
     * @param timer
     * @param task
     */
    public static void stopTimerAndTimerTask(Timer timer, TimerTask task) {
        SerialPortSendQueue.clear();
        if (timer != null) {

//            timer.purge();
            timer.cancel();

            timer = null;
        }
        if (task != null) {
            task.cancel();
            task = null;
        }
    }




}
