Package com.luxoft.dnepr.courses.regular.unit7

Examples of com.luxoft.dnepr.courses.regular.unit7.FileCrawlerResults


            }
        }
    }

    private void saveWords(String line) {
        String[] words = new WordsSplitter().split(line);
        for (String word : words) {
            wordStorage.save(word);
        }
    }
View Full Code Here


            if (files != null) {
                for (File file : files) {
                    queue.put(file);
                }
            }
            File[] directories = root.listFiles(new DirectoryFileFilter());
            if (directories != null) {
                for (File directory : directories) {
                    DirectoryScanner scanner = new DirectoryScanner(directory, executorService, queue);
                    threadCount.incrementAndGet();
                    Future<?> future = executorService.submit(scanner);
View Full Code Here

    @Override
    public void run() {
        List<Future<?>> futures = new ArrayList<>();
        try {
            File[] files = root.listFiles(new TxtFileFilter());
            if (files != null) {
                for (File file : files) {
                    queue.put(file);
                }
            }
View Full Code Here

        files = Collections.synchronizedList(files);

        File root = new File(rootFolder);
        int producerThreadAmount = maxNumberOfThreads/2;
        ExecutorService executorService = Executors.newFixedThreadPool(producerThreadAmount);
        executorService.execute(new DirectoryScanner(root, executorService, queue));

        int consumerThreadAmount = maxNumberOfThreads/2 + maxNumberOfThreads%2;
        ExecutorService fileParserService = Executors.newFixedThreadPool(consumerThreadAmount);
        List<Future<?>> futures = new ArrayList<>();
        for (int i = 0; i < consumerThreadAmount; i++) {
View Full Code Here

        int consumerThreadAmount = maxNumberOfThreads/2 + maxNumberOfThreads%2;
        ExecutorService fileParserService = Executors.newFixedThreadPool(consumerThreadAmount);
        List<Future<?>> futures = new ArrayList<>();
        for (int i = 0; i < consumerThreadAmount; i++) {
            Future<?> future = fileParserService.submit(new FileScanner(queue, wordStorage, files));
            futures.add(future);
        }
        for (Future<?> future : futures) {
            try {
                future.get();
View Full Code Here

TOP

Related Classes of com.luxoft.dnepr.courses.regular.unit7.FileCrawlerResults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.