Example usage for java.net InetSocketAddress getPort

List of usage examples for java.net InetSocketAddress getPort

Introduction

In this page you can find the example usage for java.net InetSocketAddress getPort.

Prototype

public final int getPort() 

Source Link

Document

Gets the port number.

Usage

From source file:org.apache.hadoop.hdfs.server.namenode.AvatarNodeNew.java

public static InetSocketAddress getAvatarShellAddress(Configuration conf) {
    InetSocketAddress u = NameNode.getAddress(conf);
    int port = conf.getInt("dfs.avatarnode.port", u.getPort() + 1);
    String avatarShellIP = conf.get("dfs.avatarshell.ip", u.getHostName());
    return new InetSocketAddress(avatarShellIP, port);
}

From source file:org.wso2.carbon.inbound.endpoint.protocol.hl7.core.MultiIOHandler.java

@Override
public void connected(IOSession session) {

    InetSocketAddress remoteIsa = (InetSocketAddress) session.getRemoteAddress();
    InetSocketAddress localIsa = (InetSocketAddress) session.getLocalAddress();

    MLLPSourceHandler handler = new MLLPSourceHandler(processorMap.get(localIsa.getPort()));
    handlers.put(remoteIsa.getPort(), handler);
    endpointSessions.put(localIsa.getPort() + "-" + remoteIsa.getPort(), session);

    handler.connected(session);/* ww w. j  a  v a2 s  .  c om*/

}

From source file:org.apache.hadoop.thriftfs.ThriftPluginServer.java

public ThriftPluginServer(InetSocketAddress address, TProcessorFactory processorFactory) {
    //options = new TThreadPoolServer.Options();
    port = address.getPort();
    this.address = address;
    this.processorFactory = processorFactory;
}

From source file:org.apache.hama.bsp.message.HadoopMessageManagerImpl.java

private final void startRPCServer(Configuration conf, InetSocketAddress peerAddress) {
    try {//from w w  w.j  ava2s  . c  o m
        this.server = RPC.getServer(this, peerAddress.getHostName(), peerAddress.getPort(), conf);
        LOG.debug("server : " + server);
        server.start();
        LOG.info(" BSPPeer address:" + peerAddress.getHostName() + " port:" + peerAddress.getPort());
    } catch (IOException e) {
        LOG.error("Fail to start RPC server!", e);
        throw new RuntimeException("RPC Server could not be launched!");
    }
}

From source file:org.apache.hadoop.yarn.server.resourcemanager.RMZKFailoverController.java

@Override
protected byte[] targetToData(HAServiceTarget target) {
    InetSocketAddress addr = target.getAddress();

    return RMActiveNodeInfoProto.newBuilder().setHostname(addr.getHostName()).setPort(addr.getPort())
            .setZkfcPort(target.getZKFCAddress().getPort()).setClusterid(localRMServiceTarget.getClusterId())
            .setRmId(localRMServiceTarget.getRmId()).build().toByteArray();
}

From source file:org.apache.hadoop.mapred.JobHistoryServer.java

private HttpServer initializeWebContainer(JobConf conf, ACLsManager aclsManager) throws IOException {
    InetSocketAddress infoSocAddr = NetUtils.createSocketAddr(historyInfoAddr);
    int tmpInfoPort = infoSocAddr.getPort();
    return new HttpServer("history", infoSocAddr.getHostName(), tmpInfoPort, tmpInfoPort == 0, conf,
            aclsManager.getAdminsAcl());
}

From source file:com.anrisoftware.sscontrol.parser.AppParser.java

private void parseAddress(List<InetSocketAddress> addresses, InetSocketAddressFormat format, int defaultPort,
        String s) throws ParseException {
    InetSocketAddress address = format.parse(s);
    if (address.getPort() == 0) {
        InetAddress host = address.getAddress();
        addresses.add(new InetSocketAddress(host, defaultPort));
    } else {//from ww w  .  j av a 2s.co  m
        addresses.add(address);
    }
}

From source file:org.apache.hadoop.mapred.JobTrackerHAHttpRedirector.java

public synchronized void start() throws Exception {
    if (activeJobTrackerUrl == null) {
        return;/*from  w  w w  .j a  va2  s. c o  m*/
    }
    if (server == null) {
        @SuppressWarnings("deprecation")
        String infoAddr = NetUtils2.getServerAddress(conf, HAUtil.MR_JOBTRACKER_OLD_HTTP_ADDRESS_KEY,
                HAUtil.MR_JOBTRACKER_OLD_HTTP_PORT_KEY, HAUtil.MR_JOBTRACKER_HTTP_ADDRESS_KEY);
        LOG.info("Starting " + getClass().getSimpleName() + " on " + infoAddr);
        InetSocketAddress infoSocAddr = NetUtils.createSocketAddr(infoAddr);
        String infoBindAddress = infoSocAddr.getHostName();
        int infoBindPort = infoSocAddr.getPort();
        server = new HttpServer("static", infoBindAddress, infoBindPort, false);
        server.addInternalServlet("redirector", "/*", RedirectorServlet.class, false);
        server.setAttribute(ACTIVE_JOBTRACKER_BASEURL, activeJobTrackerUrl);
        server.start();
        LOG.info("Started");
    } else {
        throw new Exception("JobTrackerHAHttpRedirector already running");
    }
}

From source file:org.scassandra.http.client.CurrentClient.java

public ConnectionReport getConnection(InetSocketAddress address) {
    return getConnection(address.getAddress().getHostAddress(), address.getPort());
}

From source file:org.apache.hama.bsp.message.HamaAsyncMessageManagerImpl.java

private final void startRPCServer(Configuration conf, InetSocketAddress peerAddress) {
    try {//  w ww . ja  va2s  . c  o m
        startServer(peerAddress.getHostName(), peerAddress.getPort());
    } catch (IOException ioe) {
        LOG.error("Fail to start RPC server!", ioe);
        throw new RuntimeException("RPC Server could not be launched!");
    }
}