RATIS-2400. Support timeout and interrupt handling in GrpcClientRpc.#1342
RATIS-2400. Support timeout and interrupt handling in GrpcClientRpc.#1342szetszwo merged 1 commit intoapache:masterfrom
Conversation
|
@szetszwo Could you please review this PR? Thank you very much! |
szetszwo
left a comment
There was a problem hiding this comment.
@slfan1989 , thanks a lot for working on this!
Let's move the try-catch from the sendRequest(request) to sendRequest(request, proxy). Then, the code is simpler; See https://issues.apache.org/jira/secure/attachment/13080704/1342_review.patch
| if (replyFuture.isCancelled()) { | ||
| requestObserver.onError(Status.CANCELLED | ||
| .withDescription(clientId + ": request #" + request.getCallId() + " cancelled") | ||
| .asRuntimeException()); |
There was a problem hiding this comment.
Let's use asException() instead of asRuntimeException().
There was a problem hiding this comment.
Thank you so much for your suggestion! I’ve already updated the code.
@slfan1989 , Have you looked at the comment above? |
@szetszwo Thank you for your suggestions! I’m updating this PR based on your feedback and will update it soon. |
szetszwo
left a comment
There was a problem hiding this comment.
+1 the change looks good.
@szetszwo Thanks for reviewing the code! |
What changes were proposed in this pull request?
This PR adds timeout and thread interruption handling support for synchronous gRPC client requests in GrpcClientRpc.
What is the link to the Apache JIRA
RATIS-2400. Support timeout and interrupt handling in GrpcClientRpc
How was this patch tested?
testGrpcClientRpcSyncTimeout: Verifies that synchronous requests correctly throw TimeoutIOException when the configured timeout is reached. Uses SimpleStateMachine4Testing.blockStartTransaction() to simulate a blocking scenario.
testGrpcClientRpcSyncCancelOnInterrupt: Verifies that when a request thread is interrupted, the request is properly cancelled and InterruptedIOException is thrown. Validates that the thread exits promptly after interruption.