示例#1
0
 static boolean isOneOfStates(RegionState regionState, State... states) {
   State s = regionState != null ? regionState.getState() : null;
   for (State state : states) {
     if (s == state) return true;
   }
   return false;
 }
示例#2
0
 /**
  * Gets current state of all regions of the table. This method looks at the in-memory state. It
  * does not go to <code>hbase:meta</code>. Method guaranteed to return keys for all states in
  * {@link org.apache.hadoop.hbase.master.RegionState.State}
  *
  * @param tableName
  * @return Online regions from <code>tableName</code>
  */
 public synchronized Map<RegionState.State, List<HRegionInfo>> getRegionByStateOfTable(
     TableName tableName) {
   Map<RegionState.State, List<HRegionInfo>> tableRegions =
       new HashMap<State, List<HRegionInfo>>();
   for (State state : State.values()) {
     tableRegions.put(state, new ArrayList<HRegionInfo>());
   }
   Map<String, RegionState> indexMap = regionStatesTableIndex.get(tableName);
   if (indexMap == null) return tableRegions;
   for (RegionState regionState : indexMap.values()) {
     tableRegions.get(regionState.getState()).add(regionState.getRegion());
   }
   return tableRegions;
 }