public abstract class FrameDecoder
extends io.netty.channel.ChannelInboundHandlerAdapter
InboundMessageHandler
for processing.
Handles work stashing, and together with InboundMessageHandler
- flow control.
Unlike most Netty inbound handlers, doesn't use the pipeline to talk to its
upstream handler. Instead, a FrameDecoder.FrameProcessor
must be registered with
the frame decoder, to be invoked on new frames. See deliver(FrameProcessor)
.
See activate(FrameProcessor)
, reactivate()
, and FrameDecoder.FrameProcessor
for flow control implementation.
Five frame decoders currently exist, one used for each connection depending on flags and messaging version:
1. FrameDecoderCrc
:
no compression; payload is protected by CRC32
2. FrameDecoderLZ4
:
LZ4 compression with custom frame format; payload is protected by CRC32
3. FrameDecoderUnprotected
:
no compression; no integrity protection
4. FrameDecoderLegacy
:
no compression; no integrity protection; turns unframed streams of legacy messages (< 4.0) into frames
5. FrameDecoderLegacyLZ4
LZ4 compression using standard LZ4 frame format; groups legacy messages (< 4.0) into framesModifier and Type | Class and Description |
---|---|
static class |
FrameDecoder.CorruptFrame
A corrupted frame was encountered; this represents the knowledge we have about this frame,
and whether or not the stream is recoverable.
|
static class |
FrameDecoder.Frame |
static interface |
FrameDecoder.FrameProcessor |
static class |
FrameDecoder.IntactFrame
The payload bytes of a complete frame, i.e.
|
Modifier and Type | Field and Description |
---|---|
protected BufferPoolAllocator |
allocator |
Modifier and Type | Method and Description |
---|---|
void |
activate(FrameDecoder.FrameProcessor processor)
For use by InboundMessageHandler (or other upstream handlers) that want to start receiving frames.
|
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object msg)
Called by Netty pipeline when a new message arrives; we anticipate in normal operation
this will receive messages of type
BufferPoolAllocator.Wrapped or
BufferPoolAllocator.Wrapped . |
void |
channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) |
void |
discard()
For use by InboundMessageHandler (or other upstream handlers) that want to permanently
stop receiving frames, e.g.
|
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
boolean |
isActive() |
void |
reactivate()
For use by InboundMessageHandler (or other upstream handlers) that want to resume
receiving frames after previously indicating that processing should be paused.
|
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerRemoved, isSharable
protected final BufferPoolAllocator allocator
public boolean isActive()
public void activate(FrameDecoder.FrameProcessor processor)
public void reactivate() throws java.io.IOException
java.io.IOException
public void discard()
public void channelRead(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg) throws java.io.IOException
BufferPoolAllocator.Wrapped
or
BufferPoolAllocator.Wrapped
.
These buffers are unwrapped and passed to decode(Collection, ShareableBytes)
,
which collects decoded frames into frames
, which we send upstream in deliver(org.apache.cassandra.net.FrameDecoder.FrameProcessor)
channelRead
in interface io.netty.channel.ChannelInboundHandler
channelRead
in class io.netty.channel.ChannelInboundHandlerAdapter
java.io.IOException
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
channelReadComplete
in interface io.netty.channel.ChannelInboundHandler
channelReadComplete
in class io.netty.channel.ChannelInboundHandlerAdapter
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
handlerAdded
in interface io.netty.channel.ChannelHandler
handlerAdded
in class io.netty.channel.ChannelHandlerAdapter
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.channel.ChannelInboundHandlerAdapter
Copyright © 2009- The Apache Software Foundation