Home / Class/ Decoder Class — netty Architecture

Decoder Class — netty Architecture

Architecture documentation for the Decoder class in BinaryMemcacheClientCodec.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4367bf83_54e6_55c7_2385_5e28b317dea2["Decoder"]
  372235a6_ca59_e557_f32c_eedb39b34c60["BinaryMemcacheClientCodec.java"]
  4367bf83_54e6_55c7_2385_5e28b317dea2 -->|defined in| 372235a6_ca59_e557_f32c_eedb39b34c60
  4e43c1ec_affb_3a7a_5a1f_60861a544d9b["Decoder()"]
  4367bf83_54e6_55c7_2385_5e28b317dea2 -->|method| 4e43c1ec_affb_3a7a_5a1f_60861a544d9b
  9da172dd_2bc2_f829_f811_8916ab7d3a66["decode()"]
  4367bf83_54e6_55c7_2385_5e28b317dea2 -->|method| 9da172dd_2bc2_f829_f811_8916ab7d3a66
  47752b82_41a6_dd61_1168_2038edf19a76["channelInactive()"]
  4367bf83_54e6_55c7_2385_5e28b317dea2 -->|method| 47752b82_41a6_dd61_1168_2038edf19a76

Relationship Graph

Source Code

codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheClientCodec.java lines 85–120

    private final class Decoder extends BinaryMemcacheResponseDecoder {

        Decoder(int chunkSize) {
            super(chunkSize);
        }

        @Override
        protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
            int oldSize = out.size();
            super.decode(ctx, in, out);

            if (failOnMissingResponse) {
                final int size = out.size();
                for (int i = oldSize; i < size; i ++) {
                    Object msg = out.get(i);
                    if (msg instanceof LastMemcacheContent) {
                        requestResponseCounter.decrementAndGet();
                    }
                }
            }
        }

        @Override
        public void channelInactive(ChannelHandlerContext ctx) throws Exception {
            super.channelInactive(ctx);

            if (failOnMissingResponse) {
                long missingResponses = requestResponseCounter.get();
                if (missingResponses > 0) {
                    ctx.fireExceptionCaught(new PrematureChannelClosureException(
                        "channel gone inactive with " + missingResponses +
                            " missing response(s)"));
                }
            }
        }
    }

Frequently Asked Questions

What is the Decoder class?
Decoder is a class in the netty codebase, defined in codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheClientCodec.java.
Where is Decoder defined?
Decoder is defined in codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/BinaryMemcacheClientCodec.java at line 85.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free