Class CmsTaskWatcher

java.lang.Object
org.opencms.util.CmsTaskWatcher

public class CmsTaskWatcher extends Object
Helper class for building diagnostics code that tracks potentially long running operations.

Is used with the try-with-resources syntax. (I_CmsCloseable c = CmsTaskWatcher.get().openTask(description)) { ... }

  • Constructor Details

  • Method Details

    • get

      public static CmsTaskWatcher get()
      Gets the singleton instance.
      Returns:
      the singleton instance
    • initialize

      public static void initialize()
      Initializes the logging job.
    • getMap

      public Map<String,org.opencms.util.CmsTaskWatcher.Entry> getMap()
      Gets the map of entries.
      Returns:
      the map of entries.
    • getReport

      public String getReport(long minAge)
      Gets a report as a string.
      Parameters:
      minAge - minimum age of entries to show in the report
      Returns:
      the report as a string
    • openTask

      public I_CmsCloseable openTask(String label)
      Adds a new task and returns a Closeable (to be used in a try-with-resources block) which removes the task entry again when closed.
      Parameters:
      label - the label for the task entry
      Returns:
      the closeable