minal-kyada commented on code in PR #4556:
URL: https://github.com/apache/cassandra/pull/4556#discussion_r2738398281


##########
src/java/org/apache/cassandra/service/reads/thresholds/CoordinatorWarnings.java:
##########
@@ -31,56 +31,72 @@
 import org.apache.cassandra.metrics.TableMetrics;
 import org.apache.cassandra.schema.Schema;
 import org.apache.cassandra.service.ClientWarn;
-
-import io.netty.util.concurrent.FastThreadLocal;
+import org.apache.cassandra.service.thresholds.CoordinatorWarningsState;
 
 import static 
org.apache.cassandra.config.CassandraRelevantProperties.READS_THRESHOLDS_COORDINATOR_DEFENSIVE_CHECKS_ENABLED;
 
+/**
+ * ThreadLocal manager for read warnings at the coordinator.
+ * <p>
+ * REFACTORED VERSION: Uses CoordinatorWarningsState for state management.
+ */
 public class CoordinatorWarnings
 {
     private static final Logger logger = 
LoggerFactory.getLogger(CoordinatorWarnings.class);
     private static final boolean ENABLE_DEFENSIVE_CHECKS = 
READS_THRESHOLDS_COORDINATOR_DEFENSIVE_CHECKS_ENABLED.getBoolean();
 
-    // when .init() is called set the STATE to be INIT; this is to lazy 
allocate the map only when warnings are generated
     private static final Map<ReadCommand, WarningsSnapshot> INIT = 
Collections.emptyMap();
-    private static final FastThreadLocal<Map<ReadCommand, WarningsSnapshot>> 
STATE = new FastThreadLocal<>();
+
+    private static final CoordinatorWarningsState<Map<ReadCommand, 
WarningsSnapshot>> STATE =
+    new CoordinatorWarningsState<>("CoordinatorWarnings",
+                                   INIT,
+                                   null, // use remove() instead of setting to 
null

Review Comment:
   Apology for a confusing comment! Have updated to something which makes more 
sense.



-- 
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