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(); } } } }
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; } } }
protected override void OnOpen(TimeSpan timeout) { Microsoft.ServiceBus.Channels.TransportChannelListener transportChannelListener = this; this.transportManagerContainer.Open(timeout, new Microsoft.ServiceBus.Channels.SelectTransportManagersCallback(transportChannelListener.SelectTransportManagers)); }
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)); }
internal abstract void Unregister(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener);
protected override void OnOpening() { base.OnOpening(); this.transportManagerContainer = this.listener.GetTransportManagers(); this.listener = null; }
public TransportReplyChannelAcceptor(Microsoft.ServiceBus.Channels.TransportChannelListener listener) : base(listener, () => listener.GetPendingException()) { this.listener = listener; }
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); }
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)); }