some small refactors

This commit is contained in:
DigitalSonic
2020-02-07 19:11:35 +08:00
parent 2466ac220f
commit f40638db28
2 changed files with 6 additions and 9 deletions
@@ -49,16 +49,9 @@ public class PoolUpdater implements Observer {
private Lock lock = new ReentrantLock();
private ScheduledExecutorService executor;
private int intervalSeconds = DEFAULT_INTERVAL;
private boolean inited = false;
private volatile boolean inited = false;
public PoolUpdater() {
}
/**
* @see #PoolUpdater()
*/
public PoolUpdater(HighAvailableDataSource highAvailableDataSource) {
this();
setHighAvailableDataSource(highAvailableDataSource);
}
@@ -73,6 +66,10 @@ public class PoolUpdater implements Observer {
if (inited) {
return;
}
if (intervalSeconds < 10) {
LOG.warn("CAUTION: Purge interval has been set to " + intervalSeconds
+ ". This value should NOT be too small.");
}
if (intervalSeconds <= 0) {
intervalSeconds = DEFAULT_INTERVAL;
}
@@ -37,7 +37,7 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* A NodeListner that watches a Zookeeper Path.
* A NodeListener that watches a Zookeeper Path.
* e.g.
* Path to watch:
* <pre>