Class FanoutReceiver<T>

  • Type Parameters:
    T - the type of data being received

    public class FanoutReceiver<T>
    extends Receiver<T>
    A FanoutReceiver will forward its callbacks to zero or more other Receivers. Any exceptions thrown by the queued Receivers will be re-thrown as an UmbrellaException after all Receivers have been invoked.
    • Constructor Summary

      Constructors 
      Constructor Description
      FanoutReceiver()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void add​(Receiver<? super T> receiver)
      Register a receiver to be called by the fanout.
      protected void finish()
      Called after all Receivers have been executed.
      void onConstraintViolation​(java.util.Set<ConstraintViolation<?>> violations)
      Called if an object sent to the server could not be validated.
      void onFailure​(ServerFailure error)
      Receives general failure notifications.
      void onSuccess​(T response)
      Called when a Request has been successfully executed on the server.
      protected void onUncaughtThrowable​(java.lang.Throwable t)
      Subclasses may override this method to alter how the FanoutReceiver collects exceptions that escape from the queued Receivers.
      void onViolation​(java.util.Set<Violation> errors)
      Deprecated.
      • Methods inherited from class java.lang.Object

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

      • FanoutReceiver

        public FanoutReceiver()
    • Method Detail

      • add

        public void add​(Receiver<? super T> receiver)
        Register a receiver to be called by the fanout.
        Throws:
        java.lang.IllegalArgumentException - if receiver is null
      • onFailure

        public void onFailure​(ServerFailure error)
        Description copied from class: Receiver
        Receives general failure notifications. The default implementation looks at ServerFailure.isFatal(), and throws a runtime exception with the failure object's error message if it is true.
        Overrides:
        onFailure in class Receiver<T>
        Parameters:
        error - a ServerFailure instance
      • onSuccess

        public void onSuccess​(T response)
        Description copied from class: Receiver
        Called when a Request has been successfully executed on the server.
        Specified by:
        onSuccess in class Receiver<T>
        Parameters:
        response - a response of type V
      • finish

        protected void finish()
        Called after all Receivers have been executed.
      • onUncaughtThrowable

        protected void onUncaughtThrowable​(java.lang.Throwable t)
        Subclasses may override this method to alter how the FanoutReceiver collects exceptions that escape from the queued Receivers.