use of com.github.mob41.osumer.Config in project osumer by mob41.
the class Main method runUi.
private static void runUi(Configuration config, String[] args, ArgParser ap, IDaemon d) {
IUI ui = null;
try {
// Contact the ui via RMI
ui = (IUI) Naming.lookup("rmi://localhost:46727/ui");
} catch (Exception e) {
}
if (ui == null) {
try {
Runtime.getRuntime().exec("\"" + OsumerNative.getProgramFiles() + "\\osumer2\\osumer-ui.exe\"");
} catch (IOException e) {
e.printStackTrace();
DumpManager.addDump(new DebugDump(null, "Check if \"ui\" is null", "Execute osumer-ui.exe", "Initialize \"c\" as 0", "Could not start UI. Terminating", false, e));
DumpManager.forceMetricsReport();
JOptionPane.showMessageDialog(null, "Could not start UI. For more details, check dump. Terminating:\n" + e, "osumer launcher Error", JOptionPane.ERROR_MESSAGE);
System.exit(-1);
return;
}
int c = 0;
while (c < 20) {
try {
// Contact the ui via RMI
ui = (IUI) Naming.lookup("rmi://localhost:46727/ui");
} catch (Exception e) {
}
try {
Thread.sleep(50);
} catch (InterruptedException e) {
break;
}
c++;
}
}
if (ui == null) {
DumpManager.addDump(new DebugDump(null, "(While-loop) Look up UI RMI", "Check if \\\"ui\\\" is null", "Try to wake up UI", false, "Could not connect to UI. Terminating"));
DumpManager.forceMetricsReport();
JOptionPane.showMessageDialog(null, "Could not connect to UI. For more details, check dump. Terminating", "osumer launcher Error", JOptionPane.ERROR_MESSAGE);
System.exit(-1);
return;
}
try {
ui.wake();
} catch (RemoteException e) {
e.printStackTrace();
DumpManager.addDump(new DebugDump(null, "Check if \\\\\\\"ui\\\\\\\" is null", "Try to wake up UI", "End of runUi()", "Could not connect or wake UI", false, e));
DumpManager.forceMetricsReport();
JOptionPane.showMessageDialog(null, "Could not connect or wake UI. For more details, check dump:\n" + e, "osumer launcher Error", JOptionPane.ERROR_MESSAGE);
System.exit(-1);
return;
}
}
Aggregations