MCPcopy Index your code
hub / github.com/BoltsFramework/Bolts-Java / continueWithTask

Method continueWithTask

Bolts/src/bolts/Task.java:370–389  ·  view source on GitHub ↗

Adds an Task-based continuation to this task that will be scheduled using the executor, returning a new task that completes after the task returned by the continuation has completed.

(
      final Continuation<TResult, Task<TContinuationResult>> continuation, final Executor executor)

Source from the content-addressed store, hash-verified

368 * returning a new task that completes after the task returned by the continuation has completed.
369 */
370 public <TContinuationResult> Task<TContinuationResult> continueWithTask(
371 final Continuation<TResult, Task<TContinuationResult>> continuation, final Executor executor) {
372 boolean completed = false;
373 final Task<TContinuationResult>.TaskCompletionSource tcs = Task.<TContinuationResult> create();
374 synchronized (lock) {
375 completed = this.isCompleted();
376 if (!completed) {
377 this.continuations.add(new Continuation<TResult, Void>() {
378 public Void then(Task<TResult> task) {
379 completeAfterTask(tcs, continuation, task, executor);
380 return null;
381 }
382 });
383 }
384 }
385 if (completed) {
386 completeAfterTask(tcs, continuation, this, executor);
387 }
388 return tcs.getTask();
389 }
390
391 /**
392 * Adds an asynchronous continuation to this task, returning a new task that completes after the

Callers 8

makeVoidMethod · 0.95
onSuccessMethod · 0.95
onSuccessTaskMethod · 0.95
callMethod · 0.80
continueWhileMethod · 0.80
thenMethod · 0.80

Calls 4

createMethod · 0.95
isCompletedMethod · 0.95
completeAfterTaskMethod · 0.95
getTaskMethod · 0.80

Tested by 3

callMethod · 0.64