Class GridClientFutureAdapter<R>

    • Constructor Detail

      • GridClientFutureAdapter

        public GridClientFutureAdapter()
        Creates not-finished future without any result.
      • GridClientFutureAdapter

        public GridClientFutureAdapter​(R res)
        Creates succeeded finished future with given result.
        Parameters:
        res - Future result.
      • GridClientFutureAdapter

        public GridClientFutureAdapter​(Throwable err)
        Creates failed finished future with given error.
        Parameters:
        err - Future error.
    • Method Detail

      • isDone

        public boolean isDone()
        Checks if future is done.
        Specified by:
        isDone in interface GridClientFuture<R>
        Returns:
        Whether future is done.
      • onDone

        public void onDone​(@Nullable
                           R res)
        Callback to notify that future is finished successfully.
        Parameters:
        res - Result (can be null).
      • onDone

        public void onDone​(Throwable err)
        Callback to notify that future is finished with error.
        Parameters:
        err - Error (can't be null).
      • listen

        public void listen​(GridClientFutureListener<R>... lsnrs)
        Register new listeners for notification when future completes. Note that current implementations are calling listeners in the completing thread.
        Specified by:
        listen in interface GridClientFuture<R>
        Parameters:
        lsnrs - Listeners to be registered.
      • chain

        public <T> GridClientFutureAdapter<T> chain​(GridClientFutureCallback<R,​T> cb)
        Creates future's chain and completes chained future, when this future finishes.
        Type Parameters:
        T - New future format to convert this finished future to.
        Parameters:
        cb - Future callback to convert this future result into expected format.
        Returns:
        Chained future with new format.