Пример #1
0
        public void Start()
        {
            STPStartInfo START_INFO = new STPStartInfo
            {
                WorkItemPriority = Amib.Threading.WorkItemPriority.Normal,
                MinWorkerThreads = 0,
                MaxWorkerThreads = Config.Settings.Instance.CFWorkerThreads,
                IdleTimeout      = THREADPOOL_IDLE_TIMEOUT,
            };

            _threadPool      = new SmartThreadPool(START_INFO);
            _threadPool.Name = "Cloudfiles";

            Func <CloudFilesAssetWorker> ctorFunc = () => { return(new CloudFilesAssetWorker(_readTimeout, _writeTimeout)); };

            _asyncAssetWorkers = new ObjectPool <CloudFilesAssetWorker>(Config.Settings.Instance.CFWorkerThreads * 2, ctorFunc);

            _assetCache = new Cache.Cache(MAX_IDLE_CACHE_ENTRY_AGE);

            if (!Config.Settings.Instance.DisableWritebackCache)
            {
                _diskWriteBack = new Cache.DiskWriteBackCache();
                _diskWriteBack.Start();
            }

            //start maintaining the cache
            _maintTimer = new Timer(this.Maintain, null, MAINTENANCE_INTERVAL, MAINTENANCE_INTERVAL);
        }
Пример #2
0
        public void Start()
        {
            STPStartInfo START_INFO = new STPStartInfo
            {
                WorkItemPriority = Amib.Threading.WorkItemPriority.Normal,
                MinWorkerThreads = 0,
                MaxWorkerThreads = Config.Settings.Instance.CFWorkerThreads,
                IdleTimeout = THREADPOOL_IDLE_TIMEOUT,
            };

            _threadPool = new SmartThreadPool(START_INFO);
            _threadPool.Name = "Cloudfiles";

            Func<CloudFilesAssetWorker> ctorFunc = () => { return new CloudFilesAssetWorker(_readTimeout, _writeTimeout); };
            _asyncAssetWorkers = new ObjectPool<CloudFilesAssetWorker>(Config.Settings.Instance.CFWorkerThreads * 2, ctorFunc);

            _assetCache = new Cache.Cache(MAX_IDLE_CACHE_ENTRY_AGE);

            if (!Config.Settings.Instance.DisableWritebackCache)
            {
                _diskWriteBack = new Cache.DiskWriteBackCache();
                _diskWriteBack.Start();
            }

            //start maintaining the cache
            _maintTimer = new Timer(this.Maintain, null, MAINTENANCE_INTERVAL, MAINTENANCE_INTERVAL);
        }