Class SharedSingletonObjectPool<T>

java.lang.Object
org.apache.camel.component.netty.SharedSingletonObjectPool<T>
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.commons.pool2.ObjectPool<T>

public class SharedSingletonObjectPool<T> extends Object implements org.apache.commons.pool2.ObjectPool<T>
An ObjectPool that uses a single shared instance.

This implementation will always return 1 in getNumActive() and return 0 in getNumIdle().

  • Constructor Details

    • SharedSingletonObjectPool

      public SharedSingletonObjectPool(org.apache.commons.pool2.PooledObjectFactory<T> factory)
  • Method Details

    • addObject

      public void addObject() throws Exception
      Specified by:
      addObject in interface org.apache.commons.pool2.ObjectPool<T>
      Throws:
      Exception
    • borrowObject

      public T borrowObject() throws Exception
      Specified by:
      borrowObject in interface org.apache.commons.pool2.ObjectPool<T>
      Throws:
      Exception
    • clear

      public void clear() throws Exception
      Specified by:
      clear in interface org.apache.commons.pool2.ObjectPool<T>
      Throws:
      Exception
    • 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>
    • getNumActive

      public int getNumActive()
      Specified by:
      getNumActive in interface org.apache.commons.pool2.ObjectPool<T>
    • getNumIdle

      public int getNumIdle()
      Specified by:
      getNumIdle in interface org.apache.commons.pool2.ObjectPool<T>
    • invalidateObject

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

      public void returnObject(T obj) throws Exception
      Specified by:
      returnObject in interface org.apache.commons.pool2.ObjectPool<T>
      Throws:
      Exception