/**
   * This method processed an arrived real element The method is synchronized to ensure that it
   * cannot interleave with {@link StreamDiscretizer#triggerOnFakeElement(Object)}
   *
   * @param input a real input element
   * @throws Exception
   */
  protected synchronized void processRealElement(IN input) throws Exception {

    // Setting the input element in order to avoid NullFieldException when triggering on fake
    // element
    windowEvent.setElement(input);
    if (isActiveTrigger) {
      ActiveTriggerPolicy<IN> trigger = (ActiveTriggerPolicy<IN>) triggerPolicy;
      Object[] result = trigger.preNotifyTrigger(input);
      for (Object in : result) {
        triggerOnFakeElement(in);
      }
    }

    boolean isTriggered = false;

    if (triggerPolicy.notifyTrigger(input)) {
      emitWindow();
      isTriggered = true;
    }

    evict(input, isTriggered);

    output.collect(windowEvent.setElement(input));
    bufferSize++;
  }
  @Override
  public void open(org.apache.flink.configuration.Configuration parameters) throws Exception {
    super.open(parameters);

    if (isActiveTrigger) {
      ActiveTriggerPolicy<IN> tp = (ActiveTriggerPolicy<IN>) triggerPolicy;

      Runnable runnable = tp.createActiveTriggerRunnable(new WindowingCallback());
      if (runnable != null) {
        activePolicyThread = new Thread(runnable);
        activePolicyThread.start();
      }
    }
  }