MultithreadEventExecutorGroup Class — netty Architecture
Architecture documentation for the MultithreadEventExecutorGroup class in MultithreadEventExecutorGroup.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD dd791801_e8f4_25f4_af13_edadaaa8ab64["MultithreadEventExecutorGroup"] 307c0c07_b747_3ca8_7e17_a2d563f23ce3["MultithreadEventExecutorGroup.java"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|defined in| 307c0c07_b747_3ca8_7e17_a2d563f23ce3 041c61bd_938e_a878_9b59_628b5e1eac33["MultithreadEventExecutorGroup()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| 041c61bd_938e_a878_9b59_628b5e1eac33 d6bd8f2c_5cd1_0e4c_b574_1efef775fb2c["ThreadFactory()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| d6bd8f2c_5cd1_0e4c_b574_1efef775fb2c c0fab0fa_7aa3_15b1_369d_204823167e7b["EventExecutor()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| c0fab0fa_7aa3_15b1_369d_204823167e7b e2722acf_ca7f_8a5b_1998_99eed65b5645["iterator()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| e2722acf_ca7f_8a5b_1998_99eed65b5645 88a206e1_2842_ea71_bb2e_cf90bb3dc11b["executorCount()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| 88a206e1_2842_ea71_bb2e_cf90bb3dc11b 215845b6_aa80_726e_a039_caa60cbb8205["activeExecutorCount()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| 215845b6_aa80_726e_a039_caa60cbb8205 38b9e538_5e7c_7dcc_e830_fae7771154c3["executorUtilizations()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| 38b9e538_5e7c_7dcc_e830_fae7771154c3 a63eafdf_4a18_9562_b42d_15780994cd06["shutdownGracefully()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| a63eafdf_4a18_9562_b42d_15780994cd06 f037cc11_2796_c5ed_0e22_d368ced309e0["terminationFuture()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| f037cc11_2796_c5ed_0e22_d368ced309e0 e690759d_acd0_41b5_16ef_d6ec0101d680["shutdown()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| e690759d_acd0_41b5_16ef_d6ec0101d680 c309c0ea_00b4_546b_b6b6_1d1589f5b463["isShuttingDown()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| c309c0ea_00b4_546b_b6b6_1d1589f5b463 944babb2_4b7c_e957_1615_3a9946ed672d["isShutdown()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| 944babb2_4b7c_e957_1615_3a9946ed672d d987e5c9_8425_0433_561c_d5bad100928d["isTerminated()"] dd791801_e8f4_25f4_af13_edadaaa8ab64 -->|method| d987e5c9_8425_0433_561c_d5bad100928d
Relationship Graph
Source Code
common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java lines 37–256
public abstract class MultithreadEventExecutorGroup extends AbstractEventExecutorGroup {
private final EventExecutor[] children;
private final Set<EventExecutor> readonlyChildren;
private final AtomicInteger terminatedChildren = new AtomicInteger();
private final Promise<?> terminationFuture = new DefaultPromise(GlobalEventExecutor.INSTANCE);
private final EventExecutorChooserFactory.EventExecutorChooser chooser;
/**
* Create a new instance.
*
* @param nThreads the number of threads that will be used by this instance.
* @param threadFactory the ThreadFactory to use, or {@code null} if the default should be used.
* @param args arguments which will passed to each {@link #newChild(Executor, Object...)} call
*/
protected MultithreadEventExecutorGroup(int nThreads, ThreadFactory threadFactory, Object... args) {
this(nThreads, threadFactory == null ? null : new ThreadPerTaskExecutor(threadFactory), args);
}
/**
* Create a new instance.
*
* @param nThreads the number of threads that will be used by this instance.
* @param executor the Executor to use, or {@code null} if the default should be used.
* @param args arguments which will passed to each {@link #newChild(Executor, Object...)} call
*/
protected MultithreadEventExecutorGroup(int nThreads, Executor executor, Object... args) {
this(nThreads, executor, DefaultEventExecutorChooserFactory.INSTANCE, args);
}
/**
* Create a new instance.
*
* @param nThreads the number of threads that will be used by this instance.
* @param executor the Executor to use, or {@code null} if the default should be used.
* @param chooserFactory the {@link EventExecutorChooserFactory} to use.
* @param args arguments which will passed to each {@link #newChild(Executor, Object...)} call
*/
protected MultithreadEventExecutorGroup(int nThreads, Executor executor,
EventExecutorChooserFactory chooserFactory, Object... args) {
checkPositive(nThreads, "nThreads");
if (executor == null) {
executor = new ThreadPerTaskExecutor(newDefaultThreadFactory());
}
children = new EventExecutor[nThreads];
for (int i = 0; i < nThreads; i ++) {
boolean success = false;
try {
children[i] = newChild(executor, args);
success = true;
} catch (Exception e) {
// TODO: Think about if this is a good exception type
throw new IllegalStateException("failed to create a child event loop", e);
} finally {
if (!success) {
for (int j = 0; j < i; j ++) {
children[j].shutdownGracefully();
}
for (int j = 0; j < i; j ++) {
EventExecutor e = children[j];
try {
while (!e.isTerminated()) {
e.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
}
} catch (InterruptedException interrupted) {
// Let the caller handle the interruption.
Thread.currentThread().interrupt();
break;
}
}
}
}
}
chooser = chooserFactory.newChooser(children);
final FutureListener<Object> terminationListener = future -> {
Source
Frequently Asked Questions
What is the MultithreadEventExecutorGroup class?
MultithreadEventExecutorGroup is a class in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java.
Where is MultithreadEventExecutorGroup defined?
MultithreadEventExecutorGroup is defined in common/src/main/java/io/netty/util/concurrent/MultithreadEventExecutorGroup.java at line 37.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free