Using Rhino with servlets: I want to do as much initialization and script compiling as possible when using Rhino in a servlet environment, to get the best performance. I am using Rhino 1.7R1. I have some library JS files that define objects/functions I always want available, but there will be specific JS files executed per servlet request.
Right now I am using a *static block* in a servlet to do Context.initStandardObjects() and I save the returned Scriptable in a static servlet variable, called topScope, which is used when processing every servlet request. I want to use topScope.evaluateString/Reader to execute the library JS files in the static block, since I always want those library objects/functions available. Questions: 1) Is it safe to create topScope and call topScope.evaluateString/Reader in the static servlet block, then reuse topScope for all Servlet requests? I am concerned that when the context exits in the static block, some state information that was on that thread will be lost. 2) Any general concerns about using a static initialization block in the servlet? Should I just stick with doing the work mentioned above in the servlet init method, or even take the hit and do the work for each servlet request? Thank you, James Burke _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
