[tcljava-user] creating and using safe interpreter in jacl
Brought to you by:
mdejong
From: Andrew G. <and...@in...> - 2004-08-26 19:05:33
|
I have been working on a Tcl plugin for JSPWiki using Jacl 1.3.1. I have have little trouble integrating the two tools up to this point. Two remaining tasks are to 1) use a safe interpreter and 2) reuse a master interpreter retained for each thread. It is not clear to me how to make a safe interpreter. Tracking the jacl code it looks like I can Interp masterInterp = new Interp(); TclObject safeInterpName = ... Interp safeInterp = InterpSlaveCmd.create( masterInterp, safeInterpName, true /* safe */ ); and now use safeInterp as I used masterInterp before. The coding does not feel right -- using another class's convenience method to create the interpreter -- and so am not confident it is right. Can anyone confirm that this is correct? The second issue is reusing and retaining a master interpreter for each thread. What I am trying to achieve is good performance within the JSPWiki. JSPWiki creates a new instance of the plugin for each use on the wiki page. A wiki page with 10 uses of the plugin will have 10 plugin instances created. If each plugin instance needs to initialize an interpreter with lots of tcl code then the performance will be poor. What I hoped to do was associate a master interpreter with each thread. This interpreter would be loaded with the initialization tcl code. Now when the plugin is instanced a safe interpreter is created and associated with the thread's master interpreter. I can see how the mechanics of this would be work in Java. What I don't know is whether Jacl will work in this context. (Note that only one thread is ever using the two interpreters.) Can anyone confirm that what I am trying to do will work? For more information about the JSPWiki Tcl plugin see http://www.jspwiki.org/Wiki.jsp?page=TclPlugin Thank you. -- Andrew Gilmartin |