示例#1
0
 private boolean moveToNext() {
   try {
     Notification<? extends T> nextNotification = observer.takeNext();
     if (nextNotification.isOnNext()) {
       isNextConsumed = false;
       next = nextNotification.getValue();
       return true;
     }
     // If an observable is completed or fails,
     // hasNext() always return false.
     hasNext = false;
     if (nextNotification.isOnCompleted()) {
       return false;
     }
     if (nextNotification.isOnError()) {
       error = nextNotification.getThrowable();
       throw Exceptions.propagate(error);
     }
     throw new IllegalStateException("Should not reach here");
   } catch (InterruptedException e) {
     Thread.currentThread().interrupt();
     error = e;
     throw Exceptions.propagate(error);
   }
 }
示例#2
0
  @Override
  protected void match() {
    if (!jo1.queue().isEmpty()
        && !jo2.queue().isEmpty()
        && !jo3.queue().isEmpty()
        && !jo4.queue().isEmpty()
        && !jo5.queue().isEmpty()
        && !jo6.queue().isEmpty()
        && !jo7.queue().isEmpty()) {
      Notification<T1> n1 = jo1.queue().peek();
      Notification<T2> n2 = jo2.queue().peek();
      Notification<T3> n3 = jo3.queue().peek();
      Notification<T4> n4 = jo4.queue().peek();
      Notification<T5> n5 = jo5.queue().peek();
      Notification<T6> n6 = jo6.queue().peek();
      Notification<T7> n7 = jo7.queue().peek();

      if (n1.isOnCompleted()
          || n2.isOnCompleted()
          || n3.isOnCompleted()
          || n4.isOnCompleted()
          || n5.isOnCompleted()
          || n6.isOnCompleted()
          || n7.isOnCompleted()) {
        onCompleted.call();
      } else {
        dequeue();
        onNext.call(
            n1.getValue(),
            n2.getValue(),
            n3.getValue(),
            n4.getValue(),
            n5.getValue(),
            n6.getValue(),
            n7.getValue());
      }
    }
  }