/** * Set an exception if a response is not yet received otherwise skip it * * @param e synthetic error to set on initial command when no actual response is available */ public void setExceptionIfResponseNotReceived(Exception e) { if (!valueSet.get() && !isTerminated()) { subject.onError(e); } }
/** * When set any client thread blocking on get() will immediately be unblocked and receive the exception. * * @throws IllegalStateException * if called more than once or after setResponse. * @param e received exception that gets set on the initial command */ @Override public void setException(Exception e) { if (!isTerminated()) { subject.onError(e); } else { throw new IllegalStateException("Response has already terminated so exception can not be set", e); } }
/** * Notifies the Observer that the {@link Observable} has experienced an error condition. * <p> * If the {@link Observable} calls this method, it will not thereafter call {@link #onNext} or * {@link #onComplete}. * * @param e the exception encountered by the Observable */ public void onError(Throwable e) { subject.onError(e); }
public void reject(Throwable reason) { subject.onError(reason); }
public void call(Throwable t) { rx.onError(t); } },
@Override public void onError(Throwable e) { finalSubject.onError(e); }
public void reject(Object reason) { this.subject.onError(new Exception(reason.toString())); }
/** * Set an exception if a response is not yet received otherwise skip it * * @param e synthetic error to set on initial command when no actual response is available */ public void setExceptionIfResponseNotReceived(Exception e) { if (!valueSet.get() && !isTerminated()) { subject.onError(e); } }
@Override public void operationComplete(Future<? super Channel> future) throws Exception { if (future.isSuccess()) { sslCompletionStatus.onCompleted(); } else { sslCompletionStatus.onError(future.cause()); } } });
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof SSLException) { sslCompletionStatus.onError(cause); } super.exceptionCaught(ctx, cause); }
/** * When set any client thread blocking on get() will immediately be unblocked and receive the exception. * * @throws IllegalStateException * if called more than once or after setResponse. * @param e received exception that gets set on the initial command */ @Override public void setException(Exception e) { if (!isTerminated()) { subject.onError(e); } else { throw new IllegalStateException("Response has already terminated so exception can not be set", e); } }
} catch (final Exception e1) { log.error("Exception in inst lookup runnable", e1); sub.onError(e1);
sub.onCompleted(); } catch (final Exception e1) { sub.onError(e1);
public Subject<R, R> Method(SD<R> body) { depth++; body.accept(null, r -> { depth--; if (depth==0) result.onCompleted(); }, () -> { depth--; if (depth==0) result.onCompleted(); }, label -> { }, label -> { }, ex -> { result.onError(ex); }) ; return result; }
public Observable<Net.HttpResponse> write (ByteString data) { Buffer buffer = Buffer.buffer (data.toByteArray ()); ReplaySubject<Net.HttpResponse> subject = ReplaySubject.createWithSize(1); request.handler (response -> { if (!okStatuses.contains (response.statusCode ())) { throw new IllegalStateException (format("Unexpected statusCode %s and message %S", response.statusCode (), response.statusMessage ())); } response.bodyHandler (body -> { subject.onNext ( new Net.HttpResponse () { @Override public BytesEvent data () { return Codecs.BYTES.from (body.getBytes ()); } @Override public int status () { return response.statusCode (); } }); subject.onCompleted (); }); }) .exceptionHandler ( ex -> subject.onError (ex)) .putHeader ("Content-Length", String.valueOf (buffer.length ())) .end (buffer); return subject; }