cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <blorit...@apache.org>
Subject FW: [Design] ContainerManager is under fire--let's find the best resolution
Date Fri, 07 Jun 2002 14:10:11 GMT
forgot to CC

-----Original Message-----
From: Berin Loritsch [mailto:bloritsch@apache.org] 
Sent: Friday, June 07, 2002 9:50 AM
To: 'Avalon Developers List'
Subject: RE: [Design] ContainerManager is under fire--let's find the
best resolution


> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> > 
> > What's wrong with this:
> > 
> > public void do () {
> >   for (int I = 0; i < 8000; i++) {
> >     mycomp = lookup (...);
> >     info = mycomp.getIt(i);
> >     release(mycomp);
> > 
> >     info = calculate(info);
> >     print(info);
> >   }
> > }
> > 
> > Assumptions: mycomp.getIt() might use JDBC connection which are
> limited in
> > count, and calculate() takes some time, so it is really not wise to
> block
> > connection for time of the whole loop.
> > 
> > 
> > Vadim


:)  Here is where the design I am advocating is already in use.  The
DataSourceComponent is a ThreadSafe(!!!!) component that you use to get
the connection.  The DataSourceComponent can safely be looked up and
held on to for the life of the calling component.  No sweat.

So the other part of your example would be written:

public String getIt(int val)
{
    String answer;
    Connection myConn = m_datasource.getConnection();
    //    .......  All the DB logic
    myConn.close();

    return answer;
}

So there is absolutely no reason at all to have to request/release the
component on every iteration--saving yourself allot of expensive
processing on the ECM.


--
To unsubscribe, e-mail:
<mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:avalon-dev-help@jakarta.apache.org>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message