sarankk commented on code in PR #187:
URL: https://github.com/apache/cassandra-sidecar/pull/187#discussion_r1942274524


##########
server/src/main/java/org/apache/cassandra/sidecar/db/schema/SidecarSchema.java:
##########
@@ -47,70 +52,68 @@
 public class SidecarSchema
 {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(SidecarSchema.class);
-    protected static final long INITIALIZATION_LOOP_DELAY_MILLIS = 1000;
+    protected static final DurationSpec INITIALIZATION_LOOP_DELAY = 
MillisecondBoundConfiguration.parse("1s");
 
     private final Vertx vertx;
-    private final ExecutorPools executorPools;
+    private final PeriodicTaskExecutor periodicTaskExecutor;
     private final SchemaKeyspaceConfiguration schemaKeyspaceConfiguration;
     private final SidecarInternalKeyspace sidecarInternalKeyspace;
-    private final AtomicLong initializationTimerId = new AtomicLong(-1L);
+    private final AtomicBoolean initializerStarted = new AtomicBoolean(false);
     private final CQLSessionProvider cqlSessionProvider;
     private final SchemaMetrics metrics;
     private final ClusterLease clusterLease;
+    @Nullable
+    private final SidecarSchemaInitializer sidecarSchemaInitializer;
 
     private boolean isInitialized = false;
 
     public SidecarSchema(Vertx vertx,
-                         ExecutorPools executorPools,
+                         PeriodicTaskExecutor periodicTaskExecutor,
                          SidecarConfiguration config,
                          SidecarInternalKeyspace sidecarInternalKeyspace,
                          CQLSessionProvider cqlSessionProvider,
                          SchemaMetrics metrics,
                          ClusterLease clusterLease)
     {
         this.vertx = vertx;
-        this.executorPools = executorPools;
+        this.periodicTaskExecutor = periodicTaskExecutor;
         this.schemaKeyspaceConfiguration = 
config.serviceConfiguration().schemaKeyspaceConfiguration();
         this.sidecarInternalKeyspace = sidecarInternalKeyspace;
         this.cqlSessionProvider = cqlSessionProvider;
         this.metrics = metrics;
         this.clusterLease = clusterLease;
         if (this.schemaKeyspaceConfiguration.isEnabled())
         {
+            this.sidecarSchemaInitializer = new SidecarSchemaInitializer();
             configureSidecarServerEventListeners();
         }
         else
         {
+            this.sidecarSchemaInitializer = null;

Review Comment:
   Nit: should we add `schemaKeyspaceConfiguration.isEnabled()` check to 
`execute` method of `SidecarSchemaInitializer`, that way we can avoid null 
checks in other places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to