Class ResourcePool.CloseableResource<T>

  • Type Parameters:
    T - Type of underlying resource
    All Implemented Interfaces:
    java.lang.AutoCloseable
    Enclosing class:
    ResourcePool<T>

    public static class ResourcePool.CloseableResource<T>
    extends java.lang.Object
    implements java.lang.AutoCloseable
    A closeable resource wrapper class which returns the resource back to the pool automatically once it is closed. Its close method is idempotent and can be invoked multiple times without returning the resource more than once.
    • Method Detail

      • getResource

        public T getResource()
      • invalidate

        public void invalidate()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable