public RoutingResult doRoute(IBatisRoutingFact routingFact) throws RoutingException {
if (enableCache) {
synchronized (localCache) {
if (localCache.containsKey(routingFact)) {
RoutingResult result = (RoutingResult) localCache.get(routingFact);
logger.info("return routing result:{} from cache for fact:{}", result, routingFact);
return result;
}
}
}
RoutingResult result = new RoutingResult();
result.setResourceIdentities(new ArrayList<String>());
IRoutingRule<IBatisRoutingFact, List<String>> ruleToUse = null;
if (!CollectionUtils.isEmpty(getRuleSequences())) {
for (Set<IRoutingRule<IBatisRoutingFact, List<String>>> ruleSet : getRuleSequences()) {
ruleToUse = searchMatchedRuleAgainst(ruleSet, routingFact);
if (ruleToUse != null) {
break;
}
}
}
if (ruleToUse != null) {
logger.info("matched with rule:{} with fact:{}", ruleToUse, routingFact);
result.getResourceIdentities().addAll(ruleToUse.action());
} else {
logger.info("No matched rule found for routing fact:{}", routingFact);
}
if (enableCache) {