Interface BabelProtocol

All Known Subinterfaces:
BroadcastConsumerBabelProtocol, BroadcastProviderBabelProtocol, MembershipConsumerBabelProtocol, MembershipProviderBabelProtocol, ResolverProviderBabelProtocol, SignedMessageBabelProtocol
All Known Implementing Classes:
LocalNetworkDiscoveryProtocol

public interface BabelProtocol
Defines the lifecycle and configuration requirements for a protocol within the Babel framework.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    connectionDown(BabelNode peer, @Nullable Throwable cause)
    Invoked when a previously established connection to peer has been closed, either locally or remotely.
    default void
    connectionFailed(BabelNode peer, @Nullable Throwable cause)
    Invoked when an outgoing connection attempt to peer failed before a connection could be established.
    default void
    Invoked when an outgoing connection to peer has been established successfully through the protocol's assigned BabelChannel.
    default void
    init(Babel runtime, ComposedBabelChannel channel)
    Initiates the protocol's logic and execution.
    default void
    Suspends the protocol's operations.
    default void
    resume(Babel runtime, ComposedBabelChannel channel)
    Reinstates the protocol's execution from a paused state.
    default void
    Completely halt the protocols execution.
  • Method Details

    • init

      default void init(Babel runtime, ComposedBabelChannel channel)
      Initiates the protocol's logic and execution. This method is managed internally by the Babel runtime and should not be invoked directly by external components.
      Parameters:
      runtime - the Babel runtime
      channel - the channel assigned to this protocol
    • pause

      default void pause()
      Suspends the protocol's operations. If the protocol is already in a paused state, this call has no effect.
    • resume

      default void resume(Babel runtime, ComposedBabelChannel channel)
      Reinstates the protocol's execution from a paused state. If the protocol is currently active, this call has no effect.
      Parameters:
      runtime - the Babel runtime
      channel - the channel assigned to this protocol
    • stop

      default void stop()
      Completely halt the protocols execution. To restart, call init(Babel, ComposedBabelChannel) again.
    • connectionUp

      default void connectionUp(BabelNode peer)
      Invoked when an outgoing connection to peer has been established successfully through the protocol's assigned BabelChannel.
      Parameters:
      peer - the remote node whose connection is now available
    • connectionFailed

      default void connectionFailed(BabelNode peer, @Nullable Throwable cause)
      Invoked when an outgoing connection attempt to peer failed before a connection could be established.
      Parameters:
      peer - the remote node that could not be reached
      cause - the underlying exception describing the failure
    • connectionDown

      default void connectionDown(BabelNode peer, @Nullable Throwable cause)
      Invoked when a previously established connection to peer has been closed, either locally or remotely.
      Parameters:
      peer - the remote node whose connection was lost
      cause - the exception that caused the disconnection, or null if the disconnection was deliberate