A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Java NativeLib: delete temporary files ASAP.
[simgrid.git]
/
src
/
bindings
/
java
/
org
/
simgrid
/
NativeLib.java
diff --git
a/src/bindings/java/org/simgrid/NativeLib.java
b/src/bindings/java/org/simgrid/NativeLib.java
index
5d2b646
..
507a2cb
100644
(file)
--- a/
src/bindings/java/org/simgrid/NativeLib.java
+++ b/
src/bindings/java/org/simgrid/NativeLib.java
@@
-48,6
+48,12
@@
public final class NativeLib {
NativeLib.nativeInit("simgrid");
NativeLib.nativeInit("simgrid-java");
isNativeInited = true;
NativeLib.nativeInit("simgrid");
NativeLib.nativeInit("simgrid-java");
isNativeInited = true;
+
+ /* Don't leak the files on disk */
+ if (tempDir != null) {
+ FileCleaner fclean = new FileCleaner(tempDir.toFile());
+ fclean.run();
+ }
}
/** Helper function trying to load one requested library */
}
/** Helper function trying to load one requested library */
@@
-108,8
+114,6
@@
public final class NativeLib {
}
tempDir = Files.createTempDirectory(tempPrefix);
}
tempDir = Files.createTempDirectory(tempPrefix);
- // don't leak the files on disk, but remove it on JVM shutdown
- Runtime.getRuntime().addShutdownHook(new Thread(new FileCleaner(tempDir.toFile())));
}
/* For each possible filename of the given library on all possible OSes, try it */
}
/* For each possible filename of the given library on all possible OSes, try it */