wt.method.MethodContext的作用和意义

wt.method.MethodContext的作用和意义

官方的JavaDoc指出:它是在MethodServer中一个活动的方法调用的上下文,用以维护当前线程和与该线程相关的资源,比如数据库连接之间的关系。

Context corresponding to an active method invocation in the method server. This class maintains an association between threads and resources currently assigned to the threads such as a database connections.
This class extends java.util.Hashtable so it can be used to maintain thread local storage that pertains to a particular method invocation. Methods are free to store whatever values they need under unique keys with confidence that the references will be freed when this context is unregistered.
For RMI calls, it is created immediately before argument unmarshaling begins and is unregisted after the reply has been marshaled back to the client. For non-RMI contexts (CORBA or internal), the context must be explicitly constructed and unregistered.

对于RMI调用,MethodContext会自动创建,并在返回时自动销毁;但对于非RMI调用,该上下文需要显示的构建和销毁

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值