Hi Linda, > I am using BSF to run javascript from my Java application. The script > code have a infinte loop in it. I would like to terminate the javascript > engine from my java process under certain condition. So I called > BSFManager.terminate() method in my java code. Base on the documentation, > this suppose to terminate the script engine. But it actually doesn't. > Anything wrong? How should I stop the script engine? > Well the BSFManager does iterate over all engines and invokes their terminate method, which each BSF engine must posses according to the BSFEngine interface definition. Most of that interface is implemented by org.apache.bsf.util.BSFEngineImpl, where terminate nullifies the references to its manager, to the declaredBeans and to the ClassLoader (freeing up the respective references). BSFManager will then "empty" the HashTable of loaded engines by creating an empty HashTable and assigning it to the loadedEngines field (which will allow the engine instances to be garbage collected, once they finish/terminate themselves).
In the case of the JavaScript engine (which specializes BSFEngineImpl) there is no override for the inherited terminate method and therefore a JavaScript program would continue to run as long as it needs, although the BSFManager instance would not be able to reuse that JavaScript engine instance anymore. HTH, ---rony --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]