本文整理了Java中org.apache.zookeeper.server.ZooKeeperServer.getClientPort()
方法的一些代码示例,展示了ZooKeeperServer.getClientPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServer.getClientPort()
方法的具体详情如下:
包路径:org.apache.zookeeper.server.ZooKeeperServer
类名称:ZooKeeperServer
方法名:getClientPort
暂无
代码示例来源:origin: apache/zookeeper
public ZooKeeperServerBean(ZooKeeperServer zks) {
startTime = new Date();
this.zks = zks;
name = "StandaloneServer_port" + zks.getClientPort();
}
代码示例来源:origin: apache/zookeeper
public String getClientPort() {
return Integer.toString(zks.getClientPort());
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
public ZooKeeperServerBean(ZooKeeperServer zks) {
startTime = new Date();
this.zks = zks;
name = "StandaloneServer_port" + zks.getClientPort();
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
public String getClientPort() {
try {
return InetAddress.getLocalHost().getHostAddress() + ":"
+ zks.getClientPort();
} catch (UnknownHostException e) {
return "localhost:" + zks.getClientPort();
}
}
代码示例来源:origin: apache/zookeeper
public PrepRequestProcessor(ZooKeeperServer zks,
RequestProcessor nextProcessor) {
super("ProcessThread(sid:" + zks.getServerId() + " cport:"
+ zks.getClientPort() + "):", zks.getZooKeeperServerListener());
this.nextProcessor = nextProcessor;
this.zks = zks;
}
代码示例来源:origin: apache/zookeeper
public void dumpConf(PrintWriter pwriter) {
pwriter.print("clientPort=");
pwriter.println(getClientPort());
pwriter.print("secureClientPort=");
pwriter.println(getSecureClientPort());
pwriter.print("dataDir=");
pwriter.println(zkDb.snapLog.getSnapDir().getAbsolutePath());
pwriter.print("dataDirSize=");
pwriter.println(getDataDirSize());
pwriter.print("dataLogDir=");
pwriter.println(zkDb.snapLog.getDataDir().getAbsolutePath());
pwriter.print("dataLogSize=");
pwriter.println(getLogDirSize());
pwriter.print("tickTime=");
pwriter.println(getTickTime());
pwriter.print("maxClientCnxns=");
pwriter.println(getMaxClientCnxnsPerHost());
pwriter.print("minSessionTimeout=");
pwriter.println(getMinSessionTimeout());
pwriter.print("maxSessionTimeout=");
pwriter.println(getMaxSessionTimeout());
pwriter.print("serverId=");
pwriter.println(getServerId());
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
public PrepRequestProcessor(ZooKeeperServer zks,
RequestProcessor nextProcessor) {
super("ProcessThread(sid:" + zks.getServerId() + " cport:"
+ zks.getClientPort() + "):", zks.getZooKeeperServerListener());
this.nextProcessor = nextProcessor;
this.zks = zks;
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
public void dumpConf(PrintWriter pwriter) {
pwriter.print("clientPort=");
pwriter.println(getClientPort());
pwriter.print("dataDir=");
pwriter.println(zkDb.snapLog.getSnapDir().getAbsolutePath());
pwriter.print("dataLogDir=");
pwriter.println(zkDb.snapLog.getDataDir().getAbsolutePath());
pwriter.print("tickTime=");
pwriter.println(getTickTime());
pwriter.print("maxClientCnxns=");
pwriter.println(serverCnxnFactory.getMaxClientCnxnsPerHost());
pwriter.print("minSessionTimeout=");
pwriter.println(getMinSessionTimeout());
pwriter.print("maxSessionTimeout=");
pwriter.println(getMaxSessionTimeout());
pwriter.print("serverId=");
pwriter.println(getServerId());
}
代码示例来源:origin: apache/zookeeper
public ZooKeeperServerConf getConf() {
return new ZooKeeperServerConf
(getClientPort(),
zkDb.snapLog.getSnapDir().getAbsolutePath(),
zkDb.snapLog.getDataDir().getAbsolutePath(),
getTickTime(),
serverCnxnFactory.getMaxClientCnxnsPerHost(),
getMinSessionTimeout(),
getMaxSessionTimeout(),
getServerId());
}
代码示例来源:origin: alibaba/jstorm
tmpDirs.add(zkDir);
Factory zookeeper = startLocalZookeeper(zkDir);
Map conf = getLocalConf(zookeeper.getZooKeeperServer().getClientPort());
代码示例来源:origin: uber/AthenaX
EmbeddedZooKeeper() throws IOException, InterruptedException {
this.tmpDir = Files.createTempDirectory(null).toFile();
this.factory = new NIOServerCnxnFactory();
this.zookeeper = new ZooKeeperServer(new File(tmpDir, "data"), new File(tmpDir, "log"), TICK_TIME);
InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 0);
factory.configure(addr, 0);
factory.startup(zookeeper);
this.port = zookeeper.getClientPort();
}
代码示例来源:origin: org.apache.hadoop/zookeeper
public PrepRequestProcessor(ZooKeeperServer zks,
RequestProcessor nextProcessor) {
super("ProcessThread:" + zks.getClientPort());
this.nextProcessor = nextProcessor;
this.zks = zks;
}
代码示例来源:origin: org.apache.hadoop/zookeeper
public String getClientPort() {
try {
return InetAddress.getLocalHost().getHostAddress() + ":"
+ zks.getClientPort();
} catch (UnknownHostException e) {
return "localhost:" + zks.getClientPort();
}
}
代码示例来源:origin: org.apache.hadoop/zookeeper
public ZooKeeperServerBean(ZooKeeperServer zks) {
startTime = new Date();
this.zks = zks;
name = "StandaloneServer_port" + zks.getClientPort();
}
代码示例来源:origin: apache/samza
public int getPort() {
return zooKeeperServer.getClientPort();
}
代码示例来源:origin: apache/incubator-sentry
private void createZkServer() throws Exception {
try {
zkServer = new EmbeddedZkServer(zkPort);
zkPort = zkServer.getZk().getClientPort();
} catch (Exception e) {
LOGGER.error("Failed to create testing zookeeper server.");
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.apache.hadoop/zookeeper
public void dumpConf(PrintWriter pwriter) {
pwriter.print("clientPort=");
pwriter.println(getClientPort());
pwriter.print("dataDir=");
pwriter.println(zkDb.snapLog.getSnapDir().getAbsolutePath());
pwriter.print("dataLogDir=");
pwriter.println(zkDb.snapLog.getDataDir().getAbsolutePath());
pwriter.print("tickTime=");
pwriter.println(getTickTime());
pwriter.print("maxClientCnxns=");
pwriter.println(serverCnxnFactory.getMaxClientCnxns());
pwriter.print("minSessionTimeout=");
pwriter.println(getMinSessionTimeout());
pwriter.print("maxSessionTimeout=");
pwriter.println(getMaxSessionTimeout());
pwriter.print("serverId=");
pwriter.println(getServerId());
}
代码示例来源:origin: org.apache.giraph/giraph-core
zkThread.setDaemon(true);
zkThread.start();
return zkServer.getClientPort();
代码示例来源:origin: linkedin/li-apache-kafka-clients
public EmbeddedZookeeper() {
try {
snapshotDir = KafkaTestUtils.newTempDir();
logDir = KafkaTestUtils.newTempDir();
tickTime = 500;
zk = new ZooKeeperServer(snapshotDir, logDir, tickTime);
registerShutdownHandler(zk);
cnxnFactory = new NIOServerCnxnFactory();
InetAddress localHost = InetAddress.getLocalHost();
hostAddress = localHost.getHostAddress();
InetSocketAddress bindAddress = new InetSocketAddress(localHost, port);
cnxnFactory.configure(bindAddress, 0);
cnxnFactory.startup(zk);
port = zk.getClientPort();
} catch (Exception e) {
throw new IllegalStateException(e);
}
//sanity check
if (zk.getClientPort() != port) {
throw new IllegalStateException();
}
}
代码示例来源:origin: com.twitter.common/zookeeper-testing
/**
* Starts zookeeper up on the configured port. If the configured port is the ephemeral port
* (@{code 0}), then the actual chosen port is returned.
*/
public final int startNetwork() throws IOException, InterruptedException {
connectionFactory = new NIOServerCnxnFactory();
connectionFactory.configure(new InetSocketAddress(port), -1);
connectionFactory.startup(zooKeeperServer);
if (!shutdownRegistered) {
shutdownRegistry.addAction(new Command() {
@Override public void execute() {
shutdownNetwork();
}
});
shutdownRegistered = true;
}
port = zooKeeperServer.getClientPort();
isStarted = true;
return port;
}
内容来源于网络,如有侵权,请联系作者删除!