Commands to launch additional script engines.
Method | Description |
---|---|
createScriptEngine() | Create a new script engine instance. |
executeSync() | Run a code fragment in a synchronized block. |
fork() | Fork a new script engine and execute provided resource. |
getSharedObject() | Get an object from the shared object store. |
join() | Wait for a script engine to shut down. |
listScriptEngines() | Retrieve a list of available script engines. |
notify() | Wakes up a single thread that is waiting on the monitor. |
notifyAll() | Wakes up all threads that are waiting on the monitor. |
setSharedObject() | Add an object to the shared object store. |
wait() | Causes the current thread to wait until either another thread invokes the Object.notify() method or the Object.notifyAll() method for this object, or a specified amount of time has elapsed. |
IScriptEngine createScriptEngine(String identifier)
Create a new script engine instance.
script engine instance (not started) or null
Object executeSync(Object monitor, Object code) throws ExecutionException
Run a code fragment in a synchronized block. Executes code within a synchronized block on the monitor object. The code object might be a String, File, IFile or any other object that can be adapted to IScriptable.
execution result of executed code
ScriptResult fork(Object resource, [String arguments], [String engineIdOrExtension])
Fork a new script engine and execute provided resource.
execution result
Object getSharedObject(String key)
Get an object from the shared object store.
shared object or null
boolean join(IScriptEngine engine, [long timeout])
Wait for a script engine to shut down. If timeout is set to 0 this method will wait endlessly.
true
when engine is shut down
String[] listScriptEngines()
Retrieve a list of available script engines.
array of engine IDs
void notify(Object monitor)
Wakes up a single thread that is waiting on the monitor. Calls the java method monitor.notify().
void notifyAll(Object monitor)
Wakes up all threads that are waiting on the monitor. Calls the java method monitor.notifyAll().
void setSharedObject(String key, Object object, [boolean permanent], [boolean writable]) throws IllegalAccessException
Add an object to the shared object store. The shared object store allows to share java instances between several script engines. By default objects are
stored until the script engine providing it is terminated. This helps to avoid polluting the java heap. When permanent is set to true
, this object will be stored forever.
void wait(Object monitor, [long timeout]) throws InterruptedException
Causes the current thread to wait until either another thread invokes the Object.notify() method or the Object.notifyAll() method for this object, or a specified amount of time has elapsed. Calls the java method monitor.wait(timeout).