提交 265a6c67 编写于 作者: J João Sousa

ServiceProxy.invoke now always releases the lock with a 'finally' clause, so...

ServiceProxy.invoke now always releases the lock with a 'finally' clause, so that unhandled exceptions do not result in threads being stuck while invoking that method.
上级 9c397b57
无法预览此类型文件
...@@ -172,6 +172,9 @@ public class ServiceProxy extends TOMSender { ...@@ -172,6 +172,9 @@ public class ServiceProxy extends TOMSender {
* @return The reply from the replicas related to request * @return The reply from the replicas related to request
*/ */
public byte[] invoke(byte[] request, TOMMessageType reqType) { public byte[] invoke(byte[] request, TOMMessageType reqType) {
try {
canSendLock.lock(); canSendLock.lock();
// Clean all statefull data to prepare for receiving next replies // Clean all statefull data to prepare for receiving next replies
...@@ -293,8 +296,12 @@ public class ServiceProxy extends TOMSender { ...@@ -293,8 +296,12 @@ public class ServiceProxy extends TOMSender {
} }
//******* EDUARDO END **************// //******* EDUARDO END **************//
canSendLock.unlock();
return ret; return ret;
} finally {
canSendLock.unlock(); //always release lock
}
} }
//******* EDUARDO BEGIN **************// //******* EDUARDO BEGIN **************//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册