use of org.apache.hadoop.registry.client.types.Endpoint in project hive by apache.
the class LlapZookeeperRegistryImpl method getServicesEndpoint.
public Endpoint getServicesEndpoint() {
final int servicePort = HiveConf.getIntVar(conf, ConfVars.LLAP_DAEMON_WEB_PORT);
final boolean isSSL = HiveConf.getBoolVar(conf, ConfVars.LLAP_DAEMON_WEB_SSL);
final String scheme = isSSL ? "https" : "http";
final URL serviceURL;
try {
serviceURL = new URL(scheme, hostname, servicePort, "");
return RegistryTypeUtils.webEndpoint(IPC_SERVICES, serviceURL.toURI());
} catch (MalformedURLException e) {
throw new RuntimeException(e);
} catch (URISyntaxException e) {
throw new RuntimeException("llap service URI for " + hostname + " is invalid", e);
}
}
use of org.apache.hadoop.registry.client.types.Endpoint in project hadoop by apache.
the class RegistryTestHelper method findEndpoint.
/**
* Find an endpoint in a record or fail,
* @param record record
* @param api API
* @param external external?
* @param addressElements expected # of address elements?
* @param addressTupleSize expected size of a type
* @return the endpoint.
*/
public static Endpoint findEndpoint(ServiceRecord record, String api, boolean external, int addressElements, int addressTupleSize) {
Endpoint epr = external ? record.getExternalEndpoint(api) : record.getInternalEndpoint(api);
if (epr != null) {
assertEquals("wrong # of addresses", addressElements, epr.addresses.size());
assertEquals("wrong # of elements in an address tuple", addressTupleSize, epr.addresses.get(0).size());
return epr;
}
List<Endpoint> endpoints = external ? record.external : record.internal;
StringBuilder builder = new StringBuilder();
for (Endpoint endpoint : endpoints) {
builder.append("\"").append(endpoint).append("\" ");
}
fail("Did not find " + api + " in endpoints " + builder);
// never reached; here to keep the compiler happy
return null;
}
Aggregations