Class VirtualMachine.ForHotSpot.Connection.Factory.ForSocketFile

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String ATTACH_FILE_PREFIX
      The name prefix for an attachment file indicator.
      private int attempts
      The maximum amount of attempts for checking the establishment of a socket connection.
      private long pause
      The pause between two checks for an established socket connection.
      private static java.lang.String SOCKET_FILE_PREFIX
      The name prefix for a socket.
      private java.lang.String temporaryDirectory
      The temporary directory to use.
      private java.util.concurrent.TimeUnit timeUnit
      The time unit of the pause time.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ForSocketFile​(java.lang.String temporaryDirectory, int attempts, long pause, java.util.concurrent.TimeUnit timeUnit)
      Creates a connection factory for creating a socket connection via a file.
    • Field Detail

      • SOCKET_FILE_PREFIX

        private static final java.lang.String SOCKET_FILE_PREFIX
        The name prefix for a socket.
        See Also:
        Constant Field Values
      • ATTACH_FILE_PREFIX

        private static final java.lang.String ATTACH_FILE_PREFIX
        The name prefix for an attachment file indicator.
        See Also:
        Constant Field Values
      • temporaryDirectory

        private final java.lang.String temporaryDirectory
        The temporary directory to use.
      • attempts

        private final int attempts
        The maximum amount of attempts for checking the establishment of a socket connection.
      • pause

        private final long pause
        The pause between two checks for an established socket connection.
      • timeUnit

        private final java.util.concurrent.TimeUnit timeUnit
        The time unit of the pause time.
    • Constructor Detail

      • ForSocketFile

        protected ForSocketFile​(java.lang.String temporaryDirectory,
                                int attempts,
                                long pause,
                                java.util.concurrent.TimeUnit timeUnit)
        Creates a connection factory for creating a socket connection via a file.
        Parameters:
        temporaryDirectory - The temporary directory to use.
        attempts - The maximum amount of attempts for checking the establishment of a socket connection.
        pause - The pause between two checks for an established socket connection.
        timeUnit - The time unit of the pause time.
    • Method Detail

      • connect

        public VirtualMachine.ForHotSpot.Connection connect​(java.lang.String processId)
                                                     throws java.io.IOException
        Connects to the supplied process.
        Specified by:
        connect in interface VirtualMachine.ForHotSpot.Connection.Factory
        Parameters:
        processId - The process id.
        Returns:
        The connection to the virtual machine with the supplied process id.
        Throws:
        java.io.IOException - If an I/O exception occurs during connecting to the targeted VM.
      • kill

        protected abstract void kill​(java.lang.String processId,
                                     int signal)
        Sends a kill signal to the target process.
        Parameters:
        processId - The process id.
        signal - The signal to send.
      • doConnect

        protected abstract VirtualMachine.ForHotSpot.Connection doConnect​(java.io.File socket)
                                                                   throws java.io.IOException
        Connects to the supplied POSIX socket.
        Parameters:
        socket - The socket to connect to.
        Returns:
        An active connection to the supplied socket.
        Throws:
        java.io.IOException - If an error occurs during connection.