mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-24 00:29:52 +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();
|
protected abstract String[] getPathsToWatch();
|
||||||
|
|
||||||
final private static Throwable loadError = tryLoad();
|
private static boolean triedLoad = false;
|
||||||
|
private static Throwable loadError = null;
|
||||||
|
|
||||||
private static Throwable tryLoad() {
|
private static Throwable tryLoad() {
|
||||||
try {
|
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) {
|
if (loadError != null) {
|
||||||
throw new IOException("JNotify not loaded", loadError);
|
throw new IOException("JNotify not loaded", loadError);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user