Example usage for java.util.concurrent BlockingDeque size

List of usage examples for java.util.concurrent BlockingDeque size

Introduction

In this page you can find the example usage for java.util.concurrent BlockingDeque size.

Prototype

int size();

Source Link

Document

Returns the number of elements in this deque.

Usage

From source file:org.fim.internal.StateGenerator.java

private void scanFileTree(BlockingDeque<Path> filesToHashQueue, Path directory, FimIgnore parentFimIgnore)
        throws NoSuchAlgorithmException {
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory)) {
        FimIgnore fimIgnore = fimIgnoreManager.loadLocalIgnore(directory, parentFimIgnore);

        for (Path file : stream) {
            if (!fileHashersStarted && filesToHashQueue.size() > FILES_QUEUE_CAPACITY / 2) {
                startFileHashers();// w w w . j av  a  2s.  c om
            }

            BasicFileAttributes attributes = Files.readAttributes(file, BasicFileAttributes.class,
                    LinkOption.NOFOLLOW_LINKS);
            String fileName = file.getFileName().toString();
            if (fimIgnoreManager.isIgnored(fileName, attributes, fimIgnore)) {
                fimIgnoreManager.ignoreThisFiles(file, attributes);
            } else {
                if (attributes.isRegularFile()) {
                    enqueueFile(filesToHashQueue, file);
                } else if (attributes.isDirectory()) {
                    scanFileTree(filesToHashQueue, file, fimIgnore);
                }
            }
        }
    } catch (IOException ex) {
        Console.newLine();
        Logger.error("Skipping - Error scanning directory '" + directory + "'", ex,
                context.isDisplayStackTrace());
    }
}