Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 public abstract void Subscribe(IUntypedSubscriber subscriber);
Ejemplo n.º 7
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="subscriber">TBD</param>
 public override void Subscribe(IUntypedSubscriber subscriber)
 {
     _publisher.Subscribe(UntypedSubscriber.ToTyped <T>(subscriber));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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;
 }