本文整理了Java中org.apache.hadoop.hbase.net.Address.equals()
方法的一些代码示例,展示了Address.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.equals()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.net.Address
类名称:Address
方法名:equals
暂无
代码示例来源:origin: apache/hbase
/**
* @return List of Regions associated with this <code>server</code>.
*/
private List<RegionInfo> getRegions(final Address server) {
LinkedList<RegionInfo> regions = new LinkedList<>();
for (Map.Entry<RegionInfo, ServerName> el :
master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) {
if (el.getValue() == null) {
continue;
}
if (el.getValue().getAddress().equals(server)) {
addRegion(regions, el.getKey());
}
}
for (RegionStateNode state : master.getAssignmentManager().getRegionsInTransition()) {
if (state.getRegionLocation().getAddress().equals(server)) {
addRegion(regions, state.getRegionInfo());
}
}
return regions;
}
代码示例来源:origin: apache/hbase
/**
* The server name in group does not contain the start code, this method will find out the start
* code and construct the ServerName object.
*/
protected ServerName getServerName(Address addr) {
return TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().stream()
.map(t -> t.getRegionServer().getServerName()).filter(sn -> sn.getAddress().equals(addr))
.findFirst().get();
}
代码示例来源:origin: apache/hbase
if (!oldAssignedServer.getAddress().equals(currentServer.getAddress())) {
assertFalse(gInfo.containsServer(oldAssignedServer.getAddress()));
代码示例来源:origin: apache/hbase
protected ArrayListMultimap<String, ServerAndLoad> convertToGroupBasedMap(
final Map<ServerName, List<RegionInfo>> serversMap) throws IOException {
ArrayListMultimap<String, ServerAndLoad> loadMap = ArrayListMultimap
.create();
for (RSGroupInfo gInfo : getMockedGroupInfoManager().listRSGroups()) {
Set<Address> groupServers = gInfo.getServers();
for (Address hostPort : groupServers) {
ServerName actual = null;
for(ServerName entry: servers) {
if(entry.getAddress().equals(hostPort)) {
actual = entry;
break;
}
}
List<RegionInfo> regions = serversMap.get(actual);
assertTrue("No load for " + actual, regions != null);
loadMap.put(gInfo.getName(),
new ServerAndLoad(actual, regions.size()));
}
}
return loadMap;
}
代码示例来源:origin: apache/hbase
/**
* Call this restart method only after running MockMasterServices#start()
* The RSs can be differentiated by the port number, see
* ServerName in MockMasterServices#start() method above.
* Restart of region server will have new startcode in server name
*
* @param serverName Server name to be restarted
*/
public void restartRegionServer(ServerName serverName) throws IOException {
List<ServerName> onlineServers = serverManager.getOnlineServersList();
long startCode = -1;
for (ServerName s : onlineServers) {
if (s.getAddress().equals(serverName.getAddress())) {
startCode = s.getStartcode() + 1;
break;
}
}
if (startCode == -1) {
return;
}
ServerName sn = ServerName.valueOf(serverName.getAddress().toString(), startCode);
serverManager.regionServerReport(sn, ServerMetricsBuilder.of(sn));
}
代码示例来源:origin: com.aliyun.hbase/alihbase-rsgroup
for (Address sName : info.getServers()) {
for(ServerName curr: clusterState.keySet()) {
if(curr.getAddress().equals(sName)) {
groupClusterState.put(curr, correctedState.get(curr));
代码示例来源:origin: org.apache.hbase/hbase-rsgroup
/**
* @return List of Regions associated with this <code>server</code>.
*/
private List<RegionInfo> getRegions(final Address server) {
LinkedList<RegionInfo> regions = new LinkedList<>();
for (Map.Entry<RegionInfo, ServerName> el :
master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) {
if (el.getValue() == null) {
continue;
}
if (el.getValue().getAddress().equals(server)) {
addRegion(regions, el.getKey());
}
}
for (RegionStateNode state : master.getAssignmentManager().getRegionsInTransition()) {
if (state.getRegionLocation().getAddress().equals(server)) {
addRegion(regions, state.getRegionInfo());
}
}
return regions;
}
代码示例来源:origin: com.aliyun.hbase/alihbase-rsgroup
/**
* @return List of Regions associated with this <code>server</code>.
*/
private List<RegionInfo> getRegions(final Address server) {
LinkedList<RegionInfo> regions = new LinkedList<>();
for (Map.Entry<RegionInfo, ServerName> el :
master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) {
if (el.getValue() == null) {
continue;
}
if (el.getValue().getAddress().equals(server)) {
addRegion(regions, el.getKey());
}
}
for (RegionStateNode state : master.getAssignmentManager().getRegionsInTransition()) {
if (state.getRegionLocation().getAddress().equals(server)) {
addRegion(regions, state.getRegionInfo());
}
}
return regions;
}
代码示例来源:origin: org.apache.hbase/hbase-rsgroup
if (!oldAssignedServer.getAddress().equals(currentServer.getAddress())) {
assertFalse(gInfo.containsServer(oldAssignedServer.getAddress()));
代码示例来源:origin: org.apache.hbase/hbase-rsgroup
private ArrayListMultimap<String, ServerAndLoad> convertToGroupBasedMap(
final Map<ServerName, List<RegionInfo>> serversMap) throws IOException {
ArrayListMultimap<String, ServerAndLoad> loadMap = ArrayListMultimap
.create();
for (RSGroupInfo gInfo : getMockedGroupInfoManager().listRSGroups()) {
Set<Address> groupServers = gInfo.getServers();
for (Address hostPort : groupServers) {
ServerName actual = null;
for(ServerName entry: servers) {
if(entry.getAddress().equals(hostPort)) {
actual = entry;
break;
}
}
List<RegionInfo> regions = serversMap.get(actual);
assertTrue("No load for " + actual, regions != null);
loadMap.put(gInfo.getName(),
new ServerAndLoad(actual, regions.size()));
}
}
return loadMap;
}
代码示例来源:origin: org.apache.hbase/hbase-server
/**
* Call this restart method only after running MockMasterServices#start()
* The RSs can be differentiated by the port number, see
* ServerName in MockMasterServices#start() method above.
* Restart of region server will have new startcode in server name
*
* @param serverName Server name to be restarted
*/
public void restartRegionServer(ServerName serverName) throws IOException {
List<ServerName> onlineServers = serverManager.getOnlineServersList();
long startCode = -1;
for (ServerName s : onlineServers) {
if (s.getAddress().equals(serverName.getAddress())) {
startCode = s.getStartcode() + 1;
break;
}
}
if (startCode == -1) {
return;
}
ServerName sn = ServerName.valueOf(serverName.getAddress().toString(), startCode);
serverManager.regionServerReport(sn, new ServerLoad(ServerMetricsBuilder.of(sn)));
}
内容来源于网络,如有侵权,请联系作者删除!