Package net.bytebuddy.agent
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 java.lang.Object implements ByteBuddyAgent.AttachmentProvider.Accessor
A simple implementation of an accessible accessor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ByteBuddyAgent.AttachmentProvider.Accessor.Simple.WithDirectAttachment
A simple implementation of an accessible accessor that attaches using a virtual machine emulation that does not require external attachment.protected static class
ByteBuddyAgent.AttachmentProvider.Accessor.Simple.WithExternalAttachment
A simple implementation of an accessible accessor that allows for external attachment.-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor
ByteBuddyAgent.AttachmentProvider.Accessor.ExternalAttachment, ByteBuddyAgent.AttachmentProvider.Accessor.Simple, ByteBuddyAgent.AttachmentProvider.Accessor.Unavailable
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<?>
virtualMachineType
AVirtualMachine
class.-
Fields inherited from interface net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor
VIRTUAL_MACHINE_TYPE_NAME, VIRTUAL_MACHINE_TYPE_NAME_J9
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Simple(java.lang.Class<?> virtualMachineType)
Creates a new simple accessor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>
getVirtualMachineType()
Returns aVirtualMachine
class.boolean
isAvailable()
Determines if this accessor is applicable for the currently running JVM.static ByteBuddyAgent.AttachmentProvider.Accessor
of(java.lang.ClassLoader classLoader, java.io.File... classPath)
Creates an accessor by reading the process id from the JMX runtime bean and by attempting to load thecom.sun.tools.attach.VirtualMachine
class from the provided class loader.static ByteBuddyAgent.AttachmentProvider.Accessor
ofJ9()
Creates an accessor by reading the process id from the JMX runtime bean and by attempting to load thecom.ibm.tools.attach.VirtualMachine
class from the provided class loader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor
getExternalAttachment, isExternalAttachmentRequired
-
-
-
-
Method Detail
-
of
public static ByteBuddyAgent.AttachmentProvider.Accessor of(java.lang.ClassLoader classLoader, java.io.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
public static ByteBuddyAgent.AttachmentProvider.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 interfaceByteBuddyAgent.AttachmentProvider.Accessor
- Returns:
true
if this accessor is available.
-
getVirtualMachineType
public java.lang.Class<?> getVirtualMachineType()
Returns aVirtualMachine
class. This method must only be called for available accessors.- Specified by:
getVirtualMachineType
in interfaceByteBuddyAgent.AttachmentProvider.Accessor
- Returns:
- The virtual machine type.
-
-