1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
public class Batch extends Thread {
private static final String CLASSE_NAME = Batch.class.getName();
private static boolean isWorking = false;
public void run() {
if (!isWorking)
executer();
else
IndigoLogger.logInfo(CLASSE_NAME,"run: impossible de lancer le thread car il tourne à ce moment");
}
public void executer() {
isWorking = true;
IndigoLogger.logInfo(CLASSE_NAME,"execute: Batch lancé...");
try {
int i = 0;
while(i<999999999) {
i++;
}
IndigoLogger.logInfo(CLASSE_NAME,"execute: LE traitement du Batch est terminé avec succès");
} catch (Exception e) {
IndigoLogger.logFatal(CLASSE_NAME,"execute: "+e.getMessage());
e.printStackTrace();
}
isWorking = false;
}
public static boolean isWorking() {
return isWorking;
}
public static void setWorking(boolean isWorking) {
Batch_.isWorking = isWorking;
}
} |
Partager