Пример #1
0
        /**
         * constructs a new worker with the specified initialdata, it will work on the tasks
         *  and return the feed to the feedback, note it won't create new queues it will use
         *  the passed arguments - and they may need to be thread safe
         */
        public Worker(Initializer initialData, Queue<Url> tasks, Queue<Url> feedback, int workersDim, int workerID)
        {
            _tasks    = tasks;
            _feedback = feedback;

            // sets default timer
            _timer    = 1000;

            // initailizing the fetcher - page downloaders
            _fetchers = new FetcherManager();
            HttpResourceFetcher httpfetcher = new HttpResourceFetcher();
            _fetchers.addProtocol("http", httpfetcher);

            // initailizing the processors - will process the downloaded urls
            _processors = new ResourceProcessorManager();

            HtmlPageCategorizationProcessor htmlProcessor = new HtmlPageCategorizationProcessor(initialData, feedback);
            htmlProcessor.ThreadID = workerID;
            htmlProcessor.ThreadsDim = workersDim;
            _processors.attachProcessor("PageProc", htmlProcessor);
        }
Пример #2
0
        /**
         * constructs a new worker with the specified initialdata, it will work on the tasks
         *  and return the feed to the feedback, note it won't create new queues it will use
         *  the passed arguments - and they may need to be thread safe
         */
        public Worker(Initializer initialData, Queue <Url> tasks, Queue <Url> feedback, int workersDim, int workerID)
        {
            _tasks    = tasks;
            _feedback = feedback;

            // sets default timer
            _timer = 1000;

            // initailizing the fetcher - page downloaders
            _fetchers = new FetcherManager();
            HttpResourceFetcher httpfetcher = new HttpResourceFetcher();

            _fetchers.addProtocol("http", httpfetcher);

            // initailizing the processors - will process the downloaded urls
            _processors = new ResourceProcessorManager();

            HtmlPageCategorizationProcessor htmlProcessor = new HtmlPageCategorizationProcessor(initialData, feedback);

            htmlProcessor.ThreadID   = workerID;
            htmlProcessor.ThreadsDim = workersDim;
            _processors.attachProcessor("PageProc", htmlProcessor);
        }
        public static void Test()
        {
            ResourceProcessorManager manager = new ResourceProcessorManager();

            manager.printLog();
        }
 public static void Test()
 {
     ResourceProcessorManager manager = new ResourceProcessorManager();
     manager.printLog();
 }