private static void checkLimit(int value, ConfigOption<Integer> option) { if (value < -1) { throw new IllegalConfigurationException("Invalid value for '" + option.key() + "': " + value); } }
/** * The total number of input plus output connections that a file system for the given scheme may open. * Unlimited be default. */ public static ConfigOption<Integer> fileSystemConnectionLimit(String scheme) { return ConfigOptions.key("fs." + scheme + ".limit.total").defaultValue(-1); }
@Override public void setBoolean(ConfigOption<Boolean> key, boolean value) { this.backingConfig.setBoolean(prefix + key.key(), value); }
@Override public void setInteger(ConfigOption<Integer> key, int value) { this.backingConfig.setInteger(prefix + key.key(), value); }
@Override public String getString(ConfigOption<String> configOption) { return this.backingConfig.getString(prefixOption(configOption, prefix)); }
public static ClusterSpecification fromConfiguration(Configuration configuration) { int slots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1); int jobManagerMemoryMb = ConfigurationUtils.getJobManagerHeapMemory(configuration).getMebiBytes(); int taskManagerMemoryMb = ConfigurationUtils.getTaskManagerHeapMemory(configuration).getMebiBytes(); return new ClusterSpecificationBuilder() .setMasterMemoryMB(jobManagerMemoryMb) .setTaskManagerMemoryMB(taskManagerMemoryMb) .setNumberTaskManagers(1) .setSlotsPerTaskManager(slots) .createClusterSpecification(); }
private Object getValueOrDefaultFromOption(ConfigOption<?> configOption) { Object o = getRawValueFromOption(configOption); return o != null ? o : configOption.defaultValue(); }
@Override public boolean getBoolean(ConfigOption<Boolean> configOption) { return this.backingConfig.getBoolean(prefixOption(configOption, prefix)); }
@Override public long getLong(ConfigOption<Long> configOption) { return this.backingConfig.getLong(prefixOption(configOption, prefix)); }
@Override public float getFloat(ConfigOption<Float> configOption) { return this.backingConfig.getFloat(prefixOption(configOption, prefix)); }
@Override public Configuration clone() { return new DelegatingConfiguration(backingConfig.clone(), prefix); }
@Override public String getValue(ConfigOption<?> configOption) { return this.backingConfig.getValue(prefixOption(configOption, prefix)); }
@Override public double getDouble(ConfigOption<Double> configOption) { return this.backingConfig.getDouble(prefixOption(configOption, prefix)); }
@Override public String getString(ConfigOption<String> configOption, String overrideDefault) { return this.backingConfig.getString(prefixOption(configOption, prefix), overrideDefault); }
private static void checkTimeout(long timeout, ConfigOption<Long> option) { if (timeout < 0) { throw new IllegalConfigurationException("Invalid value for '" + option.key() + "': " + timeout); } } }
/** * The total number of output connections that a file system for the given scheme may open. * Unlimited be default. */ public static ConfigOption<Integer> fileSystemConnectionLimitOut(String scheme) { return ConfigOptions.key("fs." + scheme + ".limit.output").defaultValue(-1); }
/** * The total number of input connections that a file system for the given scheme may open. * Unlimited be default. */ public static ConfigOption<Integer> fileSystemConnectionLimitIn(String scheme) { return ConfigOptions.key("fs." + scheme + ".limit.input").defaultValue(-1); }
/** * If any connection limit is configured, this option can be optionally set to define after * which time (in milliseconds) stream opening fails with a timeout exception, if no stream * connection becomes available. Unlimited timeout be default. */ public static ConfigOption<Long> fileSystemConnectionLimitTimeout(String scheme) { return ConfigOptions.key("fs." + scheme + ".limit.timeout").defaultValue(0L); }
/** * If any connection limit is configured, this option can be optionally set to define after * which time (in milliseconds) inactive streams are reclaimed. This option can help to prevent * that inactive streams make up the full pool of limited connections, and no further connections * can be established. Unlimited timeout be default. */ public static ConfigOption<Long> fileSystemConnectionLimitStreamInactivityTimeout(String scheme) { return ConfigOptions.key("fs." + scheme + ".limit.stream-timeout").defaultValue(0L); } }