Class ObjectPool<T>
java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.ObjectPool<T>
A pool of objects of type
T.
When an object is borrowed from an empty pool, an object will be created by the supplied
objectCreator and returned immediately. When the pool is not empty, an object is removed
from the pool and returned. The user is expected to return the object to the pool when it is no
longer used.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
This class is not thread-safe.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
pool
-
objectCreator
-
-
Constructor Details
-
ObjectPool
-
-
Method Details
-
borrowObject
Gets an object from the pool.- Returns:
- An object from the pool, or a new object if the pool is empty
-
returnObject
-