Rhino supports continuations which will allow you to do this.

Download the latest RC2 release and look in the tests package
[org.mozilla.javascript.tests], there is a very good example in the class
named ContinuationsApiTest.class.

Take a look at it, I think you should be able to set this up yourself based
on that example. 

David


-----Original Message-----
From:
dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozilla.org
[mailto:dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozill
a.org] On Behalf Of Jereme
Sent: Thursday, February 26, 2009 3:52 PM
To: [email protected]
Subject: Pause and Resume Script

I am using the Rhino script engine in JDK 6.  Is there a way to pause
and resume a script.

For example:

ScriptEngineManager engineMgr = new ScriptEngineManager();
ScriptEngine engine = engineMgr.getEngineByName("JavaScript");
engine.eval("println('1');println('2');println('3');println('4');");

I would like have the script to execute "println('1')" then pause
while I do some other processing.  Then I would like to call the
engine again and have it resume processing where it left off.

Is there way to do this?
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino


_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to