Class AMQDecoder<T extends MethodProcessor>
- java.lang.Object
-
- org.apache.qpid.server.protocol.v0_8.AMQDecoder<T>
-
- Direct Known Subclasses:
ServerDecoder
public abstract class AMQDecoder<T extends MethodProcessor> extends java.lang.ObjectAMQDecoder delegates the decoding of AMQP either to a data block decoder, or in the case of new connections, to a protocol initiation decoder. It is a cumulative decoder, which means that it can accumulate data to decode in the buffer until there is enough data to decode.One instance of this class is created per session, so any changes or configuration done at run time to the decoder will only affect decoding of the protocol session data to which is it bound.
TODO If protocol initiation decoder not needed, then don't create it. Probably not a big deal, but it adds to the per-session overhead.
-
-
Field Summary
Fields Modifier and Type Field Description static intFRAME_HEADER_SIZEstatic intFRAME_MIN_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description protectedAMQDecoder(boolean expectProtocolInitiation, T methodProcessor)Creates a new AMQP decoder.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intdecodable(org.apache.qpid.server.bytebuffer.QpidByteBuffer in)protected intdecode(org.apache.qpid.server.bytebuffer.QpidByteBuffer buf)TgetMethodProcessor()protected AMQFrameDecodingExceptionnewUnknownMethodException(int classId, int methodId, ProtocolVersion protocolVersion)protected intprocessAMQPFrames(org.apache.qpid.server.bytebuffer.QpidByteBuffer buf)protected voidprocessFrame(int channel, byte type, long bodySize, org.apache.qpid.server.bytebuffer.QpidByteBuffer in)protected voidprocessInput(org.apache.qpid.server.bytebuffer.QpidByteBuffer in)protected abstract voidprocessMethod(int channelId, org.apache.qpid.server.bytebuffer.QpidByteBuffer in)voidsetExpectProtocolInitiation(boolean expectProtocolInitiation)Sets the protocol initiation flag, that determines whether decoding is handled by the data decoder of the protocol initiation decoder.voidsetMaxFrameSize(int frameMax)
-
-
-
Field Detail
-
FRAME_HEADER_SIZE
public static final int FRAME_HEADER_SIZE
- See Also:
- Constant Field Values
-
FRAME_MIN_SIZE
public static final int FRAME_MIN_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AMQDecoder
protected AMQDecoder(boolean expectProtocolInitiation, T methodProcessor)Creates a new AMQP decoder.- Parameters:
expectProtocolInitiation-trueif this decoder needs to handle protocol initiation.methodProcessor- method processor
-
-
Method Detail
-
setExpectProtocolInitiation
public void setExpectProtocolInitiation(boolean expectProtocolInitiation)
Sets the protocol initiation flag, that determines whether decoding is handled by the data decoder of the protocol initiation decoder. This method is expected to be called withfalseonce protocol initiation completes.- Parameters:
expectProtocolInitiation-trueto use the protocol initiation decoder,falseto use the data decoder.
-
setMaxFrameSize
public void setMaxFrameSize(int frameMax)
-
getMethodProcessor
public T getMethodProcessor()
-
decode
protected final int decode(org.apache.qpid.server.bytebuffer.QpidByteBuffer buf) throws AMQFrameDecodingException- Throws:
AMQFrameDecodingException
-
processAMQPFrames
protected int processAMQPFrames(org.apache.qpid.server.bytebuffer.QpidByteBuffer buf) throws AMQFrameDecodingException- Throws:
AMQFrameDecodingException
-
decodable
protected int decodable(org.apache.qpid.server.bytebuffer.QpidByteBuffer in) throws AMQFrameDecodingException- Throws:
AMQFrameDecodingException
-
processInput
protected void processInput(org.apache.qpid.server.bytebuffer.QpidByteBuffer in) throws AMQFrameDecodingException, AMQProtocolVersionException
-
processFrame
protected void processFrame(int channel, byte type, long bodySize, org.apache.qpid.server.bytebuffer.QpidByteBuffer in) throws AMQFrameDecodingException- Throws:
AMQFrameDecodingException
-
processMethod
protected abstract void processMethod(int channelId, org.apache.qpid.server.bytebuffer.QpidByteBuffer in) throws AMQFrameDecodingException- Throws:
AMQFrameDecodingException
-
newUnknownMethodException
protected AMQFrameDecodingException newUnknownMethodException(int classId, int methodId, ProtocolVersion protocolVersion)
-
-