package com.example.iot_controlhost.model.thread;

import com.example.iot_controlhost.base.BaseQueue;
import com.example.iot_controlhost.utils.log.MyLog;

/**
 * 任务队列-IO任务
 */
public class QueueIOTask extends BaseQueue {
    /**
     * 任务内容
     */
    private Runnable task;

    public QueueIOTask(Runnable task) {
        this(3,task);
    }

    public QueueIOTask(int priority, Runnable task) {
        super(priority);
        this.task = task;
    }

    @Override
    public void run() {
        try {
            task.run();
        } catch (Throwable throwable) {
            MyLog.controllerError("控制队列任务异常：异常=" + throwable.getClass().getSimpleName()
                    + "，原因=" + throwable.getMessage());
        }
    }

}
