You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ay...@apache.org on 2020/02/12 15:13:41 UTC
[hadoop] branch trunk updated: HDFS-15161. When evictableMmapped or
evictable size is zero,
do not throw NoSuchElementException in ShortCircuitCache#close().
Contributed by Lisheng Sun
This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new f09710b HDFS-15161. When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close(). Contributed by Lisheng Sun
f09710b is described below
commit f09710bbb8e56d066f9d7a2e70a41ed82d5aa781
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Wed Feb 12 20:22:51 2020 +0530
HDFS-15161. When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close(). Contributed by Lisheng Sun
---
.../hdfs/shortcircuit/ShortCircuitCache.java | 23 ++++++----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
index d3eb3ac..d4d898c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
@@ -26,7 +26,6 @@ import java.nio.MappedByteBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.NoSuchElementException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -865,23 +864,13 @@ public class ShortCircuitCache implements Closeable {
// Close and join cacheCleaner thread.
IOUtilsClient.cleanupWithLogger(LOG, cacheCleaner);
// Purge all replicas.
- while (true) {
- Object eldestKey;
- try {
- eldestKey = evictable.firstKey();
- } catch (NoSuchElementException e) {
- break;
- }
- purge((ShortCircuitReplica)evictable.get(eldestKey));
+ while (!evictable.isEmpty()) {
+ Object eldestKey = evictable.firstKey();
+ purge((ShortCircuitReplica) evictable.get(eldestKey));
}
- while (true) {
- Object eldestKey;
- try {
- eldestKey = evictableMmapped.firstKey();
- } catch (NoSuchElementException e) {
- break;
- }
- purge((ShortCircuitReplica)evictableMmapped.get(eldestKey));
+ while (!evictableMmapped.isEmpty()) {
+ Object eldestKey = evictableMmapped.firstKey();
+ purge((ShortCircuitReplica) evictableMmapped.get(eldestKey));
}
} finally {
lock.unlock();
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org