Class JdiInitiator

java.lang.Object
jdk.jshell.execution.JdiInitiator

public class JdiInitiator extends Object
Sets up a JDI connection, providing the resulting JDI VirtualMachine and the Process the remote agent is running in.
Since:
9
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static interface 
    Callback that should invoked when the remote process is invoked.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JdiInitiator(int port, List<String> remoteVMOptions, String remoteAgent, boolean isLaunch, String host, int timeout, Map<String,String> customConnectorArgs)
    Start the remote agent and establish a JDI connection to it.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the launched process.
    protected void
    runListenProcess(String jdiAddress, int jshellControlPort, List<String> remoteVMOptions, JdiInitiator.ProcessStarted setupVM)
    Create a process that will attach to the given address.
    vm()
    Returns the resulting VirtualMachine instance.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • JdiInitiator

      public JdiInitiator(int port, List<String> remoteVMOptions, String remoteAgent, boolean isLaunch, String host, int timeout, Map<String,String> customConnectorArgs)
      Start the remote agent and establish a JDI connection to it.
      Parameters:
      port - the socket port for (non-JDI) commands
      remoteVMOptions - any user requested VM command-line options
      remoteAgent - full class name of remote agent to launch
      isLaunch - does JDI do the launch? That is, LaunchingConnector, otherwise we start explicitly and use ListeningConnector
      host - explicit hostname to use, if null use discovered hostname, applies to listening only (!isLaunch)
      timeout - the start-up time-out in milliseconds. If zero or negative, will not wait thus will timeout immediately if not already started.
      customConnectorArgs - custom arguments passed to the connector. These are JDI com.sun.jdi.connect.Connector arguments. The vmexec argument is not supported.
  • Method Details

    • vm

      public VirtualMachine vm()
      Returns the resulting VirtualMachine instance.
      Returns:
      the virtual machine
    • process

      public Process process()
      Returns the launched process.
      Returns:
      the remote agent process
    • runListenProcess

      protected void runListenProcess(String jdiAddress, int jshellControlPort, List<String> remoteVMOptions, JdiInitiator.ProcessStarted setupVM)
      Create a process that will attach to the given address.
      Parameters:
      jdiAddress - address on which a JDI server is waiting for a connection
      jshellControlPort - the port which the remote agent should connect to
      remoteVMOptions - VM options for the remote agent VM
      setupVM - a callback that should be called then the remote agent process is created. The callback will setup the JDI's VirtualMachine.
      Since:
      22