Class BroadcastProviderExtension
java.lang.Object
pt.unl.fct.di.novasys.babel2.core.broadcast.BroadcastProviderExtension
- All Implemented Interfaces:
ProtocolExtension<BroadcastProviderBabelProtocol>, EventHandler<ProtocolEvent>
public class BroadcastProviderExtension
extends Object
implements ProtocolExtension<BroadcastProviderBabelProtocol>
ProtocolExtension that routes BroadcastRequest events from
consumer protocols to the associated BroadcastProviderBabelProtocol.
When a consumer protocol calls
broadcast, a
BroadcastRequest event is dispatched through the runtime. This
extension intercepts those events and forwards each one to
uponBroadcastRequest on the provider protocol.
The extension does not handle any method annotations; its sole purpose is
to bridge the BroadcastRequest event to the provider's callback.
Register via BroadcastProviderExtensionFactory (or the convenience
method newFactory()) on the
BabelBootstrap.
- See Also:
-
Field Summary
Fields inherited from interface EventHandler
HANDLER_METHOD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aBroadcastProviderExtensionbound to the given provider protocol. -
Method Summary
Modifier and TypeMethodDescriptionSet<Class<? extends ProtocolEvent>> Returns an empty list because this extension does not declare any method annotations.voidhandleEvent(ProtocolEvent event) Handles aBroadcastRequestby forwarding the contained message toBroadcastProviderBabelProtocol.uponBroadcastRequest(BabelMessage).static ProtocolExtensionFactoryCreates a newBroadcastProviderExtensionFactorysuitable for registration withBabelBootstrap#registerExtension.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, BroadcastProviderBabelProtocol 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
-
BroadcastProviderExtension
Constructs aBroadcastProviderExtensionbound to the given provider protocol.- Parameters:
protocol- the broadcast provider this extension will forward requests to; must not benull- Throws:
NullPointerException- ifprotocolisnull
-
-
Method Details
-
handleEvent
Handles aBroadcastRequestby forwarding the contained message toBroadcastProviderBabelProtocol.uponBroadcastRequest(BabelMessage).- Specified by:
handleEventin interfaceEventHandler<ProtocolEvent>- Specified by:
handleEventin interfaceProtocolExtension<BroadcastProviderBabelProtocol>- Parameters:
event- the event to handle; must be aBroadcastRequest- Throws:
IllegalArgumentException- ifeventis not aBroadcastRequest
-
eventsClass
Returns an empty list because this extension does not declare any method annotations.- Specified by:
eventsClassin interfaceProtocolExtension<BroadcastProviderBabelProtocol>- Returns:
- an empty list
-
newFactory
Creates a newBroadcastProviderExtensionFactorysuitable for registration withBabelBootstrap#registerExtension.- Returns:
- a fresh
BroadcastProviderExtensionFactory
-