db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: WG: OJB 1.0.3 - Class PersistenceBrokerAbstractImpl - array temporaryStateListeners
Date Mon, 25 Jul 2005 12:29:50 GMT
Hi Thomas,

> I trace the problem to the array temporaryStateListeners getting really
> huge ( more than 300000 entries). This array is populated by the 
> creation of org.apache.ojb.broker.accesslayer.RsIterator which register 
> itself with PersistenceBrokerAbstractImpl.addListener() and never call 
> removeListener().
> 

yep, RsIterator add itself as listener to be able to close used 
resources (e.g ResultSet) on close of the used PB instance. This is 
needed when a user doesn't do a "full iteration" on the ResultSet. In 
this case the used resources still open and ready for use, but on 
PB.close() it's safe to close all used resources.


> In PersistenceBrokerAbstractImpl, there is permanent and temporary 
> listeners; maybe the temporary listeners must be deleted at the end of 
> fireBrokerEvent() or something like that?

The temporary listener will be deleted at PB.close().

> By the way, why permanent and 
> temporary ?

We use an PB-pool, so it's not guaranteed that always the same PB 
instances will be returned. You have to add the listener to each PB 
instance in the pool and to each new created PB instance --> permanent 
PB-listener.
But this could cause bad performance, so many times it's sufficient to 
add the listener only to the current used PB instance and OJB automatic 
remove this listener on PB.close() --> temporary listener.

> 
> Anyway, I use `brute force' by calling removeAllListeners() after every 
> 1000 iterations. And now, performances are back to normal.
> 

If you always lookup a new PB instance at begin and close it at the end 
of one each iteration you will see the same effect.

I will have a look in RsIterator to optimize the handling of the 
listener. If the user iterate the whole ResultSet then the RsIterator 
clean up resources by itself (calling #releaseDbResources()). In this 
case the resource listener can be removed from the PB instance. 
Currently this is not happen.

regards,
Armin

> Thank you for your time,
> 
> Henri
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message