private static void startConnectionPool() { MySession temp = new MySession(); AbstractPoolSource defaultSrc = new ConnectionPoolSource() { CxnSource = new mdo.DataSource() { Protocol = "PVISTA" }, Credentials = new VistaCredentials(), LoadStrategy = (LoadingStrategy)Enum.Parse(typeof(LoadingStrategy), temp.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][conf.MdwsConfigConstants.CONNECTION_POOL_LOAD_STRATEGY]), MaxPoolSize = Convert.ToInt32(temp.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][conf.MdwsConfigConstants.CONNECTION_POOL_MAX_CXNS]), MinPoolSize = Convert.ToInt32(temp.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][conf.MdwsConfigConstants.CONNECTION_POOL_MIN_CXNS]), PoolExpansionSize = Convert.ToInt32(temp.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][conf.MdwsConfigConstants.CONNECTION_POOL_EXPAND_SIZE]), WaitTime = TimeSpan.Parse(temp.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][conf.MdwsConfigConstants.CONNECTION_POOL_WAIT_TIME]), Timeout = TimeSpan.Parse(temp.MdwsConfiguration.AllConfigs[conf.MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][conf.MdwsConfigConstants.CONNECTION_POOL_CXN_TIMEOUT]) }; IList <AbstractPoolSource> sources = new List <AbstractPoolSource>(); //AbstractPoolSource poolsSource = new ConnectionPoolsSource(); //((ConnectionPoolsSource)poolsSource).CxnSources = new Dictionary<string, ConnectionPoolSource>(); AbstractPoolSourceFactory factory = new ConnectionPoolSourceFactory(defaultSrc); // instantiate the pool source factory AbstractPoolSource result = (ConnectionPoolsSource)factory.getPoolSources(temp.SiteTable); AbstractResourcePool pools = AbstractResourcePoolFactory.getResourcePool(result); // this starts the pool }
public ConnectionPools getPools(AbstractPoolSource source) { if (source == null) { throw new ArgumentException("Need to supply pool source before connection pool can be built"); } ConnectionPools pool = ConnectionPools.getInstance(); pool.PoolSource = (ConnectionPoolsSource)source; Thread poolThread = new Thread(new ThreadStart(pool.run)); poolThread.Name = "PoolOfPools"; poolThread.IsBackground = true; // this allows the main process to terminate without the connection pool being forced to clean up - ok? poolThread.Start(); return pool; }
public ConnectionPool getPool(AbstractPoolSource source) { if (source == null) { throw new ArgumentException("Need to supply pool source before connection pool can be built"); } ConnectionPool pool = new ConnectionPool(); pool.PoolSource = (ConnectionPoolSource)source; Thread poolThread = new Thread(new ThreadStart(pool.run)); poolThread.Name = "MdwsConnectionPool" + ((ConnectionPoolSource)source).CxnSource.SiteId.Id; poolThread.IsBackground = true; // this allows the main process to terminate without the connection pool being forced to clean up - ok? poolThread.Start(); return pool; }
void startPool(String site, AbstractPoolSource source) { // System.Console.WriteLine("Instantiating connection pool"); LogUtils.getInstance().Log("Instantiating connection pool for site " + site); if (_pools[site] == null) { lock (_instantiationLocker) // need to lock here so multiple threads don't try creating the same pool { if (_pools[site] == null) // and then check again after lock is entered { _pools[site] = (ConnectionPool)ConnectionPoolFactory.getResourcePool(source); } } } }
public ConnectionPools getPools(AbstractPoolSource source) { if (source == null) { throw new ArgumentException("Need to supply pool source before connection pool can be built"); } ConnectionPools pool = ConnectionPools.getInstance(); pool.PoolSource = (ConnectionPoolsSource)source; Thread poolThread = new Thread(new ThreadStart(pool.run)); poolThread.Name = "PoolOfPools"; poolThread.IsBackground = true; // this allows the main process to terminate without the connection pool being forced to clean up - ok? poolThread.Start(); return(pool); }
public ConnectionPool getPool(AbstractPoolSource source) { if (source == null) { throw new ArgumentException("Need to supply pool source before connection pool can be built"); } ConnectionPool pool = new ConnectionPool(); pool.PoolSource = (ConnectionPoolSource)source; Thread poolThread = new Thread(new ThreadStart(pool.run)); poolThread.Name = "MdwsConnectionPool" + ((ConnectionPoolSource)source).CxnSource.SiteId.Id; poolThread.IsBackground = true; // this allows the main process to terminate without the connection pool being forced to clean up - ok? poolThread.Start(); return(pool); }
/// <summary> /// Instantiate the factory with a specified default pool source /// </summary> /// <param name="defaultSource">The default source to use for calls to getPoolSource(s)</param> public ConnectionPoolSourceFactory(AbstractPoolSource defaultSource) : base(defaultSource) { }
/// <summary> /// Instantiate the factory with a specified default pool source /// </summary> /// <param name="defaultSource">The default source to use for calls to getPoolSource(s)</param> public ConnectionPoolSourceFactory(AbstractPoolSource defaultSource) : base(defaultSource) { }