Example #1
0
        internal static SmppInternalConnection GetConnection(SmppSettings Settings)
        {
            SmppPool pool;

            if (Deactivated)
            {
                throw new SmppException("The SmppPoolManager is in process of deactivation");
            }
            if (Pools == null)
            {
                Initialize();
            }
            string connectionString = Settings.ConnectionString;

            lock (Pools.SyncRoot) {
                if (!Pools.Contains(connectionString))
                {
                    pool = new SmppPool(Settings);
                    Pools.Add(connectionString, pool);
                }
                else
                {
                    pool          = Pools[connectionString] as SmppPool;
                    pool.Settings = Settings;
                }
            }
            return(pool.GetConnection());
        }
Example #2
0
        internal static void ReleaseConnection(SmppInternalConnection connection)
        {
            SmppPool pool = null;

            lock (Pools.SyncRoot) {
                string connectionString = connection.Settings.ConnectionString;
                pool = (SmppPool)Pools[connectionString];
                if (pool == null)
                {
                    throw new SmppException("Pooling exception: Unable to find original pool for connection");
                }
            }
            pool.ReleaseConnection(connection);
        }
Example #3
0
 internal static SmppInternalConnection GetConnection(SmppSettings Settings) {
   SmppPool pool;
   if (Deactivated)
     throw new SmppException("The SmppPoolManager is in process of deactivation");
   if (Pools == null)
     Initialize();
   string connectionString = Settings.ConnectionString;
   lock (Pools.SyncRoot) {
     if (!Pools.Contains(connectionString)) {
       pool = new SmppPool(Settings);
       Pools.Add(connectionString, pool);
     } else {
       pool = Pools[connectionString] as SmppPool;
       pool.Settings = Settings;
     }
   }
   return pool.GetConnection();
 }