Example usage for com.google.common.jimfs Jimfs newFileSystem

List of usage examples for com.google.common.jimfs Jimfs newFileSystem

Introduction

In this page you can find the example usage for com.google.common.jimfs Jimfs newFileSystem.

Prototype

@VisibleForTesting
    static FileSystem newFileSystem(URI uri, Configuration config) 

Source Link

Usage

From source file:org.fao.geonet.FileSystemPool.java

public synchronized CreatedFs get(String fsId) throws IOException {
    while (openFs > MAX_FS && pool.isEmpty()) {
        try {/*  www.ja va2 s  .  com*/
            this.wait(1000);
        } catch (InterruptedException e) {
            Jimfs.newFileSystem(fsId, Configuration.unix());
        }
    }

    final CreatedFs fileSystem;
    if (pool.isEmpty()) {
        openFs++;
        fileSystem = new CreatedFs(Jimfs.newFileSystem(fsId, Configuration.unix()), "nodes",
                "default_data_dir");
    } else {
        fileSystem = pool.pop();
        org.junit.Assert.assertNotNull(fileSystem);
    }

    syncWithTemplate(fileSystem);
    IO.setFileSystemThreadLocal(fileSystem.fs);

    return fileSystem;
}