KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > remoting > VirtualChannel


1 package hudson.remoting;
2
3 import java.io.IOException JavaDoc;
4
5 /**
6  * Virtualized {@link Channel} that allows different implementations.
7  *
8  * @author Kohsuke Kawaguchi
9  */

10 public interface VirtualChannel {
11     /**
12      * Makes a remote procedure call.
13      *
14      * <p>
15      * Sends {@link Callable} to the remote system, executes it, and returns its result.
16      *
17      * @throws InterruptedException
18      * If the current thread is interrupted while waiting for the completion.
19      * @throws IOException
20      * If there's any error in the communication between {@link Channel}s.
21      */

22     <V,T extends Throwable JavaDoc>
23     V call(Callable<V,T> callable) throws IOException JavaDoc, T, InterruptedException JavaDoc;
24
25     /**
26      * Makes an asynchronous remote procedure call.
27      *
28      * <p>
29      * Similar to {@link #call(Callable)} but returns immediately.
30      * The result of the {@link Callable} can be obtained through the {@link Future} object.
31      *
32      * @return
33      * The {@link Future} object that can be used to wait for the completion.
34      * @throws IOException
35      * If there's an error during the communication.
36      */

37     <V,T extends Throwable JavaDoc>
38     Future<V> callAsync(final Callable<V,T> callable) throws IOException JavaDoc;
39
40     /**
41      * Performs an orderly shut down of this channel (and the remote peer.)
42      *
43      * @throws IOException
44      * if the orderly shut-down failed.
45      */

46     void close() throws IOException JavaDoc;
47
48     /**
49      * Exports an object for remoting to the other {@link Channel}
50      * by creating a remotable proxy.
51      *
52      * <p>
53      * All the parameters and return values must be serializable.
54      *
55      * @param type
56      * Interface to be remoted.
57      * @return
58      * the proxy object that implements <tt>T</tt>. This object can be transfered
59      * to the other {@link Channel}, and calling methods on it from the remote side
60      * will invoke the same method on the given local <tt>instance</tt> object.
61      */

62     <T> T export( Class JavaDoc<T> type, T instance);
63 }
64
Popular Tags