简体   繁体   English

每个应用程序的JBoss 4覆盖标准池类

[英]JBoss 4 override standard pool class per application

we are developing a set of components that can be used by our applications which currently run on Jboss 4.2.3.GA. 我们正在开发一组可以由当前在Jboss 4.2.3.GA上运行的应用程序使用的组件。

However, since JBoss 4 is quite old now, we'd like to migrate to JBoss 5+ (most likely JBoss 6.1). 但是,由于JBoss 4现在已经很老了,我们希望迁移到JBoss 5+(最有可能是JBoss 6.1)。 In that case, we have a problems with our components containing stateless session beans annotated with the JBoss specific @PoolClass annotion, which has been renamed to @Pool as of JBoss 5. 在这种情况下,我们的组件会出现问题,这些组件包含使用JBoss特定的@PoolClass注释进行注释的无状态会话Bean,该注释已从JBoss 5开始重命名为@Pool。

As you can see, using that annotation in the components introduces a dependency not only on the application server but on specific versions as well. 如您所见,在组件中使用该注释不仅会导致对应用程序服务器的依赖,而且还会导致对特定版本的依赖。 Thus I'd like to get rid of that annotation and use configuration via XML. 因此,我想摆脱该注释,并通过XML使用配置。

In that case, I'd like not to have to define a pool class per session bean, since almost all of them use the StrictMaxPool class with the same settings. 在那种情况下,我不想不必为每个会话bean定义一个池类,因为几乎所有它们都使用具有相同设置的StrictMaxPool类。 If any session bean needs a different pool or different setting, it's ok to provide a specific entry, but I'd rather not do that for the majority. 如果任何会话bean需要不同的缓冲池或不同的设置,则可以提供一个特定的条目,但是我宁愿不对大多数人这样做。

The default pool class is generally defined in ejb3-interceptors-aop.xl. 默认池类通常在ejb3-interceptors-aop.xl中定义。 However, that configuration applies to all applications deployed on that server. 但是,该配置适用于该服务器上部署的所有应用程序。

What I'd like to do now, is to define a default pool class (with default settings) per application, if possible without adding anything specific to the session beans in our components (like the JBoss specific @AspectDomain annotation). 我现在想做的是,如果可能的话,为每个应用程序定义一个默认的池类(具有默认设置),而不必在我们的组件中添加特定于会话bean的任何东西(例如JBoss特有的@AspectDomain批注)。

Is that possible and if yes, how? 那有可能吗?如果可以,怎么办?

I couldn't manage to find any useful information yet, so I'd be glad if someone could point me in the right direction. 我还找不到任何有用的信息,因此,如果有人可以向我指出正确的方向,我将感到非常高兴。

Edit: If you have information on how to do that in JBoss 5+, that would be great too, but JBoss 4 is of higher priority for now. 编辑:如果您有有关如何在JBoss 5+中执行此操作的信息,那也很好,但是现在JBoss 4具有更高的优先级。

Seems like I found a solution: 好像我找到了解决方案:

There's a problem with JBoss AOP 1.5.6 which is used by JBoss 4.2.3.GA. JBoss 4.2.3.GA使用的JBoss AOP 1.5.6存在问题。 Although there's no bug filed it seems there is one preventing the scoped use of pool definitions (it looks like the source of the problem is an inverted if-condition :) ). 尽管没有错误,但似乎有一个阻止池定义的范围使用的方法(问题的根源是一个倒置的if-condition :))。 Upgrading to JBoss AOP 2.1.8 works like a charm. 升级到JBoss AOP 2.1.8就像一个魅力。

Here's what I do: 这是我的工作:

  • Put a jboss-aop.xml file into the root of an ejb jar in the ear (we already have one that contains our persistence.xml). 将jboss-aop.xml文件放入耳朵的ejb jar的根中(我们已经有一个包含persistence.xml的文件)。
  • In the jboss-aop.xml create a domain Stateless Bean that extends from the default Stateless Bean domain and inherits all bindings and definitions 在jboss-aop.xml中创建一个域Stateless Bean ,该域从默认Stateless Bean域扩展而来,并继承所有绑定和定义。
  • Inside the extended domain override the pool class definition. 在扩展域内部,覆盖池类定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM