From d104c7e5103228134f6b2d580198008cf5f7b08d Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 16 Dec 2016 22:40:12 +0100 Subject: [PATCH] Added extra error info when the dispatch queue is buggered up --- src/dorkbox/systemTray/jna/linux/Gtk.java | 30 +++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/dorkbox/systemTray/jna/linux/Gtk.java b/src/dorkbox/systemTray/jna/linux/Gtk.java index ad58b82..5497b48 100644 --- a/src/dorkbox/systemTray/jna/linux/Gtk.java +++ b/src/dorkbox/systemTray/jna/linux/Gtk.java @@ -248,7 +248,12 @@ class Gtk { } } - blockUntilStarted.await(10, TimeUnit.SECONDS); + if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) { + if (SystemTray.DEBUG) { + SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.", + new RuntimeException()); + } + } } catch (InterruptedException e) { e.printStackTrace(); } @@ -267,7 +272,12 @@ class Gtk { } } - blockUntilStarted.await(10, TimeUnit.SECONDS); + if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) { + if (SystemTray.DEBUG) { + SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.", + new RuntimeException()); + } + } } catch (InterruptedException e) { e.printStackTrace(); } @@ -285,7 +295,12 @@ class Gtk { } } - blockUntilStarted.await(10, TimeUnit.SECONDS); + if (!blockUntilStarted.await(10, TimeUnit.SECONDS)) { + if (SystemTray.DEBUG) { + SystemTray.logger.error("Something is very wrong. The waitForStartup took longer than expected.", + new RuntimeException()); + } + } } catch (InterruptedException e) { e.printStackTrace(); } @@ -377,11 +392,12 @@ class Gtk { try { if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) { if (SystemTray.DEBUG) { - SystemTray.logger.error("Event dispatch queue took longer than " + TIMEOUT + " seconds to complete. Please adjust " + - "`SystemTray.TIMEOUT` to a value which better suites your environment."); + 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.", + new RuntimeException()); } else { - throw new RuntimeException("Event dispatch queue took longer than " + TIMEOUT + " seconds to complete. Please adjust " + - "`SystemTray.TIMEOUT` to a value which better suites your environment."); + 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."); } } } catch (InterruptedException e) {