Skip to content

Commit

Permalink
Avoid repeated hash lookup for StreamRule#getType()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jochen Schalanda committed Jul 17, 2015
1 parent b338a2d commit cc9a113
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -149,23 +149,24 @@ public List<Stream> match(Message message) {
final Set<Stream> blackList = Sets.newHashSet();

for (final Rule rule : rulesList) {
final Stream.MatchingType matchingType = rule.getMatchingType();
if (blackList.contains(rule.getStream())) {
continue;
}

final StreamRule streamRule = rule.getStreamRule();
if (streamRule.getType() != StreamRuleType.PRESENCE && !message.hasField(streamRule.getField())) {
final StreamRuleType streamRuleType = streamRule.getType();
if (streamRuleType != StreamRuleType.PRESENCE && !message.hasField(streamRule.getField())) {
continue;
}

final Stream stream;
if (streamRule.getType() != StreamRuleType.REGEX) {
if (streamRuleType != StreamRuleType.REGEX) {
stream = rule.match(message);
} else {
stream = matchWithTimeOut(message, rule);
}

final Stream.MatchingType matchingType = rule.getMatchingType();
if (stream == null) {
if (matchingType == Stream.MatchingType.AND) {
result.remove(rule.getStream());
Expand Down

0 comments on commit cc9a113

Please sign in to comment.