Added TIMEOUT
property to adjust how long to wait for the event
dispatch queue to complete.
This commit is contained in:
parent
6fdbe8ac83
commit
62740a0d5a
|
@ -53,6 +53,10 @@ GnomeShellExtension.SHELL_RESTART_COMMAND (type String, default value 'gnome-s
|
||||||
- Command to restart the gnome-shell. It is recommended to start it in the background (hence '&')
|
- Command to restart the gnome-shell. It is recommended to start it in the background (hence '&')
|
||||||
|
|
||||||
|
|
||||||
|
SystemTray.TIMEOUT (type int, default value '2')
|
||||||
|
- How long to wait when updating menu entries before the request times-out
|
||||||
|
|
||||||
|
|
||||||
SystemTray.TRAY_SIZE (type int, default value '22')
|
SystemTray.TRAY_SIZE (type int, default value '22')
|
||||||
- Size of the tray, so that the icon can properly scale based on OS. (if it's not exact)
|
- Size of the tray, so that the icon can properly scale based on OS. (if it's not exact)
|
||||||
|
|
||||||
|
@ -147,7 +151,7 @@ This project is **kept in sync** with the utilities library, so "jar hell" is no
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dorkbox</groupId>
|
<groupId>com.dorkbox</groupId>
|
||||||
<artifactId>SystemTray</artifactId>
|
<artifactId>SystemTray</artifactId>
|
||||||
<version>2.14</version>
|
<version>2.15</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,10 @@ public abstract
|
||||||
class SystemTray {
|
class SystemTray {
|
||||||
protected static final Logger logger = LoggerFactory.getLogger(SystemTray.class);
|
protected static final Logger logger = LoggerFactory.getLogger(SystemTray.class);
|
||||||
|
|
||||||
|
@Property
|
||||||
|
/** How long to wait when updating menu entries before the request times-out */
|
||||||
|
public static final int TIMEOUT = 2;
|
||||||
|
|
||||||
@Property
|
@Property
|
||||||
/** Size of the tray, so that the icon can properly scale based on OS. (if it's not exact) */
|
/** Size of the tray, so that the icon can properly scale based on OS. (if it's not exact) */
|
||||||
public static int TRAY_SIZE = 22;
|
public static int TRAY_SIZE = 22;
|
||||||
|
@ -255,10 +259,6 @@ class SystemTray {
|
||||||
//noinspection unused
|
//noinspection unused
|
||||||
final AppIndicator instance = AppIndicator.INSTANCE;
|
final AppIndicator instance = AppIndicator.INSTANCE;
|
||||||
trayType = AppIndicatorTray.class;
|
trayType = AppIndicatorTray.class;
|
||||||
|
|
||||||
if (AppIndicator.IS_VERSION_3) {
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("AppIndicator support detected, but unable to load the library. Falling back to GTK");
|
logger.error("AppIndicator support detected, but unable to load the library. Falling back to GTK");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -267,7 +267,10 @@ class SystemTray {
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (bin != null) {
|
if (bin != null) {
|
||||||
bin.close();
|
try {
|
||||||
|
bin.close();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
bin = null;
|
bin = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,7 +414,7 @@ class SystemTray {
|
||||||
*/
|
*/
|
||||||
public static
|
public static
|
||||||
String getVersion() {
|
String getVersion() {
|
||||||
return "2.14";
|
return "2.15";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -531,6 +534,7 @@ class SystemTray {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public
|
public
|
||||||
void setIcon(InputStream imageStream) {
|
void setIcon(InputStream imageStream) {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
final String fullPath = ImageUtil.iconPathNoCache(imageStream);
|
final String fullPath = ImageUtil.iconPathNoCache(imageStream);
|
||||||
setIcon_(fullPath);
|
setIcon_(fullPath);
|
||||||
}
|
}
|
||||||
|
@ -625,7 +629,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -666,7 +674,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -708,7 +720,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -749,7 +765,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -794,7 +814,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -835,7 +859,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -879,7 +907,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -931,7 +963,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -978,7 +1014,11 @@ class SystemTray {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final boolean await = countDownLatch.await(2, TimeUnit.SECONDS);
|
if (!countDownLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user