Class SyncObjectPool<T>

  • All Implemented Interfaces:
    ObjectPool<T>

    public class SyncObjectPool<T>
    extends Object
    implements ObjectPool<T>
    简单的对象池这个池不处理 等待等问题因为大小都是固定的
    Author:
    lb
    Date:
    2023年12月15日
    • Constructor Detail

      • SyncObjectPool

        public SyncObjectPool​(int maxSize,
                              Callable<T> createT)
    • Method Detail

      • getInstance

        public T getInstance()
        Description copied from interface: ObjectPool
        获取一个缓存实例
        Specified by:
        getInstance in interface ObjectPool<T>
        Returns:
      • back

        public void back​(T instance)
        Description copied from interface: ObjectPool
        实例用完后返回给池
        Specified by:
        back in interface ObjectPool<T>
      • clear

        public void clear()
        Description copied from interface: ObjectPool
        清空实例
        Specified by:
        clear in interface ObjectPool<T>
      • getInstanceSize

        public int getInstanceSize()
        Description copied from interface: ObjectPool
        获取当前有多少个实例
        Specified by:
        getInstanceSize in interface ObjectPool<T>
        Returns:
      • getConcurrentSize

        public int getConcurrentSize()
        获取当前剩余的
        Specified by:
        getConcurrentSize in interface ObjectPool<T>
        Returns: