- java.lang.Object
-
- jdk.jshell.execution.StreamingExecutionControl
-
- All Implemented Interfaces:
-
AutoCloseable,ExecutionControl
- 已知直接子类:
-
JdiExecutionControl
public class StreamingExecutionControl extends Object implements ExecutionControl
ExecutionControl执行引擎SPI的实现, 它将请求传送到执行发生的远程代理。- 从以下版本开始:
- 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 描述 StreamingExecutionControl(ObjectOutput out, ObjectInput in)创建一个实例。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidaddToClasspath(String path)将路径添加到执行类路径。voidclose()关闭执行引擎。ObjectextensionCommand(String command, Object arg)运行非标准命令(或较新版本的标准命令)。Stringinvoke(String classname, String methodname)通过调用指定的包装类上的方法来调用可执行代码段。voidload(ExecutionControl.ClassBytecodes[] cbcs)尝试加载新类。voidredefine(ExecutionControl.ClassBytecodes[] cbcs)尝试重新定义以前加载的类。voidstop()中断一个正在运行的调用。StringvarValue(String classname, String varname)返回变量的值。-
Methods inherited from interface jdk.jshell.spi.ExecutionControl
generate, generate
-
-
-
-
构造方法详细信息
-
StreamingExecutionControl
public StreamingExecutionControl(ObjectOutput out, ObjectInput in)
创建一个实例。- 参数
-
out- 命令的输出 -
in- 命令响应的输入
-
-
方法详细信息
-
load
public void load(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
描述从接口ExecutionControl复制尝试加载新类。- Specified by:
-
load在接口ExecutionControl - 参数
-
cbcs- 要加载的类名和字节码 - 异常
-
ExecutionControl.ClassInstallException- 加载类时发生异常,部分或全部未加载 -
ExecutionControl.NotImplementedException- 如果没有实现 -
ExecutionControl.EngineTerminationException- 执行引擎已终止
-
redefine
public void redefine(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
说明从接口ExecutionControl复制尝试重新定义以前加载的类。- Specified by:
-
redefine在接口ExecutionControl - 参数
-
cbcs- 重新定义的类名和字节码 - 异常
-
ExecutionControl.ClassInstallException- 异常重新定义类,有些或全部没有重新定义 -
ExecutionControl.NotImplementedException- 如果没有实现 -
ExecutionControl.EngineTerminationException- 执行引擎已经终止
-
invoke
public String invoke(String classname, String methodname) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
描述从接口ExecutionControl复制通过调用指定的包装类上的方法来调用可执行代码段。 该方法必须没有参数并返回String。- Specified by:
-
invoke在接口ExecutionControl - 参数
-
classname- 应该调用其方法的类 -
methodname- 调用方法的名称 - 结果
- 执行的结果或如果没有结果为null
- 异常
-
ExecutionControl.UserException- 调用引发用户异常 -
ExecutionControl.ResolutionException- 调用尝试直接或间接调用未解析的代码段 -
ExecutionControl.StoppedException-如果invoke()被取消ExecutionControl.stop() -
ExecutionControl.EngineTerminationException- 执行引擎已终止 -
ExecutionControl.InternalException- 发生内部问题 -
ExecutionControl.RunException
-
varValue
public String varValue(String classname, String varname) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
说明从接口ExecutionControl复制返回变量的值。- Specified by:
-
varValue在接口ExecutionControl - 参数
-
classname- 变量的包装类的名称 -
varname- 变量的名称 - 结果
- 变量的值
- 异常
-
ExecutionControl.UserException- 格式化该值引发用户异常 -
ExecutionControl.ResolutionException- 格式化尝试直接或间接调用未解析的代码段的值 -
ExecutionControl.StoppedException- 如果格式化值被取消ExecutionControl.stop() -
ExecutionControl.EngineTerminationException- 执行引擎已终止 -
ExecutionControl.InternalException- 发生内部问题 -
ExecutionControl.RunException
-
addToClasspath
public void addToClasspath(String path) throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
描述从接口ExecutionControl复制将路径添加到执行类路径。- Specified by:
-
addToClasspath在接口ExecutionControl - 参数
-
path- 要添加的路径 - 异常
-
ExecutionControl.EngineTerminationException- 执行引擎已经终止 -
ExecutionControl.InternalException- 发生内部问题
-
stop
public void stop() throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException说明从接口ExecutionControl复制中断一个正在运行的调用。- Specified by:
-
stop在接口ExecutionControl - 异常
-
ExecutionControl.EngineTerminationException- 执行引擎已终止 -
ExecutionControl.InternalException- 发生内部问题
-
extensionCommand
public Object extensionCommand(String command, Object arg) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
说明从接口ExecutionControl复制运行非标准命令(或较新版本的标准命令)。- Specified by:
-
extensionCommand在接口ExecutionControl - 参数
-
command- 非标准命令 -
arg- 命令参数 - 结果
- 命令返回值
- 异常
-
ExecutionControl.UserException- 该命令引发用户异常 -
ExecutionControl.ResolutionException- 该命令尝试直接或间接调用未解析的代码段 -
ExecutionControl.StoppedException- 如果命令被ExecutionControl.stop()取消 -
ExecutionControl.EngineTerminationException- 执行引擎已终止 -
ExecutionControl.NotImplementedException- 如果没有实现 -
ExecutionControl.InternalException- 发生内部问题 -
ExecutionControl.RunException
-
close
public void close()
关闭执行引擎。 发送退出命令到远程代理。- Specified by:
-
close在接口AutoCloseable - Specified by:
-
close在接口ExecutionControl
-
-