Class ResettableClassFileTransformer.WithDelegation

    • Constructor Detail

      • WithDelegation

        protected WithDelegation​(ResettableClassFileTransformer classFileTransformer)
        Creates a new delegating resettable class file transformer.
        Parameters:
        classFileTransformer - The class file transformer to delegate to.
    • Method Detail

      • reset

        public boolean reset​(java.lang.instrument.Instrumentation instrumentation,
                             ResettableClassFileTransformer classFileTransformer,
                             AgentBuilder.RedefinitionStrategy redefinitionStrategy,
                             AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy,
                             AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator,
                             AgentBuilder.RedefinitionStrategy.Listener redefinitionListener)

        Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the AgentBuilder.InstallationListener is informed about the resetting without undoing any code changes.

        Note: A reset class file transformer should not be reinstalled. Instead, the AgentBuilder which built the transformer should be asked to install a new transformer.

        Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling AgentBuilder.disableClassFormatChanges().

        Parameters:
        instrumentation - The instrumentation instance from which to deregister the transformer.
        classFileTransformer - The actual class file transformer to deregister which might be this instance or any wrapper.
        redefinitionStrategy - The redefinition to apply.
        redefinitionDiscoveryStrategy - The discovery strategy for the types to reset.
        redefinitionBatchAllocator - The batch allocator to use.
        redefinitionListener - The redefinition listener to apply.
        Returns:
        true if a reset was applied and this transformer was not previously removed.