Amqp.Link.OnAttach C# (CSharp) Метод

OnAttach() приватный Метод

private OnAttach ( uint remoteHandle, Amqp.Framing.Attach attach ) : void
remoteHandle uint
attach Amqp.Framing.Attach
Результат void
        internal virtual void OnAttach(uint remoteHandle, Attach attach)
        {
            lock (this.ThisLock)
            {
                if (this.state == LinkState.AttachSent)
                {
                    this.state = LinkState.Attached;
                }
                else if (this.state == LinkState.DetachPipe)
                {
                    this.state = LinkState.DetachSent;
                }
                else
                {
                    throw new AmqpException(ErrorCode.IllegalState,
                        Fx.Format(SRAmqp.AmqpIllegalOperationState, "OnAttach", this.state));
                }
            }

            if (this.onAttached != null)
            {
                this.onAttached(this, attach);
            }
        }

Usage Example

Пример #1
0
        internal virtual void OnAttach(Attach attach)
        {
            if (attach.Handle > this.handleMax)
            {
                throw new AmqpException(ErrorCode.NotAllowed,
                                        Fx.Format(SRAmqp.AmqpHandleExceeded, this.handleMax + 1));
            }

            Link link = null;

            lock (this.ThisLock)
            {
                for (int i = 0; i < this.localLinks.Length; ++i)
                {
                    Link temp = this.localLinks[i];
                    if (temp != null && string.Compare(temp.Name, attach.LinkName) == 0)
                    {
                        link = temp;
                        this.AddRemoteLink(attach.Handle, link);
                        break;
                    }
                }
            }

            if (link == null)
            {
                throw new AmqpException(ErrorCode.NotFound,
                                        Fx.Format(SRAmqp.LinkNotFound, attach.LinkName));
            }

            link.OnAttach(attach.Handle, attach);
        }
All Usage Examples Of Amqp.Link::OnAttach