Class ObjectPool<T>
- java.lang.Object
-
- org.identityconnectors.framework.impl.api.local.ObjectPool<T>
-
public class ObjectPool<T> extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObjectPool.Statistics
Statistics bean
-
Constructor Summary
Constructors Constructor Description ObjectPool(ObjectPoolHandler<T> handler, ObjectPoolConfiguration config)
Create a new ObjectPool
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectPoolEntry<T>
borrowObject()
Borrow an object from the pool.void
disposeAllObjects()
Disposes all objects in the pool.String
getPoolName()
ObjectPool.Statistics
getStatistics()
Gets a snapshot of the pool's stats at a point in time.boolean
isDisposing()
boolean
isShutdown()
Get the state of the pool.void
setPoolName(String poolName)
void
shutdown()
Closes any idle objects in the pool.String
toString()
-
-
-
Constructor Detail
-
ObjectPool
public ObjectPool(ObjectPoolHandler<T> handler, ObjectPoolConfiguration config)
Create a new ObjectPool- Parameters:
handler
- Handler for objectsconfig
- Configuration for the pool
-
-
Method Detail
-
isShutdown
public boolean isShutdown()
Get the state of the pool.- Returns:
- true if the
shutdown()
method was called before.
-
isDisposing
public boolean isDisposing()
-
getPoolName
public String getPoolName()
-
setPoolName
public void setPoolName(String poolName)
-
borrowObject
public ObjectPoolEntry<T> borrowObject()
Borrow an object from the pool.- Returns:
- An object
-
disposeAllObjects
public void disposeAllObjects()
Disposes all objects in the pool. Existing active objects will remain alive and be allowed to shutdown gracefully. Unlike shutdown, the pool will be able to work on and create new objects.
-
shutdown
public void shutdown()
Closes any idle objects in the pool. Existing active objects will remain alive and be allowed to shutdown gracefully, but no more objects will be allocated.
-
getStatistics
public ObjectPool.Statistics getStatistics()
Gets a snapshot of the pool's stats at a point in time.- Returns:
- The statistics
-
-