コード例 #1
0
        /// <summary>
        /// Inspects all available connections. Used the specified method to analyze each connection.
        /// </summary>
        /// <param name="processConnectionEventHandler">The late-bound method analyzing the state of the connection.</param>
        /// <param name="parameter">A parameter provided to the handler.</param>
        public void InspectAllConnections(ProcessConnectionEventHandler processConnectionEventHandler, object parameter)
        {
            ArrayList allConnectionsToAllHosts = new ArrayList();

            lock (this.SyncRoot)
            {
                // go through all available hosts
                foreach (DictionaryEntry entry in this._byUri)
                {
                    ObjectStorageWithDefaultEntry objectStorageWithDefaultEntry = (ObjectStorageWithDefaultEntry)entry.Value;

                    // and collect all connections
                    foreach (DictionaryEntry connectionEntry in objectStorageWithDefaultEntry.Collection)
                    {
                        allConnectionsToAllHosts.Add(connectionEntry.Value);
                    }
                }
            }

            foreach (object connection in allConnectionsToAllHosts)
            {
                processConnectionEventHandler(connection, parameter);
            }
        }
コード例 #2
0
        /// <summary>
        /// Inspects all available connections. Used the specified method to analyze each connection.
        /// </summary>
        /// <param name="processConnectionEventHandler">The late-bound method analyzing the state of the connection.</param>
        /// <param name="parameter">A parameter provided to the handler.</param>
        public void InspectAllConnections(ProcessConnectionEventHandler processConnectionEventHandler, object parameter)
        {
            ArrayList allConnectionsToAllHosts = new ArrayList();

            lock (this.SyncRoot)
            {
                // go through all available hosts
                foreach (DictionaryEntry entry in this._byUri)
                {
                    ObjectStorageWithDefaultEntry objectStorageWithDefaultEntry = (ObjectStorageWithDefaultEntry)entry.Value;

                    // and collect all connections
                    foreach (DictionaryEntry connectionEntry in objectStorageWithDefaultEntry.Collection)
                        allConnectionsToAllHosts.Add(connectionEntry.Value);
                }

            }

            foreach (object connection in allConnectionsToAllHosts)
                processConnectionEventHandler(connection, parameter);
        }