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 int
HANDLER_ALL_EVENTS
The context indicator for a handler that wants to be sent all read and write events.static int
HANDLER_READS
The context indicator for a handler that wants to be sent read events.static int
HANDLER_WRITES
The 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 newProtonEngineHandlerContext
with the given options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Engine
engine()
void
fireEngineStarting()
Fires the engine starting event into the next handler in theEnginePipeline
chain.void
fireEngineStateChanged()
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, java.lang.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.EngineHandler
handler()
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.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.java.lang.String
name()
-
-
-
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 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 Detail
-
handler
public EngineHandler handler()
- Specified by:
handler
in interfaceEngineHandlerContext
- Returns:
- the
EngineHandler
that is associated with the context.
-
name
public java.lang.String name()
- Specified by:
name
in interfaceEngineHandlerContext
- Returns:
- the name that assigned to this
EngineHandler
when added to theEnginePipeline
.
-
engine
public Engine 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
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
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
public void fireFailed(EngineFailedException failure)
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
public void fireRead(ProtonBuffer buffer)
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
public void fireRead(HeaderEnvelope header)
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
public void fireRead(SASLEnvelope envelope)
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
public void fireRead(IncomingAMQPEnvelope envelope)
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
public void fireWrite(OutgoingAMQPEnvelope envelope)
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
public void fireWrite(SASLEnvelope envelope)
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
public void fireWrite(HeaderEnvelope envelope)
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
public void fireWrite(ProtonBuffer buffer, java.lang.Runnable ioComplete)
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.
-
-