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

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;
}
主站蜘蛛池模板: 青海省| 新余市| 贵阳市| 平乡县| 娄烦县| 遂溪县| 分宜县| 灵武市| 西青区| 丰都县| 京山县| 柳林县| 湖口县| 墨脱县| 宜昌市| 白河县| 霍林郭勒市| 长治市| 忻城县| 宝清县| 阿坝县| 积石山| 敖汉旗| 晋城| 浦江县| 紫金县| 云南省| 定兴县| 清水河县| 牡丹江市| 五寨县| 深州市| 滁州市| 舟山市| 林周县| 山阳县| 乐至县| 莆田市| 和顺县| 宕昌县| 江津市|