本文整理汇总了Java中org.apache.samza.config.Config.subset方法的典型用法代码示例。如果您正苦于以下问题:Java Config.subset方法的具体用法?Java Config.subset怎么用?Java Config.subset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.samza.config.Config
的用法示例。
在下文中一共展示了Config.subset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializePlugin
import org.apache.samza.config.Config; //导入方法依赖的package包/类
private static <T> T initializePlugin(String pluginName, String plugin, Config staticConfig,
String pluginDomainFormat, BiFunction<Object, Config, T> factoryInvoker) {
String pluginDomain = String.format(pluginDomainFormat, plugin);
Config pluginConfig = staticConfig.subset(pluginDomain);
String factoryName = pluginConfig.getOrDefault(CFG_FACTORY, "");
Validate.notEmpty(factoryName, String.format("Factory is not set for %s", plugin));
Object factory = ReflectionUtils.createInstance(factoryName);
Validate.notNull(factory, String.format("Factory creation failed for %s", plugin));
LOG.info("Instantiating {} using factory {} with props {}", pluginName, factoryName, pluginConfig);
return factoryInvoker.apply(factory, pluginConfig);
}
示例2: getMonitorConfigs
import org.apache.samza.config.Config; //导入方法依赖的package包/类
/**
*
* Groups configuration defined in the config object for each of the monitors into a MonitorConfig object
* @param config contains the entire configuration defined for all the monitors.
* @return a map of monitorName, {@link MonitorConfig}, where each MonitorConfig object
* contains all the configuration defined for the monitor named monitorName.
*/
public static Map<String, MonitorConfig> getMonitorConfigs(Config config) {
Map<String, MonitorConfig> monitorConfigMap = new HashMap<>();
Config monitorConfig = config.subset(MONITOR_PREFIX);
for (String monitorName : getMonitorNames(monitorConfig)) {
monitorConfigMap.put(monitorName,
new MonitorConfig(monitorConfig.subset(monitorName + MONITOR_CONFIG_KEY_SEPARATOR)));
}
return monitorConfigMap;
}