ProvisionMonitor monitor;
public void run() {
while (true) {
waitForMonitor();
RuleMap ruleMap;
try {
ruleMap = addRuleMapQ.take();
} catch (InterruptedException e) {
logger.debug("RuleMapWorker breaking out of main loop");
break;
}
if (ruleMap != null) {
RuleMapAssociationController controller;
ClassLoader ruleLoader;
ClassLoader currentCL = null;
try {
ruleLoader = getRuleClassLoader(ruleMap);
if(ruleLoader!=null) {
currentCL = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(ruleLoader);
}
controller = new RuleMapAssociationController(ruleMap,
kAgent,
//kBase,
monitor,
context.getServiceBeanConfig().getGroups(),
ruleLoader);
controller.addRuleMapListener(new RuleMapNotificationListener());
controllers.add(controller);
controller.process();
} catch (ResolverException e) {
logger.warn("Unable to provision artifact [{}] for RuleMap {}",
ruleMap.getRuleDefinition().getRuleClassPath(), ruleMap, e);
} catch (MalformedURLException e) {
logger.warn("Unable to create URL from rule classpath [{}], cannot set classpath for rule classpath jars",
ruleMap.getRuleDefinition().getRuleClassPath(), e);
} catch (URISyntaxException e) {
logger.warn("Unable to create URI from rule classpath [{}], cannot set classpath for rule classpath jars",
ruleMap.getRuleDefinition().getRuleClassPath(), e);
} catch (IllegalArgumentException e) {
logger.warn("Unable to create RuleMapAssociationController", e);
} finally {
if(currentCL!=null)
Thread.currentThread().setContextClassLoader(currentCL);