Class ResourceTracker

java.lang.Object
ecmwf.common.technical.ResourceTracker

public class ResourceTracker extends Object
Utility to track resource usage: open, closed, and peak concurrent count.
  • Constructor Details

    • ResourceTracker

      public ResourceTracker(Class<?> clazz)
      Instantiates a new resource tracker.
      Parameters:
      clazz - the clazz
    • ResourceTracker

      public ResourceTracker(Class<?> clazz, int debugFrequency)
      Instantiates a new resource tracker.
      Parameters:
      clazz - the clazz
      debugFrequency - the debug frequency
  • Method Details

    • onOpen

      public void onOpen()
      Call this when a resource is opened.
    • onClose

      public void onClose(boolean success)
      Call this when a resource is closed.
      Parameters:
      success - the success
    • getOpenCount

      public long getOpenCount()
      Gets the open count.
      Returns:
      the open count
    • getClosedCount

      public long getClosedCount()
      Gets the closed count.
      Returns:
      the closed count
    • getErrorCount

      public long getErrorCount()
      Gets the error count.
      Returns:
      the error count
    • getPeakOpenCount

      public long getPeakOpenCount()
      Gets the peak open count.
      Returns:
      the peak open count
    • toString

      public String toString()
      To string.
      Overrides:
      toString in class Object
      Returns:
      the string