Concurrent Java with a Future interface

One of the more common and popular APIs is the Future<V> interface. Future is a means to encapsulate an asynchronous calculation. Typically, the Future instance is returned by ExecutorService, which we'll discuss later. The calling code, once it has the reference to Future, can continue to work on other tasks while Future runs in the background in another thread. When the caller is ready for the results of Future, it calls Future.get(). If Future has finished its work, the call returns immediately with the results. If, however, Future is still working, calls to get() will block until Future completes.

For our uses, though, Future isn't the most appropriate choice. Looking over the non-functional requirements, ...

Get Java 9: Building Robust Modular Applications 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.