我有一个在其线程中运行的 MySession 对象(通用会话,而不是 Web)。我想使用 NDC 类来包含从 MySession 的字段中获取的一些数据:创建它的用户、开始时间等。我想将字段“呈现”到消息中。有可能还是仅支持消息?提前致谢
public class MySession {
String userName;
Date startTime;
public void doSomething() {
NDC.push(this); //cannot do something like this?
NDC.push(this.userName
+ " " + startTime.toString()); //or should I do this?
}
}