Microsoft.Azure.Amqp.StateTransition.CanTransite C# (CSharp) Method

CanTransite() public static method

public static CanTransite ( AmqpObjectState from, StateTransition states ) : bool
from AmqpObjectState
states StateTransition
return bool
        public static bool CanTransite(AmqpObjectState from, StateTransition[] states)
        {
            for (int i = 0; i < states.Length; i++)
            {
                if (states[i].From == from)
                {
                    return true;
                }
            }

            return false;
        }
    }

Usage Example

Example #1
0
        public void SafeClose(Exception exception)
        {
            this.TerminalException = exception;

            lock (this.thisLock)
            {
                if (this.State != AmqpObjectState.OpenReceived &&
                    !this.IsClosing() &&
                    !StateTransition.CanTransite(this.State, StateTransition.SendClose))
                {
                    this.State = AmqpObjectState.Faulted;
                }
            }

            try
            {
                this.BeginClose(TimeSpan.FromSeconds(AmqpConstants.DefaultTryCloseTimeout), onSafeCloseComplete, this);
            }
            catch (Exception exp)
            {
                if (Fx.IsFatal(exp))
                {
                    throw;
                }

                AmqpTrace.Provider.AmqpLogError(this, "SafeClose", exp.ToString());

                this.Abort();
            }
        }
All Usage Examples Of Microsoft.Azure.Amqp.StateTransition::CanTransite