Interface MembershipProviderBabelProtocol
- All Superinterfaces:
BabelProtocol
Interface for protocols that implement a membership (overlay neighbour) service.
A membership provider manages the set of active neighbours and notifies consumer protocols of changes:
- Call
neighbourUp(Babel, BabelNode)when a node joins to notify all consumers. - Call
neighbourDown(Babel, BabelNode)when a node leaves to notify all consumers. - Override
getNeighbours(Class)to respond toMembershipConsumerBabelProtocol.askNeighbourSet(Babel)requests.
A MembershipProviderExtensionFactory must be registered with the
BabelBootstrap for
getNeighbours to be invoked automatically on AskNeighbourSet
events.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidgetNeighbours(Class<? extends MembershipConsumerBabelProtocol> askingProtocol) Called by theMembershipProviderExtensionwhen a consumer protocol requests the current neighbour set viaMembershipConsumerBabelProtocol.askNeighbourSet(Babel).default voidneighbourDown(Babel runtime, BabelNode node) Notifies all registered consumer protocols thatnodehas left the overlay by dispatching aNeighbourDownevent.default voidneighbourUp(Babel runtime, BabelNode node) Notifies all registered consumer protocols thatnodehas joined the overlay by dispatching aNeighbourUpevent.Methods inherited from interface BabelProtocol
connectionDown, connectionFailed, connectionUp, init, pause, resume, stopModifier 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
-
neighbourUp
Notifies all registered consumer protocols thatnodehas joined the overlay by dispatching aNeighbourUpevent.- Parameters:
runtime- theBabelruntime used to dispatch the eventnode- the new neighbour
-
neighbourDown
Notifies all registered consumer protocols thatnodehas left the overlay by dispatching aNeighbourDownevent.- Parameters:
runtime- theBabelruntime used to dispatch the eventnode- the neighbour that left
-
getNeighbours
Called by theMembershipProviderExtensionwhen a consumer protocol requests the current neighbour set viaMembershipConsumerBabelProtocol.askNeighbourSet(Babel).The default implementation is a no-op. Override to collect the current neighbour set and call
MembershipConsumerBabelProtocol.setNeighbours(Set)on the asking protocol.- Parameters:
askingProtocol- the class of the consumer protocol requesting the neighbour set
-