Ejemplo n.º 1
0
 void AddError(Exception e)
 {
     if (!ExceptionHelper.Add(ref error, e))
     {
         RxAdvancedFlowPlugins.OnError(e);
     }
 }
 internal void OnError(Exception e)
 {
     ExceptionHelper.Add(ref error, e);
     if (Interlocked.Increment(ref wip) == 1)
     {
         Terminate();
     }
 }
 public void OnError(Exception e)
 {
     if (ExceptionHelper.Add(ref error, e))
     {
         Volatile.Write(ref done, true);
         Drain();
     }
     else
     {
         RxAdvancedFlowPlugins.OnError(e);
     }
 }
Ejemplo n.º 4
0
 public void InnerError(Exception e, PublisherZipInnerSupport inner)
 {
     if (ExceptionHelper.Add(ref error, e))
     {
         inner.SetDone();
         Drain();
     }
     else
     {
         RxAdvancedFlowPlugins.OnError(e);
     }
 }
        void Error(Exception e, int index)
        {
            if (ExceptionHelper.Add(ref error, e))
            {
                SvDone();

                Drain();
            }
            else
            {
                RxAdvancedFlowPlugins.OnError(e);
            }
        }
        void InnerError(Exception e, PublisherConcatMapEagerInner inner)
        {
            if (ExceptionHelper.Add(ref error, e))
            {
                Volatile.Write(ref done, true);
                inner.SetDone();

                Drain();
            }
            else
            {
                RxAdvancedFlowPlugins.OnError(e);
            }
        }
 public void Add(HandledExceptionDTO handledException)
 {
     if (string.IsNullOrEmpty(Setup.GetAPIKey()))
     {
         _handledExceptionRepository.Add(new Entities.HandledException()
         {
             ExceptionType = handledException.ExceptionType, Occurred = handledException.Occurred, StackTrace = handledException.StackTrace
         });
         _handledExceptionRepository.UnitOfWork.Commit();
     }
     else
     {
         using (var handledExceptionHelper = new ExceptionHelper(Guid.Parse(Setup.GetAPIKey())))
         {
             handledExceptionHelper.Add(new Entities.HandledException()
             {
                 ExceptionType = handledException.ExceptionType, Occurred = handledException.Occurred, StackTrace = handledException.StackTrace
             });
         }
     }
 }
        void Drain()
        {
            if (bp.Enter())
            {
                int missed = 1;

                ISubscriber <R>   a    = actual;
                InnerSubscriber[] subs = subscribers;

                for (;;)
                {
                    if (CheckTerminated(LvDone(), q.IsEmpty(), a))
                    {
                        return;
                    }

                    long         r         = bp.Requested();
                    bool         unbounded = r == long.MaxValue;
                    long         e         = 0;
                    CombineEntry v;

                    while (r != 0)
                    {
                        bool d = LvDone();

                        bool empty = !q.Poll(out v);

                        if (CheckTerminated(d, empty, a))
                        {
                            return;
                        }

                        if (empty)
                        {
                            break;
                        }

                        R result;

                        try
                        {
                            result = combiner(v.array);
                        }
                        catch (Exception ex)
                        {
                            ExceptionHelper.Add(ref error, ex);
                            done = true;
                            continue;
                        }

                        a.OnNext(result);

                        subs[v.index].Request(1);

                        e++;
                        r--;
                    }

                    if (e != 0 && !unbounded)
                    {
                        bp.Produced(e);
                    }


                    if (bp.TryLeave(ref missed))
                    {
                        break;
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public void Drain()
        {
            if (!bp.Enter())
            {
                return;
            }

            ISubscriber <R> a = actual;

            PublisherZipInner <T>[] inners = subscribers;

            int missed = 1;

            for (;;)
            {
                long r = bp.Requested();
                long e = 0L;

                for (;;)
                {
                    if (bp.IsCancelled())
                    {
                        return;
                    }

                    Exception ex = Volatile.Read(ref error);
                    if (ex != null)
                    {
                        Cancel();

                        ExceptionHelper.Terminate(ref error, out ex);

                        a.OnError(ex);

                        return;
                    }

                    int len = inners.Length;

                    T[]  values = new T[len];
                    bool full   = true;

                    for (int i = 0; i < len; i++)
                    {
                        PublisherZipInner <T> inner = inners[i];
                        bool d1 = inner.IsDone();

                        T    t;
                        bool empty1 = !inner.Peek(out t);
                        if (d1 && empty1)
                        {
                            Cancel();

                            a.OnComplete();

                            return;
                        }

                        if (empty1)
                        {
                            full = false;
                            break;
                        }

                        values[i] = t;
                    }

                    if (full)
                    {
                        if (r != e)
                        {
                            R v;
                            try
                            {
                                v = zipper(values);
                            }
                            catch (Exception ex1)
                            {
                                Cancel();

                                ExceptionHelper.Add(ref error, ex1);
                                ExceptionHelper.Terminate(ref error, out ex1);

                                a.OnError(ex1);
                                return;
                            }

                            a.OnNext(v);

                            foreach (PublisherZipInner <T> inner in inners)
                            {
                                inner.Drop();
                            }

                            e++;
                        }
                        else
                        {
                            if (e != 0)
                            {
                                bp.Produced(e);

                                foreach (PublisherZipInner <T> inner in inners)
                                {
                                    inner.Request(e);
                                }
                            }
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                missed = bp.Leave(missed);
                if (missed == 0)
                {
                    break;
                }
            }
        }
Ejemplo n.º 10
0
        public void Drain()
        {
            if (!bp.Enter())
            {
                return;
            }

            ISubscriber <R> a = actual;

            int missed = 1;

            for (;;)
            {
                long r = bp.Requested();
                long e = 0L;

                for (;;)
                {
                    if (bp.IsCancelled())
                    {
                        return;
                    }

                    Exception ex = Volatile.Read(ref error);
                    if (ex != null)
                    {
                        Cancel();

                        ExceptionHelper.Terminate(ref error, out ex);

                        a.OnError(ex);

                        return;
                    }

                    bool d1 = inner1.IsDone();
                    T1   t1;
                    bool e1 = !inner1.Peek(out t1);

                    if (d1 && e1)
                    {
                        Cancel();

                        a.OnComplete();

                        return;
                    }

                    bool d2 = inner2.IsDone();
                    T2   t2;
                    bool e2 = !inner2.Peek(out t2);

                    if (d2 && e2)
                    {
                        Cancel();

                        a.OnComplete();

                        return;
                    }

                    if (!e1 && !e2)
                    {
                        if (r != e)
                        {
                            R v;
                            try
                            {
                                v = zipper(t1, t2);
                            }
                            catch (Exception ex1)
                            {
                                Cancel();

                                ExceptionHelper.Add(ref error, ex1);
                                ExceptionHelper.Terminate(ref error, out ex1);

                                a.OnError(ex1);
                                return;
                            }

                            a.OnNext(v);

                            inner1.Drop();
                            inner2.Drop();

                            e++;
                        }
                        else
                        {
                            if (e != 0)
                            {
                                bp.Produced(e);

                                inner1.Request(e);
                                inner2.Request(e);
                            }
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                missed = bp.Leave(missed);
                if (missed == 0)
                {
                    break;
                }
            }
        }