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

Method continueWith

Bolts/src/bolts/Task.java:336–355  ·  view source on GitHub ↗

Adds a continuation that will be scheduled using the executor, returning a new task that completes after the continuation has finished running. This allows the continuation to be scheduled on different thread.

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

Source from the content-addressed store, hash-verified

334 * scheduled on different thread.
335 */
336 public <TContinuationResult> Task<TContinuationResult> continueWith(
337 final Continuation<TResult, TContinuationResult> continuation, final Executor executor) {
338 boolean completed = false;
339 final Task<TContinuationResult>.TaskCompletionSource tcs = Task.<TContinuationResult> create();
340 synchronized (lock) {
341 completed = this.isCompleted();
342 if (!completed) {
343 this.continuations.add(new Continuation<TResult, Void>() {
344 public Void then(Task<TResult> task) {
345 completeImmediately(tcs, continuation, task, executor);
346 return null;
347 }
348 });
349 }
350 }
351 if (completed) {
352 completeImmediately(tcs, continuation, this, executor);
353 }
354 return tcs.getTask();
355 }
356
357 /**
358 * Adds a synchronous continuation to this task, returning a new task that completes after the

Callers 6

callMethod · 0.80
whenAllMethod · 0.80
thenMethod · 0.80
runMethod · 0.80

Calls 4

createMethod · 0.95
isCompletedMethod · 0.95
completeImmediatelyMethod · 0.95
getTaskMethod · 0.80

Tested by 3

callMethod · 0.64