Package com.jprofiler.api.probe.embedded
Class Split
java.lang.Object
com.jprofiler.api.probe.embedded.Split
By calling this class you can add an arbitrary split in the call tree, just like the URL splitting of JProfiler's built-in "HTTP Server" probe.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
enter
(Class<? extends SplitProbe> probe, String name) Split the call tree with the givenname
.static void
execute
(Class<? extends SplitProbe> probe, String name, Runnable runnable) static <T> T
execute
(Class<? extends SplitProbe> probe, String name, Callable<T> callable) static void
exit()
Marks the end of a split.static void
register
(Class<? extends SplitProbe> probe) You can register your probe independently ofenter(Class, String)
andexecute
calls.
-
Constructor Details
-
Split
public Split()
-
-
Method Details
-
enter
Split the call tree with the givenname
. A matchingexit()
call must be always called.- Parameters:
probe
- the configuration class. Must not benull
.name
- the line that should show up in the call tree. Ifnull
, the call tree won't be split.
-
exit
public static void exit()Marks the end of a split. A matchingenter(Class, String)
call must have been called first. -
execute
- Parameters:
probe
- the configuration class. Must not benull
.name
- the line that should show up in the call tree. Ifnull
, the call tree won't be split.runnable
- the runnable that will be executed inside the split.
-
execute
public static <T> T execute(Class<? extends SplitProbe> probe, String name, Callable<T> callable) throws Exception - Parameters:
probe
- the configuration class. Must not benull
.name
- the line that should show up in the call tree. Ifnull
, the call tree won't be split.callable
- the callable that will be executed inside the split.- Throws:
Exception
-
register
You can register your probe independently ofenter(Class, String)
andexecute
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 anenter(Class, String)
orexecute
call takes place.enter(Class, String)
orexecute
will automatically register your probe.- Parameters:
probe
- the configuration class. Must not benull
.
-