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

org.zbus.net.Invoker Maven / Gradle / Ivy

There is a newer version: 7.2.2
Show newest version
package org.zbus.net;

import java.io.IOException;

import org.zbus.net.Sync.ResultCallback;

/**
 * The abstraction of remote invocation:
 * 1) invoke synchronously
 * 2) invoke asynchronously with a callback
 * 
 * @author rushmore (洪磊明)
 *
 * @param  request type
 * @param  response type
 */
public interface Invoker { 
	/**
	 * invoke synchronously with a timeout specified
	 * 
	 * @param req request message/object
	 * @param timeout waiting timeout in milliseconds
	 * @return response message/object
	 * @throws IOException if network failure happens
	 * @throws InterruptedException if invocation is interrupted
	 */
	RES invokeSync(REQ req, int timeout) throws IOException, InterruptedException;

	/**
	 * invoke asynchronously 
	 * @param req request message/object
	 * @param callback called when the response arrive
	 * @throws IOException if network failure happens
	 */
	void invokeAsync(REQ req, ResultCallback callback) throws IOException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy