mirror of https://github.com/grpc/grpc-java.git
core: include how long deadline was in Status message
This commit is contained in:
parent
7b97df04d3
commit
104350cf2e
|
|
@ -292,18 +292,26 @@ final class ClientCallImpl<ReqT, RespT> extends ClientCall<ReqT, RespT>
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeadlineTimer implements Runnable {
|
private class DeadlineTimer implements Runnable {
|
||||||
|
private final long remainingNanos;
|
||||||
|
|
||||||
|
DeadlineTimer(long remainingNanos) {
|
||||||
|
this.remainingNanos = remainingNanos;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// DelayedStream.cancel() is safe to call from a thread that is different from where the
|
// DelayedStream.cancel() is safe to call from a thread that is different from where the
|
||||||
// stream is created.
|
// stream is created.
|
||||||
stream.cancel(DEADLINE_EXCEEDED);
|
stream.cancel(DEADLINE_EXCEEDED.augmentDescription(
|
||||||
|
String.format("deadline exceeded after %dns", remainingNanos)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledFuture<?> startDeadlineTimer(Deadline deadline) {
|
private ScheduledFuture<?> startDeadlineTimer(Deadline deadline) {
|
||||||
|
long remainingNanos = deadline.timeRemaining(TimeUnit.NANOSECONDS);
|
||||||
return deadlineCancellationExecutor.schedule(
|
return deadlineCancellationExecutor.schedule(
|
||||||
new LogExceptionRunnable(new DeadlineTimer()), deadline.timeRemaining(TimeUnit.NANOSECONDS),
|
new LogExceptionRunnable(
|
||||||
TimeUnit.NANOSECONDS);
|
new DeadlineTimer(remainingNanos)), remainingNanos, TimeUnit.NANOSECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue