public class Split
extends java.lang.Object
You can either use a pair of enter(Class, String)
and exit()
calls or the two execute
wrappers. If you write your own
wrapper in another JVM language it is advisable to use the enter(Class, String)
and exit()
primitives.
When using the primitives, it is very important that a matching exit()
is always called, so the exit call must be put it a finally block like this:
Split.enter(MyProbe.class, "my split string");
try {
// your code
} finally {
Split.exit();
}
Constructor and Description |
---|
Split() |
Modifier and Type | Method and Description |
---|---|
static void |
enter(java.lang.Class<? extends SplitProbe> probe,
java.lang.String name)
Split the call tree with the given
name . |
static <T> T |
execute(java.lang.Class<? extends SplitProbe> probe,
java.lang.String name,
java.util.concurrent.Callable<T> callable)
|
static void |
execute(java.lang.Class<? extends SplitProbe> probe,
java.lang.String name,
java.lang.Runnable runnable)
|
static void |
exit()
Marks the end of a split.
|
static void |
register(java.lang.Class<? extends SplitProbe> probe)
You can register your probe independently of
enter(Class, String) and execute calls. |
public static void enter(java.lang.Class<? extends SplitProbe> probe, java.lang.String name)
name
. A matching exit()
call must be always called.probe
- the configuration class. Must not be null
.name
- the line that should show up in the call tree. If null
, the call tree won't be split.public static void exit()
enter(Class, String)
call must have been called first.public static void execute(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.lang.Runnable runnable)
probe
- the configuration class. Must not be null
.name
- the line that should show up in the call tree. If null
, the call tree won't be split.runnable
- the runnable that will be executed inside the split.public static <T> T execute(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.util.concurrent.Callable<T> callable) throws java.lang.Exception
probe
- the configuration class. Must not be null
.name
- the line that should show up in the call tree. If null
, the call tree won't be split.callable
- the callable that will be executed inside the split.java.lang.Exception
public static void register(java.lang.Class<? extends SplitProbe> probe)
enter(Class, String)
and execute
calls. As soon as the probe is registered
it will be displayed in the JProfiler UI and telemetries can be recorded.
You don't have to call this method if you don't want to start telemetry recording before an enter(Class, String)
or execute
call
takes place. enter(Class, String)
or execute
will automatically register your probe.probe
- the configuration class. Must not be null
.