Unset script engine variables after scripts complete, allowing memory to be freed up sooner - see also r7252

* ScriptResource.java, ActionDirectory.java, ScriptedDecideRule.java
This commit is contained in:
nlevitt
2011-10-06 18:01:01 +00:00
parent b898d55cea
commit b4e6f43052
3 changed files with 13 additions and 2 deletions
@@ -324,7 +324,10 @@ public class ActionDirectory implements ApplicationContextAware, Lifecycle, Runn
ex = e;
} catch (RuntimeException e) {
ex = e;
}
} finally {
engine.put("rawOut", null);
engine.put("appCtx", null);
}
// report output/exception to files paired with script in done dir
rawOut.flush();
@@ -112,6 +112,12 @@ public class ScriptResource extends JobRelatedResource {
rawOutput = rawString.toString();
htmlOut.flush();
htmlOutput = htmlString.toString();
eng.put("rawOut", null);
eng.put("htmlOut", null);
eng.put("job", null);
eng.put("appCtx", null);
eng.put("scriptResource", null);
}
//TODO: log script, results somewhere; job log INFO?
@@ -132,7 +132,9 @@ implements ApplicationContextAware, InitializingBean {
} catch (ScriptException e) {
logger.log(Level.WARNING,e.getMessage(),e);
return DecideResult.NONE;
}
} finally {
engine.put("object", null);
}
}
}