- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders
类的一些代码示例,展示了YarnRegistryViewForProviders
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnRegistryViewForProviders
类的具体详情如下:
包路径:org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders
类名称:YarnRegistryViewForProviders
[英]Registry view for providers. This tracks where the service is registered, offers access to the record and other things.
[中]提供程序的注册表视图。这将跟踪服务注册的位置,提供对记录和其他内容的访问。
代码示例来源:origin: org.apache.slider/slider-core
/**
* Add a service under a path for the current 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 registerSelf(
ServiceRecord record,
boolean deleteTreeFirst) throws IOException {
selfRegistrationPath =
putService(user, sliderServiceClass, instanceName, record, deleteTreeFirst);
setSelfRegistration(record);
return selfRegistrationPath;
}
代码示例来源:origin: org.apache.slider/slider-core
/**
* build the zookeeper registry path.
*
* @return the path the service registered at
* @throws NullPointerException if the service has not yet registered
*/
private String getZkRegistryPath() {
Preconditions.checkNotNull(yarnRegistry, "Yarn registry not bound");
String path = yarnRegistry.getAbsoluteSelfRegistrationPath();
Preconditions.checkNotNull(path, "Service record path not defined");
return path;
}
代码示例来源:origin: org.apache.slider/slider-core
/**
* Add a component under the slider name/entry
* @param componentName component name
* @param record record to put
* @throws IOException
*/
public void putComponent(String componentName,
ServiceRecord record) throws
IOException {
putComponent(sliderServiceClass, instanceName,
componentName,
record);
}
代码示例来源:origin: org.apache.slider/slider-core
yarnRegistryOperations = new YarnRegistryViewForProviders(
registryOperations,
service_user_name,
yarnRegistryOperations.registerSelf(serviceRecord, true);
log.info("Registered service under {}; absolute path {}",
yarnRegistryOperations.getSelfRegistrationPath(),
yarnRegistryOperations.getAbsoluteSelfRegistrationPath());
yarnRegistryOperations.deleteChildren(
yarnRegistryOperations.getSelfRegistrationPath(),
true);
代码示例来源:origin: org.apache.slider/slider-core
protected YarnRegistryViewForProviders createYarnRegistryViewForProviders(
Configuration conf) throws IOException {
conf.set(RegistryConstants.KEY_REGISTRY_ZK_ROOT,
RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
RegistryOperations registryOperations = new MockRegistryOperations();
registryOperations.init(conf);
YarnRegistryViewForProviders registryViewForProviders =
new YarnRegistryViewForProviders(registryOperations,
"hbase",
SliderKeys.APP_TYPE,
"hbase1",
new MockApplicationAttemptId(new MockApplicationId(1), 1));
registryViewForProviders.registerSelf(new ServiceRecord(), true);
return registryViewForProviders;
}
代码示例来源:origin: org.apache.slider/slider-hbase-provider
private void registerHBaseServiceEntry() throws IOException {
String name = amState.getApplicationName() ;
ServiceRecord serviceRecord = new ServiceRecord();
// bond lifespan to the application
serviceRecord.set(YarnRegistryAttributes.YARN_ID,
yarnRegistry.getApplicationAttemptId()
.getApplicationId().toString());
serviceRecord.set(YarnRegistryAttributes.YARN_PERSISTENCE,
PersistencePolicies.APPLICATION);
try {
URL configURL = new URL(amWebAPI,
SLIDER_PATH_PUBLISHER + "/" + HBASE_SERVICE_TYPE);
serviceRecord.addExternalEndpoint(
RegistryTypeUtils.restEndpoint(
CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API,
configURL.toURI()));
} catch (URISyntaxException e) {
log.warn("failed to create config URL: {}", e, e);
}
log.info("registering {}/{}", name, HBASE_SERVICE_TYPE);
yarnRegistry.putService(HBASE_SERVICE_TYPE, name, serviceRecord, true);
PublishedConfiguration publishedSite =
new PublishedConfiguration("HBase site", siteConf);
PublishedConfigSet configSet =
amState.getOrCreatePublishedConfigSet(HBASE_SERVICE_TYPE);
configSet.put(HBASE_SITE_PUBLISHED_CONFIG, publishedSite);
}
代码示例来源:origin: org.apache.slider/slider-core
/**
* Update the self record by pushing out the latest version of the service
* registration record.
* @throws IOException any failure.
*/
public void updateSelf() throws IOException {
putService(user, sliderServiceClass, instanceName, selfRegistration, false);
}
代码示例来源:origin: org.apache.slider/slider-core
@Override
public void buildEndpointDetails(Map<String, MonitorDetail> details) {
ServiceRecord self = yarnRegistry.getSelfRegistration();
List<Endpoint> externals = self.external;
for (Endpoint endpoint : externals) {
String addressType = endpoint.addressType;
if (AddressTypes.ADDRESS_URI.equals(addressType)) {
try {
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(endpoint);
if (!urls.isEmpty()) {
details.put(endpoint.api, new MonitorDetail(urls.get(0).toString(), true));
}
} catch (InvalidRecordException | MalformedURLException ignored) {
// Ignored
}
}
}
}
代码示例来源:origin: org.apache.slider/slider-core
/**
* 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);
}
}
代码示例来源:origin: apache/incubator-slider
yarnRegistryOperations = new YarnRegistryViewForProviders(
registryOperations,
service_user_name,
yarnRegistryOperations.registerSelf(serviceRecord, true);
log.info("Registered service under {}; absolute path {}",
yarnRegistryOperations.getSelfRegistrationPath(),
yarnRegistryOperations.getAbsoluteSelfRegistrationPath());
yarnRegistryOperations.deleteChildren(
yarnRegistryOperations.getSelfRegistrationPath(),
true);
代码示例来源:origin: apache/incubator-slider
protected YarnRegistryViewForProviders createYarnRegistryViewForProviders(
Configuration conf) throws IOException {
conf.set(RegistryConstants.KEY_REGISTRY_ZK_ROOT,
RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
RegistryOperations registryOperations = new MockRegistryOperations();
registryOperations.init(conf);
YarnRegistryViewForProviders registryViewForProviders =
new YarnRegistryViewForProviders(registryOperations,
"hbase",
SliderKeys.APP_TYPE,
"hbase1",
new MockApplicationAttemptId(new MockApplicationId(1), 1));
registryViewForProviders.registerSelf(new ServiceRecord(), true);
return registryViewForProviders;
}
代码示例来源:origin: apache/incubator-slider
/**
* Update the self record by pushing out the latest version of the service
* registration record.
* @throws IOException any failure.
*/
public void updateSelf() throws IOException {
putService(user, sliderServiceClass, instanceName, selfRegistration, false);
}
代码示例来源:origin: apache/incubator-slider
@Override
public void buildEndpointDetails(Map<String, MonitorDetail> details) {
ServiceRecord self = yarnRegistry.getSelfRegistration();
List<Endpoint> externals = self.external;
for (Endpoint endpoint : externals) {
String addressType = endpoint.addressType;
if (AddressTypes.ADDRESS_URI.equals(addressType)) {
try {
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(endpoint);
if (!urls.isEmpty()) {
details.put(endpoint.api, new MonitorDetail(urls.get(0).toString(), true));
}
} catch (InvalidRecordException | MalformedURLException ignored) {
// Ignored
}
}
}
}
代码示例来源:origin: apache/incubator-slider
/**
* 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);
}
}
代码示例来源:origin: apache/incubator-slider
/**
* Add a service under a path for the current 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 registerSelf(
ServiceRecord record,
boolean deleteTreeFirst) throws IOException {
selfRegistrationPath =
putService(user, sliderServiceClass, instanceName, record, deleteTreeFirst);
setSelfRegistration(record);
return selfRegistrationPath;
}
代码示例来源:origin: org.apache.slider/slider-core
/**
* Add a service under a path for the current 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 serviceClass,
String serviceName,
ServiceRecord record,
boolean deleteTreeFirst) throws IOException {
return putService(user, serviceClass, serviceName, record, deleteTreeFirst);
}
代码示例来源:origin: apache/incubator-slider
/**
* Add a component under the slider name/entry
* @param componentName component name
* @param record record to put
* @throws IOException
*/
public void putComponent(String componentName,
ServiceRecord record) throws
IOException {
putComponent(sliderServiceClass, instanceName,
componentName,
record);
}
代码示例来源:origin: apache/incubator-slider
/**
* build the zookeeper registry path.
*
* @return the path the service registered at
* @throws NullPointerException if the service has not yet registered
*/
private String getZkRegistryPath() {
Preconditions.checkNotNull(yarnRegistry, "Yarn registry not bound");
String path = yarnRegistry.getAbsoluteSelfRegistrationPath();
Preconditions.checkNotNull(path, "Service record path not defined");
return path;
}
代码示例来源:origin: apache/incubator-slider
/**
* Add a service under a path for the current 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 serviceClass,
String serviceName,
ServiceRecord record,
boolean deleteTreeFirst) throws IOException {
return putService(user, serviceClass, serviceName, record, deleteTreeFirst);
}
代码示例来源:origin: org.apache.slider/slider-core
setProvidedServiceRecordAttributes(compOps, container);
try {
yarnRegistryOperations.putComponent(cid, container);
} catch (IOException e) {
log.warn("Failed to register container {}/{}: {}",
本文整理了Java中org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders类的一些代码示例,展示了Yar
本文整理了Java中org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders.()方法的一些代码示例,展示
本文整理了Java中org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders.registerSelf()
本文整理了Java中org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders.putService()方法
我是一名优秀的程序员,十分优秀!