org.apache.hadoop.yarn.webapp.WebApp.getListenerAddress()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.apache.hadoop.yarn.webapp.WebApp.getListenerAddress()方法的一些代码示例,展示了WebApp.getListenerAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApp.getListenerAddress()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.webapp.WebApp
类名称:WebApp
方法名:getListenerAddress

WebApp.getListenerAddress介绍

[英]Get the address the http server is bound to
[中]

代码示例

代码示例来源:origin: Qihoo360/XLearning

connectHost + ":" + webApp.getListenerAddress().getPort());

代码示例来源:origin: org.apache.tez/tez-dag

.with(conf)
  .start(this.tezAMWebApp);
InetSocketAddress address = webApp.getListenerAddress();
if (address != null) {
 InetSocketAddress bindAddress = NetUtils.createSocketAddrForHost(

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-hs

@VisibleForTesting
protected void initializeWebApp(Configuration conf) {
 webApp = new HsWebApp(history);
 InetSocketAddress bindAddress = MRWebAppUtil.getJHSWebBindAddress(conf);
 // NOTE: there should be a .at(InetSocketAddress)
 WebApps
   .$for("jobhistory", HistoryClientService.class, this, "ws")
   .with(conf)
   .withHttpSpnegoKeytabKey(
     JHAdminConfig.MR_WEBAPP_SPNEGO_KEYTAB_FILE_KEY)
   .withHttpSpnegoPrincipalKey(
     JHAdminConfig.MR_WEBAPP_SPNEGO_USER_NAME_KEY)
   .at(NetUtils.getHostPortString(bindAddress)).start(webApp);
 
 String connectHost = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf).split(":")[0];
 MRWebAppUtil.setJHSWebappURLWithoutScheme(conf,
   connectHost + ":" + webApp.getListenerAddress().getPort());
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-hs

@VisibleForTesting
protected void initializeWebApp(Configuration conf) {
 webApp = new HsWebApp(history);
 InetSocketAddress bindAddress = MRWebAppUtil.getJHSWebBindAddress(conf);
 // NOTE: there should be a .at(InetSocketAddress)
 WebApps
   .$for("jobhistory", HistoryClientService.class, this, "ws")
   .with(conf)
   .withHttpSpnegoKeytabKey(
     JHAdminConfig.MR_WEBAPP_SPNEGO_KEYTAB_FILE_KEY)
   .withHttpSpnegoPrincipalKey(
     JHAdminConfig.MR_WEBAPP_SPNEGO_USER_NAME_KEY)
   .at(NetUtils.getHostPortString(bindAddress)).start(webApp);
 
 String connectHost = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf).split(":")[0];
 MRWebAppUtil.setJHSWebappURLWithoutScheme(conf,
   connectHost + ":" + webApp.getListenerAddress().getPort());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-hs

@VisibleForTesting
protected void initializeWebApp(Configuration conf) {
 webApp = new HsWebApp(history);
 InetSocketAddress bindAddress = MRWebAppUtil.getJHSWebBindAddress(conf);
 // NOTE: there should be a .at(InetSocketAddress)
 WebApps
   .$for("jobhistory", HistoryClientService.class, this, "ws")
   .with(conf)
   .withHttpSpnegoKeytabKey(
     JHAdminConfig.MR_WEBAPP_SPNEGO_KEYTAB_FILE_KEY)
   .withHttpSpnegoPrincipalKey(
     JHAdminConfig.MR_WEBAPP_SPNEGO_USER_NAME_KEY)
   .at(NetUtils.getHostPortString(bindAddress)).start(webApp);
 
 String connectHost = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf).split(":")[0];
 MRWebAppUtil.setJHSWebappURLWithoutScheme(conf,
   connectHost + ":" + webApp.getListenerAddress().getPort());
}

代码示例来源:origin: org.apache.apex/apex-engine

connectAddress = NetUtils.getConnectAddress(webApp.getListenerAddress());
String hostname = connectAddress.getAddress().getCanonicalHostName();
if (hostname.equals(connectAddress.getAddress().getHostAddress())) {

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

@Test public void testCreateWithPort() {
 // see if the ephemeral port is updated
 WebApp app = WebApps.$for(this).at(0).start();
 int port = app.getListenerAddress().getPort();
 assertTrue(port > 0);
 app.stop();
 // try to reuse the port
 app = WebApps.$for(this).at(port).start();
 assertEquals(port, app.getListenerAddress().getPort());
 app.stop();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

@Test public void testCreateWithPort() {
 // see if the ephemeral port is updated
 WebApp app = WebApps.$for(this).at(0).start();
 int port = app.getListenerAddress().getPort();
 assertTrue(port > 0);
 app.stop();
 // try to reuse the port
 app = WebApps.$for(this).at(port).start();
 assertEquals(port, app.getListenerAddress().getPort());
 app.stop();
}

代码示例来源:origin: io.hops/hadoop-yarn-common

@Test public void testCreateWithPort() {
 // see if the ephemeral port is updated
 WebApp app = WebApps.$for(this).at(0).start();
 int port = app.getListenerAddress().getPort();
 assertTrue(port > 0);
 app.stop();
 // try to reuse the port
 app = WebApps.$for(this).at(port).start();
 assertEquals(port, app.getListenerAddress().getPort());
 app.stop();
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

.getWebApp().getListenerAddress());

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

String hostPort =
  NetUtils.getHostPortString(((MRClientService) app.getClientService())
   .getWebApp().getListenerAddress());
URL httpUrl = new URL("http://" + hostPort + "/mapreduce");

代码示例来源:origin: io.hops/hadoop-yarn-common

@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class)
public void testCreateWithNonZeroPort() {
 WebApp app = WebApps.$for(this).at(50000).start();
 int port = app.getListenerAddress().getPort();
 assertEquals(50000, port);
 // start another WebApp with same NonZero port
 WebApp app2 = WebApps.$for(this).at(50000).start();
 // An exception occurs (findPort disabled)
 app.stop();
 app2.stop();
}

代码示例来源:origin: io.hops/hadoop-yarn-common

@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class)
public void testCreateWithBindAddressNonZeroPort() {
 WebApp app = WebApps.$for(this).at("0.0.0.0:50000").start();
 int port = app.getListenerAddress().getPort();
 assertEquals(50000, port);
 // start another WebApp with same NonZero port
 WebApp app2 = WebApps.$for(this).at("0.0.0.0:50000").start();
 // An exception occurs (findPort disabled)
 app.stop();
 app2.stop();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class)
public void testCreateWithBindAddressNonZeroPort() {
 WebApp app = WebApps.$for(this).at("0.0.0.0:50000").start();
 int port = app.getListenerAddress().getPort();
 assertEquals(50000, port);
 // start another WebApp with same NonZero port
 WebApp app2 = WebApps.$for(this).at("0.0.0.0:50000").start();
 // An exception occurs (findPort disabled)
 app.stop();
 app2.stop();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class)
public void testCreateWithNonZeroPort() {
 WebApp app = WebApps.$for(this).at(50000).start();
 int port = app.getListenerAddress().getPort();
 assertEquals(50000, port);
 // start another WebApp with same NonZero port
 WebApp app2 = WebApps.$for(this).at(50000).start();
 // An exception occurs (findPort disabled)
 app.stop();
 app2.stop();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class)
public void testCreateWithBindAddressNonZeroPort() {
 WebApp app = WebApps.$for(this).at("0.0.0.0:50000").start();
 int port = app.getListenerAddress().getPort();
 assertEquals(50000, port);
 // start another WebApp with same NonZero port
 WebApp app2 = WebApps.$for(this).at("0.0.0.0:50000").start();
 // An exception occurs (findPort disabled)
 app.stop();
 app2.stop();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class)
public void testCreateWithNonZeroPort() {
 WebApp app = WebApps.$for(this).at(50000).start();
 int port = app.getListenerAddress().getPort();
 assertEquals(50000, port);
 // start another WebApp with same NonZero port
 WebApp app2 = WebApps.$for(this).at(50000).start();
 // An exception occurs (findPort disabled)
 app.stop();
 app2.stop();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

assertEquals("foo", getContent(baseUrl +"test/foo").trim());
 app1 = WebApps.$for("test", this).at(port).start();
 assertEquals(port, app1.getListenerAddress().getPort());
 app2 = WebApps.$for("test", this).at("0.0.0.0", port, true).start();
 assertTrue(app2.getListenerAddress().getPort() > port);
 Configuration conf = new Configuration();
 port =  ServerSocketUtil.waitForPort(47000, 60);
 app3 = WebApps.$for("test", this).at(port).withPortRange(conf, "abc").
   start();
 assertEquals(port, app3.getListenerAddress().getPort());
 ServerSocketUtil.waitForPort(46000, 60);
 conf.set("abc", "46000-46500");
 app4 = WebApps.$for("test", this).at(port).withPortRange(conf, "abc").
   start();
 assertEquals(46000, app4.getListenerAddress().getPort());
 app5 = WebApps.$for("test", this).withPortRange(conf, "abc").start();
 assertTrue(app5.getListenerAddress().getPort() > 46000);
} finally {
 stopWebApp(app);

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void checkActiveRMWebServices() throws JSONException {
 // Validate web-service
 Client webServiceClient = Client.create(new DefaultClientConfig());
 InetSocketAddress rmWebappAddr =
   NetUtils.getConnectAddress(rm.getWebapp().getListenerAddress());
 String webappURL =
   "http://" + rmWebappAddr.getHostName() + ":" + rmWebappAddr.getPort();
 WebResource webResource = webServiceClient.resource(webappURL);
 String path = app.getApplicationId().toString();
 ClientResponse response =
   webResource.path("ws").path("v1").path("cluster").path("apps")
     .path(path).accept(MediaType.APPLICATION_JSON)
     .get(ClientResponse.class);
 assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8,
   response.getType().toString());
 JSONObject json = response.getEntity(JSONObject.class);
 assertEquals("incorrect number of elements", 1, json.length());
 JSONObject appJson = json.getJSONObject("app");
 assertEquals("ACCEPTED", appJson.getString("state"));
 // Other stuff is verified in the regular web-services related tests
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private void checkActiveRMWebServices() throws JSONException {
 // Validate web-service
 Client webServiceClient = Client.create(new DefaultClientConfig());
 InetSocketAddress rmWebappAddr =
   NetUtils.getConnectAddress(rm.getWebapp().getListenerAddress());
 String webappURL =
   "http://" + rmWebappAddr.getHostName() + ":" + rmWebappAddr.getPort();
 WebResource webResource = webServiceClient.resource(webappURL);
 String path = app.getApplicationId().toString();
 ClientResponse response =
   webResource.path("ws").path("v1").path("cluster").path("apps")
    .path(path).accept(MediaType.APPLICATION_JSON)
    .get(ClientResponse.class);
 assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
 JSONObject json = response.getEntity(JSONObject.class);
 assertEquals("incorrect number of elements", 1, json.length());
 JSONObject appJson = json.getJSONObject("app");
 assertEquals("ACCEPTED", appJson.getString("state"));
 // Other stuff is verified in the regular web-services related tests
}

相关文章