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()); }
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); }
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(); }