public static CanTransite ( AmqpObjectState from, |
||
from | AmqpObjectState | |
states | ||
Résultat | bool |
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(); } }
/// <summary> /// Closes the object with exception handling in the background. /// </summary> /// <param name="exception">The error for closing the object.</param> 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(AmqpConstants.DefaultTimeout, onSafeCloseComplete, this); } catch (Exception exp) when(!Fx.IsFatal(exp)) { AmqpTrace.Provider.AmqpLogError(this, nameof(SafeClose), exp); this.Abort(); } }