官术网_书友最值得收藏!

Writing an RMI server

Suppose we are building an application to perform diverse mathematical operations. Let's design a project that can sit on a server. Post this, have different client projects interact with this project to pass the parameters and get the computation on the remote object execute and return the result to the client components. This needs the remote interface to be defined first, as discussed in the preceding section.

The following is the definition of the Calculate interface that extends the Remote interface:

package remote;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Calculate extends Remote {
public long add(long parameterOne, long parameterTwo)
throws RemoteException;
public long sub(long parameterOne, long parameterTwo)
throws RemoteException;
public long mul(long parameterOne, long parameterTwo)
throws RemoteException;
public long div(long parameterOne, long parameterTwo)
throws RemoteException;
}
主站蜘蛛池模板: 台州市| 吉林市| 宁明县| 泸州市| 龙岩市| 子洲县| 渝北区| 洱源县| 正镶白旗| 佳木斯市| 保德县| 安溪县| 新巴尔虎左旗| 静安区| 岢岚县| 呼玛县| 孝感市| 洞头县| 浙江省| 连南| 抚顺县| 通山县| 大新县| 无棣县| 江津市| 成武县| 郸城县| 北辰区| 北川| 泾川县| 怀集县| 青海省| 泸州市| 遂平县| 甘泉县| 盈江县| 砚山县| 定南县| 崇文区| 佛坪县| 开江县|