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.void
close()
Performs an orderly shut down of this channel (and the remote peer.)<T> T
Exports an object for remoting to the otherChannel
by creating a remotable proxy.void
join()
Waits for thisChannel
to be closed down.void
join
(long timeout) Waits for thisChannel
to be closed down, but only up the given milliseconds.void
Blocks until all the I/O packets sent from remote is fully locally executed, then return.
-
Method Details
-
call
Makes a remote procedure call.Sends
Callable
to 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 betweenChannel
s.T
- User exception defined by the callable
-
callAsync
Makes an asynchronous remote procedure call.Similar to
call(Callable)
but returns immediately. The result of theCallable
can be obtained through theFuture
object. 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
Future
object 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 thisChannel
to be closed down. The close-down of aChannel
might be initiated locally or remotely.- Throws:
InterruptedException
- If the current thread is interrupted while waiting for the completion.- Since:
- 1.300
-
join
Waits for thisChannel
to 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 otherChannel
by 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:
instance
- Instance to be exported.null
instances won't be exported to the remote instance.All the parameters and return values must be serializable.
type
- Interface to be remoted.- 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 localinstance
object.null
if 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
-