AutoCloseable
, ExecutionControl
public class JdiDefaultExecutionControl extends JdiExecutionControl
ExecutionControl
that the
JShell-core uses by default.
Launches a remote process -- the "remote agent".
Interfaces to the remote agent over a socket and via JDI.
Designed to work with RemoteExecutionControl
.ExecutionControl.ClassBytecodes, ExecutionControl.ClassInstallException, ExecutionControl.EngineTerminationException, ExecutionControl.ExecutionControlException, ExecutionControl.Generator, ExecutionControl.InternalException, ExecutionControl.NotImplementedException, ExecutionControl.ResolutionException, ExecutionControl.RunException, ExecutionControl.StoppedException, ExecutionControl.UserException
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Closes the execution engine.
|
static ExecutionControl.Generator |
create(String remoteAgent,
boolean isLaunch,
String host,
int timeout) |
Creates a JDI based ExecutionControl instance.
|
static String |
defaultRemoteAgent() |
Default remote agent.
|
static int |
defaultTimeout() |
Default remote connection time-out
|
String |
invoke(String classname,
String methodname) |
Invokes an executable Snippet by calling a method on the specified
wrapper class.
|
static ExecutionControl.Generator |
launch() |
Creates an ExecutionControl instance based on a JDI
LaunchingConnector . |
static ExecutionControl.Generator |
listen(String host) |
Creates an ExecutionControl instance based on a JDI
ListeningConnector . |
void |
stop() |
Interrupts a running remote invoke by manipulating remote variables
and sending a stop via JDI.
|
protected com.sun.jdi.VirtualMachine |
vm() |
Returns the JDI
VirtualMachine instance. |
addToClasspath, extensionCommand, load, setClasspath, varValue
redefine, referenceType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addToClasspath, extensionCommand, load, setClasspath, varValue
public static ExecutionControl.Generator launch()
LaunchingConnector
. Same as
JdiDefaultExecutionControl.create(defaultRemoteAgent(), true, null, defaultTimeout())
.public static ExecutionControl.Generator listen(String host)
ListeningConnector
. Same as
JdiDefaultExecutionControl.create(defaultRemoteAgent(), false, host, defaultTimeout())
.host
- explicit hostname to use, if null use discovered
hostname, applies to listening only (!isLaunch)public static ExecutionControl.Generator create(String remoteAgent, boolean isLaunch, String host, int timeout)
remoteAgent
- the remote agent to launchisLaunch
- does JDI do the launch? That is, LaunchingConnector,
otherwise we start explicitly and use ListeningConnectorhost
- explicit hostname to use, if null use discovered
hostname, applies to listening only (!isLaunch)timeout
- the start-up time-out in millisecondspublic static String defaultRemoteAgent()
public static int defaultTimeout()
public String invoke(String classname, String methodname) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
ExecutionControl
invoke
in interface ExecutionControl
invoke
in class StreamingExecutionControl
classname
- the class whose method should be invokedmethodname
- the name of method to invokeExecutionControl.UserException
- the invoke raised a user exceptionExecutionControl.ResolutionException
- the invoke attempted to directly or
indirectly invoke an unresolved snippetExecutionControl.StoppedException
- if the invoke()
was canceled by
ExecutionControl.stop()
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredExecutionControl.RunException
public void stop() throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
stop
in interface ExecutionControl
stop
in class StreamingExecutionControl
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredpublic void close()
StreamingExecutionControl
close
in interface AutoCloseable
close
in interface ExecutionControl
close
in class StreamingExecutionControl
protected com.sun.jdi.VirtualMachine vm() throws ExecutionControl.EngineTerminationException
JdiExecutionControl
VirtualMachine
instance.vm
in class JdiExecutionControl
ExecutionControl.EngineTerminationException
- if the VM is dead/disconnected Submit a bug or feature
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 2015, 2016, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-Debian+0-9b148-1