Ejemplo n.º 1
0
  private Message updateTimeout(int indexOfCurrentFilterStage, Message message) {
    AnyHolder _lifetimeFilterResult = new AnyHolder();
    Message _currentMessage = message;

    try {
      boolean lifetimeMatch =
          _currentMessage.match(
              arrayCurrentFilterStage_[indexOfCurrentFilterStage].getLifetimeFilter(),
              _lifetimeFilterResult);

      if (lifetimeMatch && (_currentMessage == getMessage())) {
        // LifeTime Mapping Filter matched and current Message
        // was not copied yet. This depends on the fact that
        // updatePriority was run before.

        _currentMessage = (Message) getMessage().clone();

        _currentMessage.setTimeout(_lifetimeFilterResult.value.extract_long());
      }

    } catch (UnsupportedFilterableData e) {
      if (logger_.isDebugEnabled()) {
        logger_.debug("unable to evaluate PriorityFilter", e);
      } else if (logger_.isInfoEnabled()) {
        logger_.info("unable to evaluate PriorityFilter");
      }
    }

    return _currentMessage;
  }
Ejemplo n.º 2
0
  private void filter() {
    for (int x = 0; x < arrayCurrentFilterStage_.length; ++x) {
      boolean _forward = false;

      if (!arrayCurrentFilterStage_[x].isDestroyed()) {
        Message _currentMessage = getMessage();

        if (arrayCurrentFilterStage_[x].hasPriorityFilter()) {
          _currentMessage = updatePriority(x, _currentMessage);
        }

        if (arrayCurrentFilterStage_[x].hasLifetimeFilter()) {
          _currentMessage = updateTimeout(x, _currentMessage);
        }

        if (_currentMessage != getMessage()) {
          // MappingFilter attached to a particular
          // FilterStage did change (Timeout or Priority)
          // the current Message.
          // store changed Message in Map for later use.
          changedMessages_.putAlternateMessage(arrayCurrentFilterStage_[x], _currentMessage);
        }

        _forward = _currentMessage.match(arrayCurrentFilterStage_[x]);
      }

      if (_forward) {
        // the subsequent destination filters need to be eval'd
        addFilterStage(arrayCurrentFilterStage_[x].getSubsequentFilterStages());
      }
    }
  }
Ejemplo n.º 3
0
  private Message updatePriority(int indexOfCurrentEvent, Message message) {
    AnyHolder _priorityFilterResult = new AnyHolder();

    Message _currentMessage = message;

    try {
      boolean priorityMatch =
          message.match(
              arrayCurrentFilterStage_[indexOfCurrentEvent].getPriorityFilter(),
              _priorityFilterResult);

      if (priorityMatch) {
        _currentMessage = (Message) getMessage().clone();

        _currentMessage.setPriority(_priorityFilterResult.value.extract_long());
      }
    } catch (UnsupportedFilterableData e) {
      if (logger_.isDebugEnabled()) {
        logger_.debug("unable to evaluate PriorityFilter", e);
      } else if (logger_.isInfoEnabled()) {
        logger_.info("unable to evaluate PriorityFilter");
      }
    }

    return _currentMessage;
  }