Class ReleasableRef<T extends org.elasticsearch.core.RefCounted>

java.lang.Object
org.elasticsearch.core.ReleasableRef<T>
All Implemented Interfaces:
Closeable, AutoCloseable, org.elasticsearch.core.Releasable

public final class ReleasableRef<T extends org.elasticsearch.core.RefCounted> extends Object implements org.elasticsearch.core.Releasable
Adapter to use a RefCounted in a try-with-resources block.
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.elasticsearch.core.Releasable
    • of

      public static <T extends org.elasticsearch.core.RefCounted> ReleasableRef<T> of(T resource)
    • get

      public T get()
    • toString

      public String toString()
      Overrides:
      toString in class Object