Skip to content

Commit b9667b5

Browse files
committed
revert one file
1 parent 3679295 commit b9667b5

File tree

1 file changed

+26
-41
lines changed

1 file changed

+26
-41
lines changed

src/main/java/com/uid2/shared/vertx/RotatingStoreVerticle.java

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import java.util.concurrent.atomic.AtomicInteger;
1717
import java.util.concurrent.atomic.AtomicLong;
18-
import java.util.function.Consumer;
1918

2019
public class RotatingStoreVerticle extends AbstractVerticle {
2120
private static final Logger LOGGER = LoggerFactory.getLogger(RotatingStoreVerticle.class);
@@ -32,54 +31,47 @@ public class RotatingStoreVerticle extends AbstractVerticle {
3231
private final AtomicLong latestVersion = new AtomicLong(-1L);
3332
private final AtomicLong latestEntryCount = new AtomicLong(-1L);
3433
private final AtomicInteger storeRefreshIsFailing = new AtomicInteger(0);
35-
private final Runnable refreshCallback;
3634

3735
private final long refreshIntervalMs;
3836

3937
public RotatingStoreVerticle(String storeName, long refreshIntervalMs, IMetadataVersionedStore versionedStore) {
40-
this(storeName, refreshIntervalMs, versionedStore, null);
41-
}
42-
43-
public RotatingStoreVerticle(String storeName, long refreshIntervalMs, IMetadataVersionedStore versionedStore,
44-
Runnable refreshCallback) {
4538
this.healthComponent = HealthManager.instance.registerComponent(storeName + "-rotator");
4639
this.healthComponent.setHealthStatus(false, "not started");
4740

4841
this.storeName = storeName;
4942
this.counterStoreRefreshed = Counter
50-
.builder("uid2_config_store_refreshed_total")
51-
.tag("store", storeName)
52-
.description("counter for how many times " + storeName + " store is refreshed")
53-
.register(Metrics.globalRegistry);
43+
.builder("uid2_config_store_refreshed_total")
44+
.tag("store", storeName)
45+
.description("counter for how many times " + storeName + " store is refreshed")
46+
.register(Metrics.globalRegistry);
5447
this.counterStoreRefreshTimeMs = Counter
55-
.builder("uid2_config_store_refreshtime_ms_total")
56-
.tag("store", storeName)
57-
.description("counter for total time (ms) " + storeName + " store spend in refreshing")
58-
.register(Metrics.globalRegistry);
48+
.builder("uid2_config_store_refreshtime_ms_total")
49+
.tag("store", storeName)
50+
.description("counter for total time (ms) " + storeName + " store spend in refreshing")
51+
.register(Metrics.globalRegistry);
5952
this.counterStoreRefreshFailures = Counter
60-
.builder("uid2_config_store_refresh_failures_total")
61-
.tag("store", storeName)
62-
.description("counter for number of " + storeName + " store refresh failures")
63-
.register(Metrics.globalRegistry);
53+
.builder("uid2_config_store_refresh_failures_total")
54+
.tag("store", storeName)
55+
.description("counter for number of " + storeName + " store refresh failures")
56+
.register(Metrics.globalRegistry);
6457
this.gaugeStoreVersion = Gauge
65-
.builder("uid2_config_store_version", () -> this.latestVersion.get())
66-
.tag("store", storeName)
67-
.description("gauge for " + storeName + " store version")
68-
.register(Metrics.globalRegistry);
58+
.builder("uid2_config_store_version", () -> this.latestVersion.get())
59+
.tag("store", storeName)
60+
.description("gauge for " + storeName + " store version")
61+
.register(Metrics.globalRegistry);
6962
this.gaugeStoreEntryCount = Gauge
70-
.builder("uid2_config_store_entry_count", () -> this.latestEntryCount.get())
71-
.tag("store", storeName)
72-
.description("gauge for " + storeName + " store total entry count")
73-
.register(Metrics.globalRegistry);
63+
.builder("uid2_config_store_entry_count", () -> this.latestEntryCount.get())
64+
.tag("store", storeName)
65+
.description("gauge for " + storeName + " store total entry count")
66+
.register(Metrics.globalRegistry);
7467
this.gaugeConsecutiveRefreshFailures = Gauge
75-
.builder("uid2_config_store_consecutive_refresh_failures", () -> this.storeRefreshIsFailing.get())
76-
.tag("store", storeName)
77-
.description("gauge for number of consecutive " + storeName + " store refresh failures")
78-
.register(Metrics.globalRegistry);
68+
.builder("uid2_config_store_consecutive_refresh_failures", () -> this.storeRefreshIsFailing.get())
69+
.tag("store", storeName)
70+
.description("gauge for number of consecutive " + storeName + " store refresh failures")
71+
.register(Metrics.globalRegistry);
7972
this.versionedStore = versionedStore;
8073
this.refreshIntervalMs = refreshIntervalMs;
8174
this.storeRefreshTimer = Metrics.timer("uid2_store_refresh_duration", "store_name", storeName);
82-
this.refreshCallback = refreshCallback;
8375
}
8476

8577
@Override
@@ -103,14 +95,10 @@ private void startRefresh(Promise<Void> promise) {
10395
promise.complete();
10496
storeRefreshTimer.record(java.time.Duration.ofMillis(startupRefreshTimeMs));
10597
LOGGER.info("Successful " + this.storeName + " loading. Starting Background Refresh");
106-
if (this.refreshCallback != null) {
107-
this.refreshCallback.run();
108-
}
10998
this.startBackgroundRefresh();
11099
} else {
111100
this.healthComponent.setHealthStatus(false, ar.cause().getMessage());
112-
LOGGER.error("Failed " + this.storeName + " loading. Trying again in " + refreshIntervalMs + "ms",
113-
ar.cause());
101+
LOGGER.error("Failed " + this.storeName + " loading. Trying again in " + refreshIntervalMs + "ms", ar.cause());
114102
vertx.setTimer(refreshIntervalMs, id -> this.startRefresh(promise));
115103
}
116104
});
@@ -135,12 +123,9 @@ private void startBackgroundRefresh() {
135123
this.counterStoreRefreshed.increment();
136124
this.storeRefreshIsFailing.set(0);
137125
LOGGER.trace("Successfully refreshed " + this.storeName + ", " + elapsed + " ms");
138-
if (this.refreshCallback != null) {
139-
this.refreshCallback.run();
140-
}
141126
}
142127
}
143-
});
128+
);
144129
});
145130
}
146131

0 commit comments

Comments
 (0)