Package com.jprofiler.api.probe.embedded
Class Split
- java.lang.Object
-
- com.jprofiler.api.probe.embedded.Split
-
public class Split extends java.lang.ObjectBy 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)andexit()calls or the twoexecutewrappers. If you write your own wrapper in another JVM language it is advisable to use theenter(Class, String)andexit()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 Constructor Description Split()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidenter(java.lang.Class<? extends SplitProbe> probe, java.lang.String name)Split the call tree with the givenname.static voidexecute(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.lang.Runnable runnable)static <T> Texecute(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.util.concurrent.Callable<T> callable)static voidexit()Marks the end of a split.static voidregister(java.lang.Class<? extends SplitProbe> probe)You can register your probe independently ofenter(Class, String)andexecutecalls.
-
-
-
Method Detail
-
enter
public static void enter(java.lang.Class<? extends SplitProbe> probe, java.lang.String name)
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
public static void execute(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.lang.Runnable runnable)
- 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(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.util.concurrent.Callable<T> callable) throws java.lang.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:
java.lang.Exception
-
register
public static void register(java.lang.Class<? extends SplitProbe> probe)
You can register your probe independently ofenter(Class, String)andexecutecalls. 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)orexecutecall takes place.enter(Class, String)orexecutewill automatically register your probe.- Parameters:
probe- the configuration class. Must not benull.
-
-