Package org.hbase.async.generated.ClientPB

Examples of org.hbase.async.generated.ClientPB.RegionActionResult


    final int nrpcs = batch.size();
    final Object[] resps = new Object[nrpcs];
    int n = 0// Index in `batch'.
    int r = 0// Index in `regionActionResult' in the PB.
    while (n < nrpcs) {
      final RegionActionResult results = resp.getRegionActionResult(r++);
      final int nresults = results.getResultOrExceptionCount();
      if (results.hasException()) {
        if (nresults != 0) {
          throw new InvalidResponseException("All edits in a batch failed yet"
                                             + " we found " + nresults
                                             + " results", results);
        }
        // All the edits for this region have failed, however the PB doesn't
        // tell us how many edits there were for that region, and we don't
        // keep track of this information except temporarily during
        // serialization.  So we need to go back through our list again to
        // re-count how many we did put together in this batch, so we can fail
        // all those RPCs.
        int last_edit = n + 1; // +1 because we have at least 1 edit.
        final byte[] region_name = batch.get(n).getRegion().name();
        while (last_edit < nrpcs
               && Bytes.equals(region_name,
                               batch.get(last_edit).getRegion().name())) {
          last_edit++;
        }
        final NameBytesPair pair = results.getException();
        for (int j = n; j < last_edit; j++) {
          resps[j] = RegionClient.decodeExceptionPair(batch.get(j), pair);
        }
        n = last_edit;
        continue// This batch failed, move on.
      // else: parse out the individual results:
      for (int j = 0; j < nresults; j++) {
        final ResultOrException roe = results.getResultOrException(j);
        final int index = roe.getIndex();
        if (index != n) {
          throw new InvalidResponseException("Expected result #" + n
                                             + " but got result #" + index,
                                             results);
View Full Code Here

TOP

Related Classes of org.hbase.async.generated.ClientPB.RegionActionResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.