Package co.elastic.apm.agent.objectpool
Interface ObjectPool<T>
-
- Type Parameters:
T- pooled object type. Does not have to implementRecyclablein 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()TcreateInstance()Tries to reuse any existing instance if pool has any, otherwise creates a new un-pooled instancelonggetGarbageCreated()intgetObjectsInPool()voidrecycle(T obj)Recycles an object
-
-
-
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()
-
-