Subj : Re: Rhino - looking for ways to reset a scope.txt To : Ariel Malka From : Igor Bukanov Date : Thu Aug 28 2003 11:24 am Ariel Malka wrote: > Taking in count that: > > - Context.Enter() and Context.initStandardObjects() are producing > (harmless but annoying) exceptions with the MS JVM. Are you sure that Context.enter gives you an exception as well? > > - Context.initStandardObjects() seems to be an "expensive" method. > > I would like to minimize the invocations of these 2 methods. You should not cache the results of Context.Enter() or minimize number of its calls, it is cheap even under JDK 1.1 and you should always use Context cx = Context.enter(); try { .... } finally { Context.exit(); } when you need Context objects. To minimize number of Context.initStandardObjects() see http://mozilla.org/rhino/scopes.html and in particular "Shared Scope" session there. Regards, Igor .