org.apache.flink.core.fs.local.LocalFileSystemFactory Java Examples

The following examples show how to use org.apache.flink.core.fs.local.LocalFileSystemFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileSystem.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: FileSystem.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}