Class ProtonEngineHandlerContext
- java.lang.Object
-
- org.apache.qpid.protonj2.engine.impl.ProtonEngineHandlerContext
-
- All Implemented Interfaces:
EngineHandlerContext
public class ProtonEngineHandlerContext extends java.lang.Object implements EngineHandlerContext
Context for a registered EngineHandler
-
-
Field Summary
Fields Modifier and Type Field Description static intHANDLER_ALL_EVENTSThe context indicator for a handler that wants to be sent all read and write events.static intHANDLER_READSThe context indicator for a handler that wants to be sent read events.static intHANDLER_WRITESThe context indicator for a handler that wants to be sent write events.
-
Constructor Summary
Constructors Constructor Description ProtonEngineHandlerContext(java.lang.String name, Engine engine, EngineHandler handler)Creates a newProtonEngineHandlerContextwith the given options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Engineengine()voidfireEngineStarting()Fires the engine starting event into the next handler in theEnginePipelinechain.voidfireEngineStateChanged()Fires the engine state changed event into the next handler in theEnginePipelinechain.voidfireFailed(EngineFailedException failure)Fires theEnginefailed event into the next handler in theEnginePipelinechain.voidfireRead(ProtonBuffer buffer)Fires a read of ProtonBuffer events into the previous handler in theEnginePipelinefor further processing.voidfireRead(HeaderEnvelope header)Fires a read of HeaderFrame events into the previous handler in theEnginePipelinefor further processing.voidfireRead(IncomingAMQPEnvelope envelope)Fires a read of IncomingProtocolFrame events into the previous handler in theEnginePipelinefor further processing.voidfireRead(SASLEnvelope envelope)Fires a read of SASL events into the previous handler in theEnginePipelinefor further processing.voidfireWrite(ProtonBuffer buffer, java.lang.Runnable ioComplete)Fires a write of ProtonBuffer events into the next handler in theEnginePipelinefor further processing.voidfireWrite(HeaderEnvelope envelope)Fires a write of HeaderFrame events into the next handler in theEnginePipelinefor further processing.voidfireWrite(OutgoingAMQPEnvelope envelope)Fires a write ofOutgoingAMQPEnvelopeevents into the next handler in theEnginePipelinefor further processing.voidfireWrite(SASLEnvelope envelope)Fires a write ofSASLEnvelopeevents into the next handler in theEnginePipelinefor further processing.EngineHandlerhandler()intinterestMask()Allows a handler to indicate if it wants to be notified of a Engine Handler events for specific operations or opt into all engine handler events.ProtonEngineHandlerContextinterestMask(int mask)Sets the interest mask for this handler context which controls which events should be routed here during normal engine handler pipeline operations.java.lang.Stringname()
-
-
-
Field Detail
-
HANDLER_READS
public static final int HANDLER_READS
The context indicator for a handler that wants to be sent read events.- See Also:
- Constant Field Values
-
HANDLER_WRITES
public static final int HANDLER_WRITES
The context indicator for a handler that wants to be sent write events.- See Also:
- Constant Field Values
-
HANDLER_ALL_EVENTS
public static final int HANDLER_ALL_EVENTS
The context indicator for a handler that wants to be sent all read and write events.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProtonEngineHandlerContext
public ProtonEngineHandlerContext(java.lang.String name, Engine engine, EngineHandler handler)Creates a newProtonEngineHandlerContextwith the given options.- Parameters:
name- The name of thisProtonEngineHandlerContext.engine- The engine that this context is assigned to.handler- TheEngineHandlerthat thisEngineHandlerContextmanages.
-
-
Method Detail
-
handler
public EngineHandler handler()
- Specified by:
handlerin interfaceEngineHandlerContext- Returns:
- the
EngineHandlerthat is associated with the context.
-
name
public java.lang.String name()
- Specified by:
namein interfaceEngineHandlerContext- Returns:
- the name that assigned to this
EngineHandlerwhen added to theEnginePipeline.
-
engine
public Engine engine()
- Specified by:
enginein interfaceEngineHandlerContext- Returns:
- the
Enginewhere this handler is registered.
-
interestMask
public int interestMask()
Allows a handler to indicate if it wants to be notified of a Engine Handler events for specific operations or opt into all engine handler events. By opting out of the events that the handler does not process the call chain can be reduced when processing engine events.- Returns:
- the interest mask that should be used to determine if a handler should be signaled.
-
interestMask
public ProtonEngineHandlerContext interestMask(int mask)
Sets the interest mask for this handler context which controls which events should be routed here during normal engine handler pipeline operations.- Parameters:
mask- The interest mask for thisEngineHandlerContext.- Returns:
- this
ProtonEngineHandlerContextinstance.
-
fireEngineStarting
public void fireEngineStarting()
Description copied from interface:EngineHandlerContextFires the engine starting event into the next handler in theEnginePipelinechain.- Specified by:
fireEngineStartingin interfaceEngineHandlerContext
-
fireEngineStateChanged
public void fireEngineStateChanged()
Description copied from interface:EngineHandlerContextFires the engine state changed event into the next handler in theEnginePipelinechain. The state change events occur after the engine starting event and generally signify that the engine has been shutdown normally.- Specified by:
fireEngineStateChangedin interfaceEngineHandlerContext
-
fireFailed
public void fireFailed(EngineFailedException failure)
Description copied from interface:EngineHandlerContextFires theEnginefailed event into the next handler in theEnginePipelinechain.- Specified by:
fireFailedin interfaceEngineHandlerContext- Parameters:
failure- The exception that describes the conditions under which the engine failed.
-
fireRead
public void fireRead(ProtonBuffer buffer)
Description copied from interface:EngineHandlerContextFires a read of ProtonBuffer events into the previous handler in theEnginePipelinefor further processing.- Specified by:
fireReadin interfaceEngineHandlerContext- Parameters:
buffer- TheProtonBufferthat carries the bytes read.
-
fireRead
public void fireRead(HeaderEnvelope header)
Description copied from interface:EngineHandlerContextFires a read of HeaderFrame events into the previous handler in theEnginePipelinefor further processing.- Specified by:
fireReadin interfaceEngineHandlerContext- Parameters:
header- TheHeaderEnvelopethat carries the header bytes read.
-
fireRead
public void fireRead(SASLEnvelope envelope)
Description copied from interface:EngineHandlerContextFires a read of SASL events into the previous handler in theEnginePipelinefor further processing.- Specified by:
fireReadin interfaceEngineHandlerContext- Parameters:
envelope- TheSASLEnvelopethat carries the SASL performative read.
-
fireRead
public void fireRead(IncomingAMQPEnvelope envelope)
Description copied from interface:EngineHandlerContextFires a read of IncomingProtocolFrame events into the previous handler in theEnginePipelinefor further processing.- Specified by:
fireReadin interfaceEngineHandlerContext- Parameters:
envelope- TheIncomingAMQPEnvelopethat carries the AMQP performative read.
-
fireWrite
public void fireWrite(OutgoingAMQPEnvelope envelope)
Description copied from interface:EngineHandlerContextFires a write ofOutgoingAMQPEnvelopeevents into the next handler in theEnginePipelinefor further processing.- Specified by:
fireWritein interfaceEngineHandlerContext- Parameters:
envelope- TheOutgoingAMQPEnvelopethat carries the AMQP performative being written.
-
fireWrite
public void fireWrite(SASLEnvelope envelope)
Description copied from interface:EngineHandlerContextFires a write ofSASLEnvelopeevents into the next handler in theEnginePipelinefor further processing.- Specified by:
fireWritein interfaceEngineHandlerContext- Parameters:
envelope- TheSASLEnvelopethat carries the SASL performative being written.
-
fireWrite
public void fireWrite(HeaderEnvelope envelope)
Description copied from interface:EngineHandlerContextFires a write of HeaderFrame events into the next handler in theEnginePipelinefor further processing.- Specified by:
fireWritein interfaceEngineHandlerContext- Parameters:
envelope- TheHeaderEnvelopethat carries the AMQP Header being written.
-
fireWrite
public void fireWrite(ProtonBuffer buffer, java.lang.Runnable ioComplete)
Description copied from interface:EngineHandlerContextFires a write of ProtonBuffer events into the next handler in theEnginePipelinefor further processing.- Specified by:
fireWritein interfaceEngineHandlerContext- Parameters:
buffer- TheProtonBufferthat carries the bytes being written.ioComplete- An optionalRunnablecallback that is signaled when the I/O completes successfully.
-
-