Using RMI Callbacks

Most remote object invocations use one-way invocation; the client obtains a remote object reference and makes calls on the methods of that remote reference. But sometimes it is convenient to provide two-way communication with a server object, allowing a client to make a call on a server object and having the server object respond to the client using a callback method. An efficient implementation of such a remote server would use internal multithreading to manage the clients. The following example demonstrates such an approach.

In this example we have a client application that would like to monitor orders as they are shipped. To implement this solution, we will register the client applications with the server to receive status ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.