Search in sources :

Example 1 with LocalFileSystemFactory

use of org.apache.flink.core.fs.local.LocalFileSystemFactory in project flink by apache.

the class FileSystem method loadFileSystemFactories.

// ------------------------------------------------------------------------
/**
 * Loads the factories for the file systems directly supported by Flink. Aside from the {@link
 * LocalFileSystem}, these file systems are loaded via Java's service framework.
 *
 * @return A map from the file system scheme to corresponding file system factory.
 */
private static List<FileSystemFactory> loadFileSystemFactories(Collection<Supplier<Iterator<FileSystemFactory>>> factoryIteratorsSuppliers) {
    final ArrayList<FileSystemFactory> list = new ArrayList<>();
    // by default, we always have the local file system factory
    list.add(new LocalFileSystemFactory());
    LOG.debug("Loading extension file systems via services");
    for (Supplier<Iterator<FileSystemFactory>> factoryIteratorsSupplier : factoryIteratorsSuppliers) {
        try {
            addAllFactoriesToList(factoryIteratorsSupplier.get(), list);
        } catch (Throwable t) {
            // catching Throwable here to handle various forms of class loading
            // and initialization errors
            ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
            LOG.error("Failed to load additional file systems via services", t);
        }
    }
    return Collections.unmodifiableList(list);
}
Also used : LocalFileSystemFactory(org.apache.flink.core.fs.local.LocalFileSystemFactory) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) LocalFileSystemFactory(org.apache.flink.core.fs.local.LocalFileSystemFactory)

Aggregations

ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 LocalFileSystemFactory (org.apache.flink.core.fs.local.LocalFileSystemFactory)1