org.apache.flink.core.fs.LimitedConnectionsFileSystem.ConnectionLimitingSettings Java Examples

The following examples show how to use org.apache.flink.core.fs.LimitedConnectionsFileSystem.ConnectionLimitingSettings. 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: HadoopFsFactory.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static FileSystem limitIfConfigured(HadoopFileSystem fs, String scheme, Configuration config) {
	final ConnectionLimitingSettings limitSettings = ConnectionLimitingSettings.fromConfig(config, scheme);

	// decorate only if any limit is configured
	if (limitSettings == null) {
		// no limit configured
		return fs;
	}
	else {
		return new LimitedConnectionsFileSystem(
				fs,
				limitSettings.limitTotal,
				limitSettings.limitOutput,
				limitSettings.limitInput,
				limitSettings.streamOpenTimeout,
				limitSettings.streamInactivityTimeout);
	}
}
 
Example #2
Source File: HadoopFsFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
private static FileSystem limitIfConfigured(HadoopFileSystem fs, String scheme, Configuration config) {
	final ConnectionLimitingSettings limitSettings = ConnectionLimitingSettings.fromConfig(config, scheme);

	// decorate only if any limit is configured
	if (limitSettings == null) {
		// no limit configured
		return fs;
	}
	else {
		return new LimitedConnectionsFileSystem(
				fs,
				limitSettings.limitTotal,
				limitSettings.limitOutput,
				limitSettings.limitInput,
				limitSettings.streamOpenTimeout,
				limitSettings.streamInactivityTimeout);
	}
}
 
Example #3
Source File: HadoopFsFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
private static FileSystem limitIfConfigured(HadoopFileSystem fs, String scheme, Configuration config) {
	final ConnectionLimitingSettings limitSettings = ConnectionLimitingSettings.fromConfig(config, scheme);

	// decorate only if any limit is configured
	if (limitSettings == null) {
		// no limit configured
		return fs;
	}
	else {
		return new LimitedConnectionsFileSystem(
				fs,
				limitSettings.limitTotal,
				limitSettings.limitOutput,
				limitSettings.limitInput,
				limitSettings.streamOpenTimeout,
				limitSettings.streamInactivityTimeout);
	}
}
 
Example #4
Source File: ConnectionLimitingFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private ConnectionLimitingFactory(
		FileSystemFactory factory,
		ConnectionLimitingSettings settings) {

	this.factory = checkNotNull(factory);
	this.settings = checkNotNull(settings);
}
 
Example #5
Source File: ConnectionLimitingFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Decorates the given factory for a {@code ConnectionLimitingFactory}, if the given
 * configuration configured connection limiting for the given file system scheme.
 * Otherwise, it returns the given factory as is.
 *
 * @param factory The factory to potentially decorate.
 * @param scheme The file scheme for which to check the configuration.
 * @param config The configuration
 *
 * @return The decorated factors, if connection limiting is configured, the original factory otherwise.
 */
public static FileSystemFactory decorateIfLimited(FileSystemFactory factory, String scheme, Configuration config) {
	checkNotNull(factory, "factory");

	final ConnectionLimitingSettings settings = ConnectionLimitingSettings.fromConfig(config, scheme);

	// decorate only if any limit is configured
	if (settings == null) {
		// no limit configured
		return factory;
	}
	else {
		return new ConnectionLimitingFactory(factory, settings);
	}
}
 
Example #6
Source File: ConnectionLimitingFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
private ConnectionLimitingFactory(
		FileSystemFactory factory,
		ConnectionLimitingSettings settings) {

	this.factory = checkNotNull(factory);
	this.settings = checkNotNull(settings);
}
 
Example #7
Source File: ConnectionLimitingFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Decorates the given factory for a {@code ConnectionLimitingFactory}, if the given
 * configuration configured connection limiting for the given file system scheme.
 * Otherwise, it returns the given factory as is.
 *
 * @param factory The factory to potentially decorate.
 * @param scheme The file scheme for which to check the configuration.
 * @param config The configuration
 *
 * @return The decorated factors, if connection limiting is configured, the original factory otherwise.
 */
public static FileSystemFactory decorateIfLimited(FileSystemFactory factory, String scheme, Configuration config) {
	checkNotNull(factory, "factory");

	final ConnectionLimitingSettings settings = ConnectionLimitingSettings.fromConfig(config, scheme);

	// decorate only if any limit is configured
	if (settings == null) {
		// no limit configured
		return factory;
	}
	else {
		return new ConnectionLimitingFactory(factory, settings);
	}
}
 
Example #8
Source File: ConnectionLimitingFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
private ConnectionLimitingFactory(
		FileSystemFactory factory,
		ConnectionLimitingSettings settings) {

	this.factory = checkNotNull(factory);
	this.settings = checkNotNull(settings);
}
 
Example #9
Source File: ConnectionLimitingFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Decorates the given factory for a {@code ConnectionLimitingFactory}, if the given
 * configuration configured connection limiting for the given file system scheme.
 * Otherwise, it returns the given factory as is.
 *
 * @param factory The factory to potentially decorate.
 * @param scheme The file scheme for which to check the configuration.
 * @param config The configuration
 *
 * @return The decorated factors, if connection limiting is configured, the original factory otherwise.
 */
public static FileSystemFactory decorateIfLimited(FileSystemFactory factory, String scheme, Configuration config) {
	checkNotNull(factory, "factory");

	final ConnectionLimitingSettings settings = ConnectionLimitingSettings.fromConfig(config, scheme);

	// decorate only if any limit is configured
	if (settings == null) {
		// no limit configured
		return factory;
	}
	else {
		return new ConnectionLimitingFactory(factory, settings);
	}
}