Class JsArrayFuture

  • All Implemented Interfaces:
    Supplier<CompletableFuture<JsArray>>, JsFuture<JsArray>

    public class JsArrayFuture
    extends Object
    implements JsFuture<JsArray>
    Represents a supplier of a completable future which result is a json array. It has the same recursive structure as a json array. Each index of the array is a completable future that it's executed asynchronously. When all the futures are completed, all the results are combined into a json array. JsArrayFuture(CompletableFuture(1),CompletableFuture("a"),CompletableFuture(true)) = CompletableFuture(JsArray(1,"a",true))
    • Method Detail

      • of

        public static JsArrayFuture of​(JsFuture<?> head,
                                       JsFuture<?>... tail)
        returns a JsArrayFuture from the given head and the tail
        Parameters:
        head - the head
        tail - the tail
        Returns:
        a new JsArrayFuture
      • empty

        public static JsArrayFuture empty()
        returns a JsArrayFuture that is completed returning the empty Json array
        Returns:
        a JsArrayFuture
      • executor

        public JsArrayFuture executor​(Executor executor)
        the executor to use for the asynchronous operation assigned to this future. By default the ForkJoinPool.commonPool() will be used. Notice that any future of the array can run on threads froms different executors. The job to do by this JsArrayFuture is to iterate the array of futures, trigger every future and append the result of every completed future to the final array that will be returned.
        Parameters:
        executor - the executor
        Returns:
        the same this JsArrayFuture