Java RMI - send Client stubs to other clients
I've got to implement something like P2P in RMI. 开发者_StackOverflow社区I've created two Remote intrfaces : server and client. Server is responsible for registering clients and returning client stubs to other clients that request it. How should I accomplish this? The method signature on the server looks like this:
IClient getClient(String resource) throws RemoteException;
The problem is I don't really know how should I implement that regarding the stubs&skeleton issues and that many things is happening behind the scenes.
You don't have to worry about it since JDK 1.5. See the preamble to the Javadoc for UnicastRemoteObject. As long as you quote a port number, even zero, when calling super() or exportObject you don't need stubs. And you haven't needed skeletons since 1998.
精彩评论