@Test public void stateIsIdleOnIdleTimeout() { long idleTimeoutMillis = 2000L; channelBuilder.idleTimeout(idleTimeoutMillis, TimeUnit.MILLISECONDS); createChannel(); assertEquals(IDLE, channel.getState(false)); helper.updateBalancingState(CONNECTING, mockPicker); assertEquals(CONNECTING, channel.getState(false)); timer.forwardNanos(TimeUnit.MILLISECONDS.toNanos(idleTimeoutMillis)); assertEquals(IDLE, channel.getState(false)); }
@Override public ConnectivityState getState(boolean requestConnection) { ConnectivityState savedChannelState = channelStateManager.getState(); if (requestConnection && savedChannelState == IDLE) { final class RequestConnection implements Runnable { @Override public void run() { final Object argument = getArgument(); exitIdleMode(argument); if (subchannelPicker != null) { subchannelPicker.requestConnection(); } } } syncContext.execute(new RequestConnection()); } return savedChannelState; }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public ConnectivityState getState(boolean requestConnection) { ConnectivityState savedChannelState = channelStateManager.getState(); if (requestConnection && savedChannelState == IDLE) { final class RequestConnection implements Runnable { @Override public void run() { final Object argument = getArgument(); exitIdleMode(argument); if (subchannelPicker != null) { subchannelPicker.requestConnection(); } } } syncContext.execute(new RequestConnection()); } return savedChannelState; } }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public ConnectivityState getState(boolean requestConnection) { ConnectivityState savedChannelState = channelStateManager.getState(); if (requestConnection && savedChannelState == IDLE) { final class RequestConnection implements Runnable { @Override public void run() { final Object argument = getArgument(); exitIdleMode(argument); if (subchannelPicker != null) { subchannelPicker.requestConnection(); } } } syncContext.execute(new RequestConnection()); } return savedChannelState; } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public ConnectivityState getState(boolean requestConnection) { ConnectivityState savedChannelState = channelStateManager.getState(); if (requestConnection && savedChannelState == IDLE) { final class RequestConnection implements Runnable { @Override public void run() { final Object argument = getArgument(); exitIdleMode(argument); if (subchannelPicker != null) { subchannelPicker.requestConnection(); } } } syncContext.execute(new RequestConnection()); } return savedChannelState; } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); @Override ListenableFuture<ChannelStats> getStats(); @Override InternalLogId getLogId(); @Override ManagedChannelImpl shutdown(); @Override ManagedChannelImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override boolean isTerminated(); @Override ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method,
      CallOptions callOptions); @Override String authority(); @Override ConnectivityState getState(boolean requestConnection); @Override void notifyWhenStateChanged(final ConnectivityState source, final Runnable callback); @Override void resetConnectBackoff(); @Override void enterIdle(); @Override String toString(); @Override Map<String, String> getLoadBalanceModeMap(); @Override void setLoadBalanceModeMap(Map<String, String> map); @Override NameResolver getNameResolver(); @Override LoadBalancer getLoadBalancer(); }
ManagedChannelImpl extends ManagedChannel implements
    InternalInstrumented<ChannelStats> { @Override public ConnectivityState getState(boolean requestConnection) { ConnectivityState savedChannelState = channelStateManager.getState(); if (requestConnection && savedChannelState == IDLE) { final class RequestConnection implements Runnable { @Override public void run() { final Object argument = getArgument(); exitIdleMode(argument); if (subchannelPicker != null) { subchannelPicker.requestConnection(); } } } syncContext.execute(new RequestConnection()); } return savedChannelState; } ManagedChannelImpl(
      AbstractManagedChannelImplBuilder<?> builder,
      ClientTransportFactory clientTransportFactory,
      BackoffPolicy.Provider backoffPolicyProvider,
      ObjectPool<? extends Executor> balancerRpcExecutorPool,
      Supplier<Stopwatch> stopwatchSupplier,
      List<ClientInterceptor> interceptors,
      final TimeProvider timeProvider); @Override ListenableFuture<ChannelStats> getStats(); @Override InternalLogId getLogId(); @Override ManagedChannelImpl shutdown(); @Override ManagedChannelImpl shutdownNow(); @Override boolean isShutdown(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override boolean isTerminated(); @Override ClientCall<ReqT, RespT> newCall(MethodDescriptor<ReqT, RespT> method,
      CallOptions callOptions); @Override String authority(); @Override ConnectivityState getState(boolean requestConnection); @Override void notifyWhenStateChanged(final ConnectivityState source, final Runnable callback); @Override void resetConnectBackoff(); @Override void enterIdle(); @Override String toString(); @Override Map<String, String> getLoadBalanceModeMap(); @Override void setLoadBalanceModeMap(Map<String, String> map); @Override NameResolver getNameResolver(); @Override LoadBalancer getLoadBalancer();  }