Example usage for org.apache.hadoop.yarn.webapp WebApps $for

List of usage examples for org.apache.hadoop.yarn.webapp WebApps $for

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.webapp WebApps $for.

Prototype

public static <T> Builder<T> $for(String prefix) 

Source Link

Usage

From source file:com.twitter.hraven.hadoopJobMonitor.metrics.HadoopJobMonitorWebServer.java

License:Apache License

public void start(int port) throws IOException {
    LOG.info("Instantiating " + HadoopJobMonitorWebApp.class.getName());
    try {//w ww  .  j a  v  a  2 s  . c om
        HadoopJobMonitorWebApp hadoopJobMonitorWebApp = new HadoopJobMonitorWebApp();
        this.webApp = WebApps.$for("node").at(port).start(hadoopJobMonitorWebApp);
        this.port = this.webApp.httpServer().getPort();
        this.host = InetAddress.getLocalHost().getHostName();
        this.webAddress = this.host + ":" + port;
        LOG.info(HadoopJobMonitorWebApp.class.getName() + " started: " + this.webAddress);
    } catch (Exception e) {
        String msg = HadoopJobMonitorWebApp.class.getName() + " failed to start.";
        LOG.error(msg, e);
        throw new IOException(msg);
    }
}

From source file:org.apache.tez.dag.app.web.WebUIService.java

License:Apache License

@Override
protected void serviceStart() throws Exception {
    if (tezAMWebApp != null) {
        // use AmIpFilter to restrict connections only from the rm proxy
        final Configuration conf = getConfig();
        conf.set("hadoop.http.filter.initializers",
                "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer");
        try {//from  w w  w .ja  va  2 s.co m
            // Explicitly disabling SSL for the web service. For https we do not want AM users to allow
            // access to the keystore file for opening SSL listener. We can trust RM/NM to issue SSL
            // certificates, however AM user is not trusted.
            this.webApp = WebApps.$for(this.tezAMWebApp).with(conf)
                    .withHttpPolicy(conf, HttpConfig.Policy.HTTP_ONLY).start(this.tezAMWebApp);
            this.port = this.webApp.httpServer().getConnectorAddress(0).getPort();
        } catch (Exception e) {
            LOG.error("Tez UI WebService failed to start.", e);
            throw new TezUncheckedException(e);
        }
    }
    super.serviceStart();
}