1515
1616import java .util .concurrent .atomic .AtomicInteger ;
1717import java .util .concurrent .atomic .AtomicLong ;
18- import java .util .function .Consumer ;
1918
2019public class RotatingStoreVerticle extends AbstractVerticle {
2120 private static final Logger LOGGER = LoggerFactory .getLogger (RotatingStoreVerticle .class );
@@ -32,7 +31,7 @@ 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 Consumer < Boolean > refreshCallback ;
34+ private final Runnable refreshCallback ;
3635
3736 private final long refreshIntervalMs ;
3837
@@ -41,7 +40,7 @@ public RotatingStoreVerticle(String storeName, long refreshIntervalMs, IMetadata
4140 }
4241
4342 public RotatingStoreVerticle (String storeName , long refreshIntervalMs , IMetadataVersionedStore versionedStore ,
44- Consumer < Boolean > refreshCallback ) {
43+ Runnable refreshCallback ) {
4544 this .healthComponent = HealthManager .instance .registerComponent (storeName + "-rotator" );
4645 this .healthComponent .setHealthStatus (false , "not started" );
4746
@@ -127,15 +126,12 @@ private void startBackgroundRefresh() {
127126 this .counterStoreRefreshFailures .increment ();
128127 this .storeRefreshIsFailing .set (1 );
129128 LOGGER .error ("Failed to load " + this .storeName + ", " + elapsed + " ms" , asyncResult .cause ());
130- if (this .refreshCallback != null ) {
131- this .refreshCallback .accept (false );
132- }
133129 } else {
134130 this .counterStoreRefreshed .increment ();
135131 this .storeRefreshIsFailing .set (0 );
136132 LOGGER .trace ("Successfully refreshed " + this .storeName + ", " + elapsed + " ms" );
137133 if (this .refreshCallback != null ) {
138- this .refreshCallback .accept ( true );
134+ this .refreshCallback .run ( );
139135 }
140136 }
141137 }
0 commit comments