EmbeddedChannel Class — netty Architecture
Architecture documentation for the EmbeddedChannel class in EmbeddedChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0bb3a58a_67ea_3870_31f9_00e0edf95132["EmbeddedChannel"] da14aac1_b6b5_44dd_f197_278e22c2b814["EmbeddedChannel.java"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|defined in| da14aac1_b6b5_44dd_f197_278e22c2b814 1df1d7e4_1b73_8fd8_6dfc_04020a931110["EmbeddedChannel()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 1df1d7e4_1b73_8fd8_6dfc_04020a931110 e589b24c_c557_a5b8_530c_f34cce233cc9["ChannelMetadata()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| e589b24c_c557_a5b8_530c_f34cce233cc9 6b5d6ed3_d050_ef2c_2d66_c2a7100756a4["setup()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 6b5d6ed3_d050_ef2c_2d66_c2a7100756a4 c85c6212_a011_173d_9ecd_e85b04355b01["register()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| c85c6212_a011_173d_9ecd_e85b04355b01 61bda7b0_94e1_07d9_2fc9_74acc414adb3["DefaultChannelPipeline()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 61bda7b0_94e1_07d9_2fc9_74acc414adb3 c08a99da_1612_eaad_1f64_f354bc067c31["ChannelConfig()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| c08a99da_1612_eaad_1f64_f354bc067c31 e7019352_f7bc_cb31_0ddb_d8a6e67ec806["isOpen()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| e7019352_f7bc_cb31_0ddb_d8a6e67ec806 2ab5ced9_c386_9491_74fd_f2b91a3f7db6["isActive()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 2ab5ced9_c386_9491_74fd_f2b91a3f7db6 2affe848_4b1c_81f4_e9d8_9c91aa442cdf["inboundMessages()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 2affe848_4b1c_81f4_e9d8_9c91aa442cdf 52457639_89d2_7f48_5d30_f77d5a27e0e3["lastInboundBuffer()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 52457639_89d2_7f48_5d30_f77d5a27e0e3 c4b5347e_cb73_7db4_9591_198eae7f27e1["outboundMessages()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| c4b5347e_cb73_7db4_9591_198eae7f27e1 40c100a0_9468_97f0_ba82_b8ac8c26e2c7["lastOutboundBuffer()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 40c100a0_9468_97f0_ba82_b8ac8c26e2c7 4f677ccd_7ed0_6cfd_9188_c442394bba17["T()"] 0bb3a58a_67ea_3870_31f9_00e0edf95132 -->|method| 4f677ccd_7ed0_6cfd_9188_c442394bba17
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java lines 52–1351
public class EmbeddedChannel extends AbstractChannel {
private static final SocketAddress LOCAL_ADDRESS = new EmbeddedSocketAddress();
private static final SocketAddress REMOTE_ADDRESS = new EmbeddedSocketAddress();
private static final ChannelHandler[] EMPTY_HANDLERS = new ChannelHandler[0];
private enum State { OPEN, ACTIVE, CLOSED }
private static final InternalLogger logger = InternalLoggerFactory.getInstance(EmbeddedChannel.class);
private static final ChannelMetadata METADATA_NO_DISCONNECT = new ChannelMetadata(false);
private static final ChannelMetadata METADATA_DISCONNECT = new ChannelMetadata(true);
private final EmbeddedEventLoop loop;
private final ChannelFutureListener recordExceptionListener = this::recordException;
private final ChannelMetadata metadata;
private final ChannelConfig config;
private Queue<Object> inboundMessages;
private Queue<Object> outboundMessages;
private Throwable lastException;
private State state;
private int executingStackCnt;
private boolean cancelRemainingScheduledTasks;
/**
* Create a new instance with an {@link EmbeddedChannelId} and an empty pipeline.
*/
public EmbeddedChannel() {
this(builder());
}
/**
* Create a new instance with the specified ID and an empty pipeline.
*
* @param channelId the {@link ChannelId} that will be used to identify this channel
*/
public EmbeddedChannel(ChannelId channelId) {
this(builder().channelId(channelId));
}
/**
* Create a new instance with the pipeline initialized with the specified handlers.
*
* @param handlers the {@link ChannelHandler}s which will be add in the {@link ChannelPipeline}
*/
public EmbeddedChannel(ChannelHandler... handlers) {
this(builder().handlers(handlers));
}
/**
* Create a new instance with the pipeline initialized with the specified handlers.
*
* @param hasDisconnect {@code false} if this {@link Channel} will delegate {@link #disconnect()}
* to {@link #close()}, {@code true} otherwise.
* @param handlers the {@link ChannelHandler}s which will be added to the {@link ChannelPipeline}
*/
public EmbeddedChannel(boolean hasDisconnect, ChannelHandler... handlers) {
this(builder().hasDisconnect(hasDisconnect).handlers(handlers));
}
/**
* Create a new instance with the pipeline initialized with the specified handlers.
*
* @param register {@code true} if this {@link Channel} is registered to the {@link EventLoop} in the
* constructor. If {@code false} the user will need to call {@link #register()}.
* @param hasDisconnect {@code false} if this {@link Channel} will delegate {@link #disconnect()}
* to {@link #close()}, {@code true} otherwise.
* @param handlers the {@link ChannelHandler}s which will be added to the {@link ChannelPipeline}
*/
public EmbeddedChannel(boolean register, boolean hasDisconnect, ChannelHandler... handlers) {
this(builder().register(register).hasDisconnect(hasDisconnect).handlers(handlers));
}
/**
* Create a new instance with the channel ID set to the given ID and the pipeline
* initialized with the specified handlers.
*
* @param channelId the {@link ChannelId} that will be used to identify this channel
* @param handlers the {@link ChannelHandler}s which will be added to the {@link ChannelPipeline}
Source
Frequently Asked Questions
What is the EmbeddedChannel class?
EmbeddedChannel is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java.
Where is EmbeddedChannel defined?
EmbeddedChannel is defined in transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java at line 52.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free