Sorry for bothering You! found the Error: I had to put the Object o=cx.evaluateString(newScope, code, "Manual Exec", 1, null); in an try-Except.
Now I get great errormessages (from multithreading problens in my code) Thanx anyway! Am 2010-05-28 07:07, schrieb Roland Schuller:
Hi to all! Like the Header said, im unsing Rhino in an multithreading environment and it woks. Except sometimes. And here is the problem. I have one Javascript file with some functions. Later according to Events in Java i call these functions. First I load the Javascript public void doCode(String code) { Context cxl = Context.enter(); cxl.setGeneratingDebug(false); cxl.setGeneratingSource(false); cxl.setOptimizationLevel(9); code="Packages.java\n"+code; code="Packages.at\n"+code; script=cxl.compileString(code, "InterpreterCode", 1, null); script.exec(cxl, scope); Context.exit(); } Then in an Runnable called by an Executor i call these lines. public String eval(final String code) { return (String)ContextFactory.getGlobal().call(new ContextAction() { public Object run(Context cx) { Scriptable newScope = cx.newObject(scope); newScope.setPrototype(scope); newScope.setParentScope(null); Object o=cx.evaluateString(newScope, code, "Manual Exec", 1, null); String out = Context.toString(o); return out; } }); These lines can be called parallel and in different Threads. First I had the problem that i idnt put 'var' in front of may JS variables, which turned out to make a complete mess. But I corrected this issue. Now sometimes it happens that the Code is called, 'eval ("start()") but nothing happens. Is it possible to get an Information from Rhino which Line it is currently processing? Have done something completely wrong? Using 1.7R2 and JDK 1.6.20 both Windows and Linux. Thanx for your help! Roland
_______________________________________________ dev-tech-js-engine-rhino mailing list dev-tech-js-engine-rhino@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino