Examples of RegionAction


Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction

    org.apache.hadoop.hbase.client.MultiResponse results =
      new org.apache.hadoop.hbase.client.MultiResponse();

    for (int i = 0; i < responseRegionActionResultCount; i++) {
      RegionAction actions = request.getRegionAction(i);
      RegionActionResult actionResult = response.getRegionActionResult(i);
      byte[] regionName = actions.getRegion().toByteArray();

      if (actionResult.hasException()){
        Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
        for (ClientProtos.Action a : actions.getActionList()){
          results.add(regionName, new Pair<Integer, Object>(a.getIndex(), regionException));
        }
        continue;
      }

      if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
        throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
            ", actionResult.getResultOrExceptionCount=" +
            actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
      }

      for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
        if (roe.hasException()) {
          results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
              ProtobufUtil.toException(roe.getException())));
        } else if (roe.hasResult()) {
          results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
              ProtobufUtil.toResult(roe.getResult(), cells)));
        } else {
          // no result & no exception. Unexpected.
          throw new IllegalStateException("No result & no exception roe=" + roe +
              " for region " + actions.getRegion());
        }
      }
    }

    return results;
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction

    org.apache.hadoop.hbase.client.MultiResponse results =
      new org.apache.hadoop.hbase.client.MultiResponse();

    for (int i = 0; i < responseRegionActionResultCount; i++) {
      RegionAction actions = request.getRegionAction(i);
      RegionActionResult actionResult = response.getRegionActionResult(i);
      HBaseProtos.RegionSpecifier rs = actions.getRegion();
      if (rs.hasType() &&
          (rs.getType() != HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)){
        throw new IllegalArgumentException(
            "We support only encoded types for protobuf multi response.");
      }
      byte[] regionName = rs.getValue().toByteArray();

      if (actionResult.hasException()){
        Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
        results.addException(regionName, regionException);
        continue;
      }

      if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
        throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
            ", actionResult.getResultOrExceptionCount=" +
            actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
      }

      for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
        if (roe.hasException()) {
          results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
              ProtobufUtil.toException(roe.getException())));
        } else if (roe.hasResult()) {
          results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
              ProtobufUtil.toResult(roe.getResult(), cells)));
        } else {
          // no result & no exception. Unexpected.
          throw new IllegalStateException("No result & no exception roe=" + roe +
              " for region " + actions.getRegion());
        }
      }
    }

    return results;
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction

          regionActionBuilder, actionBuilder, mutationBuilder);
      } else {
        regionActionBuilder = RequestConverter.buildRegionAction(regionName, actions,
          regionActionBuilder, actionBuilder, mutationBuilder);
      }
      RegionAction ra = regionActionBuilder.build();
      multiRequestBuilder.addRegionAction(ra);
    }
    // Controller optionally carries cell data over the proxy/service boundary and also
    // optionally ferries cell response data back out again.
    PayloadCarryingRpcController controller = new PayloadCarryingRpcController(cells);
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction

    org.apache.hadoop.hbase.client.MultiResponse results =
      new org.apache.hadoop.hbase.client.MultiResponse();

    for (int i = 0; i < responseRegionActionResultCount; i++) {
      RegionAction actions = request.getRegionAction(i);
      RegionActionResult actionResult = response.getRegionActionResult(i);
      HBaseProtos.RegionSpecifier rs = actions.getRegion();
      if (rs.hasType() &&
          (rs.getType() != HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)){
        throw new IllegalArgumentException(
            "We support only encoded types for protobuf multi response.");
      }
      byte[] regionName = rs.getValue().toByteArray();

      if (actionResult.hasException()) {
        Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
        results.addException(regionName, regionException);
        continue;
      }

      if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
        throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
            ", actionResult.getResultOrExceptionCount=" +
            actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
      }

      for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
        if (roe.hasException()) {
          results.add(regionName, roe.getIndex(), ProtobufUtil.toException(roe.getException()));
        } else if (roe.hasResult()) {
          results.add(regionName, roe.getIndex(), ProtobufUtil.toResult(roe.getResult(), cells));
        } else if (roe.hasServiceResult()) {
          results.add(regionName, roe.getIndex(), roe.getServiceResult());
        } else {
          // no result & no exception. Unexpected.
          throw new IllegalStateException("No result & no exception roe=" + roe +
              " for region " + actions.getRegion());
        }
      }
    }

    return results;
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction

    org.apache.hadoop.hbase.client.MultiResponse results =
      new org.apache.hadoop.hbase.client.MultiResponse();

    for (int i = 0; i < responseRegionActionResultCount; i++) {
      RegionAction actions = request.getRegionAction(i);
      RegionActionResult actionResult = response.getRegionActionResult(i);
      HBaseProtos.RegionSpecifier rs = actions.getRegion();
      if (rs.hasType() &&
          (rs.getType() != HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)){
        throw new IllegalArgumentException(
            "We support only encoded types for protobuf multi response.");
      }
      byte[] regionName = rs.getValue().toByteArray();

      if (actionResult.hasException()) {
        Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
        results.addException(regionName, regionException);
        continue;
      }

      if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
        throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
            ", actionResult.getResultOrExceptionCount=" +
            actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
      }

      for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
        if (roe.hasException()) {
          results.add(regionName, roe.getIndex(), ProtobufUtil.toException(roe.getException()));
        } else if (roe.hasResult()) {
          results.add(regionName, roe.getIndex(), ProtobufUtil.toResult(roe.getResult(), cells));
        } else if (roe.hasServiceResult()) {
          results.add(regionName, roe.getIndex(), roe.getServiceResult());
        } else {
          // no result & no exception. Unexpected.
          throw new IllegalStateException("No result & no exception roe=" + roe +
              " for region " + actions.getRegion());
        }
      }
    }

    return results;
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionAction

    org.apache.hadoop.hbase.client.MultiResponse results =
      new org.apache.hadoop.hbase.client.MultiResponse();

    for (int i = 0; i < responseRegionActionResultCount; i++) {
      RegionAction actions = request.getRegionAction(i);
      RegionActionResult actionResult = response.getRegionActionResult(i);
      HBaseProtos.RegionSpecifier rs = actions.getRegion();
      if (rs.hasType() &&
          (rs.getType() != HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)){
        throw new IllegalArgumentException(
            "We support only encoded types for protobuf multi response.");
      }
      byte[] regionName = rs.getValue().toByteArray();

      if (actionResult.hasException()){
        Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
        results.addException(regionName, regionException);
        continue;
      }

      if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
        throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
            ", actionResult.getResultOrExceptionCount=" +
            actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
      }

      for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
        if (roe.hasException()) {
          results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
              ProtobufUtil.toException(roe.getException())));
        } else if (roe.hasResult()) {
          results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
              ProtobufUtil.toResult(roe.getResult(), cells)));
        } else if (roe.hasServiceResult()) {
          results.add(regionName, roe.getIndex(), roe.getServiceResult());
        } else {
          // no result & no exception. Unexpected.
          throw new IllegalStateException("No result & no exception roe=" + roe +
              " for region " + actions.getRegion());
        }
      }
    }

    return results;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.