本文整理匯總了Java中org.apache.hadoop.hbase.ServerName.getServerName方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerName.getServerName方法的具體用法?Java ServerName.getServerName怎麽用?Java ServerName.getServerName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.ServerName
的用法示例。
在下文中一共展示了ServerName.getServerName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getServerName
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
@Override
public String getServerName() {
ServerName serverName = master.getServerName();
if (serverName == null) {
return "";
}
return serverName.getServerName();
}
示例2: getServerName
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
@Override
public String getServerName() {
ServerName serverName = regionServer.getServerName();
if (serverName == null) {
return "";
}
return serverName.getServerName();
}
示例3: testRemoveStaleRecoveringRegionsDuringMasterInitialization
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
@Test
public void testRemoveStaleRecoveringRegionsDuringMasterInitialization() throws Exception {
// this test is for when distributed log replay is enabled
if (!UTIL.getConfiguration().getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false)) return;
LOG.info("Starting testRemoveStaleRecoveringRegionsDuringMasterInitialization");
HMaster master = UTIL.getMiniHBaseCluster().getMaster();
MasterFileSystem fs = master.getMasterFileSystem();
String failedRegion = "failedRegoin1";
String staleRegion = "staleRegion";
ServerName inRecoveryServerName = ServerName.valueOf("mgr,1,1");
ServerName previouselyFaildServerName = ServerName.valueOf("previous,1,1");
String walPath = "/hbase/data/.logs/" + inRecoveryServerName.getServerName()
+ "-splitting/test";
// Create a ZKW to use in the test
ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
zkw.getRecoverableZooKeeper().create(ZKSplitLog.getEncodedNodeName(zkw, walPath),
new SplitLogTask.Owned(inRecoveryServerName, fs.getLogRecoveryMode()).toByteArray(),
Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
String staleRegionPath = ZKUtil.joinZNode(zkw.recoveringRegionsZNode, staleRegion);
ZKUtil.createWithParents(zkw, staleRegionPath);
String inRecoveringRegionPath = ZKUtil.joinZNode(zkw.recoveringRegionsZNode, failedRegion);
inRecoveringRegionPath = ZKUtil.joinZNode(inRecoveringRegionPath,
inRecoveryServerName.getServerName());
ZKUtil.createWithParents(zkw, inRecoveringRegionPath);
Set<ServerName> servers = new HashSet<ServerName>();
servers.add(previouselyFaildServerName);
fs.removeStaleRecoveringRegionsFromZK(servers);
// verification
assertFalse(ZKUtil.checkExists(zkw, staleRegionPath) != -1);
assertTrue(ZKUtil.checkExists(zkw, inRecoveringRegionPath) != -1);
ZKUtil.deleteChildrenRecursively(zkw, zkw.recoveringRegionsZNode);
ZKUtil.deleteChildrenRecursively(zkw, zkw.splitLogZNode);
zkw.close();
}
示例4: updateServerStats
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
public void updateServerStats(ServerName serverName, byte[] regionName,
Object r) {
if (!(r instanceof Result)) {
return;
}
Result result = (Result) r;
ClientProtos.RegionLoadStats stats = result.getStats();
if(stats == null){
return;
}
String name = serverName.getServerName() + "," + Bytes.toStringBinary(regionName);
ConcurrentMap<byte[], RegionStats> rsStats = null;
if (serverStats.containsKey(serverName)) {
rsStats = serverStats.get(serverName);
} else {
rsStats = serverStats.putIfAbsent(serverName,
new ConcurrentSkipListMap<byte[], RegionStats>(Bytes.BYTES_COMPARATOR));
if (rsStats == null) {
rsStats = serverStats.get(serverName);
}
}
RegionStats regionStats = null;
if (rsStats.containsKey(regionName)) {
regionStats = rsStats.get(regionName);
} else {
regionStats = rsStats.putIfAbsent(regionName, new RegionStats(this.registry, name));
if (regionStats == null) {
regionStats = rsStats.get(regionName);
}
}
regionStats.update(stats);
}