Comments (2)
可以了解下 Netty 的 EventLoop 的执行过程,以及 Netty 的串行化设计。
另外 ThreadLocal 本身就是一种解决线程安全的方案,跟 Netty 没有关系。
同一个线程中处理多个不同的请求,如果每个请求的 Handler 都能保证是线程安全的,那就是安全的,和是否使用 ThreadLocal 没有太大的关系。
from redant.
打扰到了,我还是得追问一下。
Netty既然可以在单个线程里面处理多个不同的Handler,每个Handler都有其自己的session信息,这些放在ThreadLocal里面,公用一个线程的多个Handler的session信息可能就会造成污染。
例如:Handler1在ThreadLocal里面存放了session1,而同一线程的Handler2就有可能在同一时间通过ThreadLocal取到session1,那么就造成污染。
请问,您上面提到的Handler线程安全是如何保证ThreadLocal在这里安全的?谢谢了
from redant.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redant.