commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uma...@comcast.net
Subject [commons-pool]: Usage of KeyedObjectPool
Date Mon, 29 Dec 2008 01:02:18 GMT

Env:
   JDK1.6

I have a hierarchy of object types as in

      (Animal
            (mammal
                   (dog)
                   (cat)
                   ...
             )
            (oviparous
                  (..)
      )

Since a large number of such animals may need to be instantiated,
I need to maintain a pool of "animals" of different species. I assume
that the KeyedObjectPool is the right pool for such an application.

Questions:
  a) Is it generally recommended that I subclass GenericKeyedObjectPool
      (to, say, AnimalObjectPool) and pool different types of animal objects in there?
  b) If I do (a), should I also subclass BaseKeyedPoolableObjectFactory (say,
      AnimalObjectFactory)?

Is there a sample to demonstrate the usage of KeyedObjectPool? Are there any
common gotchas to watch out for?

Regards,


/U

                    

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message