Equinox/Futures
< Equinox
Revision as of 12:06, 29 January 2009 by John arthorne.ca.ibm.com (Talk | contribs) (→Introduction)
Introduction
With Equinox Galileo M5, a new bundle has been introduced org.eclipse.equinox.concurrent. Futures are a way to provide support for easier handling of concurrency and synchronization within multi-threaded and/or distributed applications. See Wikipedia article on Futures for some technical background information.
Contents of Equinox Concurrent Bundle
<xxx todo>
Examples of Using Futures
Here is an API that would normally return an Integer as the result of some synchronous computation
// foo() may be a long-running operation, and if so will block in order to // synchronously return the result Integer result = foo();
With futures, foo() could instead return an IFuture, and thereby guarantee that foo() would not block indefinitely.
// foo will return the future immediately and operation will complete // asynchronously IFuture future = foo(); // do other things while operation is completed asynchronously ... Integer result = (Integer) future.get();