Class VirtualMachine.ForHotSpot.OnUnix

    • Constructor Summary

      Constructors 
      Constructor Description
      OnUnix​(java.lang.String processId, java.lang.Object socket, int attempts, long pause, long timeout, java.util.concurrent.TimeUnit timeUnit)
      Creates a new VM implementation for a HotSpot VM running on Unix.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class<?> assertAvailability()
      Asserts the availability of this virtual machine implementation.
      static VirtualMachine attach​(java.lang.String processId)
      Attaches to the supplied VM process.
      protected void connect()
      Connects to the target VM.
      void detach()
      Detaches this virtual machine representation.
      int read​(byte[] buffer)
      Reads from the communication channel.
      void write​(byte[] buffer)
      Writes to the communication channel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OnUnix

        public OnUnix​(java.lang.String processId,
                      java.lang.Object socket,
                      int attempts,
                      long pause,
                      long timeout,
                      java.util.concurrent.TimeUnit timeUnit)
        Creates a new VM implementation for a HotSpot VM running on Unix.
        Parameters:
        processId - The process id of the target VM.
        socket - The Unix socket to use for communication.
        attempts - The number of attempts to connect.
        pause - The pause time between two VMs.
        timeout - The socket timeout.
        timeUnit - The time unit of the pause time.
    • Method Detail

      • assertAvailability

        public static java.lang.Class<?> assertAvailability()
                                                     throws java.lang.Throwable
        Asserts the availability of this virtual machine implementation. If the Unix socket library is missing or if this VM does not support Unix socket communication, a Throwable is thrown.
        Returns:
        This virtual machine type.
        Throws:
        java.lang.Throwable - If this VM does not support POSIX sockets or is not running on a HotSpot VM.
      • attach

        public static VirtualMachine attach​(java.lang.String processId)
                                     throws java.io.IOException
        Attaches to the supplied VM process.
        Parameters:
        processId - The process id of the target VM.
        Returns:
        An appropriate virtual machine implementation.
        Throws:
        java.io.IOException - If an I/O exception occurs.
      • read

        public int read​(byte[] buffer)
                 throws java.io.IOException
        Description copied from class: VirtualMachine.ForHotSpot
        Reads from the communication channel.
        Specified by:
        read in class VirtualMachine.ForHotSpot
        Parameters:
        buffer - The buffer to read into.
        Returns:
        The amount of bytes read.
        Throws:
        java.io.IOException - If an I/O exception occurs.
      • write

        public void write​(byte[] buffer)
                   throws java.io.IOException
        Description copied from class: VirtualMachine.ForHotSpot
        Writes to the communication channel.
        Specified by:
        write in class VirtualMachine.ForHotSpot
        Parameters:
        buffer - The buffer to write from.
        Throws:
        java.io.IOException - If an I/O exception occurs.
      • detach

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