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

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;
}
主站蜘蛛池模板: 竹北市| 霍州市| 虞城县| 鹤山市| 凌云县| 江陵县| 长葛市| 正定县| 湄潭县| 枣强县| 南昌市| 博爱县| 莱州市| 洪江市| 积石山| 焉耆| 寿宁县| 靖远县| 广德县| 科尔| 潮州市| 东乌珠穆沁旗| 本溪市| 井研县| 隆子县| 南江县| 辽中县| 馆陶县| 瑞安市| 庆阳市| 金山区| 家居| 榆树市| 西盟| 中宁县| 宁蒗| 滨州市| 河池市| 金平| 肥乡县| 武威市|