representing partial asynchronous computations of a large one.
You can add Promise module to your project by inserting dependency in
DataKernel promises are faster and better optimized, with minimal overhead, memory consumption and Garbage Collector load:
Eventloop, they are much more efficient comparing to multithreaded Java’s CompletableFuture overhead.
represents methods which you can use to create chains of promises.
Promise will succeed (or fail) at some unspecified time and you should chain method calls that will be executed in both cases. These methods basically convert one Promise into another, passing intermediate results without storing them. If you need to get a result of your Promise, you should first materialize it.
In order to optimise Promises, there are several implementations of Promise interface:
Promise- root interface which represents promises behaviour.
NextPromise- helper classes which enable creating chains of stateless Promises. You can treat these chains as pipes which pass values through, but don’t store them.
MaterializedPromise- an interface which has getResult() and getException() methods and a special container for result. This allows to materialize intermediate stateless Promises and get their values when they will be completed.
SettablePromise- a class which can be used as a root for chain of Promises. Allows to wrap operations in Promises, can be completed manually.
CompleteExceptionallyPromise- a Promise which was completed with an exception.
CompletePromise- an abstract class which represents a successfully completed Promise.
CompleteResultPromise- a completed Promise with a result of any type.
CompleteNullPromise- a completed Promise with null result.