Class ServiceProxyPool


  • public class ServiceProxyPool
    extends java.lang.Object
    Pool containing and managing instances of CasProcessors. Managed by the container the pool facilitates check out and check in of Cas Processors.
    • Field Detail

      • mAllInstances

        private java.util.LinkedList mAllInstances
      • mFreeInstances

        private java.util.LinkedList mFreeInstances
    • Constructor Detail

      • ServiceProxyPool

        public ServiceProxyPool()
    • Method Detail

      • checkOut

        public CasProcessor checkOut()
        Checks out a Resource from the pool.
        Returns:
        a Resource for use by the client. Returns null if none are available (in which case the client may wait on this object in order to be notified when an instance becomes available).
      • checkIn

        public void checkIn​(CasProcessor aResource)
        Checks in a Resource to the pool. Also notifies other Threads that may be waiting for available instance.
        Parameters:
        aResource - - instance of the CasProcessor to check in
      • checkOut

        public CasProcessor checkOut​(long aTimeout)
        Checks out a Resource from the pool. If none is currently available, wait for the specified amount of time for one to be checked in.
        Parameters:
        aTimeout - the time to wait in milliseconds. A value of <=0 will wait forever.
        Returns:
        a Resource for use by the client. Returns null if none are available (in which case the client may wait on this object in order to be notified when an instance becomes available).
      • destroy

        public void destroy()
        Destroys all Resources in this pool.
      • getSize

        public int getSize()
        Gets the available size of this pool (the number of free, available instances at this moment).
        Returns:
        the available size of this pool
      • addCasProcessor

        public void addCasProcessor​(CasProcessor aCasProcessor)
      • getAllInstanceCount

        public int getAllInstanceCount()