Interface FailedChannelDetector.ChannelStateReader<CHANNEL,STATE>

Type Parameters:
CHANNEL - The type of ManagedChannel for the shadowing
STATE - The type of ConnectivityState for the shadowing
Enclosing class:
FailedChannelDetector<CHANNEL,STATE>

public static interface FailedChannelDetector.ChannelStateReader<CHANNEL,STATE>
Class to avoid a particular import path for gRPC classes, so that different clients can use our functionality for different shadowed gRPC packages.
  • Method Summary

    Modifier and Type
    Method
    Description
    getState(CHANNEL channel, boolean requestReconnection)
    Should implement io.grpc.ManagedChannel.getState
    boolean
    isDown(STATE state)
    Check if the channel is down
    boolean
    True if the channel is shutdown.
    boolean
    True if the channel is terminated.
    void
    notifyWhenStateChanged(CHANNEL channel, STATE state, Runnable callback)
    Request a notification the next time the channel changes state, should implement ManagedChannel.notifyWhenStateChanged
  • Method Details

    • getState

      STATE getState(CHANNEL channel, boolean requestReconnection)
      Should implement io.grpc.ManagedChannel.getState
      Parameters:
      channel - the channel
      requestReconnection - true to reconnect IDLE channels
      Returns:
      channel.getState(reconnect)
    • isDown

      boolean isDown(STATE state)
      Check if the channel is down
      Parameters:
      state - a value returned by getState
      Returns:
      true if the state represents a state that is not READY for the channel
    • notifyWhenStateChanged

      void notifyWhenStateChanged(CHANNEL channel, STATE state, Runnable callback)
      Request a notification the next time the channel changes state, should implement ManagedChannel.notifyWhenStateChanged
      Parameters:
      channel - the channel
      state - a state as returned by getState
      callback - a callback to invoke on the next change of state.
    • isShutdown

      boolean isShutdown(CHANNEL channel)
      True if the channel is shutdown. Should implement ManagedChannel.isShutdown()
      Parameters:
      channel - the channel
      Returns:
      true if the channel is shutdown.
    • isTerminated

      boolean isTerminated(CHANNEL channel)
      True if the channel is terminated. Should implement ManagedChannel.isTerminated()
      Parameters:
      channel - the channel
      Returns:
      true if the channel is terminated.