public class Util extends Object
ExecutionControl
. Particularly implementations with remote
execution.Modifier and Type | Method and 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>> streamMap)
Forward commands from the input to the specified
ExecutionControl
instance, then responses back on the output. |
static void |
forwardInputToRemote(InputStream inputStream,
OutputStream outStream,
Consumer<Exception> handler)
Creates a Thread that will ship all input to the remote agent.
|
static ObjectInput |
remoteInput(InputStream input,
Map<String,OutputStream> streamMap)
Reads from an InputStream which has been packetized and write its contents
to the out and err OutputStreams; Copies the command stream.
|
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>> streamMap) 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 System.out
,
System.err
, any specified auxiliary channels, and the
command response output.streamMap
- a map between names of additional streams to carry and setters
for the streamIOException
- if there are errors using the passed streamspublic static ObjectInput remoteInput(InputStream input, Map<String,OutputStream> streamMap) throws IOException
input
- the packetized input streamstreamMap
- a map between stream names and the output streams to forwardIOException
- 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
informationpublic static void forwardInputToRemote(InputStream inputStream, OutputStream outStream, Consumer<Exception> handler)
inputStream
- the user inputoutStream
- the input to the remote agenthandler
- a failure handler
Copyright © 2015, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-08-10-220919.robert.dev