6 |
|
|
7 |
|
package jsr166y; |
8 |
|
|
9 |
– |
import java.util.concurrent.*; |
9 |
|
import java.io.Serializable; |
10 |
|
import java.util.Collection; |
11 |
|
import java.util.Collections; |
12 |
|
import java.util.List; |
13 |
|
import java.util.RandomAccess; |
14 |
|
import java.util.Map; |
15 |
< |
import java.util.WeakHashMap; |
15 |
> |
import java.lang.ref.WeakReference; |
16 |
> |
import java.lang.ref.ReferenceQueue; |
17 |
> |
import java.util.concurrent.Callable; |
18 |
> |
import java.util.concurrent.CancellationException; |
19 |
> |
import java.util.concurrent.ExecutionException; |
20 |
> |
import java.util.concurrent.Executor; |
21 |
> |
import java.util.concurrent.ExecutorService; |
22 |
> |
import java.util.concurrent.Future; |
23 |
> |
import java.util.concurrent.RejectedExecutionException; |
24 |
> |
import java.util.concurrent.RunnableFuture; |
25 |
> |
import java.util.concurrent.TimeUnit; |
26 |
> |
import java.util.concurrent.TimeoutException; |
27 |
> |
import java.util.concurrent.locks.ReentrantLock; |
28 |
> |
import java.lang.reflect.Constructor; |
29 |
|
|
30 |
|
/** |
31 |
|
* Abstract base class for tasks that run within a {@link ForkJoinPool}. |
69 |
|
* rethrown to callers attempting to join them. These exceptions may |
70 |
|
* additionally include {@link RejectedExecutionException} stemming |
71 |
|
* from internal resource exhaustion, such as failure to allocate |
72 |
< |
* internal task queues. |
72 |
> |
* internal task queues. Rethrown exceptions behave in the same way as |
73 |
> |
* regular exceptions, but, when possible, contain stack traces (as |
74 |
> |
* displayed for example using {@code ex.printStackTrace()}) of both |
75 |
> |
* the thread that initiated the computation as well as the thread |
76 |
> |
* actually encountering the exception; minimally only the latter. |
77 |
|
* |
78 |
|
* <p>The primary method for awaiting completion and extracting |
79 |
|
* results of a task is {@link #join}, but there are several variants: |
117 |
|
* result in exceptions or errors, possibly including |
118 |
|
* {@code ClassCastException}. |
119 |
|
* |
120 |
+ |
* <p>Method {@link #join} and its variants are appropriate for use |
121 |
+ |
* only when completion dependencies are acyclic; that is, the |
122 |
+ |
* parallel computation can be described as a directed acyclic graph |
123 |
+ |
* (DAG). Otherwise, executions may encounter a form of deadlock as |
124 |
+ |
* tasks cyclically wait for each other. However, this framework |
125 |
+ |
* supports other methods and techniques (for example the use of |
126 |
+ |
* {@link Phaser}, {@link #helpQuiesce}, and {@link #complete}) that |
127 |
+ |
* may be of use in constructing custom subclasses for problems that |
128 |
+ |
* are not statically structured as DAGs. |
129 |
+ |
* |
130 |
|
* <p>Most base support methods are {@code final}, to prevent |
131 |
|
* overriding of implementations that are intrinsically tied to the |
132 |
|
* underlying lightweight task scheduling framework. Developers |
141 |
|
* computation. Large tasks should be split into smaller subtasks, |
142 |
|
* usually via recursive decomposition. As a very rough rule of thumb, |
143 |
|
* a task should perform more than 100 and less than 10000 basic |
144 |
< |
* computational steps. If tasks are too big, then parallelism cannot |
145 |
< |
* improve throughput. If too small, then memory and internal task |
146 |
< |
* maintenance overhead may overwhelm processing. |
144 |
> |
* computational steps, and should avoid indefinite looping. If tasks |
145 |
> |
* are too big, then parallelism cannot improve throughput. If too |
146 |
> |
* small, then memory and internal task maintenance overhead may |
147 |
> |
* overwhelm processing. |
148 |
|
* |
149 |
|
* <p>This class provides {@code adapt} methods for {@link Runnable} |
150 |
|
* and {@link Callable}, that may be of use when mixing execution of |
170 |
|
* status maintenance (2) execution and awaiting completion (3) |
171 |
|
* user-level methods that additionally report results. This is |
172 |
|
* sometimes hard to see because this file orders exported methods |
173 |
< |
* in a way that flows well in javadocs. In particular, most |
147 |
< |
* join mechanics are in method quietlyJoin, below. |
173 |
> |
* in a way that flows well in javadocs. |
174 |
|
*/ |
175 |
|
|
176 |
|
/* |
192 |
|
|
193 |
|
/** The run status of this task */ |
194 |
|
volatile int status; // accessed directly by pool and workers |
169 |
– |
|
195 |
|
private static final int NORMAL = -1; |
196 |
|
private static final int CANCELLED = -2; |
197 |
|
private static final int EXCEPTIONAL = -3; |
198 |
|
private static final int SIGNAL = 1; |
199 |
|
|
200 |
|
/** |
176 |
– |
* Table of exceptions thrown by tasks, to enable reporting by |
177 |
– |
* callers. Because exceptions are rare, we don't directly keep |
178 |
– |
* them with task objects, but instead use a weak ref table. Note |
179 |
– |
* that cancellation exceptions don't appear in the table, but are |
180 |
– |
* instead recorded as status values. |
181 |
– |
* TODO: Use ConcurrentReferenceHashMap |
182 |
– |
*/ |
183 |
– |
static final Map<ForkJoinTask<?>, Throwable> exceptionMap = |
184 |
– |
Collections.synchronizedMap |
185 |
– |
(new WeakHashMap<ForkJoinTask<?>, Throwable>()); |
186 |
– |
|
187 |
– |
// Maintaining completion status |
188 |
– |
|
189 |
– |
/** |
201 |
|
* Marks completion and wakes up threads waiting to join this task, |
202 |
|
* also clearing signal request bits. |
203 |
|
* |
204 |
|
* @param completion one of NORMAL, CANCELLED, EXCEPTIONAL |
205 |
+ |
* @return completion status on exit |
206 |
|
*/ |
207 |
< |
private void setCompletion(int completion) { |
208 |
< |
int s; |
209 |
< |
while ((s = status) >= 0) { |
207 |
> |
private int setCompletion(int completion) { |
208 |
> |
for (int s;;) { |
209 |
> |
if ((s = status) < 0) |
210 |
> |
return s; |
211 |
|
if (UNSAFE.compareAndSwapInt(this, statusOffset, s, completion)) { |
212 |
|
if (s != 0) |
213 |
|
synchronized (this) { notifyAll(); } |
214 |
< |
break; |
214 |
> |
return completion; |
215 |
|
} |
216 |
|
} |
217 |
|
} |
218 |
|
|
219 |
|
/** |
220 |
< |
* Records exception and sets exceptional completion. |
220 |
> |
* Tries to block a worker thread until completed or timed out. |
221 |
> |
* Uses Object.wait time argument conventions. |
222 |
> |
* May fail on contention or interrupt. |
223 |
|
* |
224 |
< |
* @return status on exit |
224 |
> |
* @param millis if > 0, wait time. |
225 |
|
*/ |
226 |
< |
private void setExceptionalCompletion(Throwable rex) { |
227 |
< |
exceptionMap.put(this, rex); |
228 |
< |
setCompletion(EXCEPTIONAL); |
229 |
< |
} |
230 |
< |
|
231 |
< |
/** |
232 |
< |
* Blocks a worker thread until completion. Called only by |
218 |
< |
* pool. Currently unused -- pool-based waits use timeout |
219 |
< |
* version below. |
220 |
< |
*/ |
221 |
< |
final void internalAwaitDone() { |
222 |
< |
int s; // the odd construction reduces lock bias effects |
223 |
< |
while ((s = status) >= 0) { |
224 |
< |
try { |
226 |
> |
final void tryAwaitDone(long millis) { |
227 |
> |
int s; |
228 |
> |
try { |
229 |
> |
if (((s = status) > 0 || |
230 |
> |
(s == 0 && |
231 |
> |
UNSAFE.compareAndSwapInt(this, statusOffset, 0, SIGNAL))) && |
232 |
> |
status > 0) { |
233 |
|
synchronized (this) { |
234 |
< |
if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL)) |
235 |
< |
wait(); |
234 |
> |
if (status > 0) |
235 |
> |
wait(millis); |
236 |
|
} |
229 |
– |
} catch (InterruptedException ie) { |
230 |
– |
cancelIfTerminating(); |
237 |
|
} |
238 |
+ |
} catch (InterruptedException ie) { |
239 |
+ |
// caller must check termination |
240 |
|
} |
241 |
|
} |
242 |
|
|
243 |
|
/** |
244 |
< |
* Blocks a worker thread until completed or timed out. Called |
245 |
< |
* only by pool. |
238 |
< |
* |
239 |
< |
* @return status on exit |
244 |
> |
* Blocks a non-worker-thread until completion. |
245 |
> |
* @return status upon completion |
246 |
|
*/ |
247 |
< |
final int internalAwaitDone(long millis) { |
247 |
> |
private int externalAwaitDone() { |
248 |
|
int s; |
249 |
|
if ((s = status) >= 0) { |
250 |
< |
try { |
251 |
< |
synchronized (this) { |
252 |
< |
if (UNSAFE.compareAndSwapInt(this, statusOffset, s,SIGNAL)) |
253 |
< |
wait(millis, 0); |
250 |
> |
boolean interrupted = false; |
251 |
> |
synchronized (this) { |
252 |
> |
while ((s = status) >= 0) { |
253 |
> |
if (s == 0) |
254 |
> |
UNSAFE.compareAndSwapInt(this, statusOffset, |
255 |
> |
0, SIGNAL); |
256 |
> |
else { |
257 |
> |
try { |
258 |
> |
wait(); |
259 |
> |
} catch (InterruptedException ie) { |
260 |
> |
interrupted = true; |
261 |
> |
} |
262 |
> |
} |
263 |
|
} |
249 |
– |
} catch (InterruptedException ie) { |
250 |
– |
cancelIfTerminating(); |
264 |
|
} |
265 |
< |
s = status; |
265 |
> |
if (interrupted) |
266 |
> |
Thread.currentThread().interrupt(); |
267 |
|
} |
268 |
|
return s; |
269 |
|
} |
270 |
|
|
271 |
|
/** |
272 |
< |
* Blocks a non-worker-thread until completion. |
272 |
> |
* Blocks a non-worker-thread until completion or interruption or timeout. |
273 |
|
*/ |
274 |
< |
private void externalAwaitDone() { |
274 |
> |
private int externalInterruptibleAwaitDone(long millis) |
275 |
> |
throws InterruptedException { |
276 |
|
int s; |
277 |
< |
while ((s = status) >= 0) { |
277 |
> |
if (Thread.interrupted()) |
278 |
> |
throw new InterruptedException(); |
279 |
> |
if ((s = status) >= 0) { |
280 |
|
synchronized (this) { |
281 |
< |
if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)) { |
282 |
< |
boolean interrupted = false; |
283 |
< |
while (status >= 0) { |
284 |
< |
try { |
285 |
< |
wait(); |
286 |
< |
} catch (InterruptedException ie) { |
287 |
< |
interrupted = true; |
288 |
< |
} |
281 |
> |
while ((s = status) >= 0) { |
282 |
> |
if (s == 0) |
283 |
> |
UNSAFE.compareAndSwapInt(this, statusOffset, |
284 |
> |
0, SIGNAL); |
285 |
> |
else { |
286 |
> |
wait(millis); |
287 |
> |
if (millis > 0L) |
288 |
> |
break; |
289 |
|
} |
273 |
– |
if (interrupted) |
274 |
– |
Thread.currentThread().interrupt(); |
275 |
– |
break; |
290 |
|
} |
291 |
|
} |
292 |
|
} |
293 |
+ |
return s; |
294 |
|
} |
295 |
|
|
296 |
|
/** |
297 |
< |
* Unless done, calls exec and records status if completed, but |
298 |
< |
* doesn't wait for completion otherwise. Primary execution method |
299 |
< |
* for ForkJoinWorkerThread. |
297 |
> |
* Primary execution method for stolen tasks. Unless done, calls |
298 |
> |
* exec and records status if completed, but doesn't wait for |
299 |
> |
* completion otherwise. |
300 |
|
*/ |
301 |
< |
final void quietlyExec() { |
302 |
< |
try { |
303 |
< |
if (status < 0 || !exec()) |
301 |
> |
final void doExec() { |
302 |
> |
if (status >= 0) { |
303 |
> |
boolean completed; |
304 |
> |
try { |
305 |
> |
completed = exec(); |
306 |
> |
} catch (Throwable rex) { |
307 |
> |
setExceptionalCompletion(rex); |
308 |
|
return; |
309 |
+ |
} |
310 |
+ |
if (completed) |
311 |
+ |
setCompletion(NORMAL); // must be outside try block |
312 |
+ |
} |
313 |
+ |
} |
314 |
+ |
|
315 |
+ |
/** |
316 |
+ |
* Primary mechanics for join, get, quietlyJoin. |
317 |
+ |
* @return status upon completion |
318 |
+ |
*/ |
319 |
+ |
private int doJoin() { |
320 |
+ |
Thread t; ForkJoinWorkerThread w; int s; boolean completed; |
321 |
+ |
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) { |
322 |
+ |
if ((s = status) < 0) |
323 |
+ |
return s; |
324 |
+ |
if ((w = (ForkJoinWorkerThread)t).unpushTask(this)) { |
325 |
+ |
try { |
326 |
+ |
completed = exec(); |
327 |
+ |
} catch (Throwable rex) { |
328 |
+ |
return setExceptionalCompletion(rex); |
329 |
+ |
} |
330 |
+ |
if (completed) |
331 |
+ |
return setCompletion(NORMAL); |
332 |
+ |
} |
333 |
+ |
return w.joinTask(this); |
334 |
+ |
} |
335 |
+ |
else |
336 |
+ |
return externalAwaitDone(); |
337 |
+ |
} |
338 |
+ |
|
339 |
+ |
/** |
340 |
+ |
* Primary mechanics for invoke, quietlyInvoke. |
341 |
+ |
* @return status upon completion |
342 |
+ |
*/ |
343 |
+ |
private int doInvoke() { |
344 |
+ |
int s; boolean completed; |
345 |
+ |
if ((s = status) < 0) |
346 |
+ |
return s; |
347 |
+ |
try { |
348 |
+ |
completed = exec(); |
349 |
|
} catch (Throwable rex) { |
350 |
< |
setExceptionalCompletion(rex); |
351 |
< |
return; |
350 |
> |
return setExceptionalCompletion(rex); |
351 |
> |
} |
352 |
> |
if (completed) |
353 |
> |
return setCompletion(NORMAL); |
354 |
> |
else |
355 |
> |
return doJoin(); |
356 |
> |
} |
357 |
> |
|
358 |
> |
// Exception table support |
359 |
> |
|
360 |
> |
/** |
361 |
> |
* Table of exceptions thrown by tasks, to enable reporting by |
362 |
> |
* callers. Because exceptions are rare, we don't directly keep |
363 |
> |
* them with task objects, but instead use a weak ref table. Note |
364 |
> |
* that cancellation exceptions don't appear in the table, but are |
365 |
> |
* instead recorded as status values. |
366 |
> |
* |
367 |
> |
* Note: These statics are initialized below in static block. |
368 |
> |
*/ |
369 |
> |
private static final ExceptionNode[] exceptionTable; |
370 |
> |
private static final ReentrantLock exceptionTableLock; |
371 |
> |
private static final ReferenceQueue<Object> exceptionTableRefQueue; |
372 |
> |
|
373 |
> |
/** |
374 |
> |
* Fixed capacity for exceptionTable. |
375 |
> |
*/ |
376 |
> |
private static final int EXCEPTION_MAP_CAPACITY = 32; |
377 |
> |
|
378 |
> |
/** |
379 |
> |
* Key-value nodes for exception table. The chained hash table |
380 |
> |
* uses identity comparisons, full locking, and weak references |
381 |
> |
* for keys. The table has a fixed capacity because it only |
382 |
> |
* maintains task exceptions long enough for joiners to access |
383 |
> |
* them, so should never become very large for sustained |
384 |
> |
* periods. However, since we do not know when the last joiner |
385 |
> |
* completes, we must use weak references and expunge them. We do |
386 |
> |
* so on each operation (hence full locking). Also, some thread in |
387 |
> |
* any ForkJoinPool will call helpExpunge when its pool becomes |
388 |
> |
* isQuiescent. |
389 |
> |
*/ |
390 |
> |
static final class ExceptionNode extends WeakReference<ForkJoinTask<?>>{ |
391 |
> |
final Throwable ex; |
392 |
> |
ExceptionNode next; |
393 |
> |
final long thrower; |
394 |
> |
ExceptionNode(ForkJoinTask<?> task, Throwable ex, ExceptionNode next) { |
395 |
> |
super(task, exceptionTableRefQueue); |
396 |
> |
this.ex = ex; |
397 |
> |
this.next = next; |
398 |
> |
this.thrower = Thread.currentThread().getId(); |
399 |
|
} |
400 |
< |
setCompletion(NORMAL); // must be outside try block |
400 |
> |
} |
401 |
> |
|
402 |
> |
/** |
403 |
> |
* Records exception and sets exceptional completion. |
404 |
> |
* |
405 |
> |
* @return status on exit |
406 |
> |
*/ |
407 |
> |
private int setExceptionalCompletion(Throwable ex) { |
408 |
> |
int h = System.identityHashCode(this); |
409 |
> |
ReentrantLock lock = exceptionTableLock; |
410 |
> |
lock.lock(); |
411 |
> |
try { |
412 |
> |
expungeStaleExceptions(); |
413 |
> |
ExceptionNode[] t = exceptionTable; |
414 |
> |
int i = h & (t.length - 1); |
415 |
> |
for (ExceptionNode e = t[i]; ; e = e.next) { |
416 |
> |
if (e == null) { |
417 |
> |
t[i] = new ExceptionNode(this, ex, t[i]); |
418 |
> |
break; |
419 |
> |
} |
420 |
> |
if (e.get() == this) // already present |
421 |
> |
break; |
422 |
> |
} |
423 |
> |
} finally { |
424 |
> |
lock.unlock(); |
425 |
> |
} |
426 |
> |
return setCompletion(EXCEPTIONAL); |
427 |
> |
} |
428 |
> |
|
429 |
> |
/** |
430 |
> |
* Removes exception node and clears status |
431 |
> |
*/ |
432 |
> |
private void clearExceptionalCompletion() { |
433 |
> |
int h = System.identityHashCode(this); |
434 |
> |
ReentrantLock lock = exceptionTableLock; |
435 |
> |
lock.lock(); |
436 |
> |
try { |
437 |
> |
ExceptionNode[] t = exceptionTable; |
438 |
> |
int i = h & (t.length - 1); |
439 |
> |
ExceptionNode e = t[i]; |
440 |
> |
ExceptionNode pred = null; |
441 |
> |
while (e != null) { |
442 |
> |
ExceptionNode next = e.next; |
443 |
> |
if (e.get() == this) { |
444 |
> |
if (pred == null) |
445 |
> |
t[i] = next; |
446 |
> |
else |
447 |
> |
pred.next = next; |
448 |
> |
break; |
449 |
> |
} |
450 |
> |
pred = e; |
451 |
> |
e = next; |
452 |
> |
} |
453 |
> |
expungeStaleExceptions(); |
454 |
> |
status = 0; |
455 |
> |
} finally { |
456 |
> |
lock.unlock(); |
457 |
> |
} |
458 |
> |
} |
459 |
> |
|
460 |
> |
/** |
461 |
> |
* Returns a rethrowable exception for the given task, if |
462 |
> |
* available. To provide accurate stack traces, if the exception |
463 |
> |
* was not thrown by the current thread, we try to create a new |
464 |
> |
* exception of the same type as the one thrown, but with the |
465 |
> |
* recorded exception as its cause. If there is no such |
466 |
> |
* constructor, we instead try to use a no-arg constructor, |
467 |
> |
* followed by initCause, to the same effect. If none of these |
468 |
> |
* apply, or any fail due to other exceptions, we return the |
469 |
> |
* recorded exception, which is still correct, although it may |
470 |
> |
* contain a misleading stack trace. |
471 |
> |
* |
472 |
> |
* @return the exception, or null if none |
473 |
> |
*/ |
474 |
> |
private Throwable getThrowableException() { |
475 |
> |
if (status != EXCEPTIONAL) |
476 |
> |
return null; |
477 |
> |
int h = System.identityHashCode(this); |
478 |
> |
ExceptionNode e; |
479 |
> |
ReentrantLock lock = exceptionTableLock; |
480 |
> |
lock.lock(); |
481 |
> |
try { |
482 |
> |
expungeStaleExceptions(); |
483 |
> |
ExceptionNode[] t = exceptionTable; |
484 |
> |
e = t[h & (t.length - 1)]; |
485 |
> |
while (e != null && e.get() != this) |
486 |
> |
e = e.next; |
487 |
> |
} finally { |
488 |
> |
lock.unlock(); |
489 |
> |
} |
490 |
> |
Throwable ex; |
491 |
> |
if (e == null || (ex = e.ex) == null) |
492 |
> |
return null; |
493 |
> |
if (e.thrower != Thread.currentThread().getId()) { |
494 |
> |
Class ec = ex.getClass(); |
495 |
> |
try { |
496 |
> |
Constructor<?> noArgCtor = null; |
497 |
> |
Constructor<?>[] cs = ec.getConstructors();// public ctors only |
498 |
> |
for (int i = 0; i < cs.length; ++i) { |
499 |
> |
Constructor<?> c = cs[i]; |
500 |
> |
Class<?>[] ps = c.getParameterTypes(); |
501 |
> |
if (ps.length == 0) |
502 |
> |
noArgCtor = c; |
503 |
> |
else if (ps.length == 1 && ps[0] == Throwable.class) |
504 |
> |
return (Throwable)(c.newInstance(ex)); |
505 |
> |
} |
506 |
> |
if (noArgCtor != null) { |
507 |
> |
Throwable wx = (Throwable)(noArgCtor.newInstance()); |
508 |
> |
wx.initCause(ex); |
509 |
> |
return wx; |
510 |
> |
} |
511 |
> |
} catch (Exception ignore) { |
512 |
> |
} |
513 |
> |
} |
514 |
> |
return ex; |
515 |
> |
} |
516 |
> |
|
517 |
> |
/** |
518 |
> |
* Poll stale refs and remove them. Call only while holding lock. |
519 |
> |
*/ |
520 |
> |
private static void expungeStaleExceptions() { |
521 |
> |
for (Object x; (x = exceptionTableRefQueue.poll()) != null;) { |
522 |
> |
if (x instanceof ExceptionNode) { |
523 |
> |
ForkJoinTask<?> key = ((ExceptionNode)x).get(); |
524 |
> |
ExceptionNode[] t = exceptionTable; |
525 |
> |
int i = System.identityHashCode(key) & (t.length - 1); |
526 |
> |
ExceptionNode e = t[i]; |
527 |
> |
ExceptionNode pred = null; |
528 |
> |
while (e != null) { |
529 |
> |
ExceptionNode next = e.next; |
530 |
> |
if (e == x) { |
531 |
> |
if (pred == null) |
532 |
> |
t[i] = next; |
533 |
> |
else |
534 |
> |
pred.next = next; |
535 |
> |
break; |
536 |
> |
} |
537 |
> |
pred = e; |
538 |
> |
e = next; |
539 |
> |
} |
540 |
> |
} |
541 |
> |
} |
542 |
> |
} |
543 |
> |
|
544 |
> |
/** |
545 |
> |
* If lock is available, poll any stale refs and remove them. |
546 |
> |
* Called from ForkJoinPool when pools become quiescent. |
547 |
> |
*/ |
548 |
> |
static final void helpExpungeStaleExceptions() { |
549 |
> |
ReentrantLock lock = exceptionTableLock; |
550 |
> |
if (lock.tryLock()) { |
551 |
> |
try { |
552 |
> |
expungeStaleExceptions(); |
553 |
> |
} finally { |
554 |
> |
lock.unlock(); |
555 |
> |
} |
556 |
> |
} |
557 |
> |
} |
558 |
> |
|
559 |
> |
/** |
560 |
> |
* Report the result of invoke or join; called only upon |
561 |
> |
* non-normal return of internal versions. |
562 |
> |
*/ |
563 |
> |
private V reportResult() { |
564 |
> |
int s; Throwable ex; |
565 |
> |
if ((s = status) == CANCELLED) |
566 |
> |
throw new CancellationException(); |
567 |
> |
if (s == EXCEPTIONAL && (ex = getThrowableException()) != null) |
568 |
> |
UNSAFE.throwException(ex); |
569 |
> |
return getRawResult(); |
570 |
|
} |
571 |
|
|
572 |
|
// public methods |
582 |
|
* #isDone} returning {@code true}. |
583 |
|
* |
584 |
|
* <p>This method may be invoked only from within {@code |
585 |
< |
* ForkJoinTask} computations (as may be determined using method |
585 |
> |
* ForkJoinPool} computations (as may be determined using method |
586 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
587 |
|
* result in exceptions or errors, possibly including {@code |
588 |
|
* ClassCastException}. |
596 |
|
} |
597 |
|
|
598 |
|
/** |
599 |
< |
* Returns the result of the computation when it {@link #isDone is done}. |
600 |
< |
* This method differs from {@link #get()} in that |
599 |
> |
* Returns the result of the computation when it {@link #isDone is |
600 |
> |
* done}. This method differs from {@link #get()} in that |
601 |
|
* abnormal completion results in {@code RuntimeException} or |
602 |
< |
* {@code Error}, not {@code ExecutionException}. |
602 |
> |
* {@code Error}, not {@code ExecutionException}, and that |
603 |
> |
* interrupts of the calling thread do <em>not</em> cause the |
604 |
> |
* method to abruptly return by throwing {@code |
605 |
> |
* InterruptedException}. |
606 |
|
* |
607 |
|
* @return the computed result |
608 |
|
*/ |
609 |
|
public final V join() { |
610 |
< |
quietlyJoin(); |
611 |
< |
Throwable ex; |
612 |
< |
if (status < NORMAL && (ex = getException()) != null) |
613 |
< |
UNSAFE.throwException(ex); |
336 |
< |
return getRawResult(); |
610 |
> |
if (doJoin() != NORMAL) |
611 |
> |
return reportResult(); |
612 |
> |
else |
613 |
> |
return getRawResult(); |
614 |
|
} |
615 |
|
|
616 |
|
/** |
622 |
|
* @return the computed result |
623 |
|
*/ |
624 |
|
public final V invoke() { |
625 |
< |
quietlyInvoke(); |
626 |
< |
Throwable ex; |
627 |
< |
if (status < NORMAL && (ex = getException()) != null) |
628 |
< |
UNSAFE.throwException(ex); |
352 |
< |
return getRawResult(); |
625 |
> |
if (doInvoke() != NORMAL) |
626 |
> |
return reportResult(); |
627 |
> |
else |
628 |
> |
return getRawResult(); |
629 |
|
} |
630 |
|
|
631 |
|
/** |
642 |
|
* unprocessed. |
643 |
|
* |
644 |
|
* <p>This method may be invoked only from within {@code |
645 |
< |
* ForkJoinTask} computations (as may be determined using method |
645 |
> |
* ForkJoinPool} computations (as may be determined using method |
646 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
647 |
|
* result in exceptions or errors, possibly including {@code |
648 |
|
* ClassCastException}. |
670 |
|
* normally or exceptionally, or left unprocessed. |
671 |
|
* |
672 |
|
* <p>This method may be invoked only from within {@code |
673 |
< |
* ForkJoinTask} computations (as may be determined using method |
673 |
> |
* ForkJoinPool} computations (as may be determined using method |
674 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
675 |
|
* result in exceptions or errors, possibly including {@code |
676 |
|
* ClassCastException}. |
689 |
|
} |
690 |
|
else if (i != 0) |
691 |
|
t.fork(); |
692 |
< |
else { |
693 |
< |
t.quietlyInvoke(); |
418 |
< |
if (ex == null && t.status < NORMAL) |
419 |
< |
ex = t.getException(); |
420 |
< |
} |
692 |
> |
else if (t.doInvoke() < NORMAL && ex == null) |
693 |
> |
ex = t.getException(); |
694 |
|
} |
695 |
|
for (int i = 1; i <= last; ++i) { |
696 |
|
ForkJoinTask<?> t = tasks[i]; |
697 |
|
if (t != null) { |
698 |
|
if (ex != null) |
699 |
|
t.cancel(false); |
700 |
< |
else { |
701 |
< |
t.quietlyJoin(); |
429 |
< |
if (ex == null && t.status < NORMAL) |
430 |
< |
ex = t.getException(); |
431 |
< |
} |
700 |
> |
else if (t.doJoin() < NORMAL && ex == null) |
701 |
> |
ex = t.getException(); |
702 |
|
} |
703 |
|
} |
704 |
|
if (ex != null) |
719 |
|
* unprocessed. |
720 |
|
* |
721 |
|
* <p>This method may be invoked only from within {@code |
722 |
< |
* ForkJoinTask} computations (as may be determined using method |
722 |
> |
* ForkJoinPool} computations (as may be determined using method |
723 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
724 |
|
* result in exceptions or errors, possibly including {@code |
725 |
|
* ClassCastException}. |
746 |
|
} |
747 |
|
else if (i != 0) |
748 |
|
t.fork(); |
749 |
< |
else { |
750 |
< |
t.quietlyInvoke(); |
481 |
< |
if (ex == null && t.status < NORMAL) |
482 |
< |
ex = t.getException(); |
483 |
< |
} |
749 |
> |
else if (t.doInvoke() < NORMAL && ex == null) |
750 |
> |
ex = t.getException(); |
751 |
|
} |
752 |
|
for (int i = 1; i <= last; ++i) { |
753 |
|
ForkJoinTask<?> t = ts.get(i); |
754 |
|
if (t != null) { |
755 |
|
if (ex != null) |
756 |
|
t.cancel(false); |
757 |
< |
else { |
758 |
< |
t.quietlyJoin(); |
492 |
< |
if (ex == null && t.status < NORMAL) |
493 |
< |
ex = t.getException(); |
494 |
< |
} |
757 |
> |
else if (t.doJoin() < NORMAL && ex == null) |
758 |
> |
ex = t.getException(); |
759 |
|
} |
760 |
|
} |
761 |
|
if (ex != null) |
765 |
|
|
766 |
|
/** |
767 |
|
* Attempts to cancel execution of this task. This attempt will |
768 |
< |
* fail if the task has already completed, has already been |
769 |
< |
* cancelled, or could not be cancelled for some other reason. If |
770 |
< |
* successful, and this task has not started when cancel is |
771 |
< |
* called, execution of this task is suppressed, {@link |
772 |
< |
* #isCancelled} will report true, and {@link #join} will result |
773 |
< |
* in a {@code CancellationException} being thrown. |
768 |
> |
* fail if the task has already completed or could not be |
769 |
> |
* cancelled for some other reason. If successful, and this task |
770 |
> |
* has not started when {@code cancel} is called, execution of |
771 |
> |
* this task is suppressed. After this method returns |
772 |
> |
* successfully, unless there is an intervening call to {@link |
773 |
> |
* #reinitialize}, subsequent calls to {@link #isCancelled}, |
774 |
> |
* {@link #isDone}, and {@code cancel} will return {@code true} |
775 |
> |
* and calls to {@link #join} and related methods will result in |
776 |
> |
* {@code CancellationException}. |
777 |
|
* |
778 |
|
* <p>This method may be overridden in subclasses, but if so, must |
779 |
< |
* still ensure that these minimal properties hold. In particular, |
780 |
< |
* the {@code cancel} method itself must not throw exceptions. |
779 |
> |
* still ensure that these properties hold. In particular, the |
780 |
> |
* {@code cancel} method itself must not throw exceptions. |
781 |
|
* |
782 |
|
* <p>This method is designed to be invoked by <em>other</em> |
783 |
|
* tasks. To terminate the current task, you can just return or |
784 |
|
* throw an unchecked exception from its computation method, or |
785 |
|
* invoke {@link #completeExceptionally}. |
786 |
|
* |
787 |
< |
* @param mayInterruptIfRunning this value is ignored in the |
788 |
< |
* default implementation because tasks are not |
789 |
< |
* cancelled via interruption |
787 |
> |
* @param mayInterruptIfRunning this value has no effect in the |
788 |
> |
* default implementation because interrupts are not used to |
789 |
> |
* control cancellation. |
790 |
|
* |
791 |
|
* @return {@code true} if this task is now cancelled |
792 |
|
*/ |
793 |
|
public boolean cancel(boolean mayInterruptIfRunning) { |
794 |
< |
setCompletion(CANCELLED); |
528 |
< |
return status == CANCELLED; |
794 |
> |
return setCompletion(CANCELLED) == CANCELLED; |
795 |
|
} |
796 |
|
|
797 |
|
/** |
807 |
|
} |
808 |
|
} |
809 |
|
|
544 |
– |
/** |
545 |
– |
* Cancels if current thread is a terminating worker thread, |
546 |
– |
* ignoring any exceptions thrown by cancel. |
547 |
– |
*/ |
548 |
– |
final void cancelIfTerminating() { |
549 |
– |
Thread t = Thread.currentThread(); |
550 |
– |
if ((t instanceof ForkJoinWorkerThread) && |
551 |
– |
((ForkJoinWorkerThread) t).isTerminating()) { |
552 |
– |
try { |
553 |
– |
cancel(false); |
554 |
– |
} catch (Throwable ignore) { |
555 |
– |
} |
556 |
– |
} |
557 |
– |
} |
558 |
– |
|
810 |
|
public final boolean isDone() { |
811 |
|
return status < 0; |
812 |
|
} |
846 |
|
int s = status; |
847 |
|
return ((s >= NORMAL) ? null : |
848 |
|
(s == CANCELLED) ? new CancellationException() : |
849 |
< |
exceptionMap.get(this)); |
849 |
> |
getThrowableException()); |
850 |
|
} |
851 |
|
|
852 |
|
/** |
904 |
|
* member of a ForkJoinPool and was interrupted while waiting |
905 |
|
*/ |
906 |
|
public final V get() throws InterruptedException, ExecutionException { |
907 |
< |
int s; |
908 |
< |
if (Thread.currentThread() instanceof ForkJoinWorkerThread) { |
909 |
< |
quietlyJoin(); |
910 |
< |
s = status; |
911 |
< |
} |
912 |
< |
else { |
913 |
< |
while ((s = status) >= 0) { |
663 |
< |
synchronized (this) { // interruptible form of awaitDone |
664 |
< |
if (UNSAFE.compareAndSwapInt(this, statusOffset, |
665 |
< |
s, SIGNAL)) { |
666 |
< |
while (status >= 0) |
667 |
< |
wait(); |
668 |
< |
} |
669 |
< |
} |
670 |
< |
} |
671 |
< |
} |
672 |
< |
if (s < NORMAL) { |
673 |
< |
Throwable ex; |
674 |
< |
if (s == CANCELLED) |
675 |
< |
throw new CancellationException(); |
676 |
< |
if (s == EXCEPTIONAL && (ex = exceptionMap.get(this)) != null) |
677 |
< |
throw new ExecutionException(ex); |
678 |
< |
} |
907 |
> |
int s = (Thread.currentThread() instanceof ForkJoinWorkerThread) ? |
908 |
> |
doJoin() : externalInterruptibleAwaitDone(0L); |
909 |
> |
Throwable ex; |
910 |
> |
if (s == CANCELLED) |
911 |
> |
throw new CancellationException(); |
912 |
> |
if (s == EXCEPTIONAL && (ex = getThrowableException()) != null) |
913 |
> |
throw new ExecutionException(ex); |
914 |
|
return getRawResult(); |
915 |
|
} |
916 |
|
|
931 |
|
public final V get(long timeout, TimeUnit unit) |
932 |
|
throws InterruptedException, ExecutionException, TimeoutException { |
933 |
|
Thread t = Thread.currentThread(); |
699 |
– |
ForkJoinPool pool; |
934 |
|
if (t instanceof ForkJoinWorkerThread) { |
935 |
|
ForkJoinWorkerThread w = (ForkJoinWorkerThread) t; |
936 |
< |
if (status >= 0 && w.unpushTask(this)) |
937 |
< |
quietlyExec(); |
938 |
< |
pool = w.pool; |
939 |
< |
} |
940 |
< |
else |
941 |
< |
pool = null; |
942 |
< |
/* |
943 |
< |
* Timed wait loop intermixes cases for FJ (pool != null) and |
710 |
< |
* non FJ threads. For FJ, decrement pool count but don't try |
711 |
< |
* for replacement; increment count on completion. For non-FJ, |
712 |
< |
* deal with interrupts. This is messy, but a little less so |
713 |
< |
* than is splitting the FJ and nonFJ cases. |
714 |
< |
*/ |
715 |
< |
boolean interrupted = false; |
716 |
< |
boolean dec = false; // true if pool count decremented |
717 |
< |
long nanos = unit.toNanos(timeout); |
718 |
< |
for (;;) { |
719 |
< |
if (pool == null && Thread.interrupted()) { |
720 |
< |
interrupted = true; |
721 |
< |
break; |
722 |
< |
} |
723 |
< |
int s = status; |
724 |
< |
if (s < 0) |
725 |
< |
break; |
726 |
< |
if (UNSAFE.compareAndSwapInt(this, statusOffset, s, SIGNAL)) { |
727 |
< |
long startTime = System.nanoTime(); |
728 |
< |
long nt; // wait time |
729 |
< |
while (status >= 0 && |
730 |
< |
(nt = nanos - (System.nanoTime() - startTime)) > 0) { |
731 |
< |
if (pool != null && !dec) |
732 |
< |
dec = pool.tryDecrementRunningCount(); |
733 |
< |
else { |
734 |
< |
long ms = nt / 1000000; |
735 |
< |
int ns = (int) (nt % 1000000); |
736 |
< |
try { |
737 |
< |
synchronized (this) { |
738 |
< |
if (status >= 0) |
739 |
< |
wait(ms, ns); |
740 |
< |
} |
741 |
< |
} catch (InterruptedException ie) { |
742 |
< |
if (pool != null) |
743 |
< |
cancelIfTerminating(); |
744 |
< |
else { |
745 |
< |
interrupted = true; |
746 |
< |
break; |
747 |
< |
} |
748 |
< |
} |
936 |
> |
long nanos = unit.toNanos(timeout); |
937 |
> |
if (status >= 0) { |
938 |
> |
boolean completed = false; |
939 |
> |
if (w.unpushTask(this)) { |
940 |
> |
try { |
941 |
> |
completed = exec(); |
942 |
> |
} catch (Throwable rex) { |
943 |
> |
setExceptionalCompletion(rex); |
944 |
|
} |
945 |
|
} |
946 |
< |
break; |
946 |
> |
if (completed) |
947 |
> |
setCompletion(NORMAL); |
948 |
> |
else if (status >= 0 && nanos > 0) |
949 |
> |
w.pool.timedAwaitJoin(this, nanos); |
950 |
|
} |
951 |
|
} |
952 |
< |
if (pool != null && dec) |
953 |
< |
pool.incrementRunningCount(); |
954 |
< |
if (interrupted) |
955 |
< |
throw new InterruptedException(); |
956 |
< |
int es = status; |
957 |
< |
if (es != NORMAL) { |
952 |
> |
else { |
953 |
> |
long millis = unit.toMillis(timeout); |
954 |
> |
if (millis > 0) |
955 |
> |
externalInterruptibleAwaitDone(millis); |
956 |
> |
} |
957 |
> |
int s = status; |
958 |
> |
if (s != NORMAL) { |
959 |
|
Throwable ex; |
960 |
< |
if (es == CANCELLED) |
960 |
> |
if (s == CANCELLED) |
961 |
|
throw new CancellationException(); |
962 |
< |
if (es == EXCEPTIONAL && (ex = exceptionMap.get(this)) != null) |
962 |
> |
if (s != EXCEPTIONAL) |
963 |
> |
throw new TimeoutException(); |
964 |
> |
if ((ex = getThrowableException()) != null) |
965 |
|
throw new ExecutionException(ex); |
765 |
– |
throw new TimeoutException(); |
966 |
|
} |
967 |
|
return getRawResult(); |
968 |
|
} |
974 |
|
* known to have aborted. |
975 |
|
*/ |
976 |
|
public final void quietlyJoin() { |
977 |
< |
Thread t; |
778 |
< |
if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) { |
779 |
< |
ForkJoinWorkerThread w = (ForkJoinWorkerThread) t; |
780 |
< |
if (status >= 0) { |
781 |
< |
if (w.unpushTask(this)) { |
782 |
< |
boolean completed; |
783 |
< |
try { |
784 |
< |
completed = exec(); |
785 |
< |
} catch (Throwable rex) { |
786 |
< |
setExceptionalCompletion(rex); |
787 |
< |
return; |
788 |
< |
} |
789 |
< |
if (completed) { |
790 |
< |
setCompletion(NORMAL); |
791 |
< |
return; |
792 |
< |
} |
793 |
< |
} |
794 |
< |
w.joinTask(this); |
795 |
< |
} |
796 |
< |
} |
797 |
< |
else |
798 |
< |
externalAwaitDone(); |
977 |
> |
doJoin(); |
978 |
|
} |
979 |
|
|
980 |
|
/** |
983 |
|
* exception. |
984 |
|
*/ |
985 |
|
public final void quietlyInvoke() { |
986 |
< |
if (status >= 0) { |
808 |
< |
boolean completed; |
809 |
< |
try { |
810 |
< |
completed = exec(); |
811 |
< |
} catch (Throwable rex) { |
812 |
< |
setExceptionalCompletion(rex); |
813 |
< |
return; |
814 |
< |
} |
815 |
< |
if (completed) |
816 |
< |
setCompletion(NORMAL); |
817 |
< |
else |
818 |
< |
quietlyJoin(); |
819 |
< |
} |
986 |
> |
doInvoke(); |
987 |
|
} |
988 |
|
|
989 |
|
/** |
994 |
|
* processed. |
995 |
|
* |
996 |
|
* <p>This method may be invoked only from within {@code |
997 |
< |
* ForkJoinTask} computations (as may be determined using method |
997 |
> |
* ForkJoinPool} computations (as may be determined using method |
998 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
999 |
|
* result in exceptions or errors, possibly including {@code |
1000 |
|
* ClassCastException}. |
1013 |
|
* under any other usage conditions are not guaranteed. |
1014 |
|
* This method may be useful when executing |
1015 |
|
* pre-constructed trees of subtasks in loops. |
1016 |
+ |
* |
1017 |
+ |
* <p>Upon completion of this method, {@code isDone()} reports |
1018 |
+ |
* {@code false}, and {@code getException()} reports {@code |
1019 |
+ |
* null}. However, the value returned by {@code getRawResult} is |
1020 |
+ |
* unaffected. To clear this value, you can invoke {@code |
1021 |
+ |
* setRawResult(null)}. |
1022 |
|
*/ |
1023 |
|
public void reinitialize() { |
1024 |
|
if (status == EXCEPTIONAL) |
1025 |
< |
exceptionMap.remove(this); |
1026 |
< |
status = 0; |
1025 |
> |
clearExceptionalCompletion(); |
1026 |
> |
else |
1027 |
> |
status = 0; |
1028 |
|
} |
1029 |
|
|
1030 |
|
/** |
1041 |
|
} |
1042 |
|
|
1043 |
|
/** |
1044 |
< |
* Returns {@code true} if the current thread is executing as a |
1045 |
< |
* ForkJoinPool computation. |
1044 |
> |
* Returns {@code true} if the current thread is a {@link |
1045 |
> |
* ForkJoinWorkerThread} executing as a ForkJoinPool computation. |
1046 |
|
* |
1047 |
< |
* @return {@code true} if the current thread is executing as a |
1048 |
< |
* ForkJoinPool computation, or false otherwise |
1047 |
> |
* @return {@code true} if the current thread is a {@link |
1048 |
> |
* ForkJoinWorkerThread} executing as a ForkJoinPool computation, |
1049 |
> |
* or {@code false} otherwise |
1050 |
|
*/ |
1051 |
|
public static boolean inForkJoinPool() { |
1052 |
|
return Thread.currentThread() instanceof ForkJoinWorkerThread; |
1061 |
|
* were not, stolen. |
1062 |
|
* |
1063 |
|
* <p>This method may be invoked only from within {@code |
1064 |
< |
* ForkJoinTask} computations (as may be determined using method |
1064 |
> |
* ForkJoinPool} computations (as may be determined using method |
1065 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
1066 |
|
* result in exceptions or errors, possibly including {@code |
1067 |
|
* ClassCastException}. |
1080 |
|
* fork other tasks. |
1081 |
|
* |
1082 |
|
* <p>This method may be invoked only from within {@code |
1083 |
< |
* ForkJoinTask} computations (as may be determined using method |
1083 |
> |
* ForkJoinPool} computations (as may be determined using method |
1084 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
1085 |
|
* result in exceptions or errors, possibly including {@code |
1086 |
|
* ClassCastException}. |
1103 |
|
* exceeded. |
1104 |
|
* |
1105 |
|
* <p>This method may be invoked only from within {@code |
1106 |
< |
* ForkJoinTask} computations (as may be determined using method |
1106 |
> |
* ForkJoinPool} computations (as may be determined using method |
1107 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
1108 |
|
* result in exceptions or errors, possibly including {@code |
1109 |
|
* ClassCastException}. |
1161 |
|
* otherwise. |
1162 |
|
* |
1163 |
|
* <p>This method may be invoked only from within {@code |
1164 |
< |
* ForkJoinTask} computations (as may be determined using method |
1164 |
> |
* ForkJoinPool} computations (as may be determined using method |
1165 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
1166 |
|
* result in exceptions or errors, possibly including {@code |
1167 |
|
* ClassCastException}. |
1180 |
|
* be useful otherwise. |
1181 |
|
* |
1182 |
|
* <p>This method may be invoked only from within {@code |
1183 |
< |
* ForkJoinTask} computations (as may be determined using method |
1183 |
> |
* ForkJoinPool} computations (as may be determined using method |
1184 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
1185 |
|
* result in exceptions or errors, possibly including {@code |
1186 |
|
* ClassCastException}. |
1203 |
|
* otherwise. |
1204 |
|
* |
1205 |
|
* <p>This method may be invoked only from within {@code |
1206 |
< |
* ForkJoinTask} computations (as may be determined using method |
1206 |
> |
* ForkJoinPool} computations (as may be determined using method |
1207 |
|
* {@link #inForkJoinPool}). Attempts to invoke in other contexts |
1208 |
|
* result in exceptions or errors, possibly including {@code |
1209 |
|
* ClassCastException}. |
1335 |
|
s.defaultReadObject(); |
1336 |
|
Object ex = s.readObject(); |
1337 |
|
if (ex != null) |
1338 |
< |
setExceptionalCompletion((Throwable) ex); |
1338 |
> |
setExceptionalCompletion((Throwable)ex); |
1339 |
|
} |
1340 |
|
|
1341 |
|
// Unsafe mechanics |
1342 |
< |
|
1343 |
< |
private static final sun.misc.Unsafe UNSAFE = getUnsafe(); |
1344 |
< |
private static final long statusOffset = |
1345 |
< |
objectFieldOffset("status", ForkJoinTask.class); |
1346 |
< |
|
1347 |
< |
private static long objectFieldOffset(String field, Class<?> klazz) { |
1342 |
> |
private static final sun.misc.Unsafe UNSAFE; |
1343 |
> |
private static final long statusOffset; |
1344 |
> |
static { |
1345 |
> |
exceptionTableLock = new ReentrantLock(); |
1346 |
> |
exceptionTableRefQueue = new ReferenceQueue<Object>(); |
1347 |
> |
exceptionTable = new ExceptionNode[EXCEPTION_MAP_CAPACITY]; |
1348 |
|
try { |
1349 |
< |
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field)); |
1350 |
< |
} catch (NoSuchFieldException e) { |
1351 |
< |
// Convert Exception to corresponding Error |
1352 |
< |
NoSuchFieldError error = new NoSuchFieldError(field); |
1353 |
< |
error.initCause(e); |
1179 |
< |
throw error; |
1349 |
> |
UNSAFE = getUnsafe(); |
1350 |
> |
statusOffset = UNSAFE.objectFieldOffset |
1351 |
> |
(ForkJoinTask.class.getDeclaredField("status")); |
1352 |
> |
} catch (Exception e) { |
1353 |
> |
throw new Error(e); |
1354 |
|
} |
1355 |
|
} |
1356 |
|
|