我遇到了内存泄漏问题,因为 EJB 没有从池中删除。 ejb 是 3.0 并且是无状态的。
In my jboss jmx-console 4.3, the statistics of a particular ejb looks like:
AvailableCount 30
MaxSize 30
CurrentSize 5727
CreateCount 5727
RemoveCount 0
我的问题是:为什么“删除计数”没有增加?并且“当前大小”大于“最大大小”?
最佳答案
伙计,你遇到了一个可怕的错误,其中 SLSB 没有被清除和泄漏......几周前我们在我们的生产环境中遇到了这个问题......
JBoss 甚至推荐的唯一解决方法是为您的 SLSB 使用 StrictMaxPool
而不是 ThreadLocalPool
。明智地选择计数。
你应该修改ejb3-interceptors-aop.xml
<domain name="Stateless Bean">
...
<annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
@org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=30, timeout=10000)
</annotation>
</domain>
这里有一些链接可以让您有所了解...
Stateless session bean pooling in JBoss
New instance of resources injected on every onMessage MDB call
ThreadlocalPool does not remove active BeanContext instances from InfinitePool
关于java - Stateless ejb 不删除池,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12013360/