public synchronized void updateRules() throws ThrottlingException {
ruleEngine =
Util.getRuleServerManagerService().createRuleEngine(
Thread.currentThread().getContextClassLoader());
RuleSetDescription ruleSetDescription = new RuleSetDescription();
Resource ruleContentResource;
// getting the resource content.
try {
UserRegistry systemRegistry = Util.getSuperTenantGovernanceSystemRegistry();
ruleContentResource =
systemRegistry.get(StratosConstants.THROTTLING_RULES_PATH);
} catch (RegistryException e) {
String msg =
"Error in reading the rule resource content. resource path: " +
StratosConstants.THROTTLING_RULES_PATH + ".";
log.error(msg, e);
throw new ThrottlingException(msg, e);
} catch (Exception e) {
String msg = "Error in loading the rules.";
log.error(msg, e);
throw new ThrottlingException(msg, e);
}
try {
ruleSetDescription.setRuleSource(ruleContentResource.getContentStream());
} catch (RegistryException e) {
String msg = "Error in loading the rules from the content stream.";
log.error(msg, e);
throw new ThrottlingException(msg, e);
}