use of org.commonjava.indy.boot.BootInterface in project indy by Commonjava.
the class JaxRsBooter method main.
public static void main(final String[] args) {
Thread.currentThread().setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(final Thread thread, final Throwable error) {
if (error instanceof InvocationTargetException) {
final InvocationTargetException ite = (InvocationTargetException) error;
System.err.println("In: " + thread.getName() + "(" + thread.getId() + "), caught InvocationTargetException:");
ite.getTargetException().printStackTrace();
System.err.println("...via:");
error.printStackTrace();
} else {
System.err.println("In: " + thread.getName() + "(" + thread.getId() + ") Uncaught error:");
error.printStackTrace();
}
}
});
BootOptions boot;
try {
boot = BootOptions.loadFromSysprops();
} catch (final IndyBootException e) {
System.err.printf("ERROR: %s", e.getMessage());
System.exit(ERR_CANT_LOAD_BOOT_OPTIONS);
return;
}
try {
if (boot.parseArgs(args)) {
try {
final BootInterface booter = new JaxRsBooter();
System.out.println("Starting Indy booter: " + booter);
final int result = booter.runAndWait(boot);
if (result != 0) {
System.exit(result);
}
} catch (final IndyBootException e) {
System.err.printf("ERROR INITIALIZING BOOTER: %s", e.getMessage());
System.exit(ERR_CANT_INIT_BOOTER);
}
}
} catch (final IndyBootException e) {
System.err.printf("ERROR: %s", e.getMessage());
System.exit(ERR_CANT_PARSE_ARGS);
}
}
Aggregations