org.apache.flink.configuration.Configuration.containsKey()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.apache.flink.configuration.Configuration.containsKey()方法的一些代码示例,展示了Configuration.containsKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.containsKey()方法的具体详情如下:
包路径:org.apache.flink.configuration.Configuration
类名称:Configuration
方法名:containsKey

Configuration.containsKey介绍

[英]Checks whether there is an entry with the specified key.
[中]

代码示例

代码示例来源:origin: apache/flink

@Override
public boolean containsKey(String key) {
  return backingConfig.containsKey(prefix + key);
}

代码示例来源:origin: apache/flink

/**
 * Get job manager's heap memory. This method will check the new key
 * {@link JobManagerOptions#JOB_MANAGER_HEAP_MEMORY} and
 * the old key {@link JobManagerOptions#JOB_MANAGER_HEAP_MEMORY_MB} for backwards compatibility.
 *
 * @param configuration the configuration object
 * @return the memory size of job manager's heap memory.
 */
public static MemorySize getJobManagerHeapMemory(Configuration configuration) {
  if (configuration.containsKey(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY.key())) {
    return MemorySize.parse(configuration.getString(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY));
  } else if (configuration.containsKey(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB.key())) {
    return MemorySize.parse(configuration.getInteger(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB) + "m");
  } else {
    //use default value
    return MemorySize.parse(configuration.getString(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY));
  }
}

代码示例来源:origin: apache/flink

/**
 * Get task manager's heap memory. This method will check the new key
 * {@link TaskManagerOptions#TASK_MANAGER_HEAP_MEMORY} and
 * the old key {@link TaskManagerOptions#TASK_MANAGER_HEAP_MEMORY_MB} for backwards compatibility.
 *
 * @param configuration the configuration object
 * @return the memory size of task manager's heap memory.
 */
public static MemorySize getTaskManagerHeapMemory(Configuration configuration) {
  if (configuration.containsKey(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY.key())) {
    return MemorySize.parse(configuration.getString(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY));
  } else if (configuration.containsKey(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB.key())) {
    return MemorySize.parse(configuration.getInteger(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB) + "m");
  } else {
    //use default value
    return MemorySize.parse(configuration.getString(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY));
  }
}

代码示例来源:origin: org.apache.flink/flink-core

@Override
public boolean containsKey(String key) {
  return backingConfig.containsKey(prefix + key);
}

代码示例来源:origin: com.alibaba.blink/flink-core

@Override
public boolean containsKey(String key) {
  return backingConfig.containsKey(prefix + key);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

public boolean hasStubWrapper() {
  return this.config.containsKey(STUB_OBJECT);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

public boolean hasStubWrapper() {
  return this.config.containsKey(STUB_OBJECT);
}

代码示例来源:origin: org.apache.flink/flink-runtime

public boolean hasStubWrapper() {
  return this.config.containsKey(STUB_OBJECT);
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

public boolean hasStubWrapper() {
  return this.config.containsKey(STUB_OBJECT);
}

代码示例来源:origin: org.apache.flink/flink-runtime-web_2.10

private File getUploadDir(Configuration configuration) {
    File baseDir = new File(configuration.getString(ConfigConstants.JOB_MANAGER_WEB_UPLOAD_DIR_KEY,
      getBaseDirStr(configuration)));

    boolean uploadDirSpecified = configuration.containsKey(ConfigConstants.JOB_MANAGER_WEB_UPLOAD_DIR_KEY);
    return uploadDirSpecified ? baseDir : new File(baseDir, "flink-web-" + UUID.randomUUID());
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

/**
* Sets the value of a new config key to the value of a deprecated config key.
* @param config Config to write
* @param deprecated The old config key
* @param designated The new config key
*/
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) {
  // set the designated key only if it is not set already
  if (!config.containsKey(designated)) {
    final String valueForDeprecated = config.getString(deprecated, null);
    if (valueForDeprecated != null) {
      config.setString(designated, valueForDeprecated);
    }
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

/**
* Sets the value of a new config key to the value of a deprecated config key.
* @param config Config to write
* @param deprecated The old config key
* @param designated The new config key
*/
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) {
  // set the designated key only if it is not set already
  if (!config.containsKey(designated)) {
    final String valueForDeprecated = config.getString(deprecated, null);
    if (valueForDeprecated != null) {
      config.setString(designated, valueForDeprecated);
    }
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

/**
* Sets the value of a new config key to the value of a deprecated config key.
* @param config Config to write
* @param deprecated The old config key
* @param designated The new config key
*/
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) {
  // set the designated key only if it is not set already
  if (!config.containsKey(designated)) {
    final String valueForDeprecated = config.getString(deprecated, null);
    if (valueForDeprecated != null) {
      config.setString(designated, valueForDeprecated);
    }
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

/**
* Sets the value of a new config key to the value of a deprecated config key.
* @param config Config to write
* @param deprecated The old config key
* @param designated The new config key
*/
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) {
  // set the designated key only if it is not set already
  if (!config.containsKey(designated)) {
    final String valueForDeprecated = config.getString(deprecated, null);
    if (valueForDeprecated != null) {
      config.setString(designated, valueForDeprecated);
    }
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

public void addBroadcastInputToGroup(int groupIndex) {
  final String grp = BROADCAST_INPUT_GROUP_SIZE_PREFIX + groupIndex;
  if (!this.config.containsKey(grp)) {
    this.config.setInteger(NUM_BROADCAST_INPUTS, this.config.getInteger(NUM_BROADCAST_INPUTS, 0) + 1);
  }
  this.config.setInteger(grp, this.config.getInteger(grp, 0) + 1);
}

代码示例来源:origin: org.apache.flink/flink-runtime

public void addBroadcastInputToGroup(int groupIndex) {
  final String grp = BROADCAST_INPUT_GROUP_SIZE_PREFIX + groupIndex;
  if (!this.config.containsKey(grp)) {
    this.config.setInteger(NUM_BROADCAST_INPUTS, this.config.getInteger(NUM_BROADCAST_INPUTS, 0) + 1);
  }
  this.config.setInteger(grp, this.config.getInteger(grp, 0) + 1);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

public void addBroadcastInputToGroup(int groupIndex) {
  final String grp = BROADCAST_INPUT_GROUP_SIZE_PREFIX + groupIndex;
  if (!this.config.containsKey(grp)) {
    this.config.setInteger(NUM_BROADCAST_INPUTS, this.config.getInteger(NUM_BROADCAST_INPUTS, 0) + 1);
  }
  this.config.setInteger(grp, this.config.getInteger(grp, 0) + 1);
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

public void addBroadcastInputToGroup(int groupIndex) {
  final String grp = BROADCAST_INPUT_GROUP_SIZE_PREFIX + groupIndex;
  if (!this.config.containsKey(grp)) {
    this.config.setInteger(NUM_BROADCAST_INPUTS, this.config.getInteger(NUM_BROADCAST_INPUTS, 0) + 1);
  }
  this.config.setInteger(grp, this.config.getInteger(grp, 0) + 1);
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Get task manager's heap memory. This method will check the new key
 * {@link TaskManagerOptions#TASK_MANAGER_HEAP_MEMORY} and
 * the old key {@link TaskManagerOptions#TASK_MANAGER_HEAP_MEMORY_MB} for backwards compatibility.
 *
 * @param configuration the configuration object
 * @return the memory size of task manager's heap memory.
 */
public static MemorySize getTaskManagerHeapMemory(Configuration configuration) {
  if (configuration.containsKey(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY.key())) {
    return MemorySize.parse(configuration.getString(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY));
  } else if (configuration.containsKey(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB.key())) {
    return MemorySize.parse(configuration.getInteger(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB) + "m");
  } else {
    //use default value
    return MemorySize.parse(configuration.getString(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY));
  }
}

代码示例来源:origin: org.apache.flink/flink-core

/**
 * Get job manager's heap memory. This method will check the new key
 * {@link JobManagerOptions#JOB_MANAGER_HEAP_MEMORY} and
 * the old key {@link JobManagerOptions#JOB_MANAGER_HEAP_MEMORY_MB} for backwards compatibility.
 *
 * @param configuration the configuration object
 * @return the memory size of job manager's heap memory.
 */
public static MemorySize getJobManagerHeapMemory(Configuration configuration) {
  if (configuration.containsKey(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY.key())) {
    return MemorySize.parse(configuration.getString(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY));
  } else if (configuration.containsKey(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB.key())) {
    return MemorySize.parse(configuration.getInteger(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB) + "m");
  } else {
    //use default value
    return MemorySize.parse(configuration.getString(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY));
  }
}

相关文章