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 TypeMethodDescriptiondefault voidconnectionDown(BabelNode peer, @Nullable Throwable cause) Invoked when a previously established connection topeerhas been closed, either locally or remotely.default voidconnectionFailed(BabelNode peer, @Nullable Throwable cause) Invoked when an outgoing connection attempt topeerfailed before a connection could be established.default voidconnectionUp(BabelNode peer) Invoked when an outgoing connection topeerhas been established successfully through the protocol's assignedBabelChannel.default voidinit(Babel runtime, ComposedBabelChannel channel) Initiates the protocol's logic and execution.default voidpause()Suspends the protocol's operations.default voidresume(Babel runtime, ComposedBabelChannel channel) Reinstates the protocol's execution from a paused state.default voidstop()Completely halt the protocols execution.
-
Method Details
-
init
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 runtimechannel- 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
Reinstates the protocol's execution from a paused state. If the protocol is currently active, this call has no effect.- Parameters:
runtime- the Babel runtimechannel- the channel assigned to this protocol
-
stop
default void stop()Completely halt the protocols execution. To restart, callinit(Babel, ComposedBabelChannel)again. -
connectionUp
Invoked when an outgoing connection topeerhas been established successfully through the protocol's assignedBabelChannel.- Parameters:
peer- the remote node whose connection is now available
-
connectionFailed
-
connectionDown
Invoked when a previously established connection topeerhas been closed, either locally or remotely.- Parameters:
peer- the remote node whose connection was lostcause- the exception that caused the disconnection, ornullif the disconnection was deliberate
-