Class AgentBuilder.InstallationListener.StreamWriting

    • Field Detail

      • PREFIX

        protected static final java.lang.String PREFIX
        The prefix prepended to any message written.
        See Also:
        Constant Field Values
      • printStream

        private final java.io.PrintStream printStream
        The print stream to write to.
    • Constructor Detail

      • StreamWriting

        public StreamWriting​(java.io.PrintStream printStream)
        Creates a new stream writing installation listener.
        Parameters:
        printStream - The print stream to write to.
    • Method Detail

      • toSystemOut

        public static AgentBuilder.InstallationListener toSystemOut()
        Creates a stream writing installation listener that prints to System.out.
        Returns:
        An installation listener that prints to System.out.
      • toSystemError

        public static AgentBuilder.InstallationListener toSystemError()
        Creates a stream writing installation listener that prints to System.err.
        Returns:
        An installation listener that prints to System.err.
      • onBeforeInstall

        public void onBeforeInstall​(java.lang.instrument.Instrumentation instrumentation,
                                    ResettableClassFileTransformer classFileTransformer)
        Invoked prior to the installation of a class file transformer.
        Specified by:
        onBeforeInstall in interface AgentBuilder.InstallationListener
        Parameters:
        instrumentation - The instrumentation on which the class file transformer is installed.
        classFileTransformer - The class file transformer that is being installed.
      • onError

        public java.lang.Throwable onError​(java.lang.instrument.Instrumentation instrumentation,
                                           ResettableClassFileTransformer classFileTransformer,
                                           java.lang.Throwable throwable)
        Invoked if an installation causes an error. The listener has an opportunity to handle the error. This method is invoked prior to AgentBuilder.InstallationListener.onInstall(Instrumentation, ResettableClassFileTransformer).
        Specified by:
        onError in interface AgentBuilder.InstallationListener
        Parameters:
        instrumentation - The instrumentation on which the class file transformer is installed.
        classFileTransformer - The class file transformer that is being installed.
        throwable - The throwable that causes the error.
        Returns:
        The error to propagate or null if the error is handled. Any subsequent listeners are not called if the exception is handled.
      • onReset

        public void onReset​(java.lang.instrument.Instrumentation instrumentation,
                            ResettableClassFileTransformer classFileTransformer)
        Invoked if an installation is reset.
        Specified by:
        onReset in interface AgentBuilder.InstallationListener
        Parameters:
        instrumentation - The instrumentation on which the class file transformer is installed.
        classFileTransformer - The class file transformer that is being installed.