コード例 #1
0
    @Override
    public void request(long n) {
      if (once) {
        return;
      }
      if (n < 0L) {
        throw new IllegalStateException("n >= required but it was " + n);
      }
      if (n != 0L) {
        once = true;
        Subscriber<? super T> a = actual;
        if (a.isUnsubscribed()) {
          return;
        }
        T v = value;
        try {
          a.onNext(v);
        } catch (Throwable e) {
          Exceptions.throwOrReport(e, a, v);
          return;
        }

        if (a.isUnsubscribed()) {
          return;
        }
        a.onCompleted();
      }
    }
コード例 #2
0
 @Override
 public void call() {
   Subscriber<? super T> a = actual;
   if (a.isUnsubscribed()) {
     return;
   }
   T v = value;
   try {
     a.onNext(v);
   } catch (Throwable e) {
     Exceptions.throwOrReport(e, a, v);
     return;
   }
   if (a.isUnsubscribed()) {
     return;
   }
   a.onCompleted();
 }