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:
Michael Bayne
2007-07-31 23:33:13 +00:00
parent 638f8b6246
commit 7fc92f99b1
@@ -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);