Interface AgentBuilder.RedefinitionListenable

    • Method Detail

      • with

        AgentBuilder.RedefinitionListenable with​(AgentBuilder.RedefinitionStrategy.Listener redefinitionListener)

        A redefinition listener is invoked before each batch of type redefinitions and on every error as well as after the redefinition was completed. A redefinition listener can be used for debugging or logging purposes and to apply actions between each batch, e.g. to pause or wait in order to avoid rendering the current VM non-responsive if a lot of classes are redefined.

        Adding several listeners does not replace previous listeners but applies them in the registration order.

        Parameters:
        redefinitionListener - The listener to register.
        Returns:
        A new instance of this agent builder which notifies the specified listener upon type redefinitions.
      • withResubmission

        AgentBuilder withResubmission​(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler)
        Enables resubmission of failed transformations by applying a retransformation of the loaded type. This can be meaningful if class files cannot be located from the class loader as a resource where the loaded type becomes available.
        Parameters:
        resubmissionScheduler - A scheduler which is responsible for scheduling the resubmission job.
        Returns:
        A new instance of this agent builder that applies resubmission.
      • withResubmission

        AgentBuilder withResubmission​(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler,
                                      ElementMatcher<? super java.lang.Throwable> matcher)
        Enables resubmission of failed transformations by applying a retransformation of the loaded type. This can be meaningful if class files cannot be located from the class loader as a resource where the loaded type becomes available.
        Parameters:
        resubmissionScheduler - A scheduler which is responsible for scheduling the resubmission job.
        matcher - A matcher that filters throwable instances where non-matched throwables are not triggering a resubmission.
        Returns:
        A new instance of this agent builder that applies resubmission.
      • withResubmission

        AgentBuilder withResubmission​(AgentBuilder.RedefinitionStrategy.ResubmissionScheduler resubmissionScheduler,
                                      ElementMatcher<? super java.lang.Throwable> matcher,
                                      ElementMatcher<? super java.lang.ClassLoader> classLoaderFilter)
        Enables resubmission of failed transformations by applying a retransformation of the loaded type. This can be meaningful if class files cannot be located from the class loader as a resource where the loaded type becomes available.
        Parameters:
        resubmissionScheduler - A scheduler which is responsible for scheduling the resubmission job.
        matcher - A matcher that filters throwable instances where non-matched throwables are not triggering a resubmission.
        classLoaderFilter - A filter to exclude class loader instances from resubmission before applying it.
        Returns:
        A new instance of this agent builder that applies resubmission.