private void compileRules(RulesCurator rulesCurator) {
scriptLock.writeLock().lock();
try {
// XXX: we need a principal to access the rules,
// but pushing and popping system principal could be a bad idea
Principal systemPrincipal = new SystemPrincipal();
ResteasyProviderFactory.pushContext(Principal.class, systemPrincipal);
// Check to see if we need to recompile. we do this inside the write lock
// just to avoid race conditions where we might double compile
Date newUpdated = rulesCurator.getUpdated();
if (newUpdated.equals(this.updated)) {