private ThreadContract ( ThreadKinds kind, ThreadKinds allowedSources, string errorMsg ) : void | ||
kind | ThreadKinds | |
allowedSources | ThreadKinds | |
errorMsg | string | |
return | void |
/// <devdoc> /// <para> /// Forces all connections on the ConnectionGroup to not be KeepAlive. /// </para> /// </devdoc> internal void DisableKeepAliveOnConnections() { // The timer thread is allowed to call this. (It doesn't call user code and doesn't block.) GlobalLog.ThreadContract(ThreadKinds.Unknown, ThreadKinds.SafeSources | ThreadKinds.Timer, "ConnectionGroup#" + ValidationHelper.HashString(this) + "::DisableKeepAliveOnConnections"); ArrayList connectionsToClose = new ArrayList(); lock (m_ConnectionList) { GlobalLog.Print("ConnectionGroup#" + ValidationHelper.HashString(this) + "::DisableKeepAliveOnConnections() Name = " + m_Name + ", Count:" + m_ConnectionList.Count); foreach (Connection currentConnection in m_ConnectionList) { // // For each Connection set KeepAlive to false // GlobalLog.Print("ConnectionGroup#" + ValidationHelper.HashString(this) + "::DisableKeepAliveOnConnections() setting KeepAlive to false Connection#" + ValidationHelper.HashString(currentConnection)); connectionsToClose.Add(currentConnection); } m_ConnectionList.Clear(); } foreach (Connection currentConnection in connectionsToClose) { currentConnection.CloseOnIdle(); } }