startThread() — netty Function Reference
Architecture documentation for the startThread() function in GlobalEventExecutor.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 31f472df_5417_844a_9cd1_9eddb4104927["startThread()"] 408381e8_b0ab_c53d_3b6c_8d8a15aaa884["GlobalEventExecutor"] 31f472df_5417_844a_9cd1_9eddb4104927 -->|defined in| 408381e8_b0ab_c53d_3b6c_8d8a15aaa884 48cb8185_67c7_dc1b_0fe4_537c9eb85449["execute0()"] 48cb8185_67c7_dc1b_0fe4_537c9eb85449 -->|calls| 31f472df_5417_844a_9cd1_9eddb4104927 9f953b79_2e4a_57b7_6141_d89c69f7af26["run()"] 9f953b79_2e4a_57b7_6141_d89c69f7af26 -->|calls| 31f472df_5417_844a_9cd1_9eddb4104927 9f953b79_2e4a_57b7_6141_d89c69f7af26["run()"] 31f472df_5417_844a_9cd1_9eddb4104927 -->|calls| 9f953b79_2e4a_57b7_6141_d89c69f7af26 72fdbb93_fa1b_91b4_c12e_dc06d2a5f63d["setContextClassLoader()"] 31f472df_5417_844a_9cd1_9eddb4104927 -->|calls| 72fdbb93_fa1b_91b4_c12e_dc06d2a5f63d 8c3d26d7_9eb5_8b59_29b5_6800113feb3c["inEventLoop()"] 31f472df_5417_844a_9cd1_9eddb4104927 -->|calls| 8c3d26d7_9eb5_8b59_29b5_6800113feb3c style 31f472df_5417_844a_9cd1_9eddb4104927 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java lines 238–267
private void startThread() {
if (started.compareAndSet(false, true)) {
final Thread callingThread = Thread.currentThread();
ClassLoader parentCCL = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() {
return callingThread.getContextClassLoader();
}
});
// Avoid calling classloader leaking through Thread.inheritedAccessControlContext.
setContextClassLoader(callingThread, null);
try {
final Thread t = threadFactory.newThread(taskRunner);
// Set to null to ensure we not create classloader leaks by holds a strong reference to the inherited
// classloader.
// See:
// - https://github.com/netty/netty/issues/7290
// - https://bugs.openjdk.java.net/browse/JDK-7008595
setContextClassLoader(t, null);
// Set the thread before starting it as otherwise inEventLoop() may return false and so produce
// an assert error.
// See https://github.com/netty/netty/issues/4357
thread = t;
t.start();
} finally {
setContextClassLoader(callingThread, parentCCL);
}
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does startThread() do?
startThread() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java.
Where is startThread() defined?
startThread() is defined in common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java at line 238.
What does startThread() call?
startThread() calls 3 function(s): inEventLoop, run, setContextClassLoader.
What calls startThread()?
startThread() is called by 2 function(s): execute0, run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free