mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
lazily load JNotify to avoid bloating the guice initialization
This commit is contained in:
@@ -19,7 +19,8 @@ JNotifyListener {
|
||||
|
||||
protected abstract String[] getPathsToWatch();
|
||||
|
||||
final private static Throwable loadError = tryLoad();
|
||||
private static boolean triedLoad = false;
|
||||
private static Throwable loadError = null;
|
||||
|
||||
private static Throwable tryLoad() {
|
||||
try {
|
||||
@@ -32,7 +33,11 @@ JNotifyListener {
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkEnabled() throws IOException {
|
||||
public static synchronized void checkEnabled() throws IOException {
|
||||
if (!triedLoad) {
|
||||
loadError = tryLoad();
|
||||
triedLoad = true;
|
||||
}
|
||||
if (loadError != null) {
|
||||
throw new IOException("JNotify not loaded", loadError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user