クライアントとサーバの機能実装
出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2017/02/18 20:06 UTC 版)
「RMI-IIOP」の記事における「クライアントとサーバの機能実装」の解説
public class MyServerImpl implements MyServer{ void receiveRequest(MyClient client, String message) throws RemoteException { System.out.println("The client says: "+message); client.receiveReply("Yes, "+message+", "+message+", "+message+"..."); }} public class MyClientImpl implements MyClient{ MyServer server; public MyClientImpl(String Server_IOR, ORB orb) throws Exception { server = (MyServer) PortableRemoteObject.narrow( orb.string_to_object(Server_IOR), MyServer.class); } // これはリモートメソッド void receiveReply(String message) throws RemoteException { System.out.println("And the answer is: "+message); } // これはリモートメソッドではなく、ローカルメソッド public void talk(String conversation) { server.receiveRequest(this, conversation); }} RMI-IIOP 開発ツール(rmic)は上記2つのクラスを使い、リモート側で使われる2つのスタブとサービス側で使われる2つの Tie を生成する。つまり、スタブと Tie のペアがそれぞれクライアント側とサーバ側に置かれる。
※この「クライアントとサーバの機能実装」の解説は、「RMI-IIOP」の解説の一部です。
「クライアントとサーバの機能実装」を含む「RMI-IIOP」の記事については、「RMI-IIOP」の概要を参照ください。
- クライアントとサーバの機能実装のページへのリンク