cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject Re: [PATCH] Re: [C2][Xalan2] Xalan2J problems under heavy load using Apache JMeter
Date Fri, 16 Mar 2001 15:37:17 GMT
Berin Loritsch wrote:
> Santiago Gala wrote:
> >
> > Berin Loritsch wrote:
> >
> > I would reimplement it completely, locking the whole set of operations.
> > A good way to start is to change public methods init(), get(), put(),
> > dispose() to synchronized methods and wrapping the while in run() in a
> > synchronized( this ).

I made some extensive changes to the JdbcDataSourcePool code, using the
Avalon Lock implementation (and I corrected a synchronization error there).

I changed the Thread that monitored the class to simply create the full number
of datasources.  It does it asynchronously, so that the pool acts like a "Future"
object.  When the pool is fully populated, it marks itself m_initialized = true.
When someone tries to get() and the object has not been initialized the pool
checks to see if the asynchronous initialization is done.  If the thread has
not been created we throw an IllegalStateException, otherwise we wait for
the thread to finish.  We also check to see if the pool is disposed.  If not,
then we procede to get an object.  Since we are not dealing with the possibility
of growing the pool, the get() code is simplified a bit.

When someone tries to put() an object, the code checks to see if the pool has
been initialized--if not, it throws an IllegalStateException (How can we receive
an object if it never was created?).  It then checks to see if the pool has been
disposed.  If it has, it destroys the JdbcConnection, otherwise it returns it
to the pool.

Hopefully this will satisfy most of the race conditions.

To unsubscribe, e-mail:
For additional commands, email:

View raw message