Class NettyExecutorProtocolHolder
java.lang.Object
pt.unl.fct.di.novasys.babel2.core.AbstractBabelProtocolHolder
pt.unl.fct.di.novasys.babel2.core.NettyExecutorProtocolHolder
- All Implemented Interfaces:
BabelProtocolHolder
Protocol holder implementation executing protocol event handlers on a Netty
EventLoopGroup.
Uses a high-performance lock-free MPSC event queue to serialize event processing on the Netty event loop.
-
Field Summary
Fields inherited from class AbstractBabelProtocolHolder
protocol -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNettyExecutorProtocolHolder(BabelProtocol protocol, Set<ProtocolExtension<? extends BabelProtocol>> extensions, io.netty.channel.EventLoopGroup executor, int maxQueueCapacity) Constructs a new Netty executor protocol holder. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeliverEvent(BabelEvent event) Enqueues or delivers an event to the underlying protocol.Methods inherited from class AbstractBabelProtocolHolder
createHandler, eventHandlers, getInnerProtocol, holdsProtocol, interestedEvents, interestedInMessages, interestedOutFailedMessages, interestedOutSuccessMessages, invokeHandler, invokeHandler, invokeHandler, invokeHandlerModifier and TypeMethodDescription<T> TcreateHandler(Method method, MethodHandles.Lookup lookup, Class<? extends BabelProtocol> protocolClass, Class<T> handlerInterface, String handlerMethodName, Class<?>[] erasedParamType, Class<?>[] actualParamType) Creates a typed functional-interface handler for the given method usingLambdaMetafactory.Map<Class<? extends ProtocolEvent>, EventHandler<? extends ProtocolEvent>> Returns the mapping of handledProtocolEventclasses to their compiled event handlers.Returns the underlying protocol instance managed by this holder.booleanholdsProtocol(Class<? extends BabelProtocol> protocolClass) Returns whether this holder manages a protocol that is an instance of or assignable to the given protocol class.Set<Class<? extends ProtocolEvent>> Returns the set ofProtocolEventclasses that this protocol has registered interest in.Set<Class<? extends BabelMessage>> Returns the set ofBabelMessageclasses that this protocol is interested in receiving.Set<Class<? extends BabelMessage>> Returns the set ofBabelMessageclasses for which this protocol handles delivery failure.Set<Class<? extends BabelMessage>> Returns the set ofBabelMessageclasses for which this protocol handles successful delivery.protected voidinvokeHandler(MessageInEvent event) Invokes the compiled handler for the specified inbound message event.protected voidInvokes the compiled handler for the specified outbound message failure event.protected voidInvokes the compiled handler for the specified outbound message success event.protected voidinvokeHandler(ProtocolEvent event) Invokes the compiled handler for the specified protocol event.
-
Constructor Details
-
NettyExecutorProtocolHolder
protected NettyExecutorProtocolHolder(BabelProtocol protocol, Set<ProtocolExtension<? extends BabelProtocol>> extensions, io.netty.channel.EventLoopGroup executor, int maxQueueCapacity) Constructs a new Netty executor protocol holder.- Parameters:
protocol- the managed protocol instanceextensions- registered protocol extensionsexecutor- the Netty event loop group executing event handlersmaxQueueCapacity- maximum capacity of the internal event queue
-
-
Method Details
-
deliverEvent
Description copied from interface:BabelProtocolHolderEnqueues or delivers an event to the underlying protocol.- Parameters:
event- the event to deliver
-