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


Java HTableDescriptor.equals方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.HTableDescriptor.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java HTableDescriptor.equals方法的具體用法?Java HTableDescriptor.equals怎麽用?Java HTableDescriptor.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.HTableDescriptor的用法示例。


在下文中一共展示了HTableDescriptor.equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: modifyTableSync

import org.apache.hadoop.hbase.HTableDescriptor; //導入方法依賴的package包/類
private void modifyTableSync(Admin admin, TableName tableName, HTableDescriptor htd)
    throws IOException {
  admin.modifyTable(tableName, htd);
  //wait until modify table finishes
  for (int t = 0; t < 100; t++) { //10 sec timeout
    HTableDescriptor td = admin.getTableDescriptor(htd.getTableName());
    if (td.equals(htd)) {
      break;
    }
    Threads.sleep(100);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:13,代碼來源:TestMasterObserver.java

示例2: checkAndSyncTableDescToPeers

import org.apache.hadoop.hbase.HTableDescriptor; //導入方法依賴的package包/類
/**
 * Connect to peer and check the table descriptor on peer:
 * <ol>
 * <li>Create the same table on peer when not exist.</li>
 * <li>Throw exception if the table exists on peer cluster but descriptors are not same.</li>
 * </ol>
 * @param tableName name of the table to sync to the peer
 * @param splits table split keys
 * @throws IOException
 */
private void checkAndSyncTableDescToPeers(final TableName tableName, final byte[][] splits)
    throws IOException {
  List<ReplicationPeer> repPeers = listReplicationPeers();
  if (repPeers == null || repPeers.size() <= 0) {
    throw new IllegalArgumentException("Found no peer cluster for replication.");
  }
  
  final TableName onlyTableNameQualifier = TableName.valueOf(tableName.getQualifierAsString());
  
  for (ReplicationPeer repPeer : repPeers) {
    Map<TableName, List<String>> tableCFMap = repPeer.getTableCFs();
    // TODO Currently peer TableCFs will not include namespace so we need to check only for table
    // name without namespace in it. Need to correct this logic once we fix HBASE-11386.
    if (tableCFMap != null && !tableCFMap.containsKey(onlyTableNameQualifier)) {
      continue;
    }

    Configuration peerConf = repPeer.getConfiguration();
    HTableDescriptor htd = null;
    try (Connection conn = ConnectionFactory.createConnection(peerConf);
        Admin admin = this.connection.getAdmin();
        Admin repHBaseAdmin = conn.getAdmin()) {
      htd = admin.getTableDescriptor(tableName);
      HTableDescriptor peerHtd = null;
      if (!repHBaseAdmin.tableExists(tableName)) {
        repHBaseAdmin.createTable(htd, splits);
      } else {
        peerHtd = repHBaseAdmin.getTableDescriptor(tableName);
        if (peerHtd == null) {
          throw new IllegalArgumentException("Failed to get table descriptor for table "
              + tableName.getNameAsString() + " from peer cluster " + repPeer.getId());
        } else if (!peerHtd.equals(htd)) {
          throw new IllegalArgumentException("Table " + tableName.getNameAsString()
              + " exists in peer cluster " + repPeer.getId()
              + ", but the table descriptors are not same when comapred with source cluster."
              + " Thus can not enable the table's replication switch.");
        }
      }
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:52,代碼來源:ReplicationAdmin.java


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