Author: j16sdiz
Date: 2008-07-11 12:45:00 +0000 (Fri, 11 Jul 2008)
New Revision: 21048
Modified:
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
Log:
randomize cleaner start time
Modified:
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
---
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
2008-07-11 11:28:57 UTC (rev 21047)
+++
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
2008-07-11 12:45:00 UTC (rev 21048)
@@ -882,15 +882,13 @@
@Override
public void run() {
+ try {
+ Thread.sleep((int)(CLEANER_PERIOD / 2 +
CLEANER_PERIOD * Math.random()));
+ } catch (InterruptedException e){}
+
while (!shutdown) {
cleanerLock.lock();
try {
- try {
-
cleanerCondition.await(CLEANER_PERIOD, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- Logger.debug(this,
"interrupted", e);
- }
-
long _prevStoreSize;
configLock.readLock().lock();
@@ -930,6 +928,12 @@
Logger.error(this, "Can't force
bloom filter", e);
}
writeConfigFile();
+
+ try {
+
cleanerCondition.await(CLEANER_PERIOD, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ Logger.debug(this,
"interrupted", e);
+ }
} finally {
cleanerLock.unlock();
}