Class SimpledObjectPool<T>
- java.lang.Object
-
- risesoft.data.transfer.core.util.pool.SimpledObjectPool<T>
-
- All Implemented Interfaces:
ObjectPool<T>
public class SimpledObjectPool<T> extends Object implements ObjectPool<T>
简单的对象池这个池不处理 等待等问题因为大小都是固定的- Author:
- lb
- Date:
- 2023年12月15日
-
-
Constructor Summary
Constructors Constructor Description SimpledObjectPool(int maxSize, Callable<T> createT)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidback(T instance)实例用完后返回给池voidclear()清空实例intgetConcurrentSize()获取当前剩余的TgetInstance()获取一个缓存实例intgetInstanceSize()获取当前有多少个实例
-
-
-
Method Detail
-
getInstance
public T getInstance()
Description copied from interface:ObjectPool获取一个缓存实例- Specified by:
getInstancein interfaceObjectPool<T>- Returns:
-
back
public void back(T instance)
Description copied from interface:ObjectPool实例用完后返回给池- Specified by:
backin interfaceObjectPool<T>
-
clear
public void clear()
Description copied from interface:ObjectPool清空实例- Specified by:
clearin interfaceObjectPool<T>
-
getInstanceSize
public int getInstanceSize()
Description copied from interface:ObjectPool获取当前有多少个实例- Specified by:
getInstanceSizein interfaceObjectPool<T>- Returns:
-
getConcurrentSize
public int getConcurrentSize()
获取当前剩余的- Specified by:
getConcurrentSizein interfaceObjectPool<T>- Returns:
-
-