anmolnar commented on code in PR #6381:
URL: https://github.com/apache/hbase/pull/6381#discussion_r1890622216


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/tls/X509Util.java:
##########
@@ -155,6 +154,8 @@ private static String[] getCBCCiphers() {
 
   private static final String[] DEFAULT_CIPHERS_OPENSSL = 
getOpenSslFilteredDefaultCiphers();
 
+  private static final Duration FILE_POLL_INTERVAL = Duration.ofMinutes(1);

Review Comment:
   Why not configurable?



##########
hbase-common/src/main/java/org/apache/hadoop/hbase/io/FileChangeWatcher.java:
##########
@@ -216,44 +214,40 @@ public void run() {
         runLoop();
       } catch (Exception e) {
         LOG.warn("Error in runLoop()", e);
-        throw e;
+        throw new RuntimeException(e);
       } finally {
-        try {
-          watchService.close();
-        } catch (IOException e) {
-          LOG.warn("Error closing watch service", e);
-        }
-        LOG.info("{} thread finished", getName());
+        LOG.debug("{} thread finished", getName());
         FileChangeWatcher.this.setState(FileChangeWatcher.State.STOPPED);
       }
     }
 
-    private void runLoop() {
+    private void runLoop() throws IOException {
       while (FileChangeWatcher.this.getState() == 
FileChangeWatcher.State.RUNNING) {
-        WatchKey key;
-        try {
-          key = watchService.take();
-        } catch (InterruptedException | ClosedWatchServiceException e) {
-          LOG.debug("{} was interrupted and is shutting down...", getName());
-          break;
+        BasicFileAttributes attributes = Files.readAttributes(filePath, 
BasicFileAttributes.class);
+        boolean modified = false;
+        synchronized (lastModifiedTimeLock) {
+          FileTime maybeNewLastModifiedTime = attributes.lastModifiedTime();
+          if (!lastModifiedTime.equals(maybeNewLastModifiedTime)) {
+            modified = true;
+            lastModifiedTime = maybeNewLastModifiedTime;
+          }

Review Comment:
   You can use 
[AtomicReference](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html)
 here:
   
   ```
   modified = 
!lastModifiedTime.getAndSet(maybeNewLastModifiedTime).equals(maybeNewLastModifiedTime);
   ```
   ```



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