szetszwo commented on code in PR #1181:
URL: https://github.com/apache/ratis/pull/1181#discussion_r1913859911
##########
ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java:
##########
@@ -353,7 +354,8 @@ void onNext(AppendEntriesRequestProto proto)
}
// stall for stream to be ready.
while (!stream.isReady() && running) {
- sleep(waitForReady, isHeartBeat);
+ //sleep(waitForReady, isHeartBeat);
+ LockSupport.parkNanos(waitForReady.toLong(TimeUnit.NANOSECONDS));
Review Comment:
@jojochuang , thanks for the update! Sorry that I missed the new change
earlier.
How about changing it in the sleep(..) method?
```java
@@ -408,12 +409,9 @@ public class GrpcLogAppender extends LogAppenderBase {
private static void sleep(TimeDuration waitTime, boolean heartbeat)
throws InterruptedIOException {
- try {
- waitTime.sleep();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw IOUtils.toInterruptedIOException(
- "Interrupted appendLog, heartbeat? " + heartbeat, e);
+ LockSupport.parkNanos(waitTime.toLong(TimeUnit.NANOSECONDS));
+ if (Thread.currentThread().isInterrupted()) {
+ throw new InterruptedIOException("Interrupted appendLog, heartbeat? "
+ heartbeat);
}
}
```
--
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]