List of usage examples for org.apache.hadoop.registry.client.binding RegistryPathUtils encodeYarnID
public static String encodeYarnID(String yarnId)
From source file:org.apache.slider.server.appmaster.SliderAppMaster.java
License:Apache License
/** * Handler for {@link RegisterComponentInstance action} * Register/re-register an ephemeral container that is already in the app state * @param id the component// w ww .j a v a 2s . c o m * @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; }
From source file:org.apache.slider.server.appmaster.SliderAppMaster.java
License:Apache License
/** * Handler for {@link UnregisterComponentInstance} * //from w w w . j a v a 2s. c o m * 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); } }