當前位置: 首頁>>代碼示例>>Java>>正文


Java SwapRegionsAction類代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.SwapRegionsAction的典型用法代碼示例。如果您正苦於以下問題:Java SwapRegionsAction類的具體用法?Java SwapRegionsAction怎麽用?Java SwapRegionsAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SwapRegionsAction類屬於org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster包,在下文中一共展示了SwapRegionsAction類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAction

import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.SwapRegionsAction; //導入依賴的package包/類
protected Cluster.Action getAction (int fromServer, int fromRegion,
    int toServer, int toRegion) {
  if (fromServer < 0 || toServer < 0) {
    return Cluster.NullAction;
  }
  if (fromRegion > 0 && toRegion > 0) {
    return new Cluster.SwapRegionsAction(fromServer, fromRegion,
      toServer, toRegion);
  } else if (fromRegion > 0) {
    return new Cluster.MoveRegionAction(fromRegion, fromServer, toServer);
  } else if (toRegion > 0) {
    return new Cluster.MoveRegionAction(toRegion, toServer, fromServer);
  } else {
    return Cluster.NullAction;
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:17,代碼來源:StochasticLoadBalancer.java

示例2: postAction

import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.SwapRegionsAction; //導入依賴的package包/類
/** Called once per cluster Action to give the cost function
 * an opportunity to update it's state. postAction() is always
 * called at least once before cost() is called with the cluster
 * that this action is performed on. */
void postAction(Action action) {
  switch (action.type) {
  case NULL: break;
  case ASSIGN_REGION:
    AssignRegionAction ar = (AssignRegionAction) action;
    regionMoved(ar.region, -1, ar.server);
    break;
  case MOVE_REGION:
    MoveRegionAction mra = (MoveRegionAction) action;
    regionMoved(mra.region, mra.fromServer, mra.toServer);
    break;
  case SWAP_REGIONS:
    SwapRegionsAction a = (SwapRegionsAction) action;
    regionMoved(a.fromRegion, a.fromServer, a.toServer);
    regionMoved(a.toRegion, a.toServer, a.fromServer);
    break;
  default:
    throw new RuntimeException("Uknown action:" + action.type);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:25,代碼來源:StochasticLoadBalancer.java

示例3: getAction

import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.SwapRegionsAction; //導入依賴的package包/類
protected Cluster.Action getAction(int fromServer, int fromRegion,
    int toServer, int toRegion) {
  if (fromServer < 0 || toServer < 0) {
    return Cluster.NullAction;
  }
  if (fromRegion > 0 && toRegion > 0) {
    return new Cluster.SwapRegionsAction(fromServer, fromRegion,
      toServer, toRegion);
  } else if (fromRegion > 0) {
    return new Cluster.MoveRegionAction(fromRegion, fromServer, toServer);
  } else if (toRegion > 0) {
    return new Cluster.MoveRegionAction(toRegion, toServer, fromServer);
  } else {
    return Cluster.NullAction;
  }
}
 
開發者ID:apache,項目名稱:hbase,代碼行數:17,代碼來源:StochasticLoadBalancer.java


注:本文中的org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.SwapRegionsAction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。