code: public Collection<PendingCommand> clearCommands() {
      Collection<PendingCommand> commands = Lists.newArrayList(pendingCommands.values());
      pendingCommands.clear();
      return commands;
    }
docs: Clears and returns all pending commands.
  
  @return a collection of pending commands