org.rzo.yajsw.app.AbstractWrapperJVMMain Maven / Gradle / Ivy
package org.rzo.yajsw.app;
import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;
public abstract class AbstractWrapperJVMMain
{
/** The WRAPPE r_ manager. */
public static WrapperManager WRAPPER_MANAGER;
public static Throwable exception = null;
// call java logger, so that it inits before groovy & co
//private static Logger dummy = Logger.getAnonymousLogger();
static class YajswUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
public void uncaughtException(Thread t, Throwable e) {
System.err.println ("Uncaught exception by " + t + ":");
System.err.println(e.getClass().getName()+":"+e.getMessage());
e.printStackTrace();
}
}
protected static void postExecute()
{
int exitCode;
if (exception == null)
exitCode = WRAPPER_MANAGER.getExitOnMainTerminate();
else
exitCode = WRAPPER_MANAGER.getExitOnException();
if (exitCode >= 0)
System.exit(exitCode);
}
protected static void preExecute(String[] args)
{
final String[] finalArgs = args;
WRAPPER_MANAGER = (WrapperManager) AccessController.doPrivileged(new PrivilegedAction
© 2015 - 2025 Weber Informatics LLC | Privacy Policy