public class HDC extends Object
This provides static methods to start, get and clean up diagnostic tasks.
This also allows to customize HDC
by setting a system property,
org.hippoecm.hst.diagnosis
to a specific implementation class name.
A custom HDC
implementation may override the instance methods (#doXXX
)
to extend the functionality.
For example, suppose you want to extend HDC
to report the duration of each task
to an external performance measuring system. Then one example implementation could look like the following:
public class CustomExternalApmIntegratedHDC extends HDC { // Suppose externalAPM is your external application performance monitoring system // at your hand to integrate with. private ExternalAPM externalAPM = ...; public CustomExternalApmIntegratedHDC() { super(); }
Modifier | Constructor and Description |
---|---|
protected |
HDC()
Protected constructor which might be called by a child class.
|
Modifier and Type | Method and Description |
---|---|
static void |
cleanUp()
Cleans up the HDC tasks and its context.
|
protected void |
doCleanUp()
Cleans up the HDC tasks and its context.
|
protected Task |
doCreateTask(String name)
Internally create a task instance by the name.
|
protected Task |
doGetCurrentTask()
Internally returns the task instance in the current thread context if available.
|
protected Task |
doGetRootTask()
Internally returns the root task instance if available.
|
protected boolean |
doIsStarted()
Internally check whether or not the root task was started.
|
protected void |
doSetCurrentTask(Task currentTask)
Internally sets the task instance in the current thread context.
|
protected Task |
doStart(String name)
Internally starts the root task by the name.
|
static Task |
getCurrentTask()
Returns the task in the current thread context.
|
static Task |
getRootTask()
Returns the root task.
|
static boolean |
isStarted()
Returns true if the root task was started.
|
static void |
setCurrentTask(Task currentTask)
Sets a task in the current thread context.
|
static Task |
start(String name)
Start the root task with the name.
|
public static final Task NOOP_TASK
protected HDC()
public static Task start(String name)
name
- root task namepublic static boolean isStarted()
public static Task getRootTask()
public static Task getCurrentTask()
public static void setCurrentTask(Task currentTask)
currentTask
- current task instancepublic static void cleanUp()
protected Task doStart(String name)
name
- root task nameprotected Task doCreateTask(String name)
doStart(String)
, so a child class may override this method
if it needs to override the default task implementation, DefaultTaskImpl
, for instance.name
- task nameprotected boolean doIsStarted()
protected Task doGetRootTask()
protected Task doGetCurrentTask()
protected void doSetCurrentTask(Task currentTask)
currentTask
- current task instanceprotected void doCleanUp()
Copyright © 2012–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.