Passing Remote Objects
In the RMI server example, the remote object was registered in the naming registry and then passed to the client on lookup.
More generally remote objects can be passed as either input or return parameters to remote methods, enabling quite general communications patterns.
The RMI server example implemented a classic client/server model where the server provides services encapsulated into methods in a remote interface. Clients initiate communication by calling a remote method.
But the client can also provide a remote interface and pass itself as a remote object to the server. Then the server can also initiate communication by calling remote methods on the client.
In remaining pages, we sketch such a collaboration server example. We omit details about setting up threads and synchronization and the server side RMI interface, in order to show the client side interface.