Copilot commented on code in PR #6980:
URL: https://github.com/apache/hbase/pull/6980#discussion_r2083216372


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestNettyTLSIPCFileWatcher.java:
##########
@@ -172,9 +185,25 @@ public void testReplaceServerKeystore()
         assertNull(pcrc.cellScanner());
       }
 
+      // truststore file change latch
+      final CountDownLatch latch = new CountDownLatch(1);
+
+      final Path trustStorePath = 
Paths.get(CONF.get(X509Util.TLS_CONFIG_TRUSTSTORE_LOCATION));
+      FileChangeWatcher fileChangeWatcher =
+        new FileChangeWatcher(trustStorePath, 
Objects.toString(trustStorePath.getFileName()),
+          Duration.ofMillis(20), watchEventFilePath -> {
+            LOG.info("File " + watchEventFilePath.getFileName() + " has been 
changed.");
+            latch.countDown();
+          });
+      fileChangeWatcher.start();

Review Comment:
   [nitpick] Consider refactoring the file watcher setup code into a helper 
method to reduce duplication across the test methods.
   ```suggestion
         final Path trustStorePath = 
Paths.get(CONF.get(X509Util.TLS_CONFIG_TRUSTSTORE_LOCATION));
         createAndStartFileWatcher(trustStorePath, latch, 
Duration.ofMillis(20));
   ```



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

Reply via email to