Handles the non-async (i.e. the continuation doesn't return a Task) continuation case, passing the results of the given Task through to the given continuation and using the results of that call to set the result of the TaskContinuationSource. @param tcs The TaskContinuationSource that will
(
final Task<TContinuationResult>.TaskCompletionSource tcs,
final Continuation<TResult, TContinuationResult> continuation, final Task<TResult> task,
Executor executor)
| 469 | * scheduled on a different thread). |
| 470 | */ |
| 471 | private static <TContinuationResult, TResult> void completeImmediately( |
| 472 | final Task<TContinuationResult>.TaskCompletionSource tcs, |
| 473 | final Continuation<TResult, TContinuationResult> continuation, final Task<TResult> task, |
| 474 | Executor executor) { |
| 475 | executor.execute(new Runnable() { |
| 476 | public void run() { |
| 477 | try { |
| 478 | TContinuationResult result = continuation.then(task); |
| 479 | tcs.setResult(result); |
| 480 | } catch (Exception e) { |
| 481 | tcs.setError(e); |
| 482 | } |
| 483 | } |
| 484 | }); |
| 485 | } |
| 486 | |
| 487 | /** |
| 488 | * Handles the async (i.e. the continuation does return a Task) continuation case, passing the |
no test coverage detected