本文整理汇总了Java中io.grpc.Status.Code.DEADLINE_EXCEEDED属性的典型用法代码示例。如果您正苦于以下问题:Java Code.DEADLINE_EXCEEDED属性的具体用法?Java Code.DEADLINE_EXCEEDED怎么用?Java Code.DEADLINE_EXCEEDED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类io.grpc.Status.Code
的用法示例。
在下文中一共展示了Code.DEADLINE_EXCEEDED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleStatus
private void handleStatus(Status statusProto) throws IOException {
StatusRuntimeException e = StatusProto.toStatusRuntimeException(statusProto);
if (e.getStatus().getCode() == Code.OK) {
return;
}
if (e.getStatus().getCode() == Code.DEADLINE_EXCEEDED) {
// This was caused by the command itself exceeding the timeout,
// therefore it is not retriable.
throw new TimeoutException();
}
throw e;
}
示例2: finishStream
void finishStream(CronetClientStream stream, Status status) {
synchronized (lock) {
if (streams.remove(stream)) {
boolean isCancelled = (status.getCode() == Code.CANCELLED
|| status.getCode() == Code.DEADLINE_EXCEEDED);
stream.transportState().transportReportStatus(status, isCancelled, new Metadata());
} else {
return;
}
}
stopIfNecessary();
}
示例3: rstStream
@Override
public void rstStream(int streamId, ErrorCode errorCode) {
Status status = toGrpcStatus(errorCode).augmentDescription("Rst Stream");
boolean stopDelivery =
(status.getCode() == Code.CANCELLED || status.getCode() == Code.DEADLINE_EXCEEDED);
finishStream(streamId, status, stopDelivery, null, null);
}