Exemple #1
0
        private void NotifyClosed()
        {
            if (this.pendingOpen != null)
            {
                object terminalException = this.TerminalException;
                if (terminalException == null)
                {
                    terminalException = new OperationCanceledException(SRAmqp.AmqpObjectAborted(this.name));
                }
                this.CompleteOpen(false, (Exception)terminalException);
            }
            if (this.pendingClose != null)
            {
                Exception operationCanceledException = this.TerminalException;
                if (operationCanceledException == null)
                {
                    operationCanceledException = new OperationCanceledException(SRAmqp.AmqpObjectAborted(this.name));
                }
                this.CompleteClose(false, operationCanceledException);
            }
            EventHandler eventHandler = Interlocked.Exchange <EventHandler>(ref this.Closed, null);

            if (eventHandler != null)
            {
                eventHandler(this, EventArgs.Empty);
            }
        }
Exemple #2
0
 private void ThrowIfNotOpen()
 {
     if (this.webSocket.State != ServiceBusClientWebSocket.WebSocketState.Open)
     {
         if (this.webSocket.State != ServiceBusClientWebSocket.WebSocketState.Aborted)
         {
             if (this.webSocket.State != ServiceBusClientWebSocket.WebSocketState.Closed)
             {
                 throw Fx.Exception.AsWarning(new AmqpException(AmqpError.IllegalState, SRAmqp.AmqpUnopenObject), this.activity);
             }
             throw Fx.Exception.AsWarning(new ObjectDisposedException(SRAmqp.AmqpUnopenObject), this.activity);
         }
         throw Fx.Exception.AsWarning(new ObjectDisposedException(SRAmqp.AmqpObjectAborted(base.GetType().Name)), this.activity);
     }
 }