Example usage for org.apache.lucene.util IOUtils spins

List of usage examples for org.apache.lucene.util IOUtils spins

Introduction

In this page you can find the example usage for org.apache.lucene.util IOUtils spins.

Prototype

public static boolean spins(Path path) throws IOException 

Source Link

Document

Rough Linux-only heuristics to determine whether the provided Path is backed by spinning storage.

Usage

From source file:org.elasticsearch.env.ESFileStore.java

License:Apache License

@SuppressForbidden(reason = "tries to determine if disk is spinning")
// TODO: move PathUtils to be package-private here instead of 
// public+forbidden api!
ESFileStore(FileStore in) {/*from   w  w  w. j av a 2 s  .com*/
    this.in = in;
    Boolean spins;
    // Lucene's IOUtils.spins only works on Linux today:
    if (Constants.LINUX) {
        try {
            spins = IOUtils.spins(PathUtils.get(getMountPointLinux(in)));
        } catch (Exception e) {
            spins = null;
        }
    } else {
        spins = null;
    }
    this.spins = spins;
}