Class SingleValuePool<T>

java.lang.Object
org.apache.commons.pool2.BaseObject
org.apache.commons.pool2.BaseObjectPool<T>
com.lucidworks.apollo.util.SingleValuePool<T>
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.commons.pool2.ObjectPool<T>

public class SingleValuePool<T> extends org.apache.commons.pool2.BaseObjectPool<T>
A pool that holds a single value and return it on borrowObject. So not exactly a pool, but a way to use the pool interface when we want to share a single value.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
     
    void
     
    void
     

    Methods inherited from class org.apache.commons.pool2.BaseObjectPool

    addObject, assertOpen, clear, getNumActive, getNumIdle, isClosed, toStringAppendFields

    Methods inherited from class org.apache.commons.pool2.BaseObject

    toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.commons.pool2.ObjectPool

    addObjects, invalidateObject
  • Constructor Details

    • SingleValuePool

      public SingleValuePool(T value)
  • Method Details

    • borrowObject

      public T borrowObject()
      Specified by:
      borrowObject in interface org.apache.commons.pool2.ObjectPool<T>
      Specified by:
      borrowObject in class org.apache.commons.pool2.BaseObjectPool<T>
    • invalidateObject

      public void invalidateObject(T obj)
      Specified by:
      invalidateObject in interface org.apache.commons.pool2.ObjectPool<T>
      Specified by:
      invalidateObject in class org.apache.commons.pool2.BaseObjectPool<T>
    • returnObject

      public void returnObject(T obj)
      Specified by:
      returnObject in interface org.apache.commons.pool2.ObjectPool<T>
      Specified by:
      returnObject in class org.apache.commons.pool2.BaseObjectPool<T>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.commons.pool2.ObjectPool<T>
      Overrides:
      close in class org.apache.commons.pool2.BaseObjectPool<T>