Class CmsTaskWatcher


  • public class CmsTaskWatcher
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      CmsTaskWatcher()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static CmsTaskWatcher get()
      Gets the singleton instance.
      java.util.Map<java.lang.String,​org.opencms.util.CmsTaskWatcher.Entry> getMap()
      Gets the map of entries.
      java.lang.String getReport​(long minAge)
      Gets a report as a string.
      static void initialize()
      Initializes the logging job.
      I_CmsCloseable openTask​(java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

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

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

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

        public java.lang.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​(java.lang.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