hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] xiaoyuyao commented on a change in pull request #2259: HADOOP-17208. LoadBalanceKMSClientProvider#deleteKey should invalidat…
Date Wed, 16 Sep 2020 17:21:13 GMT

xiaoyuyao commented on a change in pull request #2259:
URL: https://github.com/apache/hadoop/pull/2259#discussion_r489599636



##########
File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/ValueQueue.java
##########
@@ -299,19 +299,18 @@ public E getNext(String keyName)
    * @param keyName the key to drain the Queue for
    */
   public void drain(String keyName) {
+    Runnable e;
+    while ((e = queue.deleteByName(keyName)) != null) {
+      executor.remove(e);
+    }
+    writeLock(keyName);
     try {
-      Runnable e;
-      while ((e = queue.deleteByName(keyName)) != null) {
-        executor.remove(e);
-      }
-      writeLock(keyName);
-      try {
-        keyQueues.get(keyName).clear();
-      } finally {
-        writeUnlock(keyName);
+      LinkedBlockingQueue kq = keyQueues.getIfPresent(keyName);
+      if (kq != null) {
+        kq.clear();
       }
-    } catch (ExecutionException ex) {

Review comment:
       We don't have compatibility issue here. LoadingCache#get() may throw ExecutionException.
But this ticket has change to use LoadingCache#getIfPresent() which does not throw ExecutionException.
This way, we don't need to worry about either NPE from LoadingCache.get().clear() or ExecutionException.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message