Interface ConnectionStateHandler

All Superinterfaces:
ComponentLifecycle
All Known Implementing Classes:
ConnectionStateHandlerImp

public interface ConnectionStateHandler extends ComponentLifecycle
Lifecycle extension point for reacting to connection state transitions.

Implementations are attached to an AdaptrisConnection and are invoked by the standard connection lifecycle (ComponentLifecycle.init(), ComponentLifecycle.start(), ComponentLifecycle.stop(), ComponentLifecycle.close()). This lets a handler observe external signals (for example reconnecting/reconnected events) and update connection state via StateManagedComponent.changeState(ComponentState) when appropriate.

  • Method Details

    • registerConnection

      void registerConnection(AdaptrisConnection connection)
      Register the owning connection instance before lifecycle methods are invoked.
      Parameters:
      connection - the connection that owns this handler
    • retrieveConnection

      <T> T retrieveConnection(Class<T> type)
      Return the registered connection as the requested type.
      Type Parameters:
      T - target type
      Parameters:
      type - the expected connection type
      Returns:
      the registered connection cast to type