Home / Type/ ChannelHandler Type — netty Architecture

ChannelHandler Type — netty Architecture

Architecture documentation for the ChannelHandler type/interface in ChannelHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  06b694d0_3ae2_2731_0efe_e5f35c4815e4["ChannelHandler"]
  3be2cda6_58ef_2cc4_83ae_16c0ad0c151d["ChannelHandler.java"]
  06b694d0_3ae2_2731_0efe_e5f35c4815e4 -->|defined in| 3be2cda6_58ef_2cc4_83ae_16c0ad0c151d
  style 06b694d0_3ae2_2731_0efe_e5f35c4815e4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/ChannelHandler.java lines 178–219

public interface ChannelHandler {

    /**
     * Gets called after the {@link ChannelHandler} was added to the actual context and it's ready to handle events.
     */
    void handlerAdded(ChannelHandlerContext ctx) throws Exception;

    /**
     * Gets called after the {@link ChannelHandler} was removed from the actual context and it doesn't handle events
     * anymore.
     */
    void handlerRemoved(ChannelHandlerContext ctx) throws Exception;

    /**
     * Gets called if a {@link Throwable} was thrown.
     *
     * @deprecated if you want to handle this event you should implement {@link ChannelInboundHandler} and
     * implement the method there.
     */
    @Deprecated
    void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception;

    /**
     * Indicates that the same instance of the annotated {@link ChannelHandler}
     * can be added to one or more {@link ChannelPipeline}s multiple times
     * without a race condition.
     * <p>
     * If this annotation is not specified, you have to create a new handler
     * instance every time you add it to a pipeline because it has unshared
     * state such as member variables.
     * <p>
     * This annotation is provided for documentation purpose, just like
     * <a href="http://www.javaconcurrencyinpractice.com/annotations/doc/">the JCIP annotations</a>.
     */
    @Inherited
    @Documented
    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    @interface Sharable {
        // no value
    }
}

Frequently Asked Questions

What is the ChannelHandler type?
ChannelHandler is a type/interface in the netty codebase, defined in transport/src/main/java/io/netty/channel/ChannelHandler.java.
Where is ChannelHandler defined?
ChannelHandler is defined in transport/src/main/java/io/netty/channel/ChannelHandler.java at line 178.

Analyze Your Own Codebase

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

Try Supermodel Free