Class FRListenerFuture<T>

  • Type Parameters:
    T - The type of the result
    All Implemented Interfaces:
    java.util.concurrent.Future<T>, FRListener<T>

    public class FRListenerFuture<T>
    extends java.lang.Object
    implements FRListener<T>, java.util.concurrent.Future<T>
    A Future represents the result of an FRListener
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel​(boolean mayInterruptIfRunning)  
      T get()  
      T get​(long timeout, java.util.concurrent.TimeUnit unit)  
      boolean isCancelled()  
      boolean isDone()  
      void onException​(java.lang.Exception e)
      Called when an asynchronous call fails to complete.
      void onSuccess​(T token)
      Called when an asynchronous call completes successfully.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FRListenerFuture

        public FRListenerFuture()
    • Method Detail

      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<T>
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface java.util.concurrent.Future<T>
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future<T>
      • get

        public T get()
              throws java.util.concurrent.ExecutionException,
                     java.lang.InterruptedException
        Specified by:
        get in interface java.util.concurrent.Future<T>
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • get

        public T get​(long timeout,
                     @NonNull
                     java.util.concurrent.TimeUnit unit)
              throws java.util.concurrent.ExecutionException,
                     java.lang.InterruptedException,
                     java.util.concurrent.TimeoutException
        Specified by:
        get in interface java.util.concurrent.Future<T>
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
        java.util.concurrent.TimeoutException
      • onSuccess

        public void onSuccess​(T token)
        Description copied from interface: FRListener
        Called when an asynchronous call completes successfully.
        Specified by:
        onSuccess in interface FRListener<T>
        Parameters:
        token - the value returned
      • onException

        public void onException​(java.lang.Exception e)
        Description copied from interface: FRListener
        Called when an asynchronous call fails to complete.
        Specified by:
        onException in interface FRListener<T>
        Parameters:
        e - the reason for failure