Class Split


  • public class Split
    extends java.lang.Object
    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 
      Constructor Description
      Split()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void enter​(java.lang.Class<? extends SplitProbe> probe, java.lang.String name)
      Split the call tree with the given name.
      static void execute​(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.lang.Runnable runnable)
      A wrapper for the enter(Class, String) and exit() primitives for a Runnable.
      static <T> T execute​(java.lang.Class<? extends SplitProbe> probe, java.lang.String name, java.util.concurrent.Callable<T> callable)
      A wrapper for the enter(Class, String) and exit() primitives for a Callable.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Split

        public Split()
    • Method Detail

      • enter

        public static void enter​(java.lang.Class<? extends SplitProbe> probe,
                                 java.lang.String name)
        Split the call tree with the given name. A matching exit() call must be always called.
        Parameters:
        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.
      • exit

        public static void exit()
        Marks the end of a split. A matching enter(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)
        A wrapper for the enter(Class, String) and exit() primitives for a Runnable.
        Parameters:
        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.
      • 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
        A wrapper for the enter(Class, String) and exit() primitives for a Callable.
        Parameters:
        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.
        Throws:
        java.lang.Exception
      • register

        public static void register​(java.lang.Class<? extends SplitProbe> probe)
        You can register your probe independently of 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.
        Parameters:
        probe - the configuration class. Must not be null.