From commons-user-return-7626-apmail-jakarta-commons-user-archive=jakarta.apache.org@jakarta.apache.org Thu May 06 22:44:55 2004 Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 39129 invoked from network); 6 May 2004 22:44:54 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 May 2004 22:44:54 -0000 Received: (qmail 14934 invoked by uid 500); 6 May 2004 22:44:38 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 14894 invoked by uid 500); 6 May 2004 22:44:38 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 14877 invoked from network); 6 May 2004 22:44:37 -0000 Received: from unknown (HELO wasp.cpitt.uq.edu.au) (152.98.194.130) by daedalus.apache.org with SMTP; 6 May 2004 22:44:37 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [POOL] Initial Pool size Date: Fri, 7 May 2004 08:44:41 +1000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [POOL] Initial Pool size Thread-Index: AcQzjSa4s1GEOi0eQtKF63GkYFhoqgALgfYg From: "Vikram Goyal" To: "Jakarta Commons Users List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Thanks for your response Dirk. However, as I said in my post, the evictor thread is not guaranteed to run, because it is not run unless the default values are changed. I think that the Pool component needs to have an initialSize property to allow the pool to be populated at start-up, irrespective of the minIdle property. Of course, the initialSize should be between the minIdle and maxIdle properties. Regards, Vikram -----Original Message----- From: Dirk Verbeeck [mailto:dirk.verbeeck@pandora.be]=20 Sent: Friday, 7 May 2004 3:11 AM To: Jakarta Commons Users List Subject: Re: [POOL] Initial Pool size The MinIdle property is used to maintain a minimum number of idle=20 object in the pool ready to be used. So when the evictor thread runs=20 (every x milliseconds) it will test the existing idle objects and=20 add/remove when needed. There is no initialSize property on GenericObjectPool. But you can use the addObject method to populate the pool. for (int i =3D 0 ; i < initialSize ; i++) { pool.addObject(); } The BasicDataSource implementation will have a initialSize property in=20 version 1.2 (currently in nightly build): http://cvs.apache.org/viewcvs.cgi/jakarta-commons/dbcp/src/java/org/apac he/commons/dbcp/BasicDataSource.java?r1=3D1.32&r2=3D1.33&diff_format=3Dh Cheers Dirk Vikram Goyal wrote: > * Resending email sent to commons-dev * >=20 > Hello,=20 >=20 > My query regarding the initial size of a pool seems so basic that I am > sure that I am wasting your time. However, I have scoured the source > code for both Pool and DBCP for the better part of a day and I am having > trouble understanding how the initial size of a pool is maintained. I > apologize in advance if the answer should be right in front of my eyes > and I can't see it. >=20 > At the moment, as I understand it, the only way to set the initial size > of a pool is by the following code: >=20 > pool.setMinIdle(5); // some random number >=20 > pool.setTimeBetweenEvictionRunsMillis(200L); // basically set to a > non-negative value >=20 > As per the documentation and the code, the pool will only be initialized > with the min idle value of 5 as specified above IF an Evictor thread is > started. This can only happen by overriding the default value of -1 for > "time between eviction runs millis" property of the pool. >=20 >=20 > Is this assumption correct? Technically, this means that, with the > default settings in place, no objects are present in the initial pool, > as minIdle is set to 0 and the eviction thread is not started because it > is only started for non-negative values of the above property. With > these default settings, it also means that objects are added to the > pool, only when they are requested the first time. This solves the > purpose of reusability, provided the borrowed objects are returned, it > gives slower response time for initial objects. >=20 > This seems to me an odd way of initializing the pool. Why would you want > the Evictor thread to initialize the pool as a side effect of its main > work of evicting idle objects? Shouldn't the pool initialize itself > based on an initial pool size property? >=20 > Regards, > Vikram --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org