Class MembershipProviderExtension
java.lang.Object
pt.unl.fct.di.novasys.babel2.core.membership.MembershipProviderExtension
- All Implemented Interfaces:
ProtocolExtension<MembershipProviderBabelProtocol>, EventHandler<ProtocolEvent>
public class MembershipProviderExtension
extends Object
implements ProtocolExtension<MembershipProviderBabelProtocol>
ProtocolExtension that routes AskNeighbourSet events from
consumer protocols to the associated MembershipProviderBabelProtocol.
When a consumer protocol calls
askNeighbourSet, an
AskNeighbourSet event is dispatched through the runtime. This
extension intercepts those events and calls
getNeighbours on the
provider protocol, which is responsible for sending back a
NeighbourSet
response.
The extension does not handle any method-level annotations.
Register via MembershipProviderExtensionFactory on the
BabelBootstrap.
- See Also:
-
Field Summary
Fields inherited from interface EventHandler
HANDLER_METHOD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aMembershipProviderExtensionbound to the given provider protocol. -
Method Summary
Modifier and TypeMethodDescriptionSet<Class<? extends ProtocolEvent>> Returns the set ofProtocolEventtypes that this extension handles.voidhandleEvent(ProtocolEvent event) Handles anAskNeighbourSetevent by callingMembershipProviderBabelProtocol.getNeighbours(Class)on the provider.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, MembershipProviderBabelProtocol 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
-
MembershipProviderExtension
Constructs aMembershipProviderExtensionbound to the given provider protocol.- Parameters:
protocol- the membership provider that will receiveAskNeighbourSetcallbacks
-
-
Method Details
-
handleEvent
Handles anAskNeighbourSetevent by callingMembershipProviderBabelProtocol.getNeighbours(Class)on the provider.- Specified by:
handleEventin interfaceEventHandler<ProtocolEvent>- Specified by:
handleEventin interfaceProtocolExtension<MembershipProviderBabelProtocol>- Parameters:
event- the event to handle; must be anAskNeighbourSet- Throws:
IllegalArgumentException- ifeventis not anAskNeighbourSet
-
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<MembershipProviderBabelProtocol>- Returns:
- a list of event classes; may be empty
-