예제 #1
0
                bool ReturnToPool(TItem connection)
                {
                    bool result = this.idleConnections.Return(connection);

                    if (!result)
                    {
                        if (TD.MaxOutboundConnectionsPerEndpointExceededIsEnabled())
                        {
                            TD.MaxOutboundConnectionsPerEndpointExceeded(SR.GetString(SR.TraceCodeConnectionPoolMaxOutboundConnectionsPerEndpointQuotaReached, maxCount));
                        }
                        if (DiagnosticUtility.ShouldTraceInformation)
                        {
                            TraceUtility.TraceEvent(TraceEventType.Information,
                                                    TraceCode.ConnectionPoolMaxOutboundConnectionsPerEndpointQuotaReached,
                                                    SR.GetString(SR.TraceCodeConnectionPoolMaxOutboundConnectionsPerEndpointQuotaReached, maxCount),
                                                    this);
                        }
                    }
                    else if (TD.OutboundConnectionsPerEndpointRatioIsEnabled())
                    {
                        TD.OutboundConnectionsPerEndpointRatio(this.idleConnections.Count, maxCount);
                    }

                    return(result);
                }
예제 #2
0
                private bool ReturnToPool(TItem connection)
                {
                    bool result = _idleConnections.Return(connection);

                    if (!result)
                    {
                        if (TD.MaxOutboundConnectionsPerEndpointExceededIsEnabled())
                        {
                            TD.MaxOutboundConnectionsPerEndpointExceeded(SR.Format(SR.TraceCodeConnectionPoolMaxOutboundConnectionsPerEndpointQuotaReached, _maxCount));
                        }
                    }
                    else if (TD.OutboundConnectionsPerEndpointRatioIsEnabled())
                    {
                        TD.OutboundConnectionsPerEndpointRatio(_idleConnections.Count, _maxCount);
                    }

                    return(result);
                }