HDFS-7266. HDFS Peercache enabled check should not lock on object (awang via cmccabe)
This commit is contained in:
parent
e90718fa5a
commit
4799570dfd
@ -381,6 +381,9 @@ Release 2.7.0 - UNRELEASED
|
||||
|
||||
HDFS-6252. Phase out the old web UI in HDFS. (wheat9)
|
||||
|
||||
HDFS-7266. HDFS Peercache enabled check should not lock on object (awang
|
||||
via cmccabe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
@ -140,12 +140,15 @@ public String toString() {
|
||||
* @return An open Peer connected to the DN, or null if none
|
||||
* was found.
|
||||
*/
|
||||
public synchronized Peer get(DatanodeID dnId, boolean isDomain) {
|
||||
public Peer get(DatanodeID dnId, boolean isDomain) {
|
||||
|
||||
if (capacity <= 0) { // disabled
|
||||
return null;
|
||||
}
|
||||
return getInternal(dnId, isDomain);
|
||||
}
|
||||
|
||||
private synchronized Peer getInternal(DatanodeID dnId, boolean isDomain) {
|
||||
List<Value> sockStreamList = multimap.get(new Key(dnId, isDomain));
|
||||
if (sockStreamList == null) {
|
||||
return null;
|
||||
@ -174,7 +177,7 @@ public synchronized Peer get(DatanodeID dnId, boolean isDomain) {
|
||||
/**
|
||||
* Give an unused socket to the cache.
|
||||
*/
|
||||
public synchronized void put(DatanodeID dnId, Peer peer) {
|
||||
public void put(DatanodeID dnId, Peer peer) {
|
||||
Preconditions.checkNotNull(dnId);
|
||||
Preconditions.checkNotNull(peer);
|
||||
if (peer.isClosed()) return;
|
||||
@ -183,7 +186,10 @@ public synchronized void put(DatanodeID dnId, Peer peer) {
|
||||
IOUtils.cleanup(LOG, peer);
|
||||
return;
|
||||
}
|
||||
putInternal(dnId, peer);
|
||||
}
|
||||
|
||||
private synchronized void putInternal(DatanodeID dnId, Peer peer) {
|
||||
startExpiryDaemon();
|
||||
|
||||
if (capacity == multimap.size()) {
|
||||
|
Loading…
Reference in New Issue
Block a user