O'Reilly logo

Java™ Network Programming and Distributed Computing by Michael Reilly, David Reilly

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

11.11. Using Remote Method Invocation to Implement Callbacks

A common technique used in event-driven programming is the callback. The simplest way of understanding a callback is to think of a phone call. Suppose you want to know if a stock price hits a certain level, and you ask your broker to call back when it does. When the broker (the source of the event) notices that the stock price reflects your parameters, he or she calls you back, to notify you of the new price. That's a callback.

11.11.1. Object-Oriented Callbacks

Of course, in an object-oriented system, we're talking about software components or entire systems, not people. When one object needs to be notified of events as they occur (as opposed to continually polling to see if an event ...

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