`
vyloy
  • 浏览: 78650 次
  • 性别: Icon_minigender_1
  • 来自: 佛山
社区版块
存档分类
最新评论

Mina的一个重要保证

阅读更多
MINA ensures that there will never be more than one thread simultaneously executing the decode() function for the same IoSession, but it does not guarantee that it will always be the same thread. Suppose the first piece of data is handled by thread-1 who decides it cannot yet decode, when the next piece of data arrives, it could be handled by another thread. To avoid visibility problems, you must properly synchronize access to this decoder state (IoSession attributes are stored in a ConcurrentHashMap, so they are automatically visible to other threads).

MINA会保证不会有超过1条线程,同时在为IoSession执行decode()方法。简单来说,同一个IoSession对象是支持并发操作的。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics