Пример #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());
        }
Пример #2
0
 public SmppShare(SmppSettings Settings) {
   this.Settings = Settings;
   availablePool = new SmppInternalConnection[Settings.Recycling.MaxSize];
   for (int i = 0; i < availablePool.Length; i++)
     availablePool[i] = new SmppInternalConnection(Settings);
   tmCheckIdleConn.AutoReset = false;
   tmCheckIdleConn.Enabled = true;
   tmCheckIdleConn.Elapsed += tmCheckIdleConn_Elapsed;
 }
Пример #3
0
 public SmppShare(SmppSettings Settings)
 {
     this.Settings = Settings;
     availablePool = new SmppInternalConnection[Settings.Recycling.MaxSize];
     for (int i = 0; i < availablePool.Length; i++)
     {
         availablePool[i] = new SmppInternalConnection(Settings);
     }
     tmCheckIdleConn.AutoReset = false;
     tmCheckIdleConn.Enabled   = true;
     tmCheckIdleConn.Elapsed  += tmCheckIdleConn_Elapsed;
 }
Пример #4
0
 public SmppInternalConnection(SmppSettings Settings) {
   TcpConnection = new SockClient();
   PendingResponse = new ListDictionary();
   PendingQueue = new ArrayList(15);
   PendingBind = new ArrayList(10);
   ReleasedDateTime = DateTime.Now;
   LastReceptionTime = DateTime.Now;
   ClientGuid = Guid.NewGuid();
   this.Settings = Settings;
   TcpConnection.DataReceived += TcpConnection_DataReceived;
   TcpConnection.CloseConnection += TcpConnection_CloseConnection;
 }
Пример #5
0
 public SmppInternalConnection(SmppSettings Settings)
 {
     TcpConnection                  = new SockClient();
     PendingResponse                = new ListDictionary();
     PendingQueue                   = new ArrayList(15);
     PendingBind                    = new ArrayList(10);
     ReleasedDateTime               = DateTime.Now;
     LastReceptionTime              = DateTime.Now;
     ClientGuid                     = Guid.NewGuid();
     this.Settings                  = Settings;
     TcpConnection.DataReceived    += TcpConnection_DataReceived;
     TcpConnection.CloseConnection += TcpConnection_CloseConnection;
 }
Пример #6
0
 public SmppPool(SmppSettings Settings) {
   _Settings = Settings;
   inUsePool = new ArrayList();
   idlePool = new ArrayList(Settings.Recycling.MinSize);
   lock (idlePool.SyncRoot) {
     lock (inUsePool.SyncRoot) {
       for (int i = 0; i < Settings.Recycling.MinSize; i++) {
         var connection = new SmppInternalConnection(Settings);
         idlePool.Add(connection);
       }
     }
   }
   tmCheckIdleConn.AutoReset = false;
   tmCheckIdleConn.Enabled = true;
   tmCheckIdleConn.Elapsed += tmCheckIdleConn_Elapsed;
 }
Пример #7
0
 internal static SmppInternalConnection GetConnection(SmppSettings Settings) {
   SmppShare share;
   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)) {
       share = new SmppShare(Settings);
       Pools.Add(connectionString, share);
     } else {
       share = Pools[connectionString] as SmppShare;
       share.Settings = Settings;
     }
   }
   return share.GetConnection();
 }
Пример #8
0
 public SmppPool(SmppSettings Settings)
 {
     _Settings = Settings;
     inUsePool = new ArrayList();
     idlePool  = new ArrayList(Settings.Recycling.MinSize);
     lock (idlePool.SyncRoot) {
         lock (inUsePool.SyncRoot) {
             for (int i = 0; i < Settings.Recycling.MinSize; i++)
             {
                 var connection = new SmppInternalConnection(Settings);
                 idlePool.Add(connection);
             }
         }
     }
     tmCheckIdleConn.AutoReset = false;
     tmCheckIdleConn.Enabled   = true;
     tmCheckIdleConn.Elapsed  += tmCheckIdleConn_Elapsed;
 }
Пример #9
0
 internal static SmppInternalConnection[] GetConnections(SmppSettings Settings) {
   var share = Pools[Settings.ConnectionString] as SmppShare;
   return share.GetConnections();
 }
Пример #10
0
 public SmppConnection(SmppSettings ConnectionSettings) {
   _Settings = ConnectionSettings;
 }
Пример #11
0
 public SmppConnection(SmppSettings ConnectionSettings)
 {
     _Settings = ConnectionSettings;
 }
Пример #12
0
        internal static SmppInternalConnection[] GetConnections(SmppSettings Settings)
        {
            var share = Pools[Settings.ConnectionString] as SmppShare;

            return(share.GetConnections());
        }