Interface VirtualMachine

  • All Known Implementing Classes:
    VirtualMachine.ForHotSpot, VirtualMachine.ForHotSpot.OnUnix

    public interface VirtualMachine

    An implementation for attachment on a virtual machine. This interface mimics the tooling API's virtual machine interface to allow for similar usage by ByteBuddyAgent where all calls are made via reflection such that this structural typing suffices for interoperability.

    Note: Implementations are required to declare a static method attach(String) returning an instance of a class that declares the methods defined by VirtualMachine.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  VirtualMachine.ForHotSpot
      A virtual machine implementation for a HotSpot VM or any compatible VM.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void detach()
      Detaches this virtual machine representation.
      void loadAgent​(java.lang.String jarFile, java.lang.String argument)
      Loads an agent into the represented virtual machine.
    • Method Detail

      • loadAgent

        void loadAgent​(java.lang.String jarFile,
                       java.lang.String argument)
                throws java.io.IOException
        Loads an agent into the represented virtual machine.
        Parameters:
        jarFile - The jar file to attach.
        argument - The argument to provide or null if no argument should be provided.
        Throws:
        java.io.IOException - If an I/O exception occurs.
      • detach

        void detach()
             throws java.io.IOException
        Detaches this virtual machine representation.
        Throws:
        java.io.IOException - If an I/O exception occurs.