/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package salidasautomaticas.schedule;

import java.util.Timer;
import java.util.TimerTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import salidasautomaticas.main.Main;
import salidasautomaticas.services.SalidasServices;

/**
 *
 * @author sistem19user
 */
public class ActualizarSalidaTask extends TimerTask {
    private static final Logger log = LogManager.getLogger(Main.class);

    SalidasServices services = new SalidasServices();
    private Timer timer;
    private String horaSalida;

    public ActualizarSalidaTask(Timer timer, String horaSalida) {
        this.timer = timer;
        this.horaSalida = horaSalida;
    }

    @Override
    public void run() {
        log.trace("Ejecutando salida " + horaSalida);
        services.actualizarSalidas(horaSalida);
        log.info("Se generaron salidas");
        

        log.trace("Matando timer");
        timer.cancel();
    }

}
