Be sure not to leave our lock dangling if the wrapped operation fails with an
exception. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4797 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -505,8 +505,11 @@ public class PeerManager
|
||||
public void requestCompleted (String nodeName) {
|
||||
if (getNodeObject().nodeName.equals(nodeName)) {
|
||||
// lock acquired successfully - perform the operation, and release the lock.
|
||||
operation.run();
|
||||
releaseLock(lock, new ResultListener.NOOP<String>());
|
||||
try {
|
||||
operation.run();
|
||||
} finally {
|
||||
releaseLock(lock, new ResultListener.NOOP<String>());
|
||||
}
|
||||
} else {
|
||||
// some other peer beat us to it
|
||||
operation.fail(nodeName);
|
||||
|
||||
Reference in New Issue
Block a user