Represents a communication channel to the remote peer.
A {@link Channel} is a mechanism for two JVMs to communicate overbi-directional {@link InputStream}/ {@link OutputStream} pair.{@link Channel} represents an endpoint of the stream, and thustwo {@link Channel}s are always used in a pair.
Communication is established as soon as two {@link Channel} instancesare created at the end fo the stream pair until the stream is terminated via {@link #close()}.
The basic unit of remoting is an executable {@link Callable} object.An application can create a {@link Callable} object, and execute it remotelyby using the {@link #call(Callable)} method or {@link #callAsync(Callable)} method.
In this sense, {@link Channel} is a mechanism to delegate/offload computationto other JVMs and somewhat like an agent system. This is bit different from remoting technologies like CORBA or web services, where the server exposes a certain functionality that clients invoke.
{@link Callable} object, as well as the return value / exceptions,are transported by using Java serialization. All the necessary class files are also shipped over {@link Channel} on-demand, so there's no need topre-deploy such classes on both JVMs.
Implementor's Note
{@link Channel} builds its features in a layered model. Its higher-layerfeatures are built on top of its lower-layer features, and they are called layer-0, layer-1, etc.
- Layer 0: See {@link Command} for more details. This is for higher-level features,and not likely useful for applications directly.
- Layer 1: See {@link Request} for more details. This is for higher-level features,and not likely useful for applications directly.
@author Kohsuke Kawaguchi, Winston Prakash (bug fixes)