Java ejb bean实例池jboss EAP 6.1
在我们的项目中,我们正在从JBoss5迁移到Jboss EAP 6.1。 当我浏览Jboss EAP 6.1中要使用的配置时,我偶然发现了以下内容:Java ejb bean实例池jboss EAP 6.1,java,performance,jakarta-ee,jboss7.x,Java,Performance,Jakarta Ee,Jboss7.x,在我们的项目中,我们正在从JBoss5迁移到Jboss EAP 6.1。 当我浏览Jboss EAP 6.1中要使用的配置时,我偶然发现了以下内容: <pools> <bean-instance-pools> <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="1" instance-acquisitiontimeout-unit=
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="1" instance-acquisitiontimeout-unit="MILLISECONDS"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="1" instance-acquisitiontimeout-unit="MILLISECONDS"/>
</bean-instance-pools>
</pools>
我不清楚max pool size参数。这个限制是每个部署在JBoss上的无状态EJB bean 20个实例,还是池最多只能有20个实例,而不管无状态EJB bean的数量如何。说
bean池的最大大小
另外,如果您进入EAP的管理面板,进入概要文件->容器->EJB3->Bean池->需要帮助吗
最大池大小:池可以容纳的最大bean实例数
在给定的时间点保持
我认为这意味着该池最多只能运行20个实例
编辑:回想起来,说它是每个实例的,似乎足够有说服力,你应该相信这一点。我不同意eis。 以下是Wildfly 8.2.1的代码 无状态SessionComponent.java
public StatelessSessionComponent(final StatelessSessionComponentCreateService slsbComponentCreateService) {
super(slsbComponentCreateService);
StatelessObjectFactory<StatelessSessionComponentInstance> factory = new StatelessObjectFactory<StatelessSessionComponentInstance>() {
@Override
public StatelessSessionComponentInstance create() {
return (StatelessSessionComponentInstance) createInstance();
}
@Override
public void destroy(StatelessSessionComponentInstance obj) {
obj.destroy();
}
};
final PoolConfig poolConfig = slsbComponentCreateService.getPoolConfig();
if (poolConfig == null) {
ROOT_LOGGER.debug("Pooling is disabled for Stateless EJB " + slsbComponentCreateService.getComponentName());
this.pool = null;
this.poolName = null;
} else {
ROOT_LOGGER.debug("Using pool config " + poolConfig + " to create pool for Stateless EJB " + slsbComponentCreateService.getComponentName());
this.pool = poolConfig.createPool(factory);
this.poolName = poolConfig.getPoolName();
}
this.timeoutMethod = slsbComponentCreateService.getTimeoutMethod();
this.weakAffinity = slsbComponentCreateService.getWeakAffinity();
}
公共无状态SessionComponent(最终无状态SessionComponentCreateService slsbComponentCreateService){
超级(slsbComponentCreateService);
无状态对象工厂=新的无状态对象工厂(){
@凌驾
公共无状态SessionComponentInstance创建(){
返回(无状态SessionComponentInstance)createInstance();
}
@凌驾
公共无效销毁(无状态SessionComponentInstance obj){
破坏目标();
}
};
final PoolConfig PoolConfig=slsbComponentCreateService.getPoolConfig();
if(poolConfig==null){
ROOT_LOGGER.debug(“无状态EJB禁用池”+slsbComponentCreateService.getComponentName());
this.pool=null;
this.poolName=null;
}否则{
ROOT_LOGGER.debug(“使用池配置”+poolConfig+“为无状态EJB创建池”+slsbComponentCreateService.getComponentName());
this.pool=poolConfig.createPool(工厂);
this.poolName=poolConfig.getPoolName();
}
this.timeoutMethod=slsbComponentCreateService.getTimeoutMethod();
this.weakAffinity=slsbComponentCreateService.getWeakAffinity();
}
正如我看到的,池是非静态字段,是为每种类型的组件(ejb类)创建的。过去我认为每个bean有20个池实例。我同意这是非常模糊的,命名将表明总共最多有20个池bean,但这不可能是正确的,因为当您有20多个EJB时,这将导致问题。这一部分没有被记录也是非常有用的:/它如何决定哪些bean应该被实例化?@Rips这取决于配置,bean在应用程序启动或第一次使用时被实例化。至于是否需要比池中允许的更多的豆子,我不知道哪个豆子会更受欢迎。这个解释是错误的,谢尔盖的回答是正确的。如果将“org.jboss.as.ejb3”日志级别更改为调试并启动jboss,您将看到一个语句列表,如“使用池配置StrictMaxPoolConfig{name=slsb strict max pool,maxPoolSize=20,timeoutUnit=MINUTES,timeout=5}为无状态EJB xxx创建池”,这意味着jboss正在为每种slsb类型创建一个新池。