コード例 #1
0
 protected override IObjectPool <WorkerThread> NewObjectPool()
 {
     ObjectPool.AutoScale.IBuilder <WorkerThread> builder = ObjectPools.NewAutoScaleObjectPoolConfigBuilder <WorkerThread>();
     builder.SetCheckInterval(Config.CheckInterval).SetMaxIdleTime(Config.MaxIdleTime)
     .SetScaleFactor(Config.ScaleFactor)
     .SetStaleChecker(t => t.InnerThread.ThreadState == ThreadState.Aborted ||
                      t.InnerThread.ThreadState == ThreadState.Stopped);
     SetObjectPoolConfigBuilder <ObjectPool.AutoScale.IBuilder <WorkerThread> >(builder);
     return(ObjectPools.NewAutoScaleObjectPool(builder.Build()));
 }