本文整理汇总了Java中rx.exceptions.OnErrorNotImplementedException类的典型用法代码示例。如果您正苦于以下问题:Java OnErrorNotImplementedException类的具体用法?Java OnErrorNotImplementedException怎么用?Java OnErrorNotImplementedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnErrorNotImplementedException类属于rx.exceptions包,在下文中一共展示了OnErrorNotImplementedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitError
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
void emitError(Throwable t) {
set(STATE_TERMINATED);
if (!isUnsubscribed()) {
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);
}
}
}
示例2: onNext
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的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);
}
}
}
示例3: onError
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的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();
}
示例4: onNext
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的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) {
RxJavaHooks.getOnError().call(e);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
RxJavaHooks.getOnError().call(new CompositeException(t, inner));
}
}
}
示例5: onError
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的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();
}
示例6: run
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
@Override
public void run() {
nsBlockOperation.addExecutionBlock(new NSBlockOperation.Block_addExecutionBlock() {
@Override
public void call_addExecutionBlock() {
try {
action.call();
} catch (Throwable e) {
// nothing to do but print a System error as this is fatal and there is nowhere else to throw this
IllegalStateException ie;
if (e instanceof OnErrorNotImplementedException) {
ie = new IllegalStateException("Exception thrown on Scheduler.Worker thread. Add `onError` handling.", e);
} else {
ie = new IllegalStateException("Fatal Exception thrown on Scheduler.Worker thread.", e);
}
RxJavaPlugins.getInstance().getErrorHandler().handleError(ie);
Thread thread = Thread.currentThread();
thread.getUncaughtExceptionHandler().uncaughtException(thread, ie);
} finally {
unsubscribe();
}
}
});
operationQueue.addOperation(nsBlockOperation);
}
示例7: subscribe
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
public final Subscription subscribe(final Action1<? super T> onSuccess) {
if (onSuccess != null) {
return subscribe(new Subscriber<T>() {
public final void onCompleted() {
}
public final void onError(Throwable e) {
throw new OnErrorNotImplementedException(e);
}
public final void onNext(T args) {
onSuccess.call(args);
}
});
}
throw new IllegalArgumentException("onSuccess can not be null");
}
示例8: run
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
public void run() {
try {
lazySet(Thread.currentThread());
this.action.call();
} catch (Throwable e) {
IllegalStateException ie;
if (e instanceof OnErrorNotImplementedException) {
ie = new IllegalStateException("Exception thrown on Scheduler.Worker thread. Add `onError` handling.", e);
} else {
ie = new IllegalStateException("Fatal Exception thrown on Scheduler.Worker thread.", e);
}
RxJavaPlugins.getInstance().getErrorHandler().handleError(ie);
Thread thread = Thread.currentThread();
thread.getUncaughtExceptionHandler().uncaughtException(thread, ie);
} finally {
unsubscribe();
}
}
示例9: create
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
public static final <T> Observer<T> create(final Action1<? super T> onNext) {
if (onNext != null) {
return new Observer<T>() {
public final void onCompleted() {
}
public final void onError(Throwable e) {
throw new OnErrorNotImplementedException(e);
}
public final void onNext(T args) {
onNext.call(args);
}
};
}
throw new IllegalArgumentException("onNext can not be null");
}
示例10: create
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
public static final <T> Subscriber<T> create(final Action1<? super T> onNext) {
if (onNext != null) {
return new Subscriber<T>() {
public final void onCompleted() {
}
public final void onError(Throwable e) {
throw new OnErrorNotImplementedException(e);
}
public final void onNext(T args) {
onNext.call(args);
}
};
}
throw new IllegalArgumentException("onNext can not be null");
}
示例11: run
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
@Override
public void run() {
try {
action.call();
} catch (Throwable e) {
// nothing to do but print a System error as this is fatal and there is nowhere else to throw this
IllegalStateException ie;
if (e instanceof OnErrorNotImplementedException) {
ie = new IllegalStateException("Exception thrown on Scheduler.Worker thread. Add `onError` handling.", e);
} else {
ie = new IllegalStateException("Fatal Exception thrown on Scheduler.Worker thread.", e);
}
RxJavaPlugins.getInstance().getErrorHandler().handleError(ie);
Thread thread = Thread.currentThread();
thread.getUncaughtExceptionHandler().uncaughtException(thread, ie);
}
}
示例12: schedulePeriodicSync
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
private void schedulePeriodicSync(Sync sync) {
if (isSyncScheduled(sync.getId())) {
return;
}
subscriptionStorage.put(sync.getId(),
Observable.interval(sync.getTrigger(), sync.getInterval(), TimeUnit.MILLISECONDS)
.switchMap(__ -> sync.execute()
.doOnError(throwable -> consoleLogger.log(throwable))
.onErrorComplete()
.toObservable())
.subscribe(__ -> {
}, throwable -> {
throw new OnErrorNotImplementedException(throwable);
}));
}
示例13: split
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
/**
* Returns an {@link Action1} that can be used to split {@link Notification} to appropriate
* dematerialized onNext and onError calls.
*
* @param onNext a method that will be called in case of onNext notification, or null.
* @param onError a method that will be called in case of onError notification, or null.
* @param <T> a type of onNext value.
* @return an {@link Action1} that can be used to split a {@link Notification} into appropriate
* onNext, onError calls.
*/
public static <T> Action1<Notification<T>> split(
@Nullable final Action1<T> onNext,
@Nullable final Action1<Throwable> onError) {
return new Action1<Notification<T>>() {
@Override
public void call(Notification<T> notification) {
if (notification.isOnNext()) {
if (onNext != null)
onNext.call(notification.getValue());
}
else if (notification.isOnError()) {
if (onError != null)
onError.call(notification.getThrowable());
else
throw new OnErrorNotImplementedException(notification.getThrowable());
}
}
};
}
示例14: OBSERVER_ONERROR_NOTIMPLEMENTED
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
private static Subscriber<String> OBSERVER_ONERROR_NOTIMPLEMENTED() {
return new Subscriber<String>() {
@Override
public void onComplete() {
}
@Override
public void onError(Throwable e) {
throw new OnErrorNotImplementedException(e);
}
@Override
public void onNext(String args) {
}
};
}
示例15: simulate
import rx.exceptions.OnErrorNotImplementedException; //导入依赖的package包/类
/**
* Run a simulation of 'count' selects and update the clients
* @param strategy
* @param N
* @param count
* @return
* @throws Throwable
*/
static Integer[] simulate(LoadBalancer<IntClientAndMetrics> lb, int N, int count) throws Throwable {
// Set up array of counts
final Integer[] counts = new Integer[N];
for (int i = 0; i < N; i++) {
counts[i] = 0;
}
// Run simulation
for (int i = 0; i < count; i++) {
try {
lb.toObservable().subscribe(new Action1<IntClientAndMetrics>() {
@Override
public void call(IntClientAndMetrics t1) {
counts[t1.getClient()] = counts[t1.getClient()] + 1;
}
});
}
catch (OnErrorNotImplementedException e) {
throw e.getCause();
}
}
return counts;
}