类org.apache.hadoop.hbase.HConstants.OperationStatusCode源码实例Demo

下面列出了怎么用org.apache.hadoop.hbase.HConstants.OperationStatusCode的API类实例代码及写法,或者点击链接到github查看源代码。


/**
 * Adds the mutations to labels region and set the results to the finalOpStatus. finalOpStatus
 * might have some entries in it where the OpStatus is FAILURE. We will leave those and set in
 * others in the order.
 * @param mutations
 * @param finalOpStatus
 * @return whether we need a ZK update or not.
 */
private boolean mutateLabelsRegion(List<Mutation> mutations, OperationStatus[] finalOpStatus)
    throws IOException {
  OperationStatus[] opStatus = this.labelsRegion.batchMutate(mutations
    .toArray(new Mutation[mutations.size()]));
  int i = 0;
  boolean updateZk = false;
  for (OperationStatus status : opStatus) {
    // Update the zk when atleast one of the mutation was added successfully.
    updateZk = updateZk || (status.getOperationStatusCode() == OperationStatusCode.SUCCESS);
    for (; i < finalOpStatus.length; i++) {
      if (finalOpStatus[i] == null) {
        finalOpStatus[i] = status;
        break;
      }
    }
  }
  return updateZk;
}
 
源代码2 项目: hbase   文件: TestParallelPut.java

@Override
public void run() {
  byte[] value = new byte[100];
  Put[]  in = new Put[1];

  // iterate for the specified number of operations
  for (int i=0; i<numOps; i++) {
    // generate random bytes
    rand.nextBytes(value);

    // put the randombytes and verify that we can read it. This is one
    // way of ensuring that rwcc manipulation in HRegion.put() is fine.
    Put put = new Put(rowkey);
    put.addColumn(fam1, qual1, value);
    in[0] = put;
    try {
      OperationStatus[] ret = region.batchMutate(in);
      assertEquals(1, ret.length);
      assertEquals(OperationStatusCode.SUCCESS, ret[0].getOperationStatusCode());
      assertGet(this.region, rowkey, fam1, qual1, value);
    } catch (IOException e) {
      assertTrue("Thread id " + threadNumber + " operation " + i + " failed.",
                 false);
    }
  }
}
 

@Override
public OperationStatus[] addLabels(List<byte[]> labels) throws IOException {
  // Not doing specific label add. We will just add labels in Mutation
  // visibility expression as it
  // is along with every cell.
  OperationStatus[] status = new OperationStatus[labels.size()];
  for (int i = 0; i < labels.size(); i++) {
    status[i] = new OperationStatus(OperationStatusCode.SUCCESS);
  }
  return status;
}
 
源代码4 项目: hbase   文件: OperationStatus.java

public OperationStatus(OperationStatusCode code) {
  this(code, "");
}
 
源代码5 项目: hbase   文件: OperationStatus.java

public OperationStatus(OperationStatusCode code, String exceptionMsg) {
  this.code = code;
  this.exceptionMsg = exceptionMsg;
}
 
源代码6 项目: hbase   文件: OperationStatus.java

public OperationStatus(OperationStatusCode code, Exception e) {
  this.code = code;
  this.exceptionMsg = (e == null) ? "" : e.getClass().getName() + ": " + e.getMessage();
}
 
源代码7 项目: hbase   文件: OperationStatus.java

/**
 * @return OperationStatusCode
 */
public OperationStatusCode getOperationStatusCode() {
  return code;
}
 
 类所在包
 类方法
 同包方法