コード例 #1
0
ファイル: DominoEndpoint.java プロジェクト: felix-zz/domino
 private HTableInterface getTrxMetaTable() throws IOException {
   HTableInterface meta = metaTable.get();
   if (meta != null) {
     return meta;
   }
   synchronized (metaTable) {
     meta = metaTable.get();
     if (meta != null) {
       return meta;
     }
     HBaseAdmin admin = new HBaseAdmin(conf);
     if (!admin.tableExists(DominoConst.TRANSACTION_META)) {
       while (true) {
         try {
           admin.createTable(DominoConst.TRANSACTION_META_DESCRIPTOR);
         } catch (PleaseHoldException phe) {
           LOG.info("Failed to create transaction meta table: Got a PleaseHoldException.");
           try {
             Thread.sleep(200);
           } catch (InterruptedException ie) {
             break;
           }
           continue;
         } catch (IOException e) {
           LOG.warn("Failed to create transaction meta table. ", e);
         }
         break;
       }
     }
     admin.close();
     try {
       meta = env.getTable(DominoConst.TRANSACTION_META.getBytes(DominoConst.META_CHARSET));
       metaTable.set(meta);
     } catch (IOException e) {
       LOG.error("Failed to open transaction meta table: {}.", e.toString());
       throw e;
     }
   }
   return meta;
 }