@Test public void getRetryPolicies_hedgingDisabled() throws Exception { Channel channel = mock(Channel.class); ArgumentCaptor<CallOptions> callOptionsCap = ArgumentCaptor.forClass(CallOptions.class); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(RetryPolicyTest.class.getResourceAsStream( "/io/grpc/internal/test_hedging_service_config.json"), "UTF-8")); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line).append('\n'); } Object serviceConfigObj = JsonParser.parse(sb.toString()); assertTrue(serviceConfigObj instanceof Map); @SuppressWarnings("unchecked") Map<String, Object> serviceConfig = (Map<String, Object>) serviceConfigObj; ServiceConfigInterceptor serviceConfigInterceptor = new ServiceConfigInterceptor( false, 3, 4); serviceConfigInterceptor.handleUpdate(serviceConfig); MethodDescriptor.Builder<Void, Void> builder = TestMethodDescriptors.voidMethod().toBuilder(); MethodDescriptor<Void, Void> method = builder.setFullMethodName("SimpleService1/Foo1").build(); serviceConfigInterceptor.interceptCall(method, CallOptions.DEFAULT, channel); verify(channel).newCall(eq(method), callOptionsCap.capture()); assertThat(callOptionsCap.getValue().getOption(HEDGING_POLICY_KEY)).isNull(); } finally { if (reader != null) { reader.close(); } } }
@Override public String toString() { return MoreObjects.toStringHelper(this) .add("maxAttempts", maxAttempts) .add("hedgingDelayNanos", hedgingDelayNanos) .add("nonFatalStatusCodes", nonFatalStatusCodes) .toString(); }
HedgingPolicy { @Override public String toString() { return MoreObjects.toStringHelper(this) .add("maxAttempts", maxAttempts) .add("hedgingDelayNanos", hedgingDelayNanos) .add("nonFatalStatusCodes", nonFatalStatusCodes) .toString(); } }
HedgingPolicy { @Override public String toString() { return MoreObjects.toStringHelper(this) .add("maxAttempts", maxAttempts) .add("hedgingDelayNanos", hedgingDelayNanos) .add("nonFatalStatusCodes", nonFatalStatusCodes) .toString(); } HedgingPolicy(int maxAttempts, long hedgingDelayNanos, Set<Code> nonFatalStatusCodes); }
HedgingPolicy { @Override public String toString() { return MoreObjects.toStringHelper(this) .add("maxAttempts", maxAttempts) .add("hedgingDelayNanos", hedgingDelayNanos) .add("nonFatalStatusCodes", nonFatalStatusCodes) .toString(); } HedgingPolicy(int maxAttempts, long hedgingDelayNanos, Set<Code> nonFatalStatusCodes); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); }
HedgingPolicy { @Override public String toString() { return MoreObjects.toStringHelper(this) .add("maxAttempts", maxAttempts) .add("hedgingDelayNanos", hedgingDelayNanos) .add("nonFatalStatusCodes", nonFatalStatusCodes) .toString(); } HedgingPolicy(int maxAttempts, long hedgingDelayNanos, Set<Code> nonFatalStatusCodes); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }