code: @Override
      public void onEvent(Event event, Object source, Object data)
      {
          if (event instanceof BeginEvent) {
              pushCurrentEvent((BeginEvent) event);
          } else if (event instanceof EndEvent) {
              Stack<BeginEvent> events = getCurrentEvents();
  
              if (events != null && !events.isEmpty()) {
                  events.pop();
              } else {
                  this.logger.error("Can't find any begin event corresponding to [{}]", event);
              }
          }
      }
docs: EventListener