示例#1
0
        private void ProcessQueue(Action act)
        {
            while (true)
            {
                try
                {
                    act();
                }
                catch (Exception exn)
                {
                    Log.E(exn, "Unhandled exception while executing dispatched action");
                    UnhandledExceptionWatcher.Swallow(exn);
                }

                lock (_queue)
                {
                    if (_queue.Count <= 0)
                    {
                        _acquired = false;
                        return;
                    }

                    act = _queue.Dequeue();
                }
            }
        }
示例#2
0
 public override void OnLeave()
 {
     Log.V("Leaving state: {0}", this);
     Fsm.NotifyLeaveConnecting();
     try
     {
         _cts.Cancel();
     }
     catch (Exception exn)
     {
         Log.E(exn, "Unhandled exception while cancelling connection");
         UnhandledExceptionWatcher.Swallow(exn);
     }
 }
        public static void NotifyUnsubscribeError(this IEnumerable <ISubscriptionObserver> observers, ISubscription subscription, Exception error)
        {
            if (observers == null)
            {
                return;
            }

            foreach (var observer in observers)
            {
                try
                {
                    observer.OnUnsubscribeError(subscription, error);
                }
                catch (Exception ex)
                {
                    UnhandledExceptionWatcher.Swallow(ex);
                }
            }
        }
        public static void NotifySubscriptionInfo(this IEnumerable <ISubscriptionObserver> observers, ISubscription subscription, RtmSubscriptionInfo info)
        {
            if (observers == null)
            {
                return;
            }

            foreach (var observer in observers)
            {
                try
                {
                    observer.OnSubscriptionInfo(subscription, info);
                }
                catch (Exception ex)
                {
                    UnhandledExceptionWatcher.Swallow(ex);
                }
            }
        }
        public static void NotifyLeaveFailed(this IEnumerable <ISubscriptionObserver> observers, ISubscription subscription)
        {
            if (observers == null)
            {
                return;
            }

            foreach (var observer in observers)
            {
                try
                {
                    observer.OnLeaveFailed(subscription);
                }
                catch (Exception ex)
                {
                    UnhandledExceptionWatcher.Swallow(ex);
                }
            }
        }
        public static void NotifyEnterSubscribing(this IEnumerable <ISubscriptionObserver> observers, ISubscription subscription, RtmSubscribeRequest request)
        {
            if (observers == null)
            {
                return;
            }

            foreach (var observer in observers)
            {
                try
                {
                    observer.OnEnterSubscribing(subscription, request);
                }
                catch (Exception ex)
                {
                    UnhandledExceptionWatcher.Swallow(ex);
                }
            }
        }