Skip to content

Commit e0b9606

Browse files
Add property to get JNIUtils to delete on exit rather than immediately. (#138)
1 parent 1473517 commit e0b9606

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/jitsi/utils/JNIUtils.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
*/
3232
public final class JNIUtils
3333
{
34+
/** Set this property to get JNIUtils to always delete the libraries when the JVM exits,
35+
* rather than immediately. Useful for debugging.
36+
*/
37+
private static final String DELETE_ON_EXIT_PROPERTY =
38+
"org.jitsi.utils.JniUtils.AlwaysDeleteOnExit";
39+
3440
private static final Logger logger = Logger.getLogger(JNIUtils.class);
3541

3642
public static void loadLibrary(String libname, ClassLoader classLoader)
@@ -105,7 +111,7 @@ private static <T> void loadLibrary(String libname, Class<T> clazz,
105111
if (embedded.getName().startsWith("jna"))
106112
{
107113
// Native.deleteLibrary(String) is (package) internal.
108-
if (!embedded.delete())
114+
if (System.getProperty(DELETE_ON_EXIT_PROPERTY) != null || !embedded.delete())
109115
embedded.deleteOnExit();
110116
}
111117
}

0 commit comments

Comments
 (0)