MCPcopy Create free account
hub / github.com/BoltsFramework/Bolts-Java / completeImmediately

Method completeImmediately

Bolts/src/bolts/Task.java:471–485  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 2

thenMethod · 0.95
continueWithMethod · 0.95

Calls 1

executeMethod · 0.80

Tested by

no test coverage detected