forgot to CC -----Original Message----- From: Berin Loritsch [mailto:[EMAIL PROTECTED]] 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:[EMAIL PROTECTED]] > > > > 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:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]