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

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;
}
主站蜘蛛池模板: 五台县| 喀什市| 陈巴尔虎旗| 广宁县| 祁东县| 永吉县| 新源县| 犍为县| 遂昌县| 恭城| 凯里市| 新余市| 山东省| 平陆县| 社会| 石屏县| 明水县| 延津县| 道孚县| 辽阳县| 宣恩县| 昂仁县| 达拉特旗| 云林县| 平湖市| 信宜市| 江陵县| 卓尼县| 克山县| 古田县| 安阳市| 广宁县| 光泽县| 射洪县| 黎平县| 会理县| 五家渠市| 阿城市| 诸暨市| 靖宇县| 河间市|