75 |
|
return sync.innerCancel(mayInterruptIfRunning); |
76 |
|
} |
77 |
|
|
78 |
– |
/** |
79 |
– |
* Waits if necessary for execution to complete, and then |
80 |
– |
* retrieves its result. |
81 |
– |
* |
82 |
– |
* @return computed result |
83 |
– |
* @throws CancellationException if underlying computation was |
84 |
– |
* cancelled |
85 |
– |
* @throws ExecutionException if underlying computation threw an |
86 |
– |
* exception |
87 |
– |
* @throws InterruptedException if current thread was interrupted |
88 |
– |
* while waiting |
89 |
– |
*/ |
78 |
|
public V get() throws InterruptedException, ExecutionException { |
79 |
|
return sync.innerGet(); |
80 |
|
} |
81 |
|
|
94 |
– |
/** |
95 |
– |
* Waits if necessary for at most the given time for execution to |
96 |
– |
* complete, and then retrieves its result, if available. |
97 |
– |
* |
98 |
– |
* @param timeout the maximum time to wait |
99 |
– |
* @param unit the time unit of the timeout argument |
100 |
– |
* @return computed result |
101 |
– |
* @throws CancellationException if underlying computation was |
102 |
– |
* cancelled |
103 |
– |
* @throws ExecutionException if underlying computation threw an |
104 |
– |
* exception |
105 |
– |
* @throws InterruptedException if current thread was interrupted |
106 |
– |
* while waiting |
107 |
– |
* @throws TimeoutException if the wait timed out |
108 |
– |
*/ |
82 |
|
public V get(long timeout, TimeUnit unit) |
83 |
|
throws InterruptedException, ExecutionException, TimeoutException { |
84 |
|
return sync.innerGet(unit.toNanos(timeout)); |
123 |
|
} |
124 |
|
|
125 |
|
/** |
126 |
< |
* Executes the computation without setting result, and then |
127 |
< |
* resets this Future to initial state; failing to do so if the |
126 |
> |
* Executes the computation without setting its result, and then |
127 |
> |
* resets this Future to initial state, failing to do so if the |
128 |
|
* computation encounters an exception or is cancelled. This is |
129 |
|
* designed for use with tasks that intrinsically execute more |
130 |
|
* than once. |
136 |
|
|
137 |
|
/** |
138 |
|
* Synchronization control for FutureTask. Note that this must be |
139 |
< |
* a non-static inner class in order to invoke protected |
139 |
> |
* a non-static inner class in order to invoke the protected |
140 |
|
* <tt>done</tt> method. For clarity, all inner class support |
141 |
|
* methods are same as outer, prefixed with "inner". |
142 |
|
* |