|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthudson.remoting.Pipe
public final class Pipe
Pipe for the remote Callable and the local program to talk to each other.
There are two kinds of pipes. One is for having a local system write to a remote system, and the other is for having a remote system write to a local system. Use the different versions of the create method to create the appropriate kind of pipes.
Once created, Pipe can be sent to the remote system as a part of a serialization of
Callable between Channels.
Once re-instantiated on the remote Channel, pipe automatically connects
back to the local instance and perform necessary set up.
The local and remote system can then call getIn() and getOut() to
read/write bytes.
Pipe can be only written by one system and read by the other system. It is an error to
send one Pipe to two remote Channels, or send one Pipe to
the same Channel twice.
final Pipe p = Pipe.createLocalToRemote();
channel.callAsync(new Callable() {
public Object call() {
InputStream in = p.getIn();
... read from in ...
}
});
OutputStream out = p.getOut();
... write to out ...
For better performance, Pipe uses lower-level Command abstraction
to send data, instead of typed proxy object. This allows the writer to send data
without blocking until the arrival of the data is confirmed.
| Method Summary | |
|---|---|
static Pipe |
createLocalToRemote()
Creates a Pipe that allows local system to write and remote system to read. |
static Pipe |
createRemoteToLocal()
Creates a Pipe that allows remote system to write and local system to read. |
InputStream |
getIn()
Gets the reading end of the pipe. |
OutputStream |
getOut()
Gets the writing end of the pipe. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public InputStream getIn()
public OutputStream getOut()
public static Pipe createRemoteToLocal()
Pipe that allows remote system to write and local system to read.
public static Pipe createLocalToRemote()
Pipe that allows local system to write and remote system to read.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||