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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.