O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing Callbacks

In most RMI applications, a client makes a call to a server object. In some cases, however, the server needs to make a call back to the client. For example, in a stock quote system, you might set up the server to call the client every time a stock price changes. A client registers with the server by invoking a remote method and passing a remote object reference to the server. From the client's standpoint, it's really passing a remote object, but RMI converts the remote object to a remote reference (that is, stub) when it sends the request to the server.

Figure 4.6 illustrates how the callback generally works.

Figure 4.6. With a callback architecture, the server can invoke methods on a client.

Listing 4.10 shows a simple ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required