Thanks for responding Armin.
>
> > Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey:
>
> your PB-pool is exhausted (configured in OJB.properties file), seems you cause an PB-leak (PB.close() was not called) or run an massive multithreaded test.
I am sure I am causing PB-leak because the RDBMS (Oracle) returns error that max number of processes (150) has been reached.
> Do you only use the ODMG-api without access of the PB-api?
For all my entities but one, I am using ODMG api. For one entity which is an enumeration type and is also refered to by all other entities I use Persistent Broker API.
Which version
> of OJB do you use?
I am using db-ojb-1.0.rc6.jar
I now think that perhaps there is something wrong with how I am creating/closing broker. This is how I am doing right now every time something has to be retrieved/stored:-
Implementation odmg = null;
Database db = null;
Transaction tx = null;
PersistenceBroker broker = null; Collection list = new ArrayList();
try {
odmg = OJB.getInstance();
db = odmg.newDatabase();
db.open("default", Database.OPEN_READ_WRITE); tx = odmg.newTransaction();
tx.begin();
// cast to get internally used PB instance
broker = ((HasBroker) tx).getBroker();
:
:
[Here I query/lock object to be updated]
:
:
tx.commit();
} catch ( ODMGException oEx) {
if (tx != null) {
tx.abort();
}
} catch(Exception ex){ if(tx != null){ tx.abort(); }
ex.printStackTrace();
}finally {
try{
if (db != null) {
db.close();
}
} catch(ODMGException oEx){
oEx.printStackTrace();
}
}
Places where I need to make a query I do this after tx.begin():->
broker = ((HasBroker) tx).getBroker(); : : QueryByCriteria query = new QueryByCriteria(objectToFind); list = broker.getCollectionByQuery(query);
Here I am not closing the broker explicitly assuming committing the transaction or closing the database as above takes care of this.
Could you please advise here what all I am doing wrong and what is causing the leak? I am thinking opening-closing database every time is also not a very smart way either. Any advice to improve that will be appreciated.
Thanks for your time and help.
Ashish
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
