提交 c567cfa0 编写于 作者: wu-sheng's avatar wu-sheng

fix IndexDataCapacityMonitor’s timer issue. maybe happened issue.

上级 3a7e331a
......@@ -38,20 +38,20 @@ public class IndexDataCapacityMonitor {
public Detector(long timestamp) {
this.timestamp = timestamp;
currentSize = new AtomicLong();
startTimer();
start();
}
public Detector(long timestamp, long currentSize) {
this.currentSize = new AtomicLong(currentSize);
this.timestamp = timestamp;
startTimer();
start();
}
public void startTimer() {
timer.scheduleAtFixedRate(this, 0, TimeUnit.SECONDS.toMillis(30));
public void start() {
timer.schedule(this, 0, TimeUnit.SECONDS.toMillis(30));
}
public void stopTimer() {
public void stop() {
timer.cancel();
}
......@@ -66,8 +66,8 @@ public class IndexDataCapacityMonitor {
@Override
public void run() {
if (currentSize.get() > SIZE * 0.8) {
stop();
notificationAddNewBlockIndexAndCreateNewIndexDB();
stopTimer();
HealthCollector.getCurrentHeathReading("Index Data Capacity Detector").updateData(HeathReading.INFO,
"Detector is detecting the index [%d]. and the capacity of {} is %d", timestamp,
currentSize.get());
......@@ -111,6 +111,6 @@ public class IndexDataCapacityMonitor {
public static void stop() {
detector.stopTimer();
detector.stop();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册