Example usage for org.apache.hadoop.registry.client.api BindFlags OVERWRITE

List of usage examples for org.apache.hadoop.registry.client.api BindFlags OVERWRITE

Introduction

In this page you can find the example usage for org.apache.hadoop.registry.client.api BindFlags OVERWRITE.

Prototype

int OVERWRITE

To view the source code for org.apache.hadoop.registry.client.api BindFlags OVERWRITE.

Click Source Link

Document

The entry should be created even if an existing entry is there.

Usage

From source file:com.alibaba.jstorm.yarn.registry.YarnRegistryViewForProviders.java

License:Apache License

/**
 * Add a component //w  w  w.  j a  v  a2 s .c om
 * @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);
}

From source file:com.alibaba.jstorm.yarn.registry.YarnRegistryViewForProviders.java

License:Apache License

/**
 * Add a service under a path, optionally purging any history
 * @param username user//from  ww w  .j  av a  2  s.  co  m
 * @param serviceClass service class to use under ~user
 * @param serviceName name of the service
 * @param record service record
 * @param deleteTreeFirst perform recursive delete of the path first.
 * @return the path the service was created at
 * @throws IOException
 */
public String putService(String username, String serviceClass, String serviceName, ServiceRecord record,
        boolean deleteTreeFirst) throws IOException {
    String path = RegistryUtils.servicePath(username, serviceClass, serviceName);
    if (deleteTreeFirst) {
        registryOperations.delete(path, true);
    }
    registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
    registryOperations.bind(path, record, BindFlags.OVERWRITE);
    return path;
}