예제 #1
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 /// <param name="subscription">TBD</param>
 /// <exception cref="SignalThrewException">TBD</exception>
 internal static void TryOnSubscribe(IUntypedSubscriber subscriber, ISubscription subscription)
 {
     try
     {
         subscriber.OnSubscribe(subscription);
     }
     catch (Exception e)
     {
         throw new SignalThrewException($"{subscriber}.OnSubscribe", e);
     }
 }
예제 #2
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 /// <exception cref="SignalThrewException">TBD</exception>
 internal static void TryOnComplete(IUntypedSubscriber subscriber)
 {
     try
     {
         subscriber.OnComplete();
     }
     catch (Exception e)
     {
         throw new SignalThrewException($"{subscriber}.OnComplete", e);
     }
 }
예제 #3
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 /// <param name="element">TBD</param>
 /// <exception cref="SignalThrewException">TBD</exception>
 internal static void TryOnNext(IUntypedSubscriber subscriber, object element)
 {
     RequireNonNullElement(element);
     try
     {
         subscriber.OnNext(element);
     }
     catch (Exception e)
     {
         throw new SignalThrewException($"{subscriber}.OnNext", e);
     }
 }
예제 #4
0
 private void SubscribePending(IEnumerable <IUntypedSubscriber> subscribers)
 {
     foreach (var subscriber in subscribers)
     {
         if (ReferenceEquals(Subscriber, null))
         {
             Subscriber = subscriber;
             ReactiveStreamsCompliance.TryOnSubscribe(subscriber, CreateSubscription());
         }
         else
         {
             ReactiveStreamsCompliance.RejectAdditionalSubscriber(subscriber, GetType().Name);
         }
     }
 }
예제 #5
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="subscriber">TBD</param>
        /// <param name="cause">TBD</param>
        /// <exception cref="IllegalStateException">TBD</exception>
        /// <exception cref="SignalThrewException">TBD</exception>
        internal static void TryOnError(IUntypedSubscriber subscriber, Exception cause)
        {
            if (cause is ISpecViolation)
            {
                throw new IllegalStateException("It's illegal to try to signal OnError with a spec violation", cause);
            }

            try
            {
                subscriber.OnError(cause);
            }
            catch (Exception e)
            {
                throw new SignalThrewException($"{subscriber}.OnError", e);
            }
        }
예제 #6
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 public abstract void Subscribe(IUntypedSubscriber subscriber);
예제 #7
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 public override void Subscribe(IUntypedSubscriber subscriber)
 {
     _publisher.Subscribe(UntypedSubscriber.ToTyped <T>(subscriber));
 }
예제 #8
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 /// <param name="rejector">TBD</param>
 internal static void RejectAdditionalSubscriber(IUntypedSubscriber subscriber, string rejector)
 {
     TryOnSubscribe(subscriber, CancelledSubscription.Instance);
     TryOnError(subscriber, new IllegalStateException(rejector + " " + SupportsOnlyASingleSubscriber));
 }
예제 #9
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <typeparam name="T">TBD</typeparam>
 /// <param name="untypedSubscriber">TBD</param>
 /// <returns>TBD</returns>
 public static ISubscriber <T> ToTyped <T>(IUntypedSubscriber untypedSubscriber)
 {
     return((ISubscriber <T>)ToTyped(untypedSubscriber));
 }
예제 #10
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 /// <param name="demand">TBD</param>
 /// <param name="lifecycleState">TBD</param>
 public State(IUntypedSubscriber subscriber, long demand, LifecycleState lifecycleState)
 {
     Subscriber     = subscriber;
     Demand         = demand;
     LifecycleState = lifecycleState;
 }