作者sbrhsieh (偶爾想擺爛一下)
看板java
標題Re: [J2SE] RMI
時間Sun Nov 1 02:08:57 2009
※ 引述《InitialShuk (Shuk)》之銘言:
: 再次詳述我的想法:
: server 端:MyRemote(interface) MyRemoterImpl(main)
: Client 端:MyRemoteClient MyRemote <===現在需將interface先給client端
: (新版的用法 雖然目前我還看不出
: "產生stub再給client"
: "把interface直接給client端" 兩者比較省工在哪?)底層?
不管 client 使用哪一版的 JRE, client site 部屬程式時就必須有 remote object
interface. 如果 client site 在 build time 沒有 remote object interface,
那 client 程式還能做什麼事是有關於 remote object 提供的 service?
JRE 1.5+ 新增動態產生 stub 的機制後, 可以讓 remote object server 在 build,
deployment 時省點事(應用的情境越複雜省的程度會降低).
建置階段不需要事先產生 stub class.
部署時不需要提供可讓 client下載檔案的 server(讓 client 下載 stub class),
如果應用情境夠單純的話.
: server端啟動法
: start rmiregistry
: java MyRemoteImpl
: 要如何把server端包成jar 讓他點兩下可以直行上面兩個動作
: 當然我會下面那個拉~"~(manifest)
很顯然你沒有看 API doc, 甚至沒有仔細看與想下面這一段文的意思.
: : rmiregistry 工具程式是以一個 java process 來提供 rmi registry(所以程式向
: : rmi registry 註冊或取得 object 本身也是透過 RMI 機制). 如果你的 rmi server
: : 程式自己提供(建立) rmi registry, 就不需要額外使用 rmiregistry 工具程式
: : 來建立 rmi registry.
: : see: java.rmi.registry.LocateRegistry class
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.173.133.172
※ 編輯: sbrhsieh 來自: 218.173.133.172 (11/01 02:10)
→ InitialShuk:sry... 11/01 12:22
推 InitialShuk:感謝sbrhsieh讓我了解RMI,願意回我文^^ 11/01 12:39
→ InitialShuk:已經知道盲點在哪 也解決了^^ 11/01 12:41