ActualizarSalidaTask.java 1.15 KB
Newer Older
1 2 3 4 5 6 7 8 9
/*
 * 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;
10 11
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
12
import org.json.JSONArray;
13
import org.json.JSONObject;
14
import salidasautomaticas.main.Main;
15 16 17 18 19 20
import salidasautomaticas.services.SalidasServices;

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

24 25 26
    SalidasServices services = new SalidasServices();
    private Timer timer;
    private String horaSalida;
27 28

    public ActualizarSalidaTask(Timer timer, String horaSalida) {
29 30 31
        this.timer = timer;
        this.horaSalida = horaSalida;
    }
32

33 34
    @Override
    public void run() {
35 36 37
        log.trace("Ejecutando salida " + horaSalida);
        services.actualizarSalidas(horaSalida);
        log.info("Se generaron salidas");
38
        
39 40

        log.trace("Matando timer");
41 42
        timer.cancel();
    }
43

44
}