Package org.qiunet.utils.pool
Class ObjectPool<T>
java.lang.Object
org.qiunet.utils.pool.ObjectPool<T>
一个简单的对象池
- Author:
- qiunet 2022/8/15 15:29
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint其它线程回收数get()获得对象protected abstract TnewObject(ObjectPool.Handle<T> handler) 为池构造一个新的对象int线程域的sizeint线程域的 stack size
-
Constructor Details
-
ObjectPool
public ObjectPool() -
ObjectPool
public ObjectPool(int maxCapacity, int queueCapacityForPerThread)
-
-
Method Details
-
newObject
为池构造一个新的对象- Parameters:
handler-- Returns:
-
threadScopeSize
public int threadScopeSize()线程域的size- Returns:
-
threadScopeStackSize
public int threadScopeStackSize()线程域的 stack size- Returns:
-
asyncThreadRecycleSize
public int asyncThreadRecycleSize()其它线程回收数- Returns:
-
get
获得对象- Returns:
-