internal void ReturnChannel(PooledChannelTicket pooledChannel) { DiagnosticUtility.DebugAssert(pooledChannel != null, "pooled channel cannot be null"); if (pooledChannel == null) { return; } WorkflowTrace.Host.TraceEvent( TraceEventType.Information, 0, "ChannelManagerService: return channel for workflow instance {0}, logical channel {1}", new object[] { pooledChannel.WorkflowId, pooledChannel.LogicalChannelId }); this.channelManager.ReturnChannel(pooledChannel.ChannelPoolKey, pooledChannel.PooledChannel); }
internal PooledChannelTicket TakeChannel(Guid workflowId, LogicalChannel logicalChannel) { if (this.closed) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR2.GetString(SR2.Error_CannotProvideChannel_ServiceStopped, logicalChannel.ConfigurationName, logicalChannel.CustomAddress))); } if (workflowId == Guid.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("workflowId", SR2.GetString(SR2.Error_Cache_InvalidWorkflowId)); } if (logicalChannel == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("logicalChannel"); } WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "ChannelManagerService: get channel for workflow instance {0}, logical channel {1}", new object[] { workflowId, logicalChannel.InstanceId }); string endpointName = logicalChannel.ConfigurationName; Type contractType = logicalChannel.ContractType; string customAddress = logicalChannel.CustomAddress; ChannelPoolKey channelKey; ChannelManager.PooledChannel channel = this.channelManager.TakeChannel(endpointName, contractType, customAddress, out channelKey); if (channel == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR2.GetString(SR2.Error_CannotProvideChannel, logicalChannel.ConfigurationName, logicalChannel.CustomAddress))); } PooledChannelTicket pooledChannel = new PooledChannelTicket(this, channel, channelKey, workflowId, logicalChannel.InstanceId); return(pooledChannel); }
internal PooledChannelTicket TakeChannel(Guid workflowId, LogicalChannel logicalChannel) { if (this.closed) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR2.GetString(SR2.Error_CannotProvideChannel_ServiceStopped, logicalChannel.ConfigurationName, logicalChannel.CustomAddress))); } if (workflowId == Guid.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("workflowId", SR2.GetString(SR2.Error_Cache_InvalidWorkflowId)); } if (logicalChannel == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("logicalChannel"); } WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "ChannelManagerService: get channel for workflow instance {0}, logical channel {1}", new object[] { workflowId, logicalChannel.InstanceId }); string endpointName = logicalChannel.ConfigurationName; Type contractType = logicalChannel.ContractType; string customAddress = logicalChannel.CustomAddress; ChannelPoolKey channelKey; ChannelManager.PooledChannel channel = this.channelManager.TakeChannel(endpointName, contractType, customAddress, out channelKey); if (channel == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR2.GetString(SR2.Error_CannotProvideChannel, logicalChannel.ConfigurationName, logicalChannel.CustomAddress))); } PooledChannelTicket pooledChannel = new PooledChannelTicket(this, channel, channelKey, workflowId, logicalChannel.InstanceId); return pooledChannel; }