- java.lang.Object
-
- jdk.jshell.execution.DirectExecutionControl
-
- jdk.jshell.execution.RemoteExecutionControl
-
- All Implemented Interfaces:
-
AutoCloseable,ExecutionControl
public class RemoteExecutionControl extends DirectExecutionControl implements ExecutionControl
远程代理在执行过程中运行(与主JShell进程分开)。 该代理程序通过主JShell进程的套接字加载代码,执行代码和其他misc,专业化DirectExecutionControl,它增加了由外部进程控制的停止支持。 设计使用JdiDefaultExecutionControl。- 从以下版本开始:
- 9
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jdk.jshell.spi.ExecutionControl
ExecutionControl.ClassBytecodes, ExecutionControl.ClassInstallException, ExecutionControl.EngineTerminationException, ExecutionControl.ExecutionControlException, ExecutionControl.InternalException, ExecutionControl.NotImplementedException, ExecutionControl.ResolutionException, ExecutionControl.RunException, ExecutionControl.StoppedException, ExecutionControl.UserException
-
-
构造方法摘要
构造方法 Constructor 描述 RemoteExecutionControl()使用默认的类加载创建一个实例。RemoteExecutionControl(LoaderDelegate loaderDelegate)创建一个实例,将加载器操作委派给指定的委托。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 protected voidclientCodeEnter()标记输入用户代码。protected voidclientCodeLeave()标记离开用户代码。protected Stringinvoke(方法 doitMethod)调用指定的“doit-method”,一个没有参数的静态方法。static voidmain(String[] args)启动代理,通过命令行参数指定的套接字连接到JShell核心。voidredefine(ExecutionControl.ClassBytecodes[] cbcs)远程重新定义处理只用于注册重新定义的类voidstop()中断一个正在运行的调用。protected StringthrowConvertedInvocationException(Throwable cause)将用户代码中的传入异常转换为ExecutionControl.ExecutionControlException子类型的实例,并抛出转换的异常。protected StringthrowConvertedOtherException(Throwable ex)将代理代码中的传入异常转换为ExecutionControl.ExecutionControlException子类型的实例,并抛出转换的异常。StringvarValue(String className, String varName)返回变量的值。-
Methods inherited from class jdk.jshell.execution.DirectExecutionControl
addToClasspath, classesRedefined, close, extensionCommand, findClass, invoke, load, valueString
-
Methods inherited from interface jdk.jshell.spi.ExecutionControl
addToClasspath, close, extensionCommand, generate, generate, invoke, load
-
-
-
-
构造方法详细信息
-
RemoteExecutionControl
public RemoteExecutionControl(LoaderDelegate loaderDelegate)
创建一个实例,将加载器操作委派给指定的委托。- 参数
-
loaderDelegate- 处理加载类的loaderDelegate
-
RemoteExecutionControl
public RemoteExecutionControl()
使用默认的类加载创建一个实例。
-
-
方法详细信息
-
main
public static void main(String[] args) throws 异常
启动代理,通过命令行参数指定的套接字连接到JShell核心。- 参数
-
args- 标准命令行参数,期望是套接字号是唯一的参数 - 异常
-
异常- 任何意外的异常
-
redefine
public void redefine(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
远程重新定义处理只用于注册重新定义的类- Specified by:
-
redefine在接口ExecutionControl - 重写:
-
redefine在DirectExecutionControl - 参数
-
cbcs- 重新定义的类名和字节码 - 异常
-
ExecutionControl.ClassInstallException- 异常重新定义类,有些或全部没有重新定义 -
ExecutionControl.NotImplementedException- 如果没有实现 -
ExecutionControl.EngineTerminationException- 执行引擎已经终止
-
stop
public void stop() throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException说明从类别复制:DirectExecutionControl中断一个正在运行的调用。不支持。
- Specified by:
-
stop在接口ExecutionControl - 重写:
-
stop在DirectExecutionControl - 异常
-
ExecutionControl.EngineTerminationException- 执行引擎已经终止 -
ExecutionControl.InternalException- 发生内部问题
-
invoke
protected String invoke(方法 doitMethod) throws 异常
说明从类别复制:DirectExecutionControl调用指定的“doit-method”,一个没有参数的静态方法。 这个类中的DirectExecutionControl.invoke(java.lang.String, java.lang.String)会调用这个来调用。- 重写:
-
invoke在DirectExecutionControl - 参数
-
doitMethod- 调用的方法 - 结果
- 该值或null
- 异常
-
异常-Method.invoke(Object, Object...)或任何ExecutionControl.ExecutionControlException传递的任何异常。
-
varValue
public String varValue(String className, String varName) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
描述从接口ExecutionControl复制返回变量的值。- Specified by:
-
varValue在接口ExecutionControl - 重写:
-
varValue在DirectExecutionControl - 参数
-
className- 变量的包装类的名称 -
varName- 变量的名称 - 结果
- 变量的值
- 异常
-
ExecutionControl.UserException- 格式化该值引发用户异常 -
ExecutionControl.ResolutionException- 格式化尝试直接或间接调用未解析的代码段的值 -
ExecutionControl.StoppedException- 如果格式化值被取消ExecutionControl.stop() -
ExecutionControl.EngineTerminationException- 执行引擎已终止 -
ExecutionControl.InternalException- 发生内部问题 -
ExecutionControl.RunException
-
throwConvertedInvocationException
protected String throwConvertedInvocationException(Throwable cause) throws ExecutionControl.RunException, ExecutionControl.InternalException
描述从类别复制:DirectExecutionControl将用户代码中的传入异常转换为ExecutionControl.ExecutionControlException的子类型,并抛出转换的异常。- 重写:
-
throwConvertedInvocationException在DirectExecutionControl - 参数
-
cause- 转换的例外 - 结果
- 永远不会回报,因为它总是抛出
- 异常
-
ExecutionControl.RunException- 用于正常的异常事件 -
ExecutionControl.InternalException- 内部问题
-
throwConvertedOtherException
protected String throwConvertedOtherException(Throwable ex) throws ExecutionControl.RunException, ExecutionControl.InternalException
描述从类别复制:DirectExecutionControl将代理代码中的传入异常转换为ExecutionControl.ExecutionControlException的子类型,并抛出转换的异常。- 重写:
-
throwConvertedOtherException在DirectExecutionControl - 参数
-
ex- 转换的例外 - 结果
- 永远不会回报,因为它总是抛出
- 异常
-
ExecutionControl.RunException- 用于正常的异常事件 -
ExecutionControl.InternalException- 内部问题
-
clientCodeEnter
protected void clientCodeEnter()
描述从类别复制:DirectExecutionControl标记输入用户代码。
-
clientCodeLeave
protected void clientCodeLeave() throws ExecutionControl.InternalException描述从类别复制:DirectExecutionControl标记离开用户代码。- 重写:
-
clientCodeLeave在DirectExecutionControl - 异常
-
ExecutionControl.InternalException- in unexpected failure cases
-
-