class TaskExecutorResourceUtils {

	private static MemorySize getTotalFlinkMemorySize(final Configuration config) {
		checkArgument(isTotalFlinkMemorySizeExplicitlyConfigured(config));
		if (config.contains(TaskManagerOptions.TOTAL_FLINK_MEMORY)) {
			return MemorySize.parse(config.getString(TaskManagerOptions.TOTAL_FLINK_MEMORY));
		} else {
			@SuppressWarnings("deprecation")
			final long legacyHeapMemoryMB = config.getInteger(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB);
			return new MemorySize(legacyHeapMemoryMB << 20); // megabytes to bytes
		}
	}

	private  TaskExecutorResourceUtils();

}