Java Reference
In-Depth Information
Table6-1 refersto java.util.concurrent.TimeUnit ,anenumthatrepres-
ents time durations at given units of granularity: DAYS , HOURS , MICROSECONDS ,
MILLISECONDS , MINUTES , NANOSECONDS , and SECONDS . Furthermore,
TimeUnit declares methods for converting across units (e.g., long
toHours(long duration) ),andforperformingtiminganddelayoperations(e.g.,
void sleep(long timeout) ) in these units.
Table6-1 alsoreferstocallabletasks,whichareanalogoustorunnabletasks.Unlike
Runnable , whose void run() method cannot throw checked exceptions,
Callable<V> declares a V call() method that returns a value, and which can
throwcheckedexceptionsbecause call() isdeclaredwitha throws Exception
clause.
Finally, Table 6-1 refers to the Future interface, which represents the result of
anasynchronouscomputation. Future ,whosegenerictypeis Future<V> ,provides
methodsforcancelingatask,forreturningatask'svalue,andfordeterminingwhether
or not the task has finished. Table 6-2 describes Future 's methods.
Search WWH ::




Custom Search