ThreadPerChannelEventLoopGroup Class — netty Architecture
Architecture documentation for the ThreadPerChannelEventLoopGroup class in ThreadPerChannelEventLoopGroup.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 087189b8_1bd9_3f4f_71bf_da2f9e819990["ThreadPerChannelEventLoopGroup"] 29edc990_f68f_aaf5_de42_1662f9fa21ac["ThreadPerChannelEventLoopGroup.java"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|defined in| 29edc990_f68f_aaf5_de42_1662f9fa21ac 172f9987_3acf_4815_d789_e63a392bd546["ThreadPerChannelEventLoopGroup()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 172f9987_3acf_4815_d789_e63a392bd546 e3fa1663_3071_49cf_56b9_1544ad610a52["EventLoop()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| e3fa1663_3071_49cf_56b9_1544ad610a52 565b0a4f_310f_ffe4_e2e0_2f4d818faf99["iterator()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 565b0a4f_310f_ffe4_e2e0_2f4d818faf99 1901a00c_536d_79e2_b2fe_7df578f6aa2c["shutdownGracefully()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 1901a00c_536d_79e2_b2fe_7df578f6aa2c 830c16db_984c_670d_1b94_c53487f291a7["terminationFuture()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 830c16db_984c_670d_1b94_c53487f291a7 f2a3df96_17cc_dbf8_9da8_93ad7b0c9adf["shutdown()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| f2a3df96_17cc_dbf8_9da8_93ad7b0c9adf fbf85bea_72fd_83f0_ca2a_ce7ea7ec7872["isShuttingDown()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| fbf85bea_72fd_83f0_ca2a_ce7ea7ec7872 381073e4_366c_7161_12a5_080f17451356["isShutdown()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 381073e4_366c_7161_12a5_080f17451356 33d8df27_6974_99b5_3395_981893ea763a["isTerminated()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 33d8df27_6974_99b5_3395_981893ea763a 550918a0_baf7_8c71_7348_49d8a45832ce["awaitTermination()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 550918a0_baf7_8c71_7348_49d8a45832ce 5492d2b5_faf8_a4d8_fca2_3f320c996006["ChannelFuture()"] 087189b8_1bd9_3f4f_71bf_da2f9e819990 -->|method| 5492d2b5_faf8_a4d8_fca2_3f320c996006
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/ThreadPerChannelEventLoopGroup.java lines 48–320
@Deprecated
public class ThreadPerChannelEventLoopGroup extends AbstractEventExecutorGroup implements EventLoopGroup {
private final Object[] childArgs;
private final int maxChannels;
final Executor executor;
final Set<EventLoop> activeChildren = ConcurrentHashMap.newKeySet();
final Queue<EventLoop> idleChildren = new ConcurrentLinkedQueue<>();
private final ChannelException tooManyChannels;
private volatile boolean shuttingDown;
private final Promise<?> terminationFuture = new DefaultPromise<Void>(GlobalEventExecutor.INSTANCE);
private final FutureListener<Object> childTerminationListener = new FutureListener<Object>() {
@Override
public void operationComplete(Future<Object> future) throws Exception {
// Inefficient, but works.
if (isTerminated()) {
terminationFuture.trySuccess(null);
}
}
};
/**
* Create a new {@link ThreadPerChannelEventLoopGroup} with no limit in place.
*/
protected ThreadPerChannelEventLoopGroup() {
this(0);
}
/**
* Create a new {@link ThreadPerChannelEventLoopGroup}.
*
* @param maxChannels the maximum number of channels to handle with this instance. Once you try to register
* a new {@link Channel} and the maximum is exceed it will throw an
* {@link ChannelException}. on the {@link #register(Channel)} and
* {@link #register(ChannelPromise)} method.
* Use {@code 0} to use no limit
*/
protected ThreadPerChannelEventLoopGroup(int maxChannels) {
this(maxChannels, (ThreadFactory) null);
}
/**
* Create a new {@link ThreadPerChannelEventLoopGroup}.
*
* @param maxChannels the maximum number of channels to handle with this instance. Once you try to register
* a new {@link Channel} and the maximum is exceed it will throw an
* {@link ChannelException} on the {@link #register(Channel)} and
* {@link #register(ChannelPromise)} method.
* Use {@code 0} to use no limit
* @param threadFactory the {@link ThreadFactory} used to create new {@link Thread} instances that handle the
* registered {@link Channel}s
* @param args arguments which will passed to each {@link #newChild(Object...)} call.
*/
protected ThreadPerChannelEventLoopGroup(int maxChannels, ThreadFactory threadFactory, Object... args) {
this(maxChannels, threadFactory == null ? null : new ThreadPerTaskExecutor(threadFactory), args);
}
/**
* Create a new {@link ThreadPerChannelEventLoopGroup}.
*
* @param maxChannels the maximum number of channels to handle with this instance. Once you try to register
* a new {@link Channel} and the maximum is exceed it will throw an
* {@link ChannelException} on the {@link #register(Channel)} and
* {@link #register(ChannelPromise)} method.
* Use {@code 0} to use no limit
* @param executor the {@link Executor} used to create new {@link Thread} instances that handle the
* registered {@link Channel}s
* @param args arguments which will passed to each {@link #newChild(Object...)} call.
*/
protected ThreadPerChannelEventLoopGroup(int maxChannels, Executor executor, Object... args) {
ObjectUtil.checkPositiveOrZero(maxChannels, "maxChannels");
if (executor == null) {
executor = new ThreadPerTaskExecutor(new DefaultThreadFactory(getClass()));
}
if (args == null) {
childArgs = EmptyArrays.EMPTY_OBJECTS;
} else {
childArgs = args.clone();
}
Source
Frequently Asked Questions
What is the ThreadPerChannelEventLoopGroup class?
ThreadPerChannelEventLoopGroup is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/ThreadPerChannelEventLoopGroup.java.
Where is ThreadPerChannelEventLoopGroup defined?
ThreadPerChannelEventLoopGroup is defined in transport/src/main/java/io/netty/channel/ThreadPerChannelEventLoopGroup.java at line 48.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free