public HBaseTcpServer(HRegionServer regionServer) { ZooKeeperAdmin.createBaseZNodes(); initConf(regionServer.getConfiguration()); tcpPort = getRegionServerTcpPort(regionServer.getConfiguration()); serverName = regionServer.getServerName(); this.regionServer = regionServer; init(regionServer.getConfiguration()); }
public HBaseTcpServer(HMaster master) { ZooKeeperAdmin.createBaseZNodes(); initConf(master.getConfiguration()); tcpPort = getMasterTcpPort(master.getConfiguration()); serverName = master.getServerName(); this.master = master; init(master.getConfiguration()); }
@Override public void start() { try { super.start(); TcpPortTracker.createTcpPortEphemeralNode(serverName, tcpPort, master != null); ZooKeeperAdmin.getTcpPortTracker(); // 初始化TcpPortTracker String name = getName() + " (" + getURL() + ")"; Thread t = new Thread(this, name); t.setDaemon(isDaemon()); t.start(); log.info("Started lealone tcp server at port " + tcpPort); } catch (SQLException e) { throw new RuntimeException(e); } }