1319 |
|
Object r; Throwable ex, cause; |
1320 |
|
if ((r = result) == null && (r = waitingGet(true)) == null) |
1321 |
|
throw new InterruptedException(); |
1322 |
< |
if (r instanceof AltResult) { |
1323 |
< |
if ((ex = ((AltResult)r).ex) != null) { |
1324 |
< |
if (ex instanceof CancellationException) |
1325 |
< |
throw (CancellationException)ex; |
1326 |
< |
if ((ex instanceof CompletionException) && |
1327 |
< |
(cause = ex.getCause()) != null) |
1328 |
< |
ex = cause; |
1329 |
< |
throw new ExecutionException(ex); |
1330 |
< |
} |
1331 |
< |
return null; |
1322 |
> |
if (!(r instanceof AltResult)) { |
1323 |
> |
@SuppressWarnings("unchecked") T tr = (T) r; |
1324 |
> |
return tr; |
1325 |
|
} |
1326 |
< |
@SuppressWarnings("unchecked") T tr = (T) r; |
1327 |
< |
return tr; |
1326 |
> |
if ((ex = ((AltResult)r).ex) == null) |
1327 |
> |
return null; |
1328 |
> |
if (ex instanceof CancellationException) |
1329 |
> |
throw (CancellationException)ex; |
1330 |
> |
if ((ex instanceof CompletionException) && |
1331 |
> |
(cause = ex.getCause()) != null) |
1332 |
> |
ex = cause; |
1333 |
> |
throw new ExecutionException(ex); |
1334 |
|
} |
1335 |
|
|
1336 |
|
/** |
1355 |
|
throw new InterruptedException(); |
1356 |
|
if ((r = result) == null) |
1357 |
|
r = timedAwaitDone(nanos); |
1358 |
< |
if (r instanceof AltResult) { |
1359 |
< |
if ((ex = ((AltResult)r).ex) != null) { |
1360 |
< |
if (ex instanceof CancellationException) |
1362 |
< |
throw (CancellationException)ex; |
1363 |
< |
if ((ex instanceof CompletionException) && |
1364 |
< |
(cause = ex.getCause()) != null) |
1365 |
< |
ex = cause; |
1366 |
< |
throw new ExecutionException(ex); |
1367 |
< |
} |
1368 |
< |
return null; |
1358 |
> |
if (!(r instanceof AltResult)) { |
1359 |
> |
@SuppressWarnings("unchecked") T tr = (T) r; |
1360 |
> |
return tr; |
1361 |
|
} |
1362 |
< |
@SuppressWarnings("unchecked") T tr = (T) r; |
1363 |
< |
return tr; |
1362 |
> |
if ((ex = ((AltResult)r).ex) == null) |
1363 |
> |
return null; |
1364 |
> |
if (ex instanceof CancellationException) |
1365 |
> |
throw (CancellationException)ex; |
1366 |
> |
if ((ex instanceof CompletionException) && |
1367 |
> |
(cause = ex.getCause()) != null) |
1368 |
> |
ex = cause; |
1369 |
> |
throw new ExecutionException(ex); |
1370 |
|
} |
1371 |
|
|
1372 |
|
/** |
1387 |
|
Object r; Throwable ex; |
1388 |
|
if ((r = result) == null) |
1389 |
|
r = waitingGet(false); |
1390 |
< |
if (r instanceof AltResult) { |
1391 |
< |
if ((ex = ((AltResult)r).ex) != null) { |
1392 |
< |
if (ex instanceof CancellationException) |
1395 |
< |
throw (CancellationException)ex; |
1396 |
< |
if (ex instanceof CompletionException) |
1397 |
< |
throw (CompletionException)ex; |
1398 |
< |
throw new CompletionException(ex); |
1399 |
< |
} |
1400 |
< |
return null; |
1390 |
> |
if (!(r instanceof AltResult)) { |
1391 |
> |
@SuppressWarnings("unchecked") T tr = (T) r; |
1392 |
> |
return tr; |
1393 |
|
} |
1394 |
< |
@SuppressWarnings("unchecked") T tr = (T) r; |
1395 |
< |
return tr; |
1394 |
> |
if ((ex = ((AltResult)r).ex) == null) |
1395 |
> |
return null; |
1396 |
> |
if (ex instanceof CancellationException) |
1397 |
> |
throw (CancellationException)ex; |
1398 |
> |
if (ex instanceof CompletionException) |
1399 |
> |
throw (CompletionException)ex; |
1400 |
> |
throw new CompletionException(ex); |
1401 |
|
} |
1402 |
|
|
1403 |
|
/** |
1414 |
|
Object r; Throwable ex; |
1415 |
|
if ((r = result) == null) |
1416 |
|
return valueIfAbsent; |
1417 |
< |
if (r instanceof AltResult) { |
1418 |
< |
if ((ex = ((AltResult)r).ex) != null) { |
1419 |
< |
if (ex instanceof CancellationException) |
1423 |
< |
throw (CancellationException)ex; |
1424 |
< |
if (ex instanceof CompletionException) |
1425 |
< |
throw (CompletionException)ex; |
1426 |
< |
throw new CompletionException(ex); |
1427 |
< |
} |
1428 |
< |
return null; |
1417 |
> |
if (!(r instanceof AltResult)) { |
1418 |
> |
@SuppressWarnings("unchecked") T tr = (T) r; |
1419 |
> |
return tr; |
1420 |
|
} |
1421 |
< |
@SuppressWarnings("unchecked") T tr = (T) r; |
1422 |
< |
return tr; |
1421 |
> |
if ((ex = ((AltResult)r).ex) == null) |
1422 |
> |
return null; |
1423 |
> |
if (ex instanceof CancellationException) |
1424 |
> |
throw (CancellationException)ex; |
1425 |
> |
if (ex instanceof CompletionException) |
1426 |
> |
throw (CompletionException)ex; |
1427 |
> |
throw new CompletionException(ex); |
1428 |
|
} |
1429 |
|
|
1430 |
|
/** |
2629 |
|
*/ |
2630 |
|
public boolean isCancelled() { |
2631 |
|
Object r; |
2632 |
< |
return ((r = result) != null && |
2633 |
< |
(r instanceof AltResult) && |
2638 |
< |
(((AltResult)r).ex instanceof CancellationException)); |
2632 |
> |
return ((r = result) instanceof AltResult) && |
2633 |
> |
(((AltResult)r).ex instanceof CancellationException); |
2634 |
|
} |
2635 |
|
|
2636 |
|
/** |
2637 |
|
* Forcibly sets or resets the value subsequently returned by |
2638 |
< |
* method get() and related methods, whether or not already |
2639 |
< |
* completed. This method is designed for use only in error |
2640 |
< |
* recovery actions, and even in such situations may result in |
2641 |
< |
* ongoing dependent completions using established versus |
2638 |
> |
* method {@link #get()} and related methods, whether or not |
2639 |
> |
* already completed. This method is designed for use only in |
2640 |
> |
* error recovery actions, and even in such situations may result |
2641 |
> |
* in ongoing dependent completions using established versus |
2642 |
|
* overwritten outcomes. |
2643 |
|
* |
2644 |
|
* @param value the completion value |