Package hudson.remoting
Interface VirtualChannel
- All Known Implementing Classes:
Channel,LocalChannel
public interface VirtualChannel
Virtualized
Channel that allows different implementations.- Author:
- Kohsuke Kawaguchi
-
Method Summary
Modifier and TypeMethodDescription<V,T extends Throwable>
VMakes a remote procedure call.Makes an asynchronous remote procedure call.voidclose()Performs an orderly shut down of this channel (and the remote peer.)<T> TExports an object for remoting to the otherChannelby creating a remotable proxy.voidjoin()Waits for thisChannelto be closed down.voidjoin(long timeout) Waits for thisChannelto be closed down, but only up the given milliseconds.voidBlocks until all the I/O packets sent from remote is fully locally executed, then return.
-
Method Details
-
call
Makes a remote procedure call.Sends
Callableto the remote system, executes it, and returns its result. Such calls will be considered as user-space requests. If the channel cannot execute the requests (e.g. when it is being closed), the operations may be rejected even if the channel is still active.- Parameters:
callable- Callable to be executed- Throws:
InterruptedException- If the current thread is interrupted while waiting for the completion.IOException- If there's any error in the communication betweenChannels.T- User exception defined by the callable
-
callAsync
Makes an asynchronous remote procedure call.Similar to
call(Callable)but returns immediately. The result of theCallablecan be obtained through theFutureobject. Such calls will be considered as user-space requests. If the channel cannot execute the requests (e.g. when it is being closed), the operations may be rejected even if the channel is still active.- Returns:
- The
Futureobject that can be used to wait for the completion. - Throws:
IOException- If there's an error during the communication.
-
close
Performs an orderly shut down of this channel (and the remote peer.)- Throws:
IOException- if the orderly shut-down failed.
-
join
Waits for thisChannelto be closed down. The close-down of aChannelmight be initiated locally or remotely.- Throws:
InterruptedException- If the current thread is interrupted while waiting for the completion.- Since:
- 1.300
-
join
Waits for thisChannelto be closed down, but only up the given milliseconds.- Parameters:
timeout- Timeout in milliseconds- Throws:
InterruptedException- If the current thread is interrupted while waiting for the completion.- Since:
- 1.300
-
export
Exports an object for remoting to the otherChannelby creating a remotable proxy. The returned reference must be kept if there is ongoing operation on the remote side. Once it is released, the exported object will be deallocated as well. Please keep in mind that the object may be also released earlier than expected by JVM (e.g. see JENKINS-23271).- Type Parameters:
T- Type- Parameters:
type- Interface to be remoted.instance- Instance to be exported.nullinstances won't be exported to the remote instance.All the parameters and return values must be serializable.
- Returns:
- the proxy object that implements
T. This object can be transferred to the otherChannel, and calling methods on it from the remote side will invoke the same method on the given localinstanceobject.nullif the input instance isnull.
-
syncLocalIO
Blocks until all the I/O packets sent from remote is fully locally executed, then return.- Throws:
InterruptedException- Since:
- 1.402
-