hudson.remoting
Class LocalChannel

java.lang.Object
  extended by hudson.remoting.LocalChannel
All Implemented Interfaces:
VirtualChannel

public class LocalChannel
extends java.lang.Object
implements VirtualChannel

VirtualChannel that performs computation on the local JVM.

Author:
Kohsuke Kawaguchi

Constructor Summary
LocalChannel(java.util.concurrent.ExecutorService executor)
           
 
Method Summary
<V,T extends java.lang.Throwable>
V
call(Callable<V,T> callable)
          Makes a remote procedure call.
<V,T extends java.lang.Throwable>
Future<V>
callAsync(Callable<V,T> callable)
          Makes an asynchronous remote procedure call.
 void close()
          Performs an orderly shut down of this channel (and the remote peer.)
<T> T
export(java.lang.Class<T> intf, T instance)
          Exports an object for remoting to the other Channel by creating a remotable proxy.
 void join()
          Waits for this Channel to be closed down.
 void join(long timeout)
          Waits for this Channel to be closed down, but only up the given milliseconds.
 void syncLocalIO()
          Blocks until all the I/O packets sent from remote is fully locally executed, then return.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalChannel

public LocalChannel(java.util.concurrent.ExecutorService executor)
Method Detail

call

public <V,T extends java.lang.Throwable> V call(Callable<V,T> callable)
       throws T extends java.lang.Throwable
Description copied from interface: VirtualChannel
Makes a remote procedure call.

Sends Callable to the remote system, executes it, and returns its result.

Specified by:
call in interface VirtualChannel
Throws:
T extends java.lang.Throwable

callAsync

public <V,T extends java.lang.Throwable> Future<V> callAsync(Callable<V,T> callable)
                    throws java.io.IOException
Description copied from interface: VirtualChannel
Makes an asynchronous remote procedure call.

Similar to VirtualChannel.call(Callable) but returns immediately. The result of the Callable can be obtained through the Future object.

Specified by:
callAsync in interface VirtualChannel
Returns:
The Future object that can be used to wait for the completion.
Throws:
java.io.IOException - If there's an error during the communication.

close

public void close()
Description copied from interface: VirtualChannel
Performs an orderly shut down of this channel (and the remote peer.)

Specified by:
close in interface VirtualChannel

join

public void join()
          throws java.lang.InterruptedException
Description copied from interface: VirtualChannel
Waits for this Channel to be closed down. The close-down of a Channel might be initiated locally or remotely.

Specified by:
join in interface VirtualChannel
Throws:
java.lang.InterruptedException - If the current thread is interrupted while waiting for the completion.

join

public void join(long timeout)
          throws java.lang.InterruptedException
Description copied from interface: VirtualChannel
Waits for this Channel to be closed down, but only up the given milliseconds.

Specified by:
join in interface VirtualChannel
Throws:
java.lang.InterruptedException - If the current thread is interrupted while waiting for the completion.

export

public <T> T export(java.lang.Class<T> intf,
                    T instance)
Description copied from interface: VirtualChannel
Exports an object for remoting to the other Channel by creating a remotable proxy.

All the parameters and return values must be serializable.

Specified by:
export in interface VirtualChannel
Parameters:
intf - Interface to be remoted.
Returns:
the proxy object that implements T. This object can be transfered to the other Channel, and calling methods on it from the remote side will invoke the same method on the given local instance object.

syncLocalIO

public void syncLocalIO()
                 throws java.lang.InterruptedException
Description copied from interface: VirtualChannel
Blocks until all the I/O packets sent from remote is fully locally executed, then return.

Specified by:
syncLocalIO in interface VirtualChannel
Throws:
java.lang.InterruptedException


Copyright © 2012. All Rights Reserved.