Pools are used to manage objects that do processing, have internal state and can only be used by one thread at a time.
Things like parsers, handlers, all kinds of connections/connectors, ...
Static data used by multiple threads at the same should be put in a kind of cache. (refactored out of the processing objects)
Your factory then can quickly create the needed processing objects by getting the needed data from the cache.
You can start with a simple singleton or hashtable. In a distributed system you can use a more advanced cache to manage the data.
Something like JCS - Java Caching System: http://jakarta.apache.org/turbine/jcs/index.html
In a J2EE environment then you can also try to use entity beans for your data needs but carefully test your J2EE server to see if it has a good cache.
Dirk
Steve Maring wrote:
I've created a synchronized factory that is responsible for creating object pools and returning pool instances to clients wanting to borrow objects from the pool. However, I was wondering if anyone could comment of best practices for seeding and clustering.
SEEDING Some of my pools contain objects that represent the result sets of common long running queries. Of coarse, if the pool receives multiple requests to borrow objects out of these pools before a makeObject can complete, I see an explosion of resources while all the requests end up running makeObject and ultimately end up throwing away most of those objects from the pool once things cool down. I'd like to prime the object pool in the same synchronized method that creates the pool. However, executing a number of threads to borrowObject in order to seed the pool seems a bit odd. Is there a more elegant way to invoke the makeObject?
CLUSTERING I'm deploying these object pools into a clustered J2EE app. Therefore, every node in the cluster ends up with it's own object pool. This is not a terrible thing for non-keyed object pools, but makes the notion of a KeyedObjectPool seem kind of silly. Can anyone recommend a strategy for singleton object pools across a cluster?
Many Thanks. Steve Maring Tampa, FL
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
