ss77892 commented on code in PR #11195:
URL: https://github.com/apache/ozone/pull/11195#discussion_r3961243329
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java:
##########
@@ -573,16 +573,13 @@ public void streamRead(ContainerCommandRequestProto
request,
request.getReadBlock().getBlockID().getLocalID(),
request.getReadBlock().getOffset(),
request.getReadBlock().getLength());
- final long deadlineNs = System.nanoTime() + streamReadTimeoutNanos;
- while (!obs.isReady() && System.nanoTime() - deadlineNs < 0) {
- LockSupport.parkNanos(10_000_000L);
- if (Thread.currentThread().isInterrupted()) {
- Thread.currentThread().interrupt();
- throw new InterruptedIOException("Interrupted while waiting for
stream to become ready: " + streamObserver);
+ try {
+ if (!streamObserver.awaitReady(streamReadTimeoutNanos)) {
+ throw new TimeoutIOException("Timed out waiting for stream to become
ready: " + streamObserver);
}
- }
- if (!obs.isReady()) {
- throw new TimeoutIOException("Timed out waiting for stream to become
ready: " + streamObserver);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new InterruptedIOException("Interrupted while waiting for stream
to become ready: " + streamObserver);
Review Comment:
Good catch. It's fixed in the followup commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]