J2EE / EJB +服务定位器:缓存EJB Home查找结果是否安全? [英] J2EE/EJB + service locator: is it safe to cache EJB Home lookup result?
问题描述
在J2EE应用程序中,我们在weblogic中使用EJB2。
为了避免浪费时间构建初始上下文并查找EJB Home接口,我正在考虑服务定位器模式。
但是在网上进行了一些搜索之后,我发现即使这种模式经常被推荐用于InitialContext缓存,也有一些关于EJB Home缓存的负面看法。
<问题:
- 缓存EJB Home查找结果是否安全?
- 如果我的群集节点不再有效,会发生什么?
- 如果我安装新版本的EJB而不刷新,会发生什么?服务定位器的缓存?
缓存EJB是否安全家庭查询
结果?
是。
如果我的群集
节点不再有效,会发生什么?
如果您的服务器已配置对于群集/ WLM,请求应以静默方式故障转移到群集中的另一台服务器。路由信息在存根IOR中编码。
如果我在没有刷新的情况下安装新的
版本的EJB会发生什么
服务定位器的缓存?
假设您更新bean而不是组件或home接口,那么一切都继续工作。 EJBHome实际上是一个无状态会话bean,因此如果可用,可以继续从同一服务器访问请求,如果不是,则可以在集群中的其他服务器上访问。
注意EJB3中的@EJB注入有效地鼓励了家庭缓存。 (虽然,诚然,它也允许SFSB缓存,即使这显然不正确,所以也许@EJB不是我声称的最佳支持: - ))。
In a J2EE application, we are using EJB2 in weblogic.
To avoid losing time building the initial context and looking up EJB Home interface, I'm considering the Service Locator Pattern.
But after a few search on the web I found that even if this pattern is often recommended for the InitialContext caching, there are some negative opinion about the EJB Home caching.
Questions:
- Is it safe to cache EJB Home lookup result ?
- What will happen if one my cluster node is no more working ?
- What will happen if I install a new version of the EJB without refreshing the service locator's cache ?
Is it safe to cache EJB Home lookup result ?
Yes.
What will happen if one my cluster node is no more working ?
If your server is configured for clustering/WLM, then the request should silently failover to another server in the cluster. The routing information is encoded in the stub IOR.
What will happen if I install a new version of the EJB without refreshing the service locator's cache ?
Assuming you update the bean and not the component or home interfaces, then everything continues to work. EJBHome is effectively a stateless session bean, so the request can continue to be accessed from the same server if available or on a different server in the cluster if not.
Note that the @EJB injection in EJB3 effectively encourages home caching. (Though, admittedly, it also allows SFSB caching even though this is clearly incorrect, so perhaps @EJB isn't the best support of my claim :-)).
这篇关于J2EE / EJB +服务定位器:缓存EJB Home查找结果是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!