Class ByteBuddyAgent.AttachmentProvider.Accessor.Simple

java.lang.Object
net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor.Simple
All Implemented Interfaces:
ByteBuddyAgent.AttachmentProvider.Accessor
Direct Known Subclasses:
ByteBuddyAgent.AttachmentProvider.Accessor.Simple.WithDirectAttachment, ByteBuddyAgent.AttachmentProvider.Accessor.Simple.WithExternalAttachment
Enclosing interface:
ByteBuddyAgent.AttachmentProvider.Accessor

public abstract static class ByteBuddyAgent.AttachmentProvider.Accessor.Simple extends Object implements ByteBuddyAgent.AttachmentProvider.Accessor
A simple implementation of an accessible accessor.
  • Field Details

    • virtualMachineType

      protected final Class<?> virtualMachineType
      A VirtualMachine class.
  • Constructor Details

    • Simple

      protected Simple(Class<?> virtualMachineType)
      Creates a new simple accessor.
      Parameters:
      virtualMachineType - A VirtualMachine class.
  • Method Details

    • of

      public static ByteBuddyAgent.AttachmentProvider.Accessor of(@MaybeNull ClassLoader classLoader, File... classPath)

      Creates an accessor by reading the process id from the JMX runtime bean and by attempting to load the com.sun.tools.attach.VirtualMachine class from the provided class loader.

      This accessor is supposed to work on any implementation of the OpenJDK or Oracle JDK.

      Parameters:
      classLoader - A class loader that is capable of loading the virtual machine type.
      classPath - The class path required to load the virtual machine class.
      Returns:
      An appropriate accessor.
    • ofJ9

      Creates an accessor by reading the process id from the JMX runtime bean and by attempting to load the com.ibm.tools.attach.VirtualMachine class from the provided class loader.

      This accessor is supposed to work on any implementation of IBM's J9.

      Returns:
      An appropriate accessor.
    • isAvailable

      public boolean isAvailable()
      Determines if this accessor is applicable for the currently running JVM.
      Specified by:
      isAvailable in interface ByteBuddyAgent.AttachmentProvider.Accessor
      Returns:
      true if this accessor is available.
    • getVirtualMachineType

      public Class<?> getVirtualMachineType()
      Returns a VirtualMachine class. This method must only be called for available accessors.
      Specified by:
      getVirtualMachineType in interface ByteBuddyAgent.AttachmentProvider.Accessor
      Returns:
      The virtual machine type.