Dolda2000 GitWeb
/
jagi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9c4d8fd
)
Allow updated jagidir modules to be formally disposed.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 10 Nov 2023 16:27:54 +0000
(17:27 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 10 Nov 2023 16:27:54 +0000
(17:27 +0100)
src/jagi/fs/Compiler.java
patch
|
blob
|
blame
|
history
diff --git
a/src/jagi/fs/Compiler.java
b/src/jagi/fs/Compiler.java
index
60a1c24
..
b277e00
100644
(file)
--- a/
src/jagi/fs/Compiler.java
+++ b/
src/jagi/fs/Compiler.java
@@
-3,12
+3,14
@@
package jagi.fs;
import jagi.*;
import java.util.*;
import java.util.regex.*;
import jagi.*;
import java.util.*;
import java.util.regex.*;
+import java.util.logging.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.*;
import java.net.*;
public class Compiler {
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.*;
import java.net.*;
public class Compiler {
+ private static final Logger log = Logger.getLogger("jagi-fs");
private final Map<Path, File> files = new HashMap<>();
private final Map<Path, ClassLoader> libs = new HashMap<>();
private final Collection<Path> searchpath = new ArrayList<>();
private final Map<Path, File> files = new HashMap<>();
private final Map<Path, ClassLoader> libs = new HashMap<>();
private final Collection<Path> searchpath = new ArrayList<>();
@@
-323,8
+325,16
@@
public class Compiler {
synchronized(this) {
FileTime mtime = Files.getLastModifiedTime(name);
if((this.mtime == null) || (this.mtime.compareTo(mtime) < 0)) {
synchronized(this) {
FileTime mtime = Files.getLastModifiedTime(name);
if((this.mtime == null) || (this.mtime.compareTo(mtime) < 0)) {
- mod = new Module(name);
+ Module pmod = this.mod;
+ this.mod = new Module(name);
this.mtime = mtime;
this.mtime = mtime;
+ if(pmod instanceof AutoCloseable) {
+ try {
+ ((AutoCloseable)pmod).close();
+ } catch(Exception e) {
+ log.log(Level.WARNING, String.format("Error when disposing updated module %s", pmod.file), e);
+ }
+ }
}
}
}
}
}
}