ReadConfigJob minor optimization

This commit is contained in:
zzz
2016-08-19 15:56:31 +00:00
parent bcaf837da8
commit ff2d5badc9

View File

@@ -24,11 +24,12 @@ import net.i2p.util.Log;
* Unfortunately it will also read the file back in every time the
* router writes it.
*
* So maybe this should just be disabled.
* We must keep this enabled, as it's the only way for people
* to set routerconsole.advanced=true without restarting.
*/
public class ReadConfigJob extends JobImpl {
private final static long DELAY = 30*1000; // reread every 30 seconds
private long _lastRead;
private volatile long _lastRead;
public ReadConfigJob(RouterContext ctx) {
super(ctx);
@@ -50,10 +51,8 @@ public class ReadConfigJob extends JobImpl {
}
private boolean shouldReread(File configFile) {
if (!configFile.exists()) return false;
if (configFile.lastModified() > _lastRead)
return true;
else
return false;
// lastModified() returns 0 if not found
//if (!configFile.exists()) return false;
return configFile.lastModified() > _lastRead;
}
}