February 2014
Beginner
1248 pages
62h 25m
English
Interface Runnable provides only the most basic functionality for multithreaded programming. In fact, this interface has limitations. Suppose a Runnable is performing a long calculation and the application wants to retrieve the result of that calculation. The run method cannot return a value, so shared mutable data would be required to pass the value back to the calling thread. As you now know, this would require thread synchronization. The Callable interface (of package java.util.concurrent) fixes this limitation. The interface declares a single method named call which returns a value representing the result of the Callable’s task—such as the result of a long running calculation.
An application ...
Read now
Unlock full access