Class Callback


  • public final class Callback
    extends Object
    This type is the main entry point that is used to callback from injected code.
    • Method Detail

      • init

        public static void init​(Settings settings,
                                TracepointConfigService tracepointConfigService,
                                PushService pushService)
        Initialise the callback with the deep services.
        Parameters:
        settings - the deep settings
        tracepointConfigService - the tracepoint service
        pushService - the push service
      • callBackCF

        public static void callBackCF​(List<String> bpIds,
                                      String filename,
                                      int lineNo,
                                      Map<String,​Object> variables)
        The main entry point for CF ASM injected breakpoints.
        Parameters:
        bpIds - the bp ids to trigger
        filename - the filename of the breakpoint hit
        lineNo - the line number of the breakpoint hit
        variables - the map of local variables.
      • callBack

        public static void callBack​(List<String> bpIds,
                                    String filename,
                                    int lineNo,
                                    Map<String,​Object> variables)
        The main entry point for non CF ASM injected breakpoints.
        Parameters:
        bpIds - the bp ids to trigger
        filename - the filename of the breakpoint hit
        lineNo - the line number of the breakpoint hit
        variables - the map of local variables.
      • callBackException

        public static void callBackException​(Throwable t)
        This is called when an exception is captured on the visited line.
        Parameters:
        t - the exception that was captured.
      • callBackFinally

        public static void callBackFinally​(List<String> bpIds,
                                           String filename,
                                           int lineNo,
                                           Map<String,​Object> variables)
        This is called when the visited line is completed.
        Parameters:
        bpIds - the tracepoint ids that triggered this
        filename - the source file name
        lineNo - the line number we are on
        variables - the captured local variables
      • span

        public static Closeable span​(String name,
                                     String bps)
        Create a span using the tracepoint callback.

        This method will Always return a closable. This way the injected code never deals with anything but calling close. Even if close doesn't do anything.

        We use Closeable here, so we can stick to java types in the injected code. This makes testing and injected code simpler.

        Parameters:
        name - the name of the span
        bps - the tracepoints that triggered this span
        Returns:
        a Closeable to close the span
      • methodEntry

        public static void methodEntry​(String methodName,
                                       String filename,
                                       int lineNo,
                                       List<String> bpIds,
                                       Map<String,​Object> variables,
                                       String spanOnlyIds)
        This method is called when a tracepoint has triggered a method entry type.

        This method will Always return a closable. This way the injected code never deals with anything but calling close. Even if close doesn't do anything.

        We use Closeable here, so we can stick to java types in the injected code. This makes testing and injected code simpler.

        Parameters:
        methodName - the method name we have entered
        filename - the file name the method is in
        lineNo - the line number the method is on
        bpIds - the tracepoint ids that have been triggered by this entry
        variables - the map of variables captured
        spanOnlyIds - the CSV of the tracepoints ids that just want a span
      • methodException

        public static void methodException​(Throwable t)
        This is called when an exception is captured from a wrapped method.
        Parameters:
        t - the captured throwable
      • methodRet

        public static void methodRet​(Object value)
        This is called when the returned value from the wrapped method is captured.

        This method is not called on void methods.

        Parameters:
        value - the captured return value.
      • methodEnd

        public static void methodEnd​(String methodName,
                                     String filename,
                                     int lineNo,
                                     List<String> bpIds,
                                     Map<String,​Object> variables)
        This method is called when a wrapped method has completed.
        Parameters:
        methodName - the method name
        filename - the source file name
        lineNo - the line number
        bpIds - the triggering tracepoints ids
        variables - the captured local variables