From c567cfa0bada3e603d3f03bbeff8fb960db65a10 Mon Sep 17 00:00:00 2001 From: wusheng Date: Tue, 15 Nov 2016 10:23:08 +0800 Subject: [PATCH] =?UTF-8?q?fix=20IndexDataCapacityMonitor=E2=80=99s=20time?= =?UTF-8?q?r=20issue.=20maybe=20happened=20issue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/data/IndexDataCapacityMonitor.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/IndexDataCapacityMonitor.java b/skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/IndexDataCapacityMonitor.java index 309456306..c3f3062bd 100644 --- a/skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/IndexDataCapacityMonitor.java +++ b/skywalking-storage-center/skywalking-storage/src/main/java/com/a/eye/skywalking/storage/data/IndexDataCapacityMonitor.java @@ -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(); } }