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


Java HBaseAdmin.disableTableAsync方法代碼示例

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


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

示例1: deleteTable

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
/**
 * delete table in preparation for next test
 * 
 * @param tablename
 * @throws IOException
 */
void deleteTable(String tablename) throws IOException {
  HBaseAdmin admin = new HBaseAdmin(conf);
  admin.getConnection().clearRegionCache();
  byte[] tbytes = Bytes.toBytes(tablename);
  if (admin.isTableEnabled(tbytes)) {
    admin.disableTableAsync(tbytes);
  }
  while (!admin.isTableDisabled(tbytes)) {
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
      e.printStackTrace();
      fail("Interrupted when trying to disable table " + tablename);
    }
  }
  admin.deleteTable(tbytes);
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:24,代碼來源:TestHBaseFsck.java

示例2: deleteTable

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
private void deleteTable(HBaseAdmin admin, HTableDescriptor htd)
  throws IOException, InterruptedException {
  // Use disableTestAsync because disable can take a long time to complete
  System.out.print("Disabling table " + htd.getNameAsString() +" ");
  admin.disableTableAsync(htd.getName());

  long start = System.currentTimeMillis();
  // NOTE tables can be both admin.isTableEnabled=false and
  // isTableDisabled=false, when disabling must use isTableDisabled!
  while (!admin.isTableDisabled(htd.getName())) {
    System.out.print(".");
    Thread.sleep(1000);
  }
  long delta = System.currentTimeMillis() - start;
  System.out.println(" " + delta +" ms");
  System.out.println("Deleting table " + htd.getNameAsString() +" ");
  admin.deleteTable(htd.getName());
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:19,代碼來源:IntegrationTestLoadAndVerify.java

示例3: deleteTable

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
/**
 * delete table in preparation for next test
 *
 * @param tablename
 * @throws IOException
 */
void deleteTable(TableName tablename) throws IOException {
  HBaseAdmin admin = new HBaseAdmin(conf);
  admin.getConnection().clearRegionCache();
  if (admin.isTableEnabled(tablename)) {
    admin.disableTableAsync(tablename);
  }
  long totalWait = 0;
  long maxWait = 30*1000;
  long sleepTime = 250;
  while (!admin.isTableDisabled(tablename)) {
    try {
      Thread.sleep(sleepTime);
      totalWait += sleepTime;
      if (totalWait >= maxWait) {
        fail("Waited too long for table to be disabled + " + tablename);
      }
    } catch (InterruptedException e) {
      e.printStackTrace();
      fail("Interrupted when trying to disable table " + tablename);
    }
  }
  admin.deleteTable(tablename);
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:30,代碼來源:TestHBaseFsck.java

示例4: deleteTable

import org.apache.hadoop.hbase.client.HBaseAdmin; //導入方法依賴的package包/類
public void deleteTable(String tableName) throws Exception, ZooKeeperConnectionException{
	HBaseAdmin ad = new HBaseAdmin(conf);
	if(ad.tableExists(tableName)){
		ad.disableTableAsync(tableName);
		ad.deleteTable(tableName);
		System.out.println("delete table:"+tableName+" successfully!!");
	}else{
		System.out.println("the table:"+tableName+" was deleted unsuccessfully!!");
		System.exit(0);
	}
}
 
開發者ID:xuxueli,項目名稱:xxl-incubator,代碼行數:12,代碼來源:HBaseJavaApi.java


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