Class MembershipConsumerExtension
java.lang.Object
pt.unl.fct.di.novasys.babel2.core.membership.MembershipConsumerExtension
- All Implemented Interfaces:
ProtocolExtension<MembershipConsumerBabelProtocol>, EventHandler<ProtocolEvent>
public class MembershipConsumerExtension
extends Object
implements ProtocolExtension<MembershipConsumerBabelProtocol>
ProtocolExtension that delivers membership change events to
MembershipConsumerBabelProtocol instances.
This extension intercepts three event types emitted by a membership provider:
NeighbourUp— forwarded toMembershipConsumerBabelProtocol.neighbourUp(BabelNode).NeighbourDown— forwarded toMembershipConsumerBabelProtocol.neigbourDown(BabelNode).NeighbourSet— forwarded toMembershipConsumerBabelProtocol.setNeighbours(Set), providing the current neighbour snapshot requested viaMembershipConsumerBabelProtocol.askNeighbourSet(Babel).
The extension does not handle any method-level annotations.
Register via MembershipConsumerExtensionFactory on the
BabelBootstrap.
- See Also:
-
Field Summary
Fields inherited from interface EventHandler
HANDLER_METHOD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aMembershipConsumerExtensionfor the given consumer protocol. -
Method Summary
Modifier and TypeMethodDescriptionSet<Class<? extends ProtocolEvent>> Returns the set ofProtocolEventtypes that this extension handles.voidhandleEvent(ProtocolEvent event) Dispatches a membership event to the appropriate callback on the consumer protocol.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ProtocolExtension
annotationClass, registerModifier and TypeMethodDescriptiondefault Set<Class<? extends Annotation>> Returns the set of method-level annotation types that this extension processes.default voidregister(Method method, MethodHandles.Lookup lookup, MembershipConsumerBabelProtocol protocol, BabelProtocolHolder holder, Annotation annotation) Called bySharedExecutorProtocolHolderduring initialisation for each method on the protocol that carries one of the annotations returned byProtocolExtension.annotationClass().
-
Constructor Details
-
MembershipConsumerExtension
Constructs aMembershipConsumerExtensionfor the given consumer protocol.- Parameters:
protocol- the consumer protocol that will receive membership change callbacks
-
-
Method Details
-
handleEvent
Dispatches a membership event to the appropriate callback on the consumer protocol.- Specified by:
handleEventin interfaceEventHandler<ProtocolEvent>- Specified by:
handleEventin interfaceProtocolExtension<MembershipConsumerBabelProtocol>- Parameters:
event- the event to handle; must be one ofNeighbourUp,NeighbourDown, orNeighbourSet- Throws:
IllegalArgumentException- ifeventis not a recognised membership event
-
eventsClass
Description copied from interface:ProtocolExtensionReturns the set ofProtocolEventtypes that this extension handles. Events of these types are routed toProtocolExtension.handleEvent(ProtocolEvent)instead of the protocol's own@UponBabelEvent-annotated handlers.- Specified by:
eventsClassin interfaceProtocolExtension<MembershipConsumerBabelProtocol>- Returns:
- a list of event classes; may be empty
-