private void run() {
      switch (state.nextOp()) {
        case PROCESS:
          process();
          break;
        case WINDOW:
          window();
          break;
        case SCHEDULER:
          scheduler();
          break;
        case COMMIT:
          commit();
          break;
        case END_OF_STREAM:
          endOfStream();
          break;
        case DRAIN:
          drain();
          break;
        default:
          //no op
          break;
      }
    }
Invoke next task operation based on its state
samza-core/src/main/java/org/apache/samza/container/RunLoop.java