Package org.opencms.util
Class CmsTaskWatcher
java.lang.Object
org.opencms.util.CmsTaskWatcher
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic CmsTaskWatcher
get()
Gets the singleton instance.getMap()
Gets the map of entries.getReport
(long minAge) Gets a report as a string.static void
Initializes the logging job.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.
-
Constructor Details
-
CmsTaskWatcher
public CmsTaskWatcher()
-
-
Method Details
-
get
Gets the singleton instance.- Returns:
- the singleton instance
-
initialize
Initializes the logging job. -
getMap
Gets the map of entries.- Returns:
- the map of entries.
-
getReport
Gets a report as a string.- Parameters:
minAge
- minimum age of entries to show in the report- Returns:
- the report as a string
-
openTask
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
-