Package java.util.concurrent

Examples of java.util.concurrent.CompletableFuture


  @SuppressWarnings("unchecked")
  protected Object callFuture(AbstractAsyncProxyRemoteCall call, @SuppressWarnings("rawtypes") Class returnType) {
    // If the result value is a CompletableFuture then
    // we callCompletableAsync
    if (CompletableFuture.class.isAssignableFrom(returnType)) {
      @SuppressWarnings("rawtypes")
        CompletableFuture result = new CompletableFuture();
      callCompletableAsync(call, (r,hadException,exception) -> {
        if (hadException) result.completeExceptionally(exception);
        else result.complete(r);
      });
      // And return the CompletableFuture
      return result;
    }
    // Else if it's an IFuture then return
View Full Code Here


        // Because we want to test the absence of action in an async process, we forcibly repeat the server lookup
        // that just occurred so we can wait for it, and be sure that the scrubbed version of our own pledge was not
        // mistakenly added. Attempting to just test here without waiting would race, as the backend is processing
        // the reply we have above in parallel.
        CompletableFuture future = backend.refreshProjectStatusFromServer(project);
        gate.waitAndRun();
        sendServerStatus(httpReqs.take(), scrubbedPledge);
        future.get();
        assertEquals(0, gate.getTaskQueueSize());    // No pending set changes now.
        assertEquals(1, pledges.size());
        assertEquals(pledge, pledges.iterator().next());
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.CompletableFuture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.