Пример #1
0
        public void Open(TimeSpan timeout)
        {
            bool syncOpen = false;

            lock (this.thisLock)
            {
                if (this.openCalled)
                {
                    var exception = new InvalidOperationException(AmqpResources.GetString(AmqpResources.AmqpInvalidReOpenOperation, this, this.State));
                    AmqpTrace.Provider.AmqpThrowingExceptionWarning(ExceptionTrace.GetDetailsForThrownException(exception));
                    throw Fx.Exception.AsWarning(exception);
                }

                this.openCalled = true;
                if (this.State == AmqpObjectState.OpenReceived)
                {
                    syncOpen = true;
                }
            }

            if (syncOpen)
            {
                this.OpenInternal();
                this.NotifyOpened();
            }
            else
            {
                this.OnOpen(timeout);
            }
        }
Пример #2
0
 void AddReference()
 {
     if (Interlocked.Increment(ref this.references) == 1)
     {
         Interlocked.Decrement(ref this.references);
         var exception = new InvalidOperationException(AmqpResources.AmqpBufferAlreadyReclaimed);
         AmqpTrace.Provider.AmqpThrowingExceptionError(ExceptionTrace.GetDetailsForThrownException(exception));
         throw Fx.Exception.AsError(exception);
     }
 }
Пример #3
0
        public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
        {
            lock (this.thisLock)
            {
                if (this.openCalled)
                {
                    var exception = new InvalidOperationException(AmqpResources.GetString(AmqpResources.AmqpInvalidReOpenOperation, this, this.State));
                    AmqpTrace.Provider.AmqpThrowingExceptionWarning(ExceptionTrace.GetDetailsForThrownException(exception));
                    throw Fx.Exception.AsWarning(exception);
                }

                this.openCalled = true;
            }

            AmqpTrace.Provider.AmqpLogOperationVerbose(this, TraceOperation.Execute, "BeginOpen");
            return(new OpenAsyncResult(this, timeout, callback, state));
        }