當前位置: 首頁>>代碼示例>>Java>>正文


Java Exceptions.throwIfFatal方法代碼示例

本文整理匯總了Java中rx.exceptions.Exceptions.throwIfFatal方法的典型用法代碼示例。如果您正苦於以下問題:Java Exceptions.throwIfFatal方法的具體用法?Java Exceptions.throwIfFatal怎麽用?Java Exceptions.throwIfFatal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rx.exceptions.Exceptions的用法示例。


在下文中一共展示了Exceptions.throwIfFatal方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onNext

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
@Override public void onNext(Response<R> response) {
  if (response.isSuccessful()) {
    subscriber.onNext(response.body());
  } else {
    subscriberTerminated = true;
    Throwable t = new HttpException(response);
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:BodyOnSubscribe.java

示例2: onError

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
@Override public void onError(Throwable throwable) {
  try {
    subscriber.onNext(Result.<R>error(throwable));
  } catch (Throwable t) {
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
    return;
  }
  subscriber.onCompleted();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:ResultOnSubscribe.java

示例3: onError

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
@Override
public void onError(Throwable throwable) {
    try {
        subscriber.onNext(Result.<R>error(throwable));
    } catch (Throwable t) {
        try {
            subscriber.onError(t);
        } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) {
            RxJavaHooks.getOnError().call(e);
        } catch (Throwable inner) {
            Exceptions.throwIfFatal(inner);
            RxJavaHooks.getOnError().call(new CompositeException(t, inner));
        }
        return;
    }
    subscriber.onCompleted();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:ResultOnSubscribe.java

示例4: call

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
@Override
public final void call(Subscriber<? super T> subscriber) {
    try {
        T data = execute();
        if (!subscriber.isUnsubscribed()) {
            subscriber.onNext(data);
        }
    } catch (Throwable e) {
        ViseLog.e(e);
        Exceptions.throwIfFatal(e);
        if (!subscriber.isUnsubscribed()) {
            subscriber.onError(e);
        }
        return;
    }

    if (!subscriber.isUnsubscribed()) {
        subscriber.onCompleted();
    }
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:21,代碼來源:ApiCache.java

示例5: emitError

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
void emitError(Throwable t) {
  set(STATE_TERMINATED);

  if (!isUnsubscribed()) {
    try {
      subscriber.onError(t);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:CallArbiter.java

示例6: onError

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
@Override public void onError(Throwable throwable) {
  try {
    subscriber.onNext(Result.<R>error(throwable));
  } catch (Throwable t) {
    try {
      subscriber.onError(t);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
    return;
  }
  subscriber.onCompleted();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:ResultOnSubscribe.java

示例7: handleOnNextValueRendering

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
@Beta
public final String handleOnNextValueRendering(Object item) {
    try {
        return render(item);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        return item.getClass().getName() + ERROR_IN_RENDERING_SUFFIX;
    } catch (Throwable t) {
        Exceptions.throwIfFatal(t);
        return item.getClass().getName() + ERROR_IN_RENDERING_SUFFIX;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:RxJavaErrorHandler.java

示例8: emitComplete

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
void emitComplete() {
    set(STATE_TERMINATED);
    try {
        if (!isUnsubscribed()) {
            subscriber.onCompleted();
        }
    } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) {
        RxJavaHooks.getOnError().call(e);
    } catch (Throwable t) {
        Exceptions.throwIfFatal(t);
        RxJavaHooks.getOnError().call(t);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:CallArbiter.java

示例9: emitError

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
void emitError(Throwable t) {
    set(STATE_TERMINATED);
    if (!isUnsubscribed()) {
        try {
            subscriber.onError(t);
        } catch (OnCompletedFailedException | OnErrorFailedException | OnErrorNotImplementedException e) {
            RxJavaHooks.getOnError().call(e);
        } catch (Throwable inner) {
            Exceptions.throwIfFatal(inner);
            RxJavaHooks.getOnError().call(new CompositeException(t, inner));
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:CallArbiter.java

示例10: onError

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
public void onError(Throwable e) {
    Exceptions.throwIfFatal(e);
    if (!this.done) {
        this.done = true;
        _onError(e);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:SafeSubscriber.java

示例11: subscribe

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
public final void subscribe(CompletableSubscriber s) {
    requireNonNull(s);
    try {
        this.onSubscribe.call(s);
    } catch (NullPointerException ex) {
        throw ex;
    } catch (Throwable ex2) {
        ERROR_HANDLER.handleError(ex2);
        Exceptions.throwIfFatal(ex2);
        NullPointerException toNpe = toNpe(ex2);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:Completable.java

示例12: onNext

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
public void onNext(T args) {
    try {
        if (!this.done) {
            this.actual.onNext(args);
        }
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        onError(e);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:11,代碼來源:SafeSubscriber.java

示例13: unsafeSubscribe

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
public final Subscription unsafeSubscribe(Subscriber<? super T> subscriber) {
    try {
        subscriber.onStart();
        hook.onSubscribeStart(this, this.onSubscribe).call(subscriber);
        return hook.onSubscribeReturn(subscriber);
    } catch (Throwable e2) {
        Exceptions.throwIfFatal(e2);
        hook.onSubscribeError(new RuntimeException("Error occurred attempting to subscribe [" + e.getMessage() + "] and then again while trying to pass to onError.", e2));
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:11,代碼來源:Observable.java

示例14: call

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
public Subscriber<? super T> call(final Subscriber<? super T> child) {
    Subscriber<T> s = new Subscriber<T>() {
        private boolean done = false;

        public void onNext(T t) {
            if (!this.done) {
                child.onNext(t);
            }
        }

        public void onError(Throwable e) {
            if (this.done) {
                Exceptions.throwIfFatal(e);
                return;
            }
            this.done = true;
            RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
            unsubscribe();
            OperatorOnErrorResumeNextViaObservable.this.resumeSequence.unsafeSubscribe(child);
        }

        public void onCompleted() {
            if (!this.done) {
                this.done = true;
                child.onCompleted();
            }
        }

        public void setProducer(final Producer producer) {
            child.setProducer(new Producer() {
                public void request(long n) {
                    producer.request(n);
                }
            });
        }
    };
    child.add(s);
    return s;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:40,代碼來源:OperatorOnErrorResumeNextViaObservable.java

示例15: emitLoop

import rx.exceptions.Exceptions; //導入方法依賴的package包/類
void emitLoop() {
    Subscriber<? super R> child = this.child;
    Queue<Object> queue = this.queue;
    NotificationLite<R> nl = NotificationLite.instance();
    AtomicLong requested = this.requested;
    long r = requested.get();
    while (true) {
        boolean max = r == Long.MAX_VALUE;
        if (!checkTerminated(this.done, queue.isEmpty(), child)) {
            long e = 0;
            while (r != 0) {
                boolean d = this.done;
                Object o = queue.poll();
                boolean empty = o == null;
                if (!checkTerminated(d, empty, child)) {
                    if (empty) {
                        break;
                    }
                    R v = nl.getValue(o);
                    try {
                        child.onNext(v);
                        r--;
                        e--;
                    } catch (Throwable ex) {
                        Exceptions.throwIfFatal(ex);
                        child.onError(OnErrorThrowable.addValueAsLastCause(ex, v));
                        return;
                    }
                }
                return;
            }
            if (!(e == 0 || max)) {
                r = requested.addAndGet(e);
            }
            synchronized (this) {
                if (this.missed) {
                    this.missed = false;
                } else {
                    this.emitting = false;
                    return;
                }
            }
        }
        return;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:47,代碼來源:OperatorScan.java


注:本文中的rx.exceptions.Exceptions.throwIfFatal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。