Skip to content

RenderThreadFuture

final class RenderThreadFuture<T>
Extends: CompletableFuture<T>
Package: dev.joid.lib.utils.thread · Module: core · Source: RenderThreadFuture.java

Future that completes on the render thread once the work it wraps is done, so the stages chained on it can touch the interface.

Methods of JOID that load in the background, such as MsdfFontLoader.load(...), return one. The stages chained on it run at the frame after the work ends; join() and get() called on the render thread wait for the work and complete it at once, without waiting for a frame.

ReturnsSignatureSummary
RenderThreadFuture<T>from(CompletableFuture source) factoryReturns a future that completes on the render thread with the result or the failure of source; a failure is the exception of the work itself, never a CompletionException around it.

ReturnsSignatureSummary
Tjoin()Returns the result; on the render thread, it waits for the source and completes the future at once.
Tget()Returns the result like join(), and throws an ExecutionException when the work failed.
Tget(long timeout, TimeUnit unit)Returns the result like get(), waiting timeout at most; throws a TimeoutException past it.

<T> RenderThreadFuture<T> from(CompletableFuture<T> source) factory

Thread: runs on the render thread.

Returns a future that completes on the render thread with the result or the failure of source; a failure is the exception of the work itself, never a CompletionException around it.

T join()

Returns the result; on the render thread, it waits for the source and completes the future at once.

T get()

Returns the result like join(), and throws an ExecutionException when the work failed.

T get(long timeout, TimeUnit unit)

Returns the result like get(), waiting timeout at most; throws a TimeoutException past it.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page