Example usage for org.apache.hadoop.registry.client.types ServiceRecord addInternalEndpoint

List of usage examples for org.apache.hadoop.registry.client.types ServiceRecord addInternalEndpoint

Introduction

In this page you can find the example usage for org.apache.hadoop.registry.client.types ServiceRecord addInternalEndpoint.

Prototype

public void addInternalEndpoint(Endpoint endpoint) 

Source Link

Document

Add an internal endpoint

Usage

From source file:org.apache.hive.service.server.HS2ActivePassiveHARegistry.java

License:Apache License

private void updateEndpoint(final ServiceRecord srv, final String endpointName) {
    final String instanceUri = srv.get(INSTANCE_URI_CONFIG);
    final String[] tokens = instanceUri.split(":");
    final String hostname = tokens[0];
    final int port = Integer.parseInt(tokens[1]);
    Endpoint urlEndpoint = RegistryTypeUtils.ipcEndpoint(endpointName, new InetSocketAddress(hostname, port));
    srv.addInternalEndpoint(urlEndpoint);
    LOG.info("Added {} endpoint to service record", urlEndpoint);
}

From source file:org.apache.slider.providers.agent.AgentProviderService.java

License:Apache License

@Override
public void applyInitialRegistryDefinitions(URL amWebURI, URL agentOpsURI, URL agentStatusURI,
        ServiceRecord serviceRecord) throws IOException {
    super.applyInitialRegistryDefinitions(amWebURI, agentOpsURI, agentStatusURI, serviceRecord);

    try {/*from  w w  w  . j  a v  a  2s  . c om*/
        URL restURL = new URL(agentOpsURI, SLIDER_PATH_AGENTS);
        URL agentStatusURL = new URL(agentStatusURI, SLIDER_PATH_AGENTS);

        serviceRecord.addInternalEndpoint(new Endpoint(CustomRegistryConstants.AGENT_SECURE_REST_API,
                ProtocolTypes.PROTOCOL_REST, restURL.toURI()));
        serviceRecord.addInternalEndpoint(new Endpoint(CustomRegistryConstants.AGENT_ONEWAY_REST_API,
                ProtocolTypes.PROTOCOL_REST, agentStatusURL.toURI()));
    } catch (URISyntaxException e) {
        throw new IOException(e);
    }
}