public void Subscribe(ICompletableObserver observer) { RequireNonNull(observer, nameof(observer)); var completeSignals = new UnicastSubject <object>(); var redo = default(IObservable <U>); try { redo = RequireNonNullRef(handler(completeSignals), "The handler returned a null IObservable"); } catch (Exception ex) { DisposableHelper.Error(observer, ex); return; } var parent = new MainObserver(observer, source, new SerializedObserver <object>(completeSignals)); var d = redo.Subscribe(parent.handlerObserver); parent.handlerObserver.OnSubscribe(d); parent.HandlerNext(); }
public IDisposable Subscribe(IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException(nameof(observer)); } var completeSignals = new Subject <object>(); var redo = default(IObservable <U>); try { redo = handler(completeSignals); if (redo == null) { throw new NullReferenceException("The handler returned a null IObservable"); } } catch (Exception ex) { observer.OnError(ex); return(Disposable.Empty); } var parent = new MainObserver(observer, source, new RedoSerializedObserver <object>(completeSignals)); var d = redo.SubscribeSafe(parent.handlerObserver); Disposable.SetSingle(ref parent.handlerUpstream, d); parent.HandlerNext(); return(parent); }
public void Awake() { if (Instance == null) { Instance = this; } }
public IDisposable Subscribe(IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException(nameof(observer)); } var errorSignals = new UnicastSubject <Exception>(); var redo = default(IObservable <U>); try { redo = handler(errorSignals); if (redo == null) { throw new NullReferenceException("The handler returned a null IObservable"); } } catch (Exception ex) { observer.OnError(ex); return(DisposableHelper.EMPTY); } var parent = new MainObserver(observer, source, new SerializedObserver <Exception>(errorSignals)); var d = redo.Subscribe(parent.handlerObserver); parent.handlerObserver.OnSubscribe(d); parent.HandlerNext(); return(parent); }
public IDisposable Subscribe(IObserver <T> observer) { RequireNonNull(observer, nameof(observer)); var errorSignals = new UnicastSubject <Exception>(); var redo = default(IObservable <U>); try { redo = RequireNonNullRef(handler(errorSignals), "The handler returned a null IObservable"); } catch (Exception ex) { observer.OnError(ex); return(DisposableHelper.EMPTY); } var parent = new MainObserver(observer, source, new SerializedObserver <Exception>(errorSignals)); var d = redo.Subscribe(parent.handlerObserver); parent.handlerObserver.OnSubscribe(d); parent.HandlerNext(); return(parent); }
public void Subscribe(ISignalObserver <T> observer) { ValidationHelper.RequireNonNull(observer, nameof(observer)); var errorSignals = new PublishSubject <Exception>(); var redo = default(IObservableSource <U>); try { redo = ValidationHelper.RequireNonNullRef(handler(errorSignals), "The handler returned a null IObservableSource"); } catch (Exception ex) { DisposableHelper.Error(observer, ex); return; } var parent = new MainObserver(observer, source, new SerializedSignalObserver <Exception>(errorSignals)); observer.OnSubscribe(parent); redo.Subscribe(parent.handlerObserver); parent.HandlerNext(); }
public void Subscribe(ISignalObserver <T> observer) { var parent = new MainObserver(observer, source); observer.OnSubscribe(parent); other.Subscribe(parent.other); }
public void OnError(Exception ex) { var p = Volatile.Read(ref parent); if (p != null) { var src = source; parent = null; source = null; p.OnError(ex); } }
public void OnCompleted() { var p = Volatile.Read(ref parent); if (p != null) { var src = source; parent = null; source = null; DisposableHelper.WeakDispose(ref upstream); src.Subscribe(p); } }
public void OnNext(U item) { var p = Volatile.Read(ref parent); if (p != null) { var src = source; parent = null; source = null; DisposableHelper.Dispose(ref upstream); src.Subscribe(p); } }
public IDisposable Subscribe(IObserver <T> observer) { if (observer == null) { throw new ArgumentNullException(nameof(observer)); } var errorSignals = new Subject <Exception>(); IObservable <U> redo; try { redo = _handler(errorSignals); if (redo == null) { throw new NullReferenceException("The handler returned a null IObservable"); } } catch (Exception ex) { observer.OnError(ex); return(Disposable.Empty); } var parent = new MainObserver(observer, _source, new RedoSerializedObserver <Exception>(errorSignals)); var d = redo.SubscribeSafe(parent.HandlerConsumer); parent.HandlerUpstream.Disposable = d; parent.HandlerNext(); return(parent); }
internal HandlerObserver(MainObserver main) { _main = main; }
internal HandlerObserver(MainObserver main) { this.main = main; }
public void add(MainObserver mainObserver) { mainObservers.Add(mainObserver); }
public OtherObserver(MainObserver parent, IObservableSource <T> source) { this.parent = parent; Volatile.Write(ref this.source, source); }
public MulticastObserver(ISignalObserver <R> downstream, IObservableSubject <T> subject) { this.downstream = downstream; this.mainObserver = new MainObserver(this, subject); }