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 ...
Get Java™ Network Programming and Distributed Computing 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.