code: public synchronized List<alluxio.grpc.JobCommand> pollAllPendingCommands(long workerId) {
      if (!mWorkerIdToPendingCommands.containsKey(workerId)) {
        return Lists.newArrayList();
      }
      List<JobCommand> commands =
          Lists.newArrayList(mWorkerIdToPendingCommands.get(workerId));
      mWorkerIdToPendingCommands.get(workerId).clear();
      return commands;
    }
docs: Polls all the pending commands to a worker and removes the commands from the queue.
  
  @param workerId id of the worker to send the commands to
  @return the list of the commends polled