Package org.qiunet.utils.pool
Class ThreadScopeObjectPool<T>
java.lang.Object
org.qiunet.utils.pool.ThreadScopeObjectPool<T>
本地线程缓存的对象池.
仅支持同一个线程获取和回收.
如果异步线程的. 请使用
ObjectPool- Author:
- qiunet 2022/8/19 09:29
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionThreadScopeObjectPool(Consumer<T> onDrop, Supplier<T> getter, int maxElement) ThreadScopeObjectPool(Supplier<T> getter) -
Method Summary
-
Constructor Details
-
ThreadScopeObjectPool
-
ThreadScopeObjectPool
-
-
Method Details
-
get
获取一个对象- Returns:
-
threadScopeSize
public int threadScopeSize()线程域的size- Returns:
-
recycle
回收对象 -
clear
public void clear()清掉所有
-