Java源码示例:org.apache.hadoop.hbase.HConstants.OperationStatusCode

示例1
/**
 * 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
@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);
    }
  }
}
 
示例3
@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
public OperationStatus(OperationStatusCode code) {
  this(code, "");
}
 
示例5
public OperationStatus(OperationStatusCode code, String exceptionMsg) {
  this.code = code;
  this.exceptionMsg = exceptionMsg;
}
 
示例6
public OperationStatus(OperationStatusCode code, Exception e) {
  this.code = code;
  this.exceptionMsg = (e == null) ? "" : e.getClass().getName() + ": " + e.getMessage();
}
 
示例7
/**
 * @return OperationStatusCode
 */
public OperationStatusCode getOperationStatusCode() {
  return code;
}