Interface MembershipConsumerBabelProtocol
- All Superinterfaces:
BabelProtocol
Interface for protocols that consume a membership (overlay neighbour) service.
Implementing protocols receive neighbour change notifications and can request a snapshot of the current neighbour set:
neighbourUp(BabelNode)is called when a new neighbour joins.neigbourDown(BabelNode)is called when an existing neighbour leaves.askNeighbourSet(Babel)requests the full neighbour set from the provider; the reply is delivered viasetNeighbours(Set).
A MembershipConsumerExtensionFactory must be registered with the
BabelBootstrap for
the callbacks to be wired automatically.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaskNeighbourSet(Babel runtime) Requests the current set of neighbours from the membership provider by dispatching anAskNeighbourSetevent.voidneigbourDown(BabelNode node) Called when neighbournodehas left or become unreachable.voidneighbourUp(BabelNode node) Called when a new neighbour identified bynodehas joined the overlay and is now considered an active member.default voidsetNeighbours(Set<BabelNode> neighbours) Called with the current neighbour set in response to a previousaskNeighbourSet(Babel)call.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
Called when a new neighbour identified bynodehas joined the overlay and is now considered an active member.- Parameters:
node- the newly joined neighbour
-
neigbourDown
Called when neighbournodehas left or become unreachable.- Parameters:
node- the neighbour that has gone down
-
askNeighbourSet
Requests the current set of neighbours from the membership provider by dispatching anAskNeighbourSetevent. The provider responds asynchronously viasetNeighbours(Set).- Parameters:
runtime- theBabelruntime used to dispatch the request
-
setNeighbours
Called with the current neighbour set in response to a previousaskNeighbourSet(Babel)call. The default implementation is a no-op; override to process the received set.- Parameters:
neighbours- the current set of active neighbours
-