예제 #1
0
        internal void Close(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener)
        {
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);

            using (Microsoft.ServiceBus.Diagnostics.Activity activity = ServiceModelActivity.BoundOperation(this.Activity))
            {
                this.Unregister(timeoutHelper.RemainingTime(), channelListener);
            }
            lock (this.ThisLock)
            {
                if (this.openCount <= 0)
                {
                    throw Fx.AssertAndThrow("Invalid Open/Close state machine.");
                }
                Microsoft.ServiceBus.Channels.TransportManager transportManager = this;
                transportManager.openCount = transportManager.openCount - 1;
                if (this.openCount == 0)
                {
                    using (Microsoft.ServiceBus.Diagnostics.Activity activity1 = ServiceModelActivity.BoundOperation(this.Activity, true))
                    {
                        this.OnClose(timeoutHelper.RemainingTime());
                    }
                    if (this.Activity != null)
                    {
                        this.Activity.Dispose();
                    }
                }
            }
        }
예제 #2
0
        internal void Open(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener)
        {
            TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);

            if (DiagnosticUtility.ShouldUseActivity)
            {
                if (this.activity == null)
                {
                    this.activity = ServiceModelActivity.CreateActivity(true);
                }
                channelListener.ServiceModelActivity = this.Activity;
            }
            using (Microsoft.ServiceBus.Diagnostics.Activity activity = ServiceModelActivity.BoundOperation(this.Activity))
            {
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    DiagnosticTrace diagnosticTrace          = DiagnosticUtility.DiagnosticTrace;
                    string          traceCodeTransportListen = Resources.TraceCodeTransportListen;
                    object[]        absoluteUri = new object[] { channelListener.Uri.AbsoluteUri };
                    diagnosticTrace.TraceEvent(TraceEventType.Information, TraceCode.TransportListen, Microsoft.ServiceBus.SR.GetString(traceCodeTransportListen, absoluteUri), null, null, this);
                }
                this.Register(timeoutHelper.RemainingTime(), channelListener);
                try
                {
                    lock (this.ThisLock)
                    {
                        if (this.openCount == 0)
                        {
                            this.OnOpen(timeoutHelper.RemainingTime());
                        }
                        Microsoft.ServiceBus.Channels.TransportManager transportManager = this;
                        transportManager.openCount = transportManager.openCount + 1;
                    }
                }
                catch
                {
                    this.Unregister(timeoutHelper.RemainingTime(), channelListener);
                    throw;
                }
            }
        }
예제 #3
0
 protected override void OnOpen(TimeSpan timeout)
 {
     Microsoft.ServiceBus.Channels.TransportChannelListener transportChannelListener = this;
     this.transportManagerContainer.Open(timeout, new Microsoft.ServiceBus.Channels.SelectTransportManagersCallback(transportChannelListener.SelectTransportManagers));
 }
예제 #4
0
 protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
 {
     Microsoft.ServiceBus.Channels.TransportChannelListener transportChannelListener = this;
     return(this.transportManagerContainer.BeginOpen(timeout, new Microsoft.ServiceBus.Channels.SelectTransportManagersCallback(transportChannelListener.SelectTransportManagers), callback, state));
 }
예제 #5
0
 internal abstract void Unregister(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener);
예제 #6
0
 protected override void OnOpening()
 {
     base.OnOpening();
     this.transportManagerContainer = this.listener.GetTransportManagers();
     this.listener = null;
 }
예제 #7
0
 public TransportReplyChannelAcceptor(Microsoft.ServiceBus.Channels.TransportChannelListener listener) : base(listener, () => listener.GetPendingException())
 {
     this.listener = listener;
 }
예제 #8
0
 internal override void Unregister(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener)
 {
     Microsoft.ServiceBus.Channels.TransportManager.EnsureRegistered <TChannelListener>(this.AddressTable, (TChannelListener)channelListener);
     this.AddressTable.UnregisterUri(channelListener.Uri, channelListener.HostNameComparisonModeInternal);
     channelListener.SetMessageReceivedCallback(null);
 }
예제 #9
0
 internal override void Register(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener)
 {
     this.AddressTable.RegisterUri(channelListener.Uri, channelListener.HostNameComparisonModeInternal, (TChannelListener)channelListener);
     channelListener.SetMessageReceivedCallback(new MessageReceivedCallback(this.OnMessageReceived));
 }