You may want to pursue object pooling, but the prevailing conventional wisdom is that it's not really necessary. Object Pooling is important for objects that are particularly expensive to create (due to internal object requirements, like connecting to external resources) and is not really appropriate simply for "lots" of standard generic Java objects.
While instantiating an object certainly has some cost, creating and tossing them away is not overly expensive. Now, perhaps you've done some testing and found these particular objects to be problematic, but it seems to me to be a toss up between simply creating new objects versus using an object pool. Any object pool is necessarily going to at least have synchronization issues tied to it which may in the end cost more overall than creating and disposing of the objects. Modern GCs are pretty good about tossing away temporary objects. Now, if you're perhaps doing some things in a tight loop, then maybe simply a judicious use of the objects would be better. Say, rather than using a generic object pool, simply creating the few necessary instances for your loop before hand and reusing them explicity within the loop rather than constantly creating new ones. Regards, Will Hartung ([EMAIL PROTECTED]) ----- Original Message ----- From: "Felipe Schnack" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, December 20, 2002 11:00 AM Subject: object pooling Maybe I should be posting this on a commons maillist or something? Well, the problem is that I have some objects that I'm instantiaing tons of times in my application, and so, I would like to pool them. There is somewhere a good "dummies" guide to commons-pool jar? The javadocs aren't enough :-) -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universit�rio Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
