HDFS-17461. Fix spotbugs in PeerCache#getInternal (#6721). Contributed by Haiyang Hu.

Reviewed-by: ZanderXu <zanderxu@apache.org>
Reviewed-by: Ayush Saxena <ayushsaxena@apache.org>
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
huhaiyang 2024-04-12 19:53:25 +08:00 committed by GitHub
parent d194ad0242
commit 6ccb223c9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -155,10 +155,6 @@ public Peer get(DatanodeID dnId, boolean isDomain) {
private synchronized Peer getInternal(DatanodeID dnId, boolean isDomain) { private synchronized Peer getInternal(DatanodeID dnId, boolean isDomain) {
List<Value> sockStreamList = multimap.get(new Key(dnId, isDomain)); List<Value> sockStreamList = multimap.get(new Key(dnId, isDomain));
if (sockStreamList == null) {
return null;
}
Iterator<Value> iter = sockStreamList.iterator(); Iterator<Value> iter = sockStreamList.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Value candidate = iter.next(); Value candidate = iter.next();