예제 #1
0
        private void _Resolve
        (
            int count,
            Exception ex
        )
        {
            Log.Error
            (
                "RetryManager::_Resolve: "
                + "catch exception: "
                + ex.GetType().Name
                + ": "
                + ex.Message
                + ", count="
                + count
            );

            if (count >= RetryLimit)
            {
                Log.Error
                (
                    "RetryManager::_Resolve: "
                    + "count exceeded limit="
                    + RetryLimit
                );

                throw ex;
            }

            ExceptionEventArgs eventArgs
                = new ExceptionEventArgs(ex);

            ExceptionOccurs.Raise(this, eventArgs);

            if (ReferenceEquals(_resolver, null))
            {
                return;
            }

            bool result = _resolver(ex);

            if (!result)
            {
                Log.Error
                (
                    "RetryManager::_Resolve: "
                    + "couldn't resolve: "
                    + ex.GetType().Name
                );

                throw new ArsMagnaException
                      (
                          "RetryManager failed",
                          ex
                      );
            }

            Resolved.Raise(this);

            _Delay();
        }