package org.argeo.slc.runtime;
+import java.lang.System.Logger.Level;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import javax.security.auth.Subject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionModulesManager;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.ExecutionStep;
-import org.argeo.slc.execution.RealizedFlow;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionModulesManager;
+import org.argeo.api.slc.execution.ExecutionProcess;
+import org.argeo.api.slc.execution.ExecutionStep;
+import org.argeo.api.slc.execution.RealizedFlow;
/**
* Main thread coordinating an {@link ExecutionProcess}, launching parallel or
* sequential {@link ExecutionThread}s.
*/
public class ProcessThread extends Thread {
- private final static Log log = LogFactory.getLog(ProcessThread.class);
+ private final static System.Logger logger = System.getLogger(ProcessThread.class.getName());
private final ExecutionModulesManager executionModulesManager;
private final ExecutionProcess process;
// throw new SlcException("Can only execute authenticated threads");
// SecurityContextHolder.getContext().setAuthentication(authentication);
- log.info("\n##\n## SLC Process #" + process.getUuid() + " STARTED\n##\n");
+ logger.log(Level.INFO, "\n##\n## SLC Process #" + process.getUuid() + " STARTED\n##\n");
// Start logging
new LoggingThread().start();
return;
} catch (Exception e) {
String msg = "Process " + getProcess().getUuid() + " failed unexpectedly.";
- log.error(msg, e);
+ logger.log(Level.ERROR, msg, e);
getProcessThreadGroup()
.dispatchAddStep(new ExecutionStep("Process", ExecutionStep.ERROR, msg + " " + e.getMessage()));
}
process.setStatus(ExecutionProcess.COMPLETED);
// executionModulesManager.dispatchUpdateStatus(process, oldStatus,
// process.getStatus());
- log.info("\n## SLC Process #" + process.getUuid() + " " + process.getStatus() + "\n");
+ logger.log(Level.INFO, "\n## SLC Process #" + process.getUuid() + " " + process.getStatus() + "\n");
}
/** Called when being killed */
try {
executionThread.interrupt();
} catch (Exception e) {
- log.error("Cannot interrupt " + executionThread);
+ logger.log(Level.ERROR, "Cannot interrupt " + executionThread);
}
}
processThreadGroup.interrupt();
}
}
- /** @return the (distinct) thread used for this execution */
protected final void execute(RealizedFlow realizedFlow, Boolean synchronous) throws InterruptedException {
if (killed)
return;