io.grpc.Status.equals()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中io.grpc.Status.equals()方法的一些代码示例,展示了Status.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.equals()方法的具体详情如下:
包路径:io.grpc.Status
类名称:Status
方法名:equals

Status.equals介绍

[英]Equality on Statuses is not well defined. Instead, do comparison based on their Code with #getCode. The description and cause of the Status are unlikely to be stable, and additional fields may be added to Status in the future.
[中]

代码示例

代码示例来源:origin: io.grpc/grpc-core

@Override
public boolean equals(Object other) {
 if (!(other instanceof ConnectivityStateInfo)) {
  return false;
 }
 ConnectivityStateInfo o = (ConnectivityStateInfo) other;
 return state.equals(o.state) && status.equals(o.status);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public boolean equals(Object other) {
 if (!(other instanceof ConnectivityStateInfo)) {
  return false;
 }
 ConnectivityStateInfo o = (ConnectivityStateInfo) other;
 return state.equals(o.state) && status.equals(o.status);
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform

private String pollForResultForDuration(
  SubscriptionPath signalSubscriptionPath, Duration duration) throws IOException {
 List<PubsubClient.IncomingMessage> signal = null;
 DateTime endPolling = DateTime.now().plus(duration.getMillis());
 do {
  try {
   signal = pubsub.pull(DateTime.now().getMillis(), signalSubscriptionPath, 1, false);
   pubsub.acknowledge(
     signalSubscriptionPath, signal.stream().map(m -> m.ackId).collect(toList()));
   break;
  } catch (StatusRuntimeException e) {
   if (!Status.DEADLINE_EXCEEDED.equals(e.getStatus())) {
    LOG.warn(
      "(Will retry) Error while polling {} for signal: {}",
      signalSubscriptionPath,
      e.getStatus());
   }
   sleep(500);
  }
 } while (DateTime.now().isBefore(endPolling));
 if (signal == null) {
  throw new AssertionError(
    String.format(
      "Did not receive signal on %s in %ss",
      signalSubscriptionPath, duration.getStandardSeconds()));
 }
 return new String(signal.get(0).elementBytes, UTF_8);
}

相关文章