Execute the Rule
s on the IsolatedTask
ReadTask task = (ReadTask)isolatedTask.getWrappedTask();
Integer status = 0;
int i = 0;
isCachingAllowed = true;
while(true) {
rules.get(i).attach(task);
try{
status = (Integer)rules.get(i).call();
} catch(Exception ex) {
SelectorThread.logger().log(Level.SEVERE,"Rule exception",ex);
return true;
}
isCachingAllowed = (status == RULE_OK_NOCACHE ? false:true);
if (status == RULE_DELAY){
// Wait until the delay expire. The current thread will
// wait and then re-execute the rules.
try{
Thread.sleep(delayValue);
} catch (InterruptedException ex) {
SelectorThread.logger().
log(Level.SEVERE,"Rule delay exception",ex);
}
i = 0;
continue;
} else if ( status == RULE_BLOCKED ){
task.cancelTask("No resources available.", HtmlHelper.OK);
return true;
}
i++;
if (i == rules.size()){
break;
}
}
return (status == RULE_OK || status == RULE_OK_NOCACHE);