Esempio n. 1
0
        internal static OracleInternalConnection GetPooledConnection(
            string encryptedConnectionString,
            OracleConnectionString options,
            OracleConnection owningObject,
            out bool isInTransaction)
        {
            // If Init() has not been called, call it and set up the cached members
            if (null == _manager)
            {
                Init();
            }

            DBObjectPool pool   = null;
            string       userId = null;
            string       poolKey;

            if (true == options.IntegratedSecurity)
            {
                // If using integrated security, find the pool based on the connection string
                // postpended with the windows identity userId.  Otherwise, simply use the
                // connection string.  This will guarantee anyone using integrated security will
                // always be sent to the appropriate pool.

                // If this throws, Open will abort.  Is there an issue here?  UNDONE BUGBUG
                // Will this fail on some platforms?
                userId = DBObjectPool.GetCurrentIdentityName();

                Debug.Assert(userId != null && userId != "", "OracleConnectionPoolManager: WindowsIdentity.Name returned empty string!");

                poolKey = userId + encryptedConnectionString;
            }
            else
            {
                poolKey = encryptedConnectionString;
            }

            pool = _manager.FindPool(poolKey);

            if (null == pool)
            {
                // If we didn't locate a pool, we need to create one.

                OracleConnectionPoolControl poolControl;

                poolControl        = new OracleConnectionPoolControl(poolKey, options);
                poolControl.UserId = userId;

                pool = _manager.FindOrCreatePool(poolControl);
            }

            OracleInternalConnection con = (OracleInternalConnection)pool.GetObject(owningObject, out isInTransaction);

            // If GetObject() failed, the pool timeout occurred.
            if (con == null)
            {
                throw ADP.PooledOpenTimeout();
            }

            return(con);
        }
Esempio n. 2
0
            private void ReturnToPool()
            {
                if (_signaled)
                {
                    if (null != _pooledObject && null != _pool)
                    {
                        _pool.PutNewObject(_pooledObject);
                        _pool         = null;
                        _pooledObject = null;
                    }

                    if (0 != _cookie && null != _point)
                    {
                        _point.Unadvise(_cookie);
                        _point  = null;
                        _cookie = 0;
                    }
                }
            }
        public DBObjectPool FindOrCreatePool(DBObjectPoolControl ctrl)
        {
            Debug.Assert(ctrl != null, "Unexpected DefaultPoolControl null!");

            String       poolKey = ctrl.Key;
            DBObjectPool pool    = FindPool(poolKey);

            if (pool == null)
            {
                lock (_map.SyncRoot) {
                    // Did somebody else created it while we were waiting?
                    pool = FindPool(poolKey);

                    if (pool == null)
                    {
                        // Create a new pool, shove it into the map:
                        pool          = new DBObjectPool(ctrl);
                        _map[poolKey] = pool;
                    }
                }
            }

            return(pool);
        }
Esempio n. 4
0
            private bool _signaled;                    // Bool in case signal occurs before Cookie is set.

            public TransactionOutcomeEvents(DBObjectPool pool, DBPooledObject pooledObject, UCOMIConnectionPoint point)
            {
                _pool         = pool;
                _pooledObject = pooledObject;
                _point        = point;
            }
Esempio n. 5
0
 public abstract void DestroyObject(DBObjectPool p, DBPooledObject con);
Esempio n. 6
0
 public abstract DBPooledObject CreateObject(DBObjectPool p);
 public override void DestroyObject(DBObjectPool p, DBPooledObject con)
 {
     con.Close();
 }
 public override DBPooledObject CreateObject(DBObjectPool p)
 {
     return(new OracleInternalConnection(_connectionOptions, p, _fCheckLifetime, _lifetime));
 }
 public DBPooledObject(DBObjectPool pool)
 {
     _pool = pool;
 }