本文整理汇总了Java中org.apache.hadoop.registry.client.binding.RegistryPathUtils类的典型用法代码示例。如果您正苦于以下问题:Java RegistryPathUtils类的具体用法?Java RegistryPathUtils怎么用?Java RegistryPathUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistryPathUtils类属于org.apache.hadoop.registry.client.binding包,在下文中一共展示了RegistryPathUtils类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerComponent
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Handler for {@link RegisterComponentInstance action}
* Register/re-register an ephemeral container that is already in the app state
* @param id the component
* @param description
*/
public boolean registerComponent(ContainerId id, String description) throws
IOException {
RoleInstance instance = appState.getOwnedContainer(id);
if (instance == null) {
return false;
}
// this is where component registrations go
log.info("Registering component {}", id);
String cid = RegistryPathUtils.encodeYarnID(id.toString());
ServiceRecord container = new ServiceRecord();
container.set(YarnRegistryAttributes.YARN_ID, cid);
container.description = description;
container.set(YarnRegistryAttributes.YARN_PERSISTENCE,
PersistencePolicies.CONTAINER);
try {
yarnRegistryOperations.putComponent(cid, container);
} catch (IOException e) {
log.warn("Failed to register container {}/{}: {}",
id, description, e, e);
}
return true;
}
开发者ID:apache,项目名称:incubator-slider,代码行数:29,代码来源:SliderAppMaster.java
示例2: zkMkParentPath
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Recursively make a path
* @param path path to create
* @param acl ACL for path
* @throws IOException any problem
*/
public void zkMkParentPath(String path,
List<ACL> acl) throws
IOException {
// split path into elements
zkMkPath(RegistryPathUtils.parentOf(path),
CreateMode.PERSISTENT, true, acl);
}
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:CuratorService.java
示例3: testPutGetContainerPersistenceServiceEntry
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
@Test
public void testPutGetContainerPersistenceServiceEntry() throws Throwable {
String path = ENTRY_PATH;
ServiceRecord written = buildExampleServiceEntry(
PersistencePolicies.CONTAINER);
operations.mknode(RegistryPathUtils.parentOf(path), true);
operations.bind(path, written, BindFlags.CREATE);
ServiceRecord resolved = operations.resolve(path);
validateEntry(resolved);
assertMatches(written, resolved);
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestRegistryRMOperations.java
示例4: putExampleServiceEntry
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Create a service entry with the sample endpoints, and put it
* at the destination
* @param path path
* @param createFlags flags
* @return the record
* @throws IOException on a failure
*/
protected ServiceRecord putExampleServiceEntry(String path,
int createFlags,
String persistence)
throws IOException, URISyntaxException {
ServiceRecord record = buildExampleServiceEntry(persistence);
registry.mknode(RegistryPathUtils.parentOf(path), true);
operations.bind(path, record, createFlags);
return record;
}
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:AbstractRegistryTest.java
示例5: lookupServiceRecord
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Look up an instance
* @return instance data
* @throws SliderException other failures
* @throws IOException IO problems or wrapped exceptions
*/
private ServiceRecord lookupServiceRecord(ActionRegistryArgs registryArgs) throws
SliderException,
IOException {
String user;
if (StringUtils.isNotEmpty(registryArgs.user)) {
user = RegistryPathUtils.encodeForRegistry(registryArgs.user);
} else {
user = currentUser();
}
String path = servicePath(user, registryArgs.serviceType,
registryArgs.name);
return resolve(path);
}
开发者ID:apache,项目名称:incubator-slider,代码行数:21,代码来源:SliderClient.java
示例6: unregisterComponent
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Handler for {@link UnregisterComponentInstance}
*
* unregister a component. At the time this message is received,
* the component may not have been registered
* @param id the component
*/
public void unregisterComponent(ContainerId id) {
log.info("Unregistering component {}", id);
if (yarnRegistryOperations == null) {
log.warn("Processing unregister component event before initialization " +
"completed; init flag =" + initCompleted);
return;
}
String cid = RegistryPathUtils.encodeYarnID(id.toString());
try {
yarnRegistryOperations.deleteComponent(cid);
} catch (IOException e) {
log.warn("Failed to delete container {} : {}", id, e, e);
}
}
开发者ID:apache,项目名称:incubator-slider,代码行数:22,代码来源:SliderAppMaster.java
示例7: getAbsoluteSelfRegistrationPath
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Get the absolute path to where the service has registered itself.
* This includes the base registry path
* Null until the service is registered
* @return the service registration path.
*/
public String getAbsoluteSelfRegistrationPath() {
if (selfRegistrationPath == null) {
return null;
}
String root = registryOperations.getConfig().getTrimmed(
RegistryConstants.KEY_REGISTRY_ZK_ROOT,
RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
return RegistryPathUtils.join(root, selfRegistrationPath);
}
开发者ID:apache,项目名称:incubator-slider,代码行数:16,代码来源:YarnRegistryViewForProviders.java
示例8: putComponent
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的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);
}
开发者ID:apache,项目名称:incubator-slider,代码行数:17,代码来源:YarnRegistryViewForProviders.java
示例9: putService
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Add a service under a path, optionally purging any history
* @param username user
* @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;
}
开发者ID:apache,项目名称:incubator-slider,代码行数:25,代码来源:YarnRegistryViewForProviders.java
示例10: testPurgeEntryCuratorCallback
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
@Test
public void testPurgeEntryCuratorCallback() throws Throwable {
String path = "/users/example/hbase/hbase1/";
ServiceRecord written = buildExampleServiceEntry(
PersistencePolicies.APPLICATION_ATTEMPT);
written.set(YarnRegistryAttributes.YARN_ID,
"testAsyncPurgeEntry_attempt_001");
operations.mknode(RegistryPathUtils.parentOf(path), true);
operations.bind(path, written, 0);
ZKPathDumper dump = registry.dumpPath(false);
CuratorEventCatcher events = new CuratorEventCatcher();
LOG.info("Initial state {}", dump);
// container query
String id = written.get(YarnRegistryAttributes.YARN_ID, "");
int opcount = purge("/",
id,
PersistencePolicies.CONTAINER,
RegistryAdminService.PurgePolicy.PurgeAll,
events);
assertPathExists(path);
assertEquals(0, opcount);
assertEquals("Event counter", 0, events.getCount());
// now the application attempt
opcount = purge("/",
id,
PersistencePolicies.APPLICATION_ATTEMPT,
RegistryAdminService.PurgePolicy.PurgeAll,
events);
LOG.info("Final state {}", dump);
assertPathNotFound(path);
assertEquals("wrong no of delete operations in " + dump, 1, opcount);
// and validate the callback event
assertEquals("Event counter", 1, events.getCount());
}
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:TestRegistryRMOperations.java
示例11: putService
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
private void putService() throws IOException {
String path = RegistryUtils.servicePath(user, serviceClass, appIdAsName);
registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
registryOperations.bind(path, appRecord, BindFlags.OVERWRITE);
}
开发者ID:intel-hadoop,项目名称:yacop,代码行数:6,代码来源:NRegistryOperator.java
示例12: putComponent
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的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);
}
开发者ID:intel-hadoop,项目名称:yacop,代码行数:6,代码来源:NRegistryOperator.java
示例13: createFullPath
import org.apache.hadoop.registry.client.binding.RegistryPathUtils; //导入依赖的package包/类
/**
* Create a full path from the registry root and the supplied subdir
* @param path path of operation
* @return an absolute path
* @throws IllegalArgumentException if the path is invalide
*/
protected String createFullPath(String path) throws IOException {
return RegistryPathUtils.createFullPath(registryRoot, path);
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:CuratorService.java
注:本文中的org.apache.hadoop.registry.client.binding.RegistryPathUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论