org.apache.hadoop.ipc.Server.getListenerAddress()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(136)

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

Server.getListenerAddress介绍

[英]Return the socket (ip+port) on which the RPC server is listening to.
[中]返回RPC服务器正在侦听的套接字(ip+端口)。

代码示例

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

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "hostname:port" of the server,
 * or "127.0.0.1:port" when the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 return getConnectAddress(server.getListenerAddress());
}

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

protected void serviceStart() throws Exception {
 Configuration conf = new XLearningConfiguration();
 YarnRPC rpc = YarnRPC.create(conf);
 initializeWebApp(conf);
 InetSocketAddress address = conf.getSocketAddr(
   XLearningConfiguration.XLEARNING_HISTORY_BIND_HOST,
   XLearningConfiguration.XLEARNING_HISTORY_ADDRESS,
   conf.get(XLearningConfiguration.XLEARNING_HISTORY_ADDRESS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_ADDRESS),
   conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_PORT, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_PORT));
 server =
   rpc.getServer(HSClientProtocol.class, protocolHandler, address,
     conf, jhsDTSecretManager,
     conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_CLIENT_THREAD_COUNT,
       XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_CLIENT_THREAD_COUNT));
 // Enable service authorization?
 if (conf.getBoolean(
   CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
   false)) {
  server.refreshServiceAcl(conf, new ClientHSPolicyProvider());
 }
 server.start();
 this.bindAddress = conf.updateConnectAddr(XLearningConfiguration.XLEARNING_HISTORY_BIND_HOST,
   XLearningConfiguration.XLEARNING_HISTORY_ADDRESS,
   conf.get(XLearningConfiguration.XLEARNING_HISTORY_ADDRESS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_ADDRESS),
   server.getListenerAddress());
 LOG.info("Instantiated HistoryClientService at " + this.bindAddress);
 super.serviceStart();
}

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

RpcMetrics(Server server, Configuration conf) {
 String port = String.valueOf(server.getListenerAddress().getPort());
 name = "RpcActivityForPort" + port;
 this.server = server;

代码示例来源:origin: com.facebook.hadoop/hadoop-core

public InetSocketAddress getListenerAddress() {
 return server.getListenerAddress();
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

@Override // DataNodeMXBean
public String getRpcPort(){
 return Integer.toString(this.ipcServer.getListenerAddress().getPort());
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "127.0.0.1:port" when
 * the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 InetSocketAddress addr = server.getListenerAddress();
 if (addr.getAddress().getHostAddress().equals("0.0.0.0")) {
  addr = new InetSocketAddress("127.0.0.1", addr.getPort());
 }
 return addr;
}

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

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "hostname:port" of the server,
 * or "127.0.0.1:port" when the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 return getConnectAddress(server.getListenerAddress());
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "127.0.0.1:port" when
 * the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 InetSocketAddress addr = server.getListenerAddress();
 if (addr.getAddress().getHostAddress().equals("0.0.0.0")) {
  addr = new InetSocketAddress("127.0.0.1", addr.getPort());
 }
 return addr;
}

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

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "hostname:port" of the server,
 * or "127.0.0.1:port" when the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 return getConnectAddress(server.getListenerAddress());
}

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

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "hostname:port" of the server,
 * or "127.0.0.1:port" when the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 return getConnectAddress(server.getListenerAddress());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Returns InetSocketAddress that a client can use to 
 * connect to the server. Server.getListenerAddress() is not correct when
 * the server binds to "0.0.0.0". This returns "hostname:port" of the server,
 * or "127.0.0.1:port" when the getListenerAddress() returns "0.0.0.0:port".
 * 
 * @param server
 * @return socket address that a client can use to connect to the server.
 */
public static InetSocketAddress getConnectAddress(Server server) {
 return getConnectAddress(server.getListenerAddress());
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs-test

/** @return the datanode having the ipc server listen port */
public DataNode getDataNode(int ipcPort) {
 for(DataNode dn : getDataNodes()) {
  if (dn.ipcServer.getListenerAddress().getPort() == ipcPort) {
   return dn;
  }
 }
 return null;
}

代码示例来源:origin: apache/incubator-slider

@Override
public synchronized InetSocketAddress getListenerAddress() {
 return super.getListenerAddress();
}

代码示例来源:origin: org.apache.slider/slider-core

@Override
public synchronized InetSocketAddress getListenerAddress() {
 return super.getListenerAddress();
}

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

public TestProtocol run() {
  try {
   return RPC.getProxy(TestProtocol.class, 0,
     server.getListenerAddress(), conf);
  } catch (IOException e) {
   e.printStackTrace();
  }
  return null;
 }
});

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

@Override
public void serviceStart() throws Exception {
 cacheCleanup.scheduleWithFixedDelay(new CacheCleanup(dispatcher),
   cacheCleanupPeriod, cacheCleanupPeriod, TimeUnit.MILLISECONDS);
 server = createServer();
 server.start();
 localizationServerAddress =
   getConfig().updateConnectAddr(YarnConfiguration.NM_BIND_HOST,
                  YarnConfiguration.NM_LOCALIZER_ADDRESS,
                  YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS,
                  server.getListenerAddress());
 LOG.info("Localizer started on port " + server.getPort());
 super.serviceStart();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-nodemanager

@Override
public void serviceStart() throws Exception {
 cacheCleanup.scheduleWithFixedDelay(new CacheCleanup(dispatcher),
   cacheCleanupPeriod, cacheCleanupPeriod, TimeUnit.MILLISECONDS);
 server = createServer();
 server.start();
 localizationServerAddress =
   getConfig().updateConnectAddr(YarnConfiguration.NM_BIND_HOST,
                  YarnConfiguration.NM_LOCALIZER_ADDRESS,
                  YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS,
                  server.getListenerAddress());
 LOG.info("Localizer started on port " + server.getPort());
 super.serviceStart();
}

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

@Override
public void serviceStart() throws Exception {
 cacheCleanup.scheduleWithFixedDelay(new CacheCleanup(dispatcher),
   cacheCleanupPeriod, cacheCleanupPeriod, TimeUnit.MILLISECONDS);
 server = createServer();
 server.start();
 localizationServerAddress =
   getConfig().updateConnectAddr(YarnConfiguration.NM_BIND_HOST,
                  YarnConfiguration.NM_LOCALIZER_ADDRESS,
                  YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS,
                  server.getListenerAddress());
 LOG.info("Localizer started on port " + server.getPort());
 super.serviceStart();
 dirsHandler.registerLocalDirsChangeListener(localDirsChangeListener);
 dirsHandler.registerLogDirsChangeListener(logDirsChangeListener);
}

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

@Override
public void serviceStart() throws Exception {
 cacheCleanup.scheduleWithFixedDelay(new CacheCleanup(dispatcher),
   cacheCleanupPeriod, cacheCleanupPeriod, TimeUnit.MILLISECONDS);
 server = createServer();
 server.start();
 localizationServerAddress =
   getConfig().updateConnectAddr(YarnConfiguration.NM_BIND_HOST,
                  YarnConfiguration.NM_LOCALIZER_ADDRESS,
                  YarnConfiguration.DEFAULT_NM_LOCALIZER_ADDRESS,
                  server.getListenerAddress());
 LOG.info("Localizer started on port " + server.getPort());
 super.serviceStart();
 dirsHandler.registerLocalDirsChangeListener(localDirsChangeListener);
 dirsHandler.registerLogDirsChangeListener(logDirsChangeListener);
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

void setupNS(Configuration conf, AbstractList<File> dataDirs) 
throws IOException {
 // get NN proxy
 DatanodeProtocol dnp = 
  (DatanodeProtocol)RPC.waitForProxy(DatanodeProtocol.class,
    DatanodeProtocol.versionID, nnAddr, conf);
 setNameNode(dnp);
 // handshake with NN
 NamespaceInfo nsInfo = handshake();
 setNamespaceInfo(nsInfo);
 synchronized(DataNode.this){
  setupNSStorage();
 }
 
 nsRegistration.setIpcPort(ipcServer.getListenerAddress().getPort());
 nsRegistration.setInfoPort(infoServer.getPort());
}

相关文章