Class LeakTracker

java.lang.Object
org.elasticsearch.transport.LeakTracker

public final class LeakTracker extends Object
Leak tracking mechanism that allows for ensuring that a resource has been properly released before a given object is garbage collected.
  • Field Details

  • Method Details

    • track

      public LeakTracker.Leak track(Object obj)
      Track the given object.
      Parameters:
      obj - object to track
      Returns:
      leak object that must be released by a call to LeakTracker.Leak.close() before obj goes out of scope
    • setContextHint

      public static void setContextHint(String hint)
      Set a hint string that will be recorded with every leak that is recorded. Used by unit tests to allow identifying the exact test that caused a leak by setting the test name here.
      Parameters:
      hint - hint value
    • wrap

      public static Releasable wrap(Releasable releasable)
    • wrap

      public static RefCounted wrap(RefCounted refCounted)