Jens;

executeScript must be run on JavaFX Application Thread, and execution of my
script takes long time. There is an unavoidable freezing case if your
script takes long time.

CompletableFuture can't help us because the issue arise from JavaScript
execution.





2015-08-06 14:17 GMT+03:00 Jens Kapitza <j.kapi...@schwarze-allianz.de>:

> Am Donnerstag, 6. August 2015, 14:00:27 schrieb Rahman USTA:
> > @Mike
> >
> > JRuby brings me ~ +30 MB. I tried to use Nashorn also but it is so slow.
> > I'm thinking to continue with WebView.
> >
> > The question is why there is HTML 5 Web Workers. Why there is no like
> that
> > for JavaFX threading model.
> >
> > @Jens
> >
> > Expensiveness comes from JavaScript code that runs on UI thread. Script
> > execution takes long time normally. For example docbook conversion
> > execution starts from here
> >
> https://github.com/asciidocfx/AsciidocFX/blob/master/src/main/java/com/kodcu
> > /component/HtmlPane.java#L56
>
> i would replace:
>    JSObject result = (JSObject)
>
> webEngine().executeScript(String.format("convertDocbook(editorValue,docbookOptions)"));
>      return ....
>
> with:
>
>
>
> CompletableFuture<JSObject> future = CompletableFuture.supplyAsync(
> () -> {
>        return
> (JSObject)
>
> webEngine().executeScript(String.format("convertDocbook(editorValue,docbookOptions)"));
> }
> );
>
>
>     return new ConverterResult(future); <<< you should check if future is
> present
>
> change your method an provide a consumer to call on completion an do not
> return the result (would be better)
>
>
>
>
> --
> Jens Kapitza
>
>


-- 
Rahman USTA
Istanbul JUG
https://github.com/rahmanusta <http://www.kodcu.com/>

Reply via email to