Esempio n. 1
0
        public DbDriver GetDbDriver(Object caller)
        {
            DbDriver resultDbDriver;

            lock (_DbDriverListLock)
            {
                if (_listOfDbDrivers.Count == 0)
                {
                    resultDbDriver = new DbDriver();
                }
                else
                {
                    if (_listOfDbDrivers.Count < _maxDbDriverInList)
                    {
                        resultDbDriver = new DbDriver();
                        _listOfDbDrivers.Add(resultDbDriver);
                    }
                    else
                    {
                        resultDbDriver = _listOfDbDrivers[0];
                        for (int i = 1; i < _listOfDbDrivers.Count; ++i)
                        {
                            if (_listOfDbDrivers[i].LinkedObjectCount < resultDbDriver.LinkedObjectCount)
                            {
                                resultDbDriver = _listOfDbDrivers[i];
                            }
                        }
                    }
                }
                resultDbDriver.link(caller);
                return(resultDbDriver);
            }
        }
Esempio n. 2
0
        public DbDriver GetDbDriver(Object caller)
        {
            DbDriver resultDbDriver;

            lock(_DbDriverListLock)
            {
                if (_listOfDbDrivers.Count == 0)
                {
                    resultDbDriver = new DbDriver();
                }
                else
                {
                    if (_listOfDbDrivers.Count < _maxDbDriverInList)
                    {
                        resultDbDriver = new DbDriver();
                        _listOfDbDrivers.Add(resultDbDriver);
                    }
                    else
                    {
                        resultDbDriver = _listOfDbDrivers[0];
                        for (int i = 1; i < _listOfDbDrivers.Count; ++i)
                        {
                            if (_listOfDbDrivers[i].LinkedObjectCount < resultDbDriver.LinkedObjectCount)
                                resultDbDriver = _listOfDbDrivers[i];
                        }
                    }
                }
                resultDbDriver.link(caller);
                return resultDbDriver;
            }
        }