All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.remoting.VirtualChannel Maven / Gradle / Ivy

Go to download

Contains the bootstrap code to bridge separate JVMs into a single semi-shared space. Reusable outside Hudson.

There is a newer version: 3.0.3
Show newest version
/*******************************************************************************
 *
 * Copyright (c) 2004-2009 Oracle Corporation.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: 
*
*    Kohsuke Kawaguchi
 *     
 *
 *******************************************************************************/ 

package hudson.remoting;

import java.io.IOException;

/**
 * Virtualized {@link Channel} that allows different implementations.
 * 
 * @author Kohsuke Kawaguchi
 */
public interface VirtualChannel {
    /**
     * Makes a remote procedure call.
     *
     * 

* Sends {@link Callable} to the remote system, executes it, and returns its result. * * @throws InterruptedException * If the current thread is interrupted while waiting for the completion. * @throws IOException * If there's any error in the communication between {@link Channel}s. */ V call(Callable callable) throws IOException, T, InterruptedException; /** * Makes an asynchronous remote procedure call. * *

* Similar to {@link #call(Callable)} but returns immediately. * The result of the {@link Callable} can be obtained through the {@link Future} object. * * @return * The {@link Future} object that can be used to wait for the completion. * @throws IOException * If there's an error during the communication. */ Future callAsync(final Callable callable) throws IOException; /** * Performs an orderly shut down of this channel (and the remote peer.) * * @throws IOException * if the orderly shut-down failed. */ void close() throws IOException; /** * Waits for this {@link Channel} to be closed down. * * The close-down of a {@link Channel} might be initiated locally or remotely. * * @throws InterruptedException * If the current thread is interrupted while waiting for the completion. * @since 1.300 */ public void join() throws InterruptedException; /** * Waits for this {@link Channel} to be closed down, but only up the given milliseconds. * * @throws InterruptedException * If the current thread is interrupted while waiting for the completion. * @since 1.300 */ public void join(long timeout) throws InterruptedException; /** * Exports an object for remoting to the other {@link Channel} * by creating a remotable proxy. * *

* All the parameters and return values must be serializable. * * @param type * Interface to be remoted. * @return * the proxy object that implements T. This object can be transfered * to the other {@link Channel}, and calling methods on it from the remote side * will invoke the same method on the given local instance object. */ T export( Class type, T instance); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy