NTCP: Reduce lock contention (ticket #697)

This commit is contained in:
zzz
2012-08-29 13:47:05 +00:00
parent c8a46dac5d
commit 832d66bfb9
2 changed files with 8 additions and 4 deletions

View File

@ -64,8 +64,9 @@ class Reader {
already = true;
} else {
_pendingConnections.add(con);
// only notify here if added?
}
_pendingConnections.notifyAll();
_pendingConnections.notify();
}
if (_log.shouldLog(Log.DEBUG))
_log.debug("wantsRead: " + con + " already live? " + already);
@ -75,7 +76,8 @@ class Reader {
synchronized (_pendingConnections) {
_readAfterLive.remove(con);
_pendingConnections.remove(con);
_pendingConnections.notifyAll();
// necessary?
_pendingConnections.notify();
}
}

View File

@ -62,8 +62,9 @@ class Writer {
already = true;
} else {
pending = _pendingConnections.add(con);
// only notify here if added?
}
_pendingConnections.notifyAll();
_pendingConnections.notify();
}
if (_log.shouldLog(Log.DEBUG))
_log.debug("wantsWrite: " + con + " already live? " + already + " added to pending? " + pending + ": " + source);
@ -73,7 +74,8 @@ class Writer {
synchronized (_pendingConnections) {
_writeAfterLive.remove(con);
_pendingConnections.remove(con);
_pendingConnections.notifyAll();
// necessary?
_pendingConnections.notify();
}
}