isSharable() — netty Function Reference
Architecture documentation for the isSharable() function in ChannelHandlerAdapter.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 8794f3b5_081e_5ba9_b410_2d73fa5ed955["isSharable()"] 733fd4a8_2b66_5e68_0a41_9ec76f4eeefb["ChannelHandlerAdapter"] 8794f3b5_081e_5ba9_b410_2d73fa5ed955 -->|defined in| 733fd4a8_2b66_5e68_0a41_9ec76f4eeefb f27b18fb_4b39_04d7_a9c9_7cb661254c26["ensureNotSharable()"] f27b18fb_4b39_04d7_a9c9_7cb661254c26 -->|calls| 8794f3b5_081e_5ba9_b410_2d73fa5ed955 style 8794f3b5_081e_5ba9_b410_2d73fa5ed955 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java lines 45–62
public boolean isSharable() {
/**
* Cache the result of {@link Sharable} annotation detection to workaround a condition. We use a
* {@link ThreadLocal} and {@link WeakHashMap} to eliminate the volatile write/reads. Using different
* {@link WeakHashMap} instances per {@link Thread} is good enough for us and the number of
* {@link Thread}s are quite limited anyway.
*
* See <a href="https://github.com/netty/netty/issues/2289">#2289</a>.
*/
Class<?> clazz = getClass();
Map<Class<?>, Boolean> cache = InternalThreadLocalMap.get().handlerSharableCache();
Boolean sharable = cache.get(clazz);
if (sharable == null) {
sharable = clazz.isAnnotationPresent(Sharable.class);
cache.put(clazz, sharable);
}
return sharable;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does isSharable() do?
isSharable() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java.
Where is isSharable() defined?
isSharable() is defined in transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java at line 45.
What calls isSharable()?
isSharable() is called by 1 function(s): ensureNotSharable.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free