本文整理匯總了Java中org.apache.hadoop.hbase.ServerName.getHostname方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerName.getHostname方法的具體用法?Java ServerName.getHostname怎麽用?Java ServerName.getHostname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.ServerName
的用法示例。
在下文中一共展示了ServerName.getHostname方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: reorderBlocks
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
public void reorderBlocks(Configuration conf, LocatedBlocks lbs, String src)
throws IOException {
ServerName sn = DefaultWALProvider.getServerNameFromWALDirectoryName(conf, src);
if (sn == null) {
// It's not an WAL
return;
}
// Ok, so it's an WAL
String hostName = sn.getHostname();
if (LOG.isTraceEnabled()) {
LOG.trace(src +
" is an WAL file, so reordering blocks, last hostname will be:" + hostName);
}
// Just check for all blocks
for (LocatedBlock lb : lbs.getLocatedBlocks()) {
DatanodeInfo[] dnis = lb.getLocations();
if (dnis != null && dnis.length > 1) {
boolean found = false;
for (int i = 0; i < dnis.length - 1 && !found; i++) {
if (hostName.equals(dnis[i].getHostName())) {
// advance the other locations by one and put this one at the last place.
DatanodeInfo toLast = dnis[i];
System.arraycopy(dnis, i + 1, dnis, i, dnis.length - i - 1);
dnis[dnis.length - 1] = toLast;
found = true;
}
}
}
}
}
示例2: RpcChannelImplementation
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
/**
* @param channelOperationTimeout - the default timeout when no timeout is given
*/
protected RpcChannelImplementation(final AsyncRpcClient rpcClient,
final ServerName sn, final User ticket, int channelOperationTimeout) {
this.isa = new InetSocketAddress(sn.getHostname(), sn.getPort());
this.rpcClient = rpcClient;
this.ticket = ticket;
this.channelOperationTimeout = channelOperationTimeout;
}
示例3: BlockingRpcChannelImplementation
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
/**
* @param channelOperationTimeout - the default timeout when no timeout is given
*/
protected BlockingRpcChannelImplementation(final AbstractRpcClient rpcClient,
final ServerName sn, final User ticket, int channelOperationTimeout) {
this.isa = new InetSocketAddress(sn.getHostname(), sn.getPort());
this.rpcClient = rpcClient;
this.ticket = ticket;
this.channelOperationTimeout = channelOperationTimeout;
}
示例4: checkTableInfo
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
void checkTableInfo(TableInfoModel model) {
assertEquals(model.getName(), TABLE.getNameAsString());
Iterator<TableRegionModel> regions = model.getRegions().iterator();
assertTrue(regions.hasNext());
while (regions.hasNext()) {
TableRegionModel region = regions.next();
boolean found = false;
for (HRegionLocation e: regionMap) {
HRegionInfo hri = e.getRegionInfo();
String hriRegionName = hri.getRegionNameAsString();
String regionName = region.getName();
if (hriRegionName.equals(regionName)) {
found = true;
byte[] startKey = hri.getStartKey();
byte[] endKey = hri.getEndKey();
ServerName serverName = e.getServerName();
InetSocketAddress sa =
new InetSocketAddress(serverName.getHostname(), serverName.getPort());
String location = sa.getHostName() + ":" +
Integer.valueOf(sa.getPort());
assertEquals(hri.getRegionId(), region.getId());
assertTrue(Bytes.equals(startKey, region.getStartKey()));
assertTrue(Bytes.equals(endKey, region.getEndKey()));
assertEquals(location, region.getLocation());
break;
}
}
assertTrue(found);
}
}
示例5: RegionMovedException
import org.apache.hadoop.hbase.ServerName; //導入方法依賴的package包/類
public RegionMovedException(ServerName serverName, long locationSeqNum) {
this.hostname = serverName.getHostname();
this.port = serverName.getPort();
this.startCode = serverName.getStartcode();
this.locationSeqNum = locationSeqNum;
}