public class Util extends Object
ExecutionControl
. Particularly implementations with remote
execution.Modifier and Type | Method | Description |
---|---|---|
static void |
detectJDIExitEvent(com.sun.jdi.VirtualMachine vm,
Consumer<String> unbiddenExitHandler) |
Monitor the JDI event stream for
VMDeathEvent
and VMDisconnectEvent . |
static ExecutionControl.Generator |
failOverExecutionControlGenerator(ExecutionControl.Generator gec0,
ExecutionControl.Generator... gecs) |
Create a composite
ExecutionControl.Generator instance that, when
generating, will try each specified generator until successfully creating
an ExecutionControl instance, or, if all fail, will re-throw the
first exception. |
static void |
forwardExecutionControl(ExecutionControl ec,
ObjectInput in,
ObjectOutput out) |
Forward commands from the input to the specified
ExecutionControl
instance, then responses back on the output. |
static void |
forwardExecutionControlAndIO(ExecutionControl ec,
InputStream inStream,
OutputStream outStream,
Map<String,Consumer<OutputStream>> outputStreamMap,
Map<String,Consumer<InputStream>> inputStreamMap) |
Forward commands from the input to the specified
ExecutionControl
instance, then responses back on the output. |
static ExecutionControl |
remoteInputOutput(InputStream input,
OutputStream output,
Map<String,OutputStream> outputStreamMap,
Map<String,InputStream> inputStreamMap,
BiFunction<ObjectInput,ObjectOutput,ExecutionControl> factory) |
Creates an ExecutionControl for given packetized input and output.
|
public static ExecutionControl.Generator failOverExecutionControlGenerator(ExecutionControl.Generator gec0, ExecutionControl.Generator... gecs)
ExecutionControl.Generator
instance that, when
generating, will try each specified generator until successfully creating
an ExecutionControl
instance, or, if all fail, will re-throw the
first exception.gec0
- the first instance to trygecs
- the second through Nth instance to trypublic static void forwardExecutionControl(ExecutionControl ec, ObjectInput in, ObjectOutput out)
ExecutionControl
instance, then responses back on the output.ec
- the direct instance of ExecutionControl
to process commandsin
- the command inputout
- the command response outputpublic static void forwardExecutionControlAndIO(ExecutionControl ec, InputStream inStream, OutputStream outStream, Map<String,Consumer<OutputStream>> outputStreamMap, Map<String,Consumer<InputStream>> inputStreamMap) throws IOException
ExecutionControl
instance, then responses back on the output.ec
- the direct instance of ExecutionControl
to process commandsinStream
- the stream from which to create the command inputoutStream
- the stream that will carry any specified auxiliary channels (like
System.out
and System.err
), and the command response output.outputStreamMap
- a map between names of additional streams to carry and setters
for the stream. Names starting with '$' are reserved for internal use.inputStreamMap
- a map between names of additional streams to carry and setters
for the stream. Names starting with '$' are reserved for internal use.IOException
- if there are errors using the passed streamspublic static ExecutionControl remoteInputOutput(InputStream input, OutputStream output, Map<String,OutputStream> outputStreamMap, Map<String,InputStream> inputStreamMap, BiFunction<ObjectInput,ObjectOutput,ExecutionControl> factory) throws IOException
input
- the packetized input streamoutput
- the packetized output streamoutputStreamMap
- a map between stream names and the output streams to forward.
Names starting with '$' are reserved for internal use.inputStreamMap
- a map between stream names and the input streams to forward.
Names starting with '$' are reserved for internal use.factory
- to create the ExecutionControl from ObjectInput and ObjectOutput.IOException
- if setting up the streams raised an exceptionpublic static void detectJDIExitEvent(com.sun.jdi.VirtualMachine vm, Consumer<String> unbiddenExitHandler)
VMDeathEvent
and VMDisconnectEvent
. If encountered, invokes
unbiddenExitHandler
.vm
- the virtual machine to checkunbiddenExitHandler
- the handler, which will accept the exit
information
Copyright © 2015, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-Ubuntu+0-9b143-1ubuntu1