Hi, I'm trying to integrate BSF into a server side application. The documentation of BSF doesn't discuss some important questions with regards to server side scripting. I wanted to use one BSFManager for the entire application. I have a couple of questions:
1) Is BSFManager thread safe? Are there any rules the BSFEngines have to adhere to with regards to the thread model? Do seperate threads get seperate stack frames or seperate global variable declarations? 2) What is the type of the argument for the "Object script" in BSFManager.exec()? I've seen code using a String, but what else can it be? Can it be a file? Why is it of type of Object? 3) What happens if two threads run the following code at the same time? String language = manager.getLangFromFilename( scriptFile.getName() ); manager.declareBean( "request", request, request.getClass() ); manager.declareBean( "response", response, response.getClass() ); manager.exec( language, scriptFile.getPath(), 0, 0, script ); Will calling declareBean() result in two different instance variables, or will they overwrite each other? 4) Calling exec() twice retains state from the previous run. BSFManager.exec( "jython", "", 0, 0, "i = 3" ); BSFManager.exec( "jython", "", 0, 0, "print i" ); That will print out 3. In a server application you don't really want retention of state since it could result in unpredictable behavior. Are exec() and eval() the same? The exec() method I expect to simply fire off a script and not retain state between calls or threads, but eval() I expect should retain state. Sort of like interactive programs would use eval(), but users who want to run a script and retain no state could use exec(). Thanks Charlie __________________________________ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
