Java Code Examples for org.apache.hadoop.registry.client.binding.RegistryUtils#componentPath()

The following examples show how to use org.apache.hadoop.registry.client.binding.RegistryUtils#componentPath() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Executor.java    From jstorm with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: RegistryClient.java    From PoseidonX with Apache License 2.0 5 votes vote down vote up
public static String getContainerPath(Container container){
    String applicationId = container.getId().getApplicationAttemptId().getApplicationId().toString();

    String containerId = container.getId().toString();
    String containerPath = RegistryUtils.componentPath(
            JstormAMConstant.REGISTYR_APP_TYPE, JstormAMContext.clusterName,applicationId,containerId);
    return containerPath;
}
 
Example 3
Source File: RegistryClient.java    From PoseidonX with Apache License 2.0 5 votes vote down vote up
public static String getContainerPath(ContainerId containerId){
    String applicationId = containerId.getApplicationAttemptId().getApplicationId().toString();

    String containerIdStr = containerId.toString();
    String containerPath = RegistryUtils.componentPath(
            JstormAMConstant.REGISTYR_APP_TYPE, JstormAMContext.clusterName,applicationId,containerIdStr);
    return containerPath;
}
 
Example 4
Source File: YarnRegistryViewForProviders.java    From jstorm with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: YarnRegistryViewForProviders.java    From jstorm with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}