Class UnsafeFutureImpl<R>

    • Field Detail

      • isDone

        protected boolean isDone
      • isCancelled

        protected boolean isCancelled
      • result

        protected R result
      • recycleMark

        protected int recycleMark
    • Method Detail

      • getResult

        public R getResult()
        Get current result value without any blocking.
        Specified by:
        getResult in interface FutureImpl<R>
        Returns:
        current result value without any blocking.
      • result

        public void result​(R result)
        Set the result value and notify about operation completion.
        Specified by:
        result in interface FutureImpl<R>
        Parameters:
        result - the result value
      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface Future<R>
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface Future<R>
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface Future<R>
      • failure

        public void failure​(Throwable failure)
        Notify about the failure, occured during asynchronous operation execution.
        Specified by:
        failure in interface FutureImpl<R>
        Parameters:
        failure -
      • notifyHaveResult

        protected void notifyHaveResult()
        Notify blocked listeners threads about operation completion.
      • markForRecycle

        public void markForRecycle​(boolean recycleResult)
        Description copied from interface: GrizzlyFuture
        Mark GrizzlyFuture as recyclable, so once result will come - GrizzlyFuture object will be recycled and returned to a thread local object pool. You can consider to use this method, if you're not interested in using this GrizzlyFuture object.
        Specified by:
        markForRecycle in interface GrizzlyFuture<R>
        Parameters:
        recycleResult - if true - the GrizzlyFuture result, if it support recyclable mechanism, will be also recycled together with this GrizzlyFuture object.
      • reset

        protected void reset()
      • recycle

        public void recycle​(boolean recycleResult)
        Description copied from interface: GrizzlyFuture
        Recycle GrizzlyFuture now. This method could be used, if you're not interested in using this GrizzlyFuture object, and you're sure this object is not used by any other application part.
        Specified by:
        recycle in interface GrizzlyFuture<R>
        Parameters:
        recycleResult - if true - the GrizzlyFuture result, if it support recyclable mechanism, will be also recycled together with this GrizzlyFuture object.
      • recycle

        public void recycle()
        Specified by:
        recycle in interface Cacheable