Java 类org.apache.hadoop.hbase.regionserver.RowProcessor 实例源码

项目:ditb    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to region to process multiple rows atomically.
 * 
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor 
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, ProcessRequest request,
    RpcCallback<ProcessResponse> done) {
  ProcessResponse resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    Region region = env.getRegion();
    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
    long nonce = request.hasNonce() ? request.getNonce() : HConstants.NO_NONCE;
    region.processRowsWithLocks(processor, nonceGroup, nonce);
    T result = processor.getResult();
    ProcessResponse.Builder b = ProcessResponse.newBuilder();
    b.setRowProcessorResult(result.toByteString());
    resultProto = b.build();
  } catch (Exception e) {
    ResponseConverter.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:pbase    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to HRegion to process multiple rows atomically.
 * 
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor 
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, ProcessRequest request,
    RpcCallback<ProcessResponse> done) {
  ProcessResponse resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    HRegion region = env.getRegion();
    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
    long nonce = request.hasNonce() ? request.getNonce() : HConstants.NO_NONCE;
    region.processRowsWithLocks(processor, nonceGroup, nonce);
    T result = processor.getResult();
    ProcessResponse.Builder b = ProcessResponse.newBuilder();
    b.setRowProcessorResult(result.toByteString());
    resultProto = b.build();
  } catch (Exception e) {
    ResponseConverter.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:HIndex    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to HRegion to process multiple rows atomically.
 * 
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor 
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, ProcessRequest request,
    RpcCallback<ProcessResponse> done) {
  ProcessResponse resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    HRegion region = env.getRegion();
    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
    long nonce = request.hasNonce() ? request.getNonce() : HConstants.NO_NONCE;
    region.processRowsWithLocks(processor, nonceGroup, nonce);
    T result = processor.getResult();
    ProcessResponse.Builder b = ProcessResponse.newBuilder();
    b.setRowProcessorResult(result.toByteString());
    resultProto = b.build();
  } catch (Exception e) {
    ResponseConverter.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:hbase    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to region to process multiple rows atomically.
 *
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, ProcessRequest request,
    RpcCallback<ProcessResponse> done) {
  ProcessResponse resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    Region region = env.getRegion();
    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
    long nonce = request.hasNonce() ? request.getNonce() : HConstants.NO_NONCE;
    region.processRowsWithLocks(processor, nonceGroup, nonce);
    T result = processor.getResult();
    ProcessResponse.Builder b = ProcessResponse.newBuilder();
    b.setRowProcessorResult(result.toByteString());
    resultProto = b.build();
  } catch (Exception e) {
    CoprocessorRpcUtils.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:PyroDB    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to HRegion to process multiple rows atomically.
 * 
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor 
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, ProcessRequest request,
    RpcCallback<ProcessResponse> done) {
  ProcessResponse resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    HRegion region = env.getRegion();
    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
    long nonce = request.hasNonce() ? request.getNonce() : HConstants.NO_NONCE;
    region.processRowsWithLocks(processor, nonceGroup, nonce);
    T result = processor.getResult();
    ProcessResponse.Builder b = ProcessResponse.newBuilder();
    b.setRowProcessorResult(result.toByteString());
    resultProto = b.build();
  } catch (Exception e) {
    ResponseConverter.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:c5    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to HRegion to process multiple rows atomically.
 * 
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor 
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, ProcessRequest request,
    RpcCallback<ProcessResponse> done) {
  ProcessResponse resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    HRegion region = env.getRegion();
    region.processRowsWithLocks(processor);
    T result = processor.getResult();
    ProcessResponse.Builder b = ProcessResponse.newBuilder();
    b.setRowProcessorResult(result.toByteString());
    resultProto = b.build();
  } catch (Exception e) {
    ResponseConverter.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:DominoHBase    文件:BaseRowProcessorEndpoint.java   
/**
 * Pass a processor to HRegion to process multiple rows atomically.
 * 
 * The RowProcessor implementations should be the inner classes of your
 * RowProcessorEndpoint. This way the RowProcessor can be class-loaded with
 * the Coprocessor endpoint together.
 *
 * See {@code TestRowProcessorEndpoint} for example.
 *
 * The request contains information for constructing processor 
 * (see {@link #constructRowProcessorFromRequest}. The processor object defines
 * the read-modify-write procedure.
 */
@Override
public void process(RpcController controller, RowProcessorRequest request,
    RpcCallback<RowProcessorResult> done) {
  RowProcessorResult resultProto = null;
  try {
    RowProcessor<S,T> processor = constructRowProcessorFromRequest(request);
    HRegion region = env.getRegion();
    region.processRowsWithLocks(processor);
    T result = processor.getResult();
    RowProcessorResult.Builder b = RowProcessorResult.newBuilder();
    b.setRowProcessorResult(result.toByteString()); 
    resultProto = b.build();
  } catch (Exception e) {
    ResponseConverter.setControllerException(controller, new IOException(e));
  }
  done.run(resultProto);
}
项目:ditb    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
ProcessRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final ProcessRequest.Builder requestBuilder =
      ProcessRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}
项目:pbase    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
ProcessRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final ProcessRequest.Builder requestBuilder =
      ProcessRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}
项目:HIndex    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
ProcessRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final ProcessRequest.Builder requestBuilder =
      ProcessRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}
项目:hbase    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
ProcessRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final ProcessRequest.Builder requestBuilder =
      ProcessRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}
项目:PyroDB    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
ProcessRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final ProcessRequest.Builder requestBuilder =
      ProcessRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}
项目:c5    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
ProcessRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final ProcessRequest.Builder requestBuilder =
      ProcessRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}
项目:DominoHBase    文件:RowProcessorClient.java   
public static <S extends Message, T extends Message>
RowProcessorRequest getRowProcessorPB(RowProcessor<S,T> r)
    throws IOException {
  final RowProcessorRequest.Builder requestBuilder =
      RowProcessorRequest.newBuilder();
  requestBuilder.setRowProcessorClassName(r.getClass().getName());
  S s = r.getRequestData();
  if (s != null) {
    requestBuilder.setRowProcessorInitializerMessageName(s.getClass().getName());
    requestBuilder.setRowProcessorInitializerMessage(s.toByteString());
  }
  return requestBuilder.build();
}