minor cleanup - parameterized cacheTime
This commit is contained in:
parent
3d848fb069
commit
45d3cbec4e
1 changed files with 6 additions and 4 deletions
|
@ -20,6 +20,8 @@ public final class SystemProperties extends Properties {
|
||||||
private File file;
|
private File file;
|
||||||
private long lastread, lastcheck;
|
private long lastread, lastcheck;
|
||||||
|
|
||||||
|
final static long cacheTime = 1500l;
|
||||||
|
|
||||||
|
|
||||||
public SystemProperties () {
|
public SystemProperties () {
|
||||||
this (null, null);
|
this (null, null);
|
||||||
|
@ -109,25 +111,25 @@ public final class SystemProperties extends Properties {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProperty (String name) {
|
public String getProperty (String name) {
|
||||||
if (System.currentTimeMillis () - lastcheck > 1500l)
|
if (System.currentTimeMillis () - lastcheck > cacheTime)
|
||||||
checkFile ();
|
checkFile ();
|
||||||
return props.getProperty (name.toLowerCase());
|
return props.getProperty (name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProperty (String name, String defaultValue) {
|
public String getProperty (String name, String defaultValue) {
|
||||||
if (System.currentTimeMillis () - lastcheck > 1500l)
|
if (System.currentTimeMillis () - lastcheck > cacheTime)
|
||||||
checkFile ();
|
checkFile ();
|
||||||
return props.getProperty (name.toLowerCase(), defaultValue);
|
return props.getProperty (name.toLowerCase(), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration keys () {
|
public Enumeration keys () {
|
||||||
if (System.currentTimeMillis () - lastcheck > 1500l)
|
if (System.currentTimeMillis () - lastcheck > cacheTime)
|
||||||
checkFile ();
|
checkFile ();
|
||||||
return props.keys();
|
return props.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration elements () {
|
public Enumeration elements () {
|
||||||
if (System.currentTimeMillis () - lastcheck > 1500l)
|
if (System.currentTimeMillis () - lastcheck > cacheTime)
|
||||||
checkFile ();
|
checkFile ();
|
||||||
return props.elements();
|
return props.elements();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue