Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1467,10 +1467,12 @@ Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
final Connection connection = getConnection(remoteId, call, serviceClass,
fallbackToSimpleAuth);

boolean success = false;
try {
checkAsyncCall();
try {
connection.sendRpcRequest(call); // send the rpc request
success = true;
} catch (RejectedExecutionException e) {
throw new IOException("connection has been closed", e);
} catch (InterruptedException ie) {
Expand All @@ -1485,6 +1487,10 @@ Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
releaseAsyncCall();
}
throw e;
} finally {
if (!success) {
connection.calls.remove(call.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendRpcRequest(call) will try to add a pair of <call,buf> into rpcRequestQueue. Should we remove that on failure as well?

rpcRequestQueue.put(Pair.of(call, buf));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xinglin for your comment.

We don't need to remove the call from rpcRequestQueue, because the rpcRequestThread will poll it and send to the connection.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the change makes sense to me. Thanks,

}
}

if (isAsynchronousMode()) {
Expand Down