Interface ObjectPool<T>

  • Type Parameters:
    T - pooled object type. Does not have to implement Recyclable in order to allow for dealing with objects that are outside of elastic apm agent (like standard JDK or third party library classes).
    All Known Implementing Classes:
    AbstractObjectPool, ListBasedObjectPool, QueueBasedObjectPool

    public interface ObjectPool<T>
    Object pool
    • Method Detail

      • createInstance

        T createInstance()
        Tries to reuse any existing instance if pool has any, otherwise creates a new un-pooled instance
        Returns:
        object instance, either from pool or freshly allocated
      • recycle

        void recycle​(T obj)
        Recycles an object
        Parameters:
        obj - object to recycle
      • getObjectsInPool

        int getObjectsInPool()
        Returns:
        number of available objects in pool
      • getGarbageCreated

        long getGarbageCreated()
        Returns:
        number of times that objects could not be returned to the pool because the pool was already full
      • clear

        void clear()