Class PooledFactory

  • All Implemented Interfaces:
    Factory

    public class PooledFactory
    extends Object
    implements Factory
    Factory the maintains a pool of instances that are used. Can optionally create more instances than the size of the queue
    • Constructor Detail

      • PooledFactory

        public PooledFactory​(Class<?> svcClass,
                             int max)
        Pool of instances of the svcClass
        Parameters:
        svcClass - the class to create
        max - the absolute maximum number to create and pool
      • PooledFactory

        public PooledFactory​(Factory factory,
                             int max)
        Pool of instances constructed from the given factory
        Parameters:
        factory -
        max - the absolute maximum number to create and pool
      • PooledFactory

        public PooledFactory​(Factory factory,
                             int max,
                             boolean createMore)
        Pool of instances constructed from the given factory
        Parameters:
        factory -
        max - the absolute maximum number to create and pool
        createMore - If the pool is empty, but max objects have already been constructed, should more be constructed on a per-request basis (and then discarded when done) or should requests block until instances are released back into the pool.
      • PooledFactory

        public PooledFactory​(Collection<Object> objs)
        Pool constructed from the give Collection of objects.
        Parameters:
        objs - The collection of objects to pre-populate the pool