Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ease-dev] forking and joining scripts

On Sat, 11 Jan 2020 at 13:21, Christian Pontesegger <christian.pontesegger@xxxxxx> wrote:
Am Freitag, den 10.01.2020, 11:58 -0500 schrieb Geneviève Bastien:
> To wait for the callee to terminate, I should use the 'join' method,
> but
> it takes an IScriptEngine object and it's not available from using
> the
> fork method. Or am I mistaken? How can I fork and join a script from
> a
> script with a different engine?
>

fork returns a ScriptResult object. It supports wait... methods to wait
until the result (= termination return value of the forked engine) is
ready. In principle a Future would have been nicer here but future only
allows to report a single value. We do have a result or an Exception
and need to distinguish.


FWIW a Java Future supports a value or Exception return in a chainable way by using CompletableFuture. Using a Future on its own with its get() method will place a computation exception in an ExecutionException. Indeed I suspect you could fairly easily have ScriptResult implement Future interface based on a quick look at the current API.

HTH,
Jonah

Back to the top