Package dev.gmitch215.bytebox.concurrent


package dev.gmitch215.bytebox.concurrent
Suspension, and the pieces that make a blocking API possible.

Async.await(org.teavm.jso.core.JSPromise<T>) turns a JavaScript promise into an ordinary blocking call. Deferred does the reverse, and is what every trigger's entry point is built from: a promise the host can await, settled by Java once the handler has genuinely finished. Future carries the part of CompletableFuture that means anything here, since the class library has no Future at all.

Suspension is real; parallelism is not. Two fibers never run at once, so a synchronized block is uncontended and a thread pool cannot exist. What suspension does buy is that a handler can park on I/O without blocking the isolate — and that a second request can arrive while it is parked, which is why entry into a module is serialised.

Since:
1.0.0
  • Class
    Description
    Waiting on JavaScript from Java.
    Deferred<T extends org.teavm.jso.JSObject>
    A JavaScript promise that Java settles.
    Future<T extends org.teavm.jso.JSObject>
    A value that is not here yet, backed by a JavaScript promise.
    A JavaScript promise rejected with something that is not a Java throwable.