Hi Vinz,
Vincent Frison wrote:
Hi all,
I have sometimes troubles with pooling. One of the most frequent exception is:
An action has failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null
It seems that I explode the broker pool capacity (altough I close brokers as soon as possible).
yep, the exception indicate that the pool is exhausted. You can get the number of active broker instances (active PB currently used, not returned to pool) with
int active = PersistenceBrokerFactoryFactory.instance().activePersistenceBroker());
you could use this to detect PB leaks.
I'm not very familiar with pooling so please don't blame me. My poor brain can just understand that there is two different pools: one for the OJB brokers and optionally another one for the JDBC connections. Okay.
yep
But there is a lot of points which are very dark.
1) Configuring the PB pool
The default values in OJB.properties looks very strange for me:
maxIdle=-1
timeBetweenEvictionRunsMillis=-1
If I read the comments, there's no limit and no eviction for idle brokers, so it it sounds for me that they can grow indefinitely (even if whenExhaustedAction != 2)! Or maybe the maxActive value limits idle brokers too?
if whenExhaustedAction != 2 the maxActive property limit the PB-pool, so idle PB always <= max active PB.
2) Configuring the JDBC connections pool
a) Regarding to OJB:
Depending on how OJB brokers handles JDBC connections, is there any rules to respect when configuring this the pools, e.g. PB pool maxActive > JDBC pool maxActive?
Think the following "rule" is common-sense
PB-pool maxActive >= connection pool maxActive <= max active concurrent DB connections.
I guess this is not mandatory since OJB brokers use JDBC connection factory (which could not use pooling btw) and close connections properly, but i'd like to be sure..
b) <jndi-datasource-name> vs. <connection-pool>:
I use OJB within Tomcat 5.0.x and I have a JNDI DataSource defined in Tomcat (DBCP Factory). If I want to use it with OJB, I have to declare it in the <jndi-datasource-name> attribute of <jdbc-connection-descriptor>. In this case does it mean that OJB don't manage the pool itself and that the <connection-pool> declaration will be ignored?
yep! http://db.apache.org/ojb/docu/guides/connection.html#ConnectionFactory
Is the ConnectionFactoryDBCPImpl mandatory in that case?
No, you could use the "PooledImpl" or "NotPooledImpl" too.
Apparently it works better if I use it (compared to ConnectionFactoryPooledImpl).
What's the difference compared with ConnectionFactoryPooledImpl
But if a JNDI DataSource - which is not implemented with DBCP - is declared in my container, should I stay with the default implementation?
as you please ;-)
regards, Armin
Thanks a lot..
Vinz
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
