public boolean isProcessing() {
    if (foreground.getTaskCount() > 0) return true;
    if (background.getTaskCount() > 0) return true;
    Command command = tree.queue.get();
    return command != null && command.isPending();
  }
public boolean isProcessing()