當前位置: 首頁>>代碼示例>>Java>>正文


Java PickResult.withNoResult方法代碼示例

本文整理匯總了Java中io.grpc.LoadBalancer.PickResult.withNoResult方法的典型用法代碼示例。如果您正苦於以下問題:Java PickResult.withNoResult方法的具體用法?Java PickResult.withNoResult怎麽用?Java PickResult.withNoResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.grpc.LoadBalancer.PickResult的用法示例。


在下文中一共展示了PickResult.withNoResult方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleSubchannelState

import io.grpc.LoadBalancer.PickResult; //導入方法依賴的package包/類
@Override
public void handleSubchannelState(Subchannel subchannel, ConnectivityStateInfo stateInfo) {
  ConnectivityState currentState = stateInfo.getState();
  if (subchannel != this.subchannel || currentState == SHUTDOWN) {
    return;
  }

  PickResult pickResult;
  switch (currentState) {
    case CONNECTING:
      pickResult = PickResult.withNoResult();
      break;
    case READY:
    case IDLE:
      pickResult = PickResult.withSubchannel(subchannel);
      break;
    case TRANSIENT_FAILURE:
      pickResult = PickResult.withError(stateInfo.getStatus());
      break;
    default:
      throw new IllegalArgumentException("Unsupported state:" + currentState);
  }

  helper.updateBalancingState(currentState, new Picker(pickResult));
}
 
開發者ID:grpc,項目名稱:grpc-java,代碼行數:26,代碼來源:PickFirstBalancerFactory.java

示例2: pickSubchannel

import io.grpc.LoadBalancer.PickResult; //導入方法依賴的package包/類
@Override
public PickResult pickSubchannel(PickSubchannelArgs args) {
  Map<String, Object> affinity =
      args.getCallOptions().getOption(GrpcCallOptions.CALLOPTIONS_CUSTOME_KEY);
  GrpcURL refUrl = (GrpcURL) affinity.get(GrpcCallOptions.GRPC_REF_URL);
  if (size > 0) {
    Subchannel subchannel = nextSubchannel(refUrl);
    affinity.put(GrpcCallOptions.GRPC_NAMERESOVER_ATTRIBUTES, nameResovleCache);
    return PickResult.withSubchannel(subchannel);
  }
  if (status != null) {
    return PickResult.withError(status);
  }
  return PickResult.withNoResult();
}
 
開發者ID:venus-boot,項目名稱:saluki,代碼行數:16,代碼來源:GrpcRoutePicker.java

示例3: pickSubchannel

import io.grpc.LoadBalancer.PickResult; //導入方法依賴的package包/類
@Override
public PickResult pickSubchannel(PickSubchannelArgs args) {
  if (list.size() > 0) {
    return PickResult.withSubchannel(nextSubchannel());
  }

  if (status != null) {
    return PickResult.withError(status);
  }

  return PickResult.withNoResult();
}
 
開發者ID:grpc,項目名稱:grpc-java,代碼行數:13,代碼來源:RoundRobinLoadBalancerFactory.java

示例4: pickResult_withNoResult

import io.grpc.LoadBalancer.PickResult; //導入方法依賴的package包/類
@Test
public void pickResult_withNoResult() {
  PickResult result = PickResult.withNoResult();
  assertThat(result.getSubchannel()).isNull();
  assertThat(result.getStatus()).isSameAs(Status.OK);
  assertThat(result.getStreamTracerFactory()).isNull();
  assertThat(result.isDrop()).isFalse();
}
 
開發者ID:grpc,項目名稱:grpc-java,代碼行數:9,代碼來源:LoadBalancerTest.java

示例5: pickResult_equals

import io.grpc.LoadBalancer.PickResult; //導入方法依賴的package包/類
@Test
public void pickResult_equals() {
  PickResult sc1 = PickResult.withSubchannel(subchannel);
  PickResult sc2 = PickResult.withSubchannel(subchannel);
  PickResult sc3 = PickResult.withSubchannel(subchannel, tracerFactory);
  PickResult sc4 = PickResult.withSubchannel(subchannel2);
  PickResult nr = PickResult.withNoResult();
  PickResult error1 = PickResult.withError(status);
  PickResult error2 = PickResult.withError(status2);
  PickResult error3 = PickResult.withError(status2);
  PickResult drop1 = PickResult.withDrop(status);
  PickResult drop2 = PickResult.withDrop(status);
  PickResult drop3 = PickResult.withDrop(status2);

  assertThat(sc1).isNotEqualTo(nr);
  assertThat(sc1).isNotEqualTo(error1);
  assertThat(sc1).isNotEqualTo(drop1);
  assertThat(sc1).isEqualTo(sc2);
  assertThat(sc1).isNotEqualTo(sc3);
  assertThat(sc1).isNotEqualTo(sc4);

  assertThat(error1).isNotEqualTo(error2);
  assertThat(error2).isEqualTo(error3);

  assertThat(drop1).isEqualTo(drop2);
  assertThat(drop1).isNotEqualTo(drop3);

  assertThat(error1.getStatus()).isEqualTo(drop1.getStatus());
  assertThat(error1).isNotEqualTo(drop1);
}
 
開發者ID:grpc,項目名稱:grpc-java,代碼行數:31,代碼來源:LoadBalancerTest.java

示例6: picked

import io.grpc.LoadBalancer.PickResult; //導入方法依賴的package包/類
@Override
public PickResult picked(Metadata headers) {
  return PickResult.withNoResult();
}
 
開發者ID:grpc,項目名稱:grpc-java,代碼行數:5,代碼來源:GrpclbState.java


注:本文中的io.grpc.LoadBalancer.PickResult.withNoResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。