title: Java CompletableFuture.complete() block
body: <p>I have a problem when using CompletableFuture in java.
  I have 2 select requests those are filled when receiving responses from server.</p>
  
  <p>In the connection thread (THREAD-1) (use reactor), I use:</p>
  
  <pre><code>if(hasException) {
     selectFuture.completeExceptionally(new ClientException(errorCode));
  } else {
     System.out.println("Before complete future");
     selectFuture.complete(result);
     System.out.println("After complete future");
  }
  </code></pre>
  
  <p>And in other thread (THREAD-2), I use:</p>
  
  <pre><code>CompleteFuture.allOf(allSelect).whenComplete((aVoid, throwable) -&gt; {
     System.out.println("Receive all future");
     // Do sth here
  });
  </code></pre>
  
  <p>My situation is that the system print out "Receive all future" but THREAD-1 is blocked when calling <code>future.complete(result);</code> It cannot get out of that command.
  If in THREAD-2, I use <code>CompletableFuture.allOf(allOfSelect).get()</code>, the THREAD-1 will run correctly. But using <code>CompletableFuture.get()</code> reduces performance, so I would like to use <code>CompletableFuture.whenComplete()</code>.</p>
  
  <p>Anyone can help me explain the cause of blocking?</p>
  
  <p>Thanks!</p>