Пример #1
0
        public GenericObjectPool(IPooledObjectFactory <T> factory,
                                 GenericObjectPoolConfig config) : base(config)
        {
            if (factory == null)
            {
                throw new Exception("factory may not be null");
            }
            this.factory = factory;

            idleObjects = new LinkedBlockingDeque <IPooledObject <T> >();

            SetConfig(config);

            // TODO startEvictor(getTimeBetweenEvictionRunsMillis());
        }
Пример #2
0
 private void SetConfig(GenericObjectPoolConfig conf)
 {
     // SetLifo(conf.getLifo());
     SetMaxIdle(conf.GetMaxIdle());
     SetMinIdle(conf.GetMinIdle());
     SetMaxTotal(conf.GetMaxTotal());
     SetMaxWaitMillis(conf.getMaxWaitMillis());
     SetBlockWhenExhausted(conf.getBlockWhenExhausted());
     SetTestOnCreate(conf.getTestOnCreate());
     SetTestOnBorrow(conf.getTestOnBorrow());
     SetTestOnReturn(conf.getTestOnReturn());
     SetTestWhileIdle(conf.getTestWhileIdle());
     SetNumTestsPerEvictionRun(conf.getNumTestsPerEvictionRun());
     SetMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis());
     SetTimeBetweenEvictionRunsMillis(
         conf.getTimeBetweenEvictionRunsMillis());
     SetSoftMinEvictableIdleTimeMillis(
         conf.getSoftMinEvictableIdleTimeMillis());
     SetEvictionPolicyClassName(conf.getEvictionPolicyClassName());
 }