private File subject = null;
- private long lastStat;
+ private long lastStat[];
boolean exists = false;
* @param subject
*/
private boolean checkLock() {
- if (subject!=null) {
+ if (subject!=null && subject.exists()) {
Lock tl = new Lock(subject);
if (tl.isLocked()) {
tl.release();
}
return false;
}
+ private long[] getStat(File subject) {
+ return new long[] { subject.lastModified(), subject.length() };
+ }
+ private boolean compStat(long[] stat, long[] newstat) {
+ if (stat.hashCode()!=newstat.hashCode())
+ return false;
+ return true;
+ }
private boolean check() {
if (subject != null) {
if (!subject.exists()) {
return false;
} else {
- long newStat = subject.lastModified();
- if (exists && ((lastStat == newStat) || checkLock())) {
+ long[] newStat = getStat(subject); // subject.lastModified();
+ if (exists && ((compStat(lastStat, newStat) || checkLock()))) {
return false;
}
lastStat = newStat;