Hi all. I've been some time testing with OJB rc4 and now I'm trying it in production environment, but i'm having some troubles.
The system it's a tomcat struts-based application. The user interact
finally ends with a interaction with an object with methods like
"getProductCollection" or "updateProduct". This object does not contain
any field, just methods.
Each of this methods interfaces with a MySQL server 4 using OJB.
A typical piece of code in one of this methods:
...
PersistenceBroker broker = null;
try {
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
Iterator iter = broker.getCollectionByQuery(query);
while (iter.hasNext()) {
do_things
}
catch (some exceptions) {
}
finally {
if (broker != null) {
broker.close();
}
}
...
So I think all of them are thread-safe.
I suppose the previous piece of code should get a broker from the pool
or instanciate a new one if there is any of them "free", use it and get
it back to the pool with broker.close.
What I get is each call to
PersistenceBrokerFactory.defaultPersistenceBroker() instances a new
broker from the pool. I've this debug message:
[org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl] INFO:
Create new PB instance for PBKey org.apache.ojb.broker.PBKey:
jcdAlias=default, user=xxxxx, password=*****, already created
persistence broker instances: 71
And when instances reach maxActive value defined in OJB.properties, I
get the next exception:
[org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl] DEBUG:
createPersistenceBroker(key) called
java.util.NoSuchElementException
at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.defaultPersistenceBroker(Unknown
Source)
....
I've defined in OBJ.properties the next values for broker pool:
maxActive=20
maxIdle=3
maxWait=30
timeBetweenEvictionRunsMillis=10000
minEvictableIdleTimeMillis=10
whenExhaustedAction=0
Could someone tell me why are not the brokers returning to the pool?
Am I right in my assumptions???
signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente
