public void LinkStateLost(string clientId, string receiveLinkName, AmqpObjectState receiveLinkState, bool isSessionReceiver, Exception exception) { if (this.IsEnabled()) { this.LinkStateLost(clientId, receiveLinkName, receiveLinkState.ToString(), isSessionReceiver, exception.ToString()); } }
protected override bool CloseInternal() { AmqpObjectState state = this.State; if (state == AmqpObjectState.OpenReceived || state == AmqpObjectState.ClosePipe) { this.settings.Source = null; this.settings.Target = null; this.SendAttach(); } if (this.inflightDeliveries != null) { this.inflightDeliveries.Abort(); } if (Interlocked.Decrement(ref this.references) > 0) { // let other thread finish its work. close is low pri SpinWait.SpinUntil(() => this.references <= 0, 10000); } this.Session.Flush(); state = this.SendDetach(); return(state == AmqpObjectState.End); }
public void LinkStateLost(string identifier, string receiveLinkName, AmqpObjectState receiveLinkState, bool isSessionReceiver, Exception exception) { if (IsEnabled()) { WriteEvent(37, identifier, receiveLinkName, receiveLinkState.ToString(), isSessionReceiver, exception.ToString()); } }
public bool IsClosing() { AmqpObjectState state = this.State; return(state == AmqpObjectState.CloseSent || state == AmqpObjectState.CloseReceived || state == AmqpObjectState.ClosePipe || state == AmqpObjectState.End || state == AmqpObjectState.Faulted); }
internal bool IsClosing() { AmqpObjectState state = this.State; if (state == AmqpObjectState.CloseSent || state == AmqpObjectState.CloseReceived || state == AmqpObjectState.ClosePipe || state == AmqpObjectState.End) { return(true); } return(state == AmqpObjectState.Faulted); }
protected override bool OpenInternal() { AmqpObjectState amqpObjectState = this.SendAttach(); if (this.IsReceiver) { this.ApplyTempTotalLinkCredit(); } return(amqpObjectState == AmqpObjectState.Opened); }
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); }
/// <summary> /// Closes the session. /// </summary> /// <returns>True if the session is closed; false if close is pending.</returns> /// <remarks>All links in the session are also closed.</remarks> protected override bool CloseInternal() { if (this.State == AmqpObjectState.OpenReceived) { this.SendBegin(); } this.CloseLinks(!this.LinkFrameAllowed()); AmqpDebug.Dump(this); AmqpObjectState state = this.SendEnd(); return(state == AmqpObjectState.End); }
/// <summary> /// Opens the link. /// </summary> /// <returns>True if the link is open; false if open is pending.</returns> protected override bool OpenInternal() { AmqpObjectState state = this.SendAttach(this.settings); if (this.IsReceiver) { lock (this.syncRoot) { this.ApplyTempTotalLinkCredit(); } } return(state == AmqpObjectState.Opened); }
void OnOperationComplete(AmqpObject link, IAsyncResult result, bool isOpen) { Exception completeException = null; try { if (isOpen) { link.EndOpen(result); } else { link.EndClose(result); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } completeException = exception; } bool shouldComplete = true; if (completeException == null) { AmqpObjectState initialState = isOpen ? AmqpObjectState.OpenSent : AmqpObjectState.CloseSent; lock (this.ThisLock) { shouldComplete = this.sender.State != initialState && this.receiver.State != initialState; } } if (shouldComplete) { if (isOpen) { this.CompleteOpen(false, completeException); } else { this.CompleteClose(false, completeException); } } }
private void OnOperationComplete(AmqpObject link, IAsyncResult result, bool isOpen) { Exception exception = null; try { if (!isOpen) { link.EndClose(result); } else { link.EndOpen(result); } } catch (Exception exception2) { Exception exception1 = exception2; if (Fx.IsFatal(exception1)) { throw; } exception = exception1; } bool flag = true; if (exception == null) { AmqpObjectState amqpObjectState = (isOpen ? AmqpObjectState.OpenSent : AmqpObjectState.CloseSent); lock (base.ThisLock) { flag = (this.sender.State == amqpObjectState ? false : this.receiver.State != amqpObjectState); } } if (flag) { if (isOpen) { base.CompleteOpen(false, exception); return; } base.CompleteClose(false, exception); } }
public StateTransition(AmqpObjectState from, AmqpObjectState to) { this.From = from; this.To = to; }
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; }
/// <summary> /// Opens the session. /// </summary> /// <returns>True if the session is open; false if open is pending.</returns> protected override bool OpenInternal() { AmqpObjectState state = this.SendBegin(); return(state == AmqpObjectState.Opened); }
/// <summary> /// Called when an AmqpObject state is changed. /// </summary> /// <param name="source">The object.</param> /// <param name="operation">The operation that triggers the change.</param> /// <param name="fromState">The previous state.</param> /// <param name="toState">The current state.</param> public virtual void AmqpStateTransition(AmqpObject source, string operation, AmqpObjectState fromState, AmqpObjectState toState) { }