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); } }
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); } }
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)); }