@RequiresBackgroundThread
  void waitForAllExecuted(long timeout, @NotNull TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException {
    CompletableFuture<?> future = new CompletableFuture<>();
    queue(new Update(new Object()/*must not coalesce with anything in the queue*/) {
      @Override
      public void setRejected() {
        super.setRejected();
        future.cancel(false);
      }

      @Override
      public void run() {
        future.complete(null);
      }
    });
    myExternalActivitiesQueue.flush();
    future.get(timeout, unit);
  }
@RequiresBackgroundThread
  void waitForAllExecuted(long timeout, @NotNull TimeUnit unit)