Updated dispatchAndWait, updated exceptions, update gtkUpdateThread
This commit is contained in:
parent
6cce5cd1cb
commit
022e3e1036
@ -214,6 +214,7 @@ class Gtk {
|
|||||||
// gdk_threads_leave(); would be needed for g_idle_add()
|
// gdk_threads_leave(); would be needed for g_idle_add()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
gtkUpdateThread.setDaemon(false); // explicitly NOT daemon so that this will hold the JVM open as necessary
|
||||||
gtkUpdateThread.setName("GTK Native Event Loop");
|
gtkUpdateThread.setName("GTK Native Event Loop");
|
||||||
gtkUpdateThread.start();
|
gtkUpdateThread.start();
|
||||||
}
|
}
|
||||||
@ -252,7 +253,7 @@ class Gtk {
|
|||||||
if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) {
|
if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.",
|
SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.",
|
||||||
new Exception());
|
new Exception(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -276,7 +277,7 @@ class Gtk {
|
|||||||
if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) {
|
if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.",
|
SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.",
|
||||||
new Exception());
|
new Exception(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -299,7 +300,7 @@ class Gtk {
|
|||||||
if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) {
|
if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.",
|
SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.",
|
||||||
new Exception());
|
new Exception(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -374,7 +375,10 @@ class Gtk {
|
|||||||
|
|
||||||
public static
|
public static
|
||||||
void dispatchAndWait(final Runnable runnable) {
|
void dispatchAndWait(final Runnable runnable) {
|
||||||
|
if (isDispatch.get()) {
|
||||||
|
// Run directly on the dispatch thread (should not "redispatch" this again)
|
||||||
|
runnable.run();
|
||||||
|
} else {
|
||||||
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
Gtk.dispatch(new Runnable() {
|
Gtk.dispatch(new Runnable() {
|
||||||
@ -396,14 +400,15 @@ class Gtk {
|
|||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.error("Something is very wrong. The Event Dispatch Queue took longer than " + TIMEOUT + " seconds " +
|
SystemTray.logger.error("Something is very wrong. The Event Dispatch Queue took longer than " + TIMEOUT + " seconds " +
|
||||||
"to complete. Please adjust `SystemTray.TIMEOUT` to a value which better suites your environment.",
|
"to complete. Please adjust `SystemTray.TIMEOUT` to a value which better suites your environment.",
|
||||||
new Exception());
|
new Exception(""));
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Something is very wrong. The Event Dispatch Queue took longer than " + TIMEOUT + " seconds " +
|
throw new RuntimeException("Something is very wrong. The Event Dispatch Queue took longer than " + TIMEOUT + " seconds " +
|
||||||
"to complete. Please adjust `SystemTray.TIMEOUT` to a value which better suites your environment.");
|
"to complete. Please adjust `SystemTray.TIMEOUT` to a value which better suites your environment.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
SystemTray.logger.error("Error waiting for dispatch to complete.", new Exception());
|
SystemTray.logger.error("Error waiting for dispatch to complete.", new Exception(""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user