Example usage for org.apache.hadoop.registry.client.binding RegistryTypeUtils retrieveAddressURLs

List of usage examples for org.apache.hadoop.registry.client.binding RegistryTypeUtils retrieveAddressURLs

Introduction

In this page you can find the example usage for org.apache.hadoop.registry.client.binding RegistryTypeUtils retrieveAddressURLs.

Prototype

public static List<URL> retrieveAddressURLs(Endpoint epr) throws InvalidRecordException, MalformedURLException 

Source Link

Document

Get the address URLs.

Usage

From source file:org.apache.slider.providers.AbstractProviderService.java

License:Apache License

@Override
public void buildEndpointDetails(Map<String, String> 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, urls.get(0).toString());
                }/*  ww  w .j  av a  2s  . c  om*/
            } catch (InvalidRecordException ignored) {
                // Ignored
            } catch (MalformedURLException ignored) {
                // ignored
            }

        }

    }
}