本文整理汇总了Java中org.apache.hadoop.registry.client.binding.RegistryUtils.componentPath方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryUtils.componentPath方法的具体用法?Java RegistryUtils.componentPath怎么用?Java RegistryUtils.componentPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.registry.client.binding.RegistryUtils
的用法示例。
在下文中一共展示了RegistryUtils.componentPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: needUpgrade
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
public boolean needUpgrade() {
String containerPath = RegistryUtils.componentPath(
JOYConstants.APP_TYPE, this.executorMeta.getInstanceName(),
this.executorMeta.getApplicationId(), this.executorMeta.getRunningContainer());
try {
if (registryOperations.exists(containerPath)) {
ServiceRecord sr = registryOperations.resolve(containerPath);
if (sr.get(JOYConstants.NEED_UPGRADE) != null && sr.get(JOYConstants.NEED_UPGRADE).equals(JOYConstants.TRUE)) {
sr.set(JOYConstants.NEED_UPGRADE, JOYConstants.FALSE);
registryOperations.bind(containerPath, sr, BindFlags.OVERWRITE);
LOG.info(JOYConstants.NEED_UPGRADE);
return true;
}
}
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
示例2: deleteContainer
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
public void deleteContainer(String containerIdAsName) {
try {
String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerIdAsName);
boolean exists = registryOperations.exists(path);
if (exists) {
registryOperations.delete(path, false);
} else {
LOG.info(path + " cannot be found");
}
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: resolveContainer
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
public ServiceRecord resolveContainer(String containerIdAsName) throws IOException {
String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerIdAsName);
boolean exists = registryOperations.exists(path);
if (exists) {
ServiceRecord record = registryOperations.resolve(path);
return record;
} else {
LOG.info(path + " cannot be found");
return null;
}
}
示例4: resolveContainers
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
public Map<String, ServiceRecord> resolveContainers() throws IOException {
Map<String, ServiceRecord> records = new HashMap<String, ServiceRecord>();
List<String> containerIds = listAllContainers();
if (containerIds.isEmpty()) {
return null;
}
for (String containerId : containerIds) {
String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerId);
ServiceRecord record = registryOperations.resolve(path);
records.put(containerId, record);
}
return records;
}
示例5: putComponent
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
/**
* Add a component
* @param serviceClass service class to use under ~user
* @param componentName component name
* @param record record to put
* @throws IOException
*/
public void putComponent(String serviceClass,
String serviceName,
String componentName,
ServiceRecord record) throws IOException {
String path = RegistryUtils.componentPath(
user, serviceClass, serviceName, componentName);
registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
registryOperations.bind(path, record, BindFlags.OVERWRITE);
}
示例6: deleteComponent
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
/**
* Delete a component
* @param componentName component name
* @throws IOException
*/
public void deleteComponent(String componentName) throws IOException {
String path = RegistryUtils.componentPath(
user, sliderServiceClass, instanceName,
componentName);
registryOperations.delete(path, false);
}
示例7: deleteComponent
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
/**
* Delete a component
* @param componentName component name
* @throws IOException
*/
public void deleteComponent(String componentName) throws IOException {
String path = RegistryUtils.componentPath(
user, jstormServiceClass, instanceName,
componentName);
registryOperations.delete(path, false);
}
示例8: putComponent
import org.apache.hadoop.registry.client.binding.RegistryUtils; //导入方法依赖的package包/类
private void putComponent(String containerIdAsName) throws IOException {
String path = RegistryUtils.componentPath(user, serviceClass, appIdAsName, containerIdAsName);
registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
registryOperations.bind(path, containerRecords.get(containerIdAsName), BindFlags.OVERWRITE);
}