예제 #1
0
        public Instance()
        {
            workerManager     = new WorkerManager();
            intervalProxyPool = new IntervalProxyPool();
            sqlServerTaskPool = new SQLServerTaskPool();
//			sqlServerTaskPool.ConnectionString = dbConnectionString;
            sqlServerTaskPool.InitTable();
            sqlServerTaskPool.DaemonRestTime = 2000;
            sqlServerTaskPool.MaxDaemonEnqueueThreadCount = 2;


            amazonPictureTaskGuide = new AmazonPictureTaskGuide(storePath);
            amazonPictureTaskGuide.GlobalTimeout = 60000;
            amazonPictureTaskGuide.MaxWorkers    = 1;

            proxyManager = new ProxyManager();
            proxyManager.DaemonRestTime = 1000;
            proxyManager.LoadProxyProviders(ProxyProviderParser.ReadConfig("config/proxyprovider.xml"));
            proxyManager.ProxyValidator = new ProxyValidator();
            proxyManager.ProxyValidator.LoadProxyValidations(ProxyValidateConditionParser.ReadConfig("config/proxyvalidate.xml"));
            proxyManager.MaxValidateThreadCount = 20;

            workerManager.ProxyPool = intervalProxyPool;
            workerManager.TaskPool  = sqlServerTaskPool;
            workerManager.TaskGuide = amazonPictureTaskGuide;

            intervalProxyPool.ProxyManager   = proxyManager;
            intervalProxyPool.DaemonRestTime = 1000;
            intervalProxyPool.ProxyRestTime  = new TimeSpan(0, 0, 20);
        }
예제 #2
0
        public Instance()
        {
            workerManager = new WorkerManager();

            sqlServerTaskPool = new SQLServerTaskPool();
//			sqlServerTaskPool.ConnectionString = dbConnectionString;
            sqlServerTaskPool.InitTable();
            sqlServerTaskPool.DaemonRestTime = 2000;
            sqlServerTaskPool.MaxDaemonEnqueueThreadCount = 2;


            taobaoTaskGuide = new TaobaoTaskGuide();
            taobaoTaskGuide.GlobalTimeout = 60000;
            taobaoTaskGuide.MaxWorkers    = 1;

            proxyManager = new ProxyManager();
            proxyManager.DaemonRestTime = 1000;
            proxyManager.LoadProxyProviders(ProxyProviderParser.ReadConfig("config/proxyprovider.xml"));
            proxyManager.ProxyValidator = new ProxyValidator();
            proxyManager.ProxyValidator.LoadProxyValidations(ProxyValidateConditionParser.ReadConfig("config/proxyvalidate.xml"));
            proxyManager.MaxValidateThreadCount = 20;



            proxyPool = new TaobaoSelectiveIntervalProxyPool();
            proxyPool.LocalRestTime       = new TimeSpan(0, 0, 5);
            proxyPool.MaxLocalConnections = 1;
            proxyPool.ProxyManager        = proxyManager;
            proxyPool.DaemonRestTime      = new TimeSpan(0, 0, 1);
            proxyPool.ProxyRestTime       = new TimeSpan(0, 0, 5);

            workerManager.ProxyPool = proxyPool;
            workerManager.TaskPool  = sqlServerTaskPool;
            workerManager.TaskGuide = taobaoTaskGuide;

//			directProxyPool.ProxyManager = proxyManager;
//			directProxyPool.DaemonRestTime = 1000;
//			directProxyPool.ProxyRestTime = new TimeSpan(0, 0, 20);
        }