Class ProtonEngineHandlerContext
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEngineHandlerContext
- All Implemented Interfaces:
EngineHandlerContext
Context for a registered EngineHandler
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The context indicator for a handler that wants to be sent all read and write events.static final int
The context indicator for a handler that wants to be sent read events.static final int
The context indicator for a handler that wants to be sent write events. -
Constructor Summary
ConstructorDescriptionProtonEngineHandlerContext
(String name, Engine engine, EngineHandler handler) Creates a newProtonEngineHandlerContext
with the given options. -
Method Summary
Modifier and TypeMethodDescriptionengine()
void
Fires the engine starting event into the next handler in theEnginePipeline
chain.void
Fires the engine state changed event into the next handler in theEnginePipeline
chain.void
fireFailed
(EngineFailedException failure) Fires theEngine
failed event into the next handler in theEnginePipeline
chain.void
fireRead
(ProtonBuffer buffer) Fires a read of ProtonBuffer events into the previous handler in theEnginePipeline
for further processing.void
fireRead
(HeaderEnvelope header) Fires a read of HeaderFrame events into the previous handler in theEnginePipeline
for further processing.void
fireRead
(IncomingAMQPEnvelope envelope) Fires a read of IncomingProtocolFrame events into the previous handler in theEnginePipeline
for further processing.void
fireRead
(SASLEnvelope envelope) Fires a read of SASL events into the previous handler in theEnginePipeline
for further processing.void
fireWrite
(ProtonBuffer buffer, Runnable ioComplete) Fires a write of ProtonBuffer events into the next handler in theEnginePipeline
for further processing.void
fireWrite
(HeaderEnvelope envelope) Fires a write of HeaderFrame events into the next handler in theEnginePipeline
for further processing.void
fireWrite
(OutgoingAMQPEnvelope envelope) Fires a write ofOutgoingAMQPEnvelope
events into the next handler in theEnginePipeline
for further processing.void
fireWrite
(SASLEnvelope envelope) Fires a write ofSASLEnvelope
events into the next handler in theEnginePipeline
for further processing.handler()
int
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.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.name()
-
Field Details
-
HANDLER_READS
public static final int HANDLER_READSThe context indicator for a handler that wants to be sent read events.- See Also:
-
HANDLER_WRITES
public static final int HANDLER_WRITESThe context indicator for a handler that wants to be sent write events.- See Also:
-
HANDLER_ALL_EVENTS
public static final int HANDLER_ALL_EVENTSThe context indicator for a handler that wants to be sent all read and write events.- See Also:
-
-
Constructor Details
-
ProtonEngineHandlerContext
Creates a newProtonEngineHandlerContext
with the given options.- Parameters:
name
- The name of thisProtonEngineHandlerContext
.engine
- The engine that this context is assigned to.handler
- TheEngineHandler
that thisEngineHandlerContext
manages.
-
-
Method Details
-
handler
- Specified by:
handler
in interfaceEngineHandlerContext
- Returns:
- the
EngineHandler
that is associated with the context.
-
name
- Specified by:
name
in interfaceEngineHandlerContext
- Returns:
- the name that assigned to this
EngineHandler
when added to theEnginePipeline
.
-
engine
- Specified by:
engine
in interfaceEngineHandlerContext
- Returns:
- the
Engine
where 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
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
ProtonEngineHandlerContext
instance.
-
fireEngineStarting
public void fireEngineStarting()Description copied from interface:EngineHandlerContext
Fires the engine starting event into the next handler in theEnginePipeline
chain.- Specified by:
fireEngineStarting
in interfaceEngineHandlerContext
-
fireEngineStateChanged
public void fireEngineStateChanged()Description copied from interface:EngineHandlerContext
Fires the engine state changed event into the next handler in theEnginePipeline
chain. The state change events occur after the engine starting event and generally signify that the engine has been shutdown normally.- Specified by:
fireEngineStateChanged
in interfaceEngineHandlerContext
-
fireFailed
Description copied from interface:EngineHandlerContext
Fires theEngine
failed event into the next handler in theEnginePipeline
chain.- Specified by:
fireFailed
in interfaceEngineHandlerContext
- Parameters:
failure
- The exception that describes the conditions under which the engine failed.
-
fireRead
Description copied from interface:EngineHandlerContext
Fires a read of ProtonBuffer events into the previous handler in theEnginePipeline
for further processing.- Specified by:
fireRead
in interfaceEngineHandlerContext
- Parameters:
buffer
- TheProtonBuffer
that carries the bytes read.
-
fireRead
Description copied from interface:EngineHandlerContext
Fires a read of HeaderFrame events into the previous handler in theEnginePipeline
for further processing.- Specified by:
fireRead
in interfaceEngineHandlerContext
- Parameters:
header
- TheHeaderEnvelope
that carries the header bytes read.
-
fireRead
Description copied from interface:EngineHandlerContext
Fires a read of SASL events into the previous handler in theEnginePipeline
for further processing.- Specified by:
fireRead
in interfaceEngineHandlerContext
- Parameters:
envelope
- TheSASLEnvelope
that carries the SASL performative read.
-
fireRead
Description copied from interface:EngineHandlerContext
Fires a read of IncomingProtocolFrame events into the previous handler in theEnginePipeline
for further processing.- Specified by:
fireRead
in interfaceEngineHandlerContext
- Parameters:
envelope
- TheIncomingAMQPEnvelope
that carries the AMQP performative read.
-
fireWrite
Description copied from interface:EngineHandlerContext
Fires a write ofOutgoingAMQPEnvelope
events into the next handler in theEnginePipeline
for further processing.- Specified by:
fireWrite
in interfaceEngineHandlerContext
- Parameters:
envelope
- TheOutgoingAMQPEnvelope
that carries the AMQP performative being written.
-
fireWrite
Description copied from interface:EngineHandlerContext
Fires a write ofSASLEnvelope
events into the next handler in theEnginePipeline
for further processing.- Specified by:
fireWrite
in interfaceEngineHandlerContext
- Parameters:
envelope
- TheSASLEnvelope
that carries the SASL performative being written.
-
fireWrite
Description copied from interface:EngineHandlerContext
Fires a write of HeaderFrame events into the next handler in theEnginePipeline
for further processing.- Specified by:
fireWrite
in interfaceEngineHandlerContext
- Parameters:
envelope
- TheHeaderEnvelope
that carries the AMQP Header being written.
-
fireWrite
Description copied from interface:EngineHandlerContext
Fires a write of ProtonBuffer events into the next handler in theEnginePipeline
for further processing.- Specified by:
fireWrite
in interfaceEngineHandlerContext
- Parameters:
buffer
- TheProtonBuffer
that carries the bytes being written.ioComplete
- An optionalRunnable
callback that is signaled when the I/O completes successfully.
-