【发布时间】:2012-12-04 00:50:01
【问题描述】:
如何在基于 Netty 的 TCP 服务器中实现 @SessionScoped?创建 Custom Scopes 记录在 Guice 手册中,但似乎该解决方案仅适用于基于线程而不是异步 IO 服务器。
在scope.enter() 和scope.exit() 之间创建Channel Pipeline 是否足够?
【问题讨论】:
-
Netty 支持“会话对象”吗?看起来 Channel.getId() 与 Netty 相似。因此,您可以使用example 并将 ThreadLocal 切换为
, Object>> 的映射。
标签: dependency-injection guice netty