Ejemplo n.º 1
0
 /**
  * Wrap a throwable to an action result.
  *
  * @param r
  * @return an action result builder
  */
 public static ResultOrException.Builder buildActionResult(
     final ClientProtos.Result r, ClientProtos.RegionLoadStats stats) {
   ResultOrException.Builder builder = ResultOrException.newBuilder();
   if (r != null) builder.setResult(r);
   if (stats != null) builder.setLoadStats(stats);
   return builder;
 }
Ejemplo n.º 2
0
 static MultiResponse doMultiResponse(
     final SortedMap<byte[], Pair<HRegionInfo, ServerName>> meta,
     final AtomicLong sequenceids,
     final MultiRequest request) {
   // Make a response to match the request.  Act like there were no failures.
   ClientProtos.MultiResponse.Builder builder = ClientProtos.MultiResponse.newBuilder();
   // Per Region.
   RegionActionResult.Builder regionActionResultBuilder = RegionActionResult.newBuilder();
   ResultOrException.Builder roeBuilder = ResultOrException.newBuilder();
   for (RegionAction regionAction : request.getRegionActionList()) {
     regionActionResultBuilder.clear();
     // Per Action in a Region.
     for (ClientProtos.Action action : regionAction.getActionList()) {
       roeBuilder.clear();
       // Return empty Result and proper index as result.
       roeBuilder.setResult(ClientProtos.Result.getDefaultInstance());
       roeBuilder.setIndex(action.getIndex());
       regionActionResultBuilder.addResultOrException(roeBuilder.build());
     }
     builder.addRegionActionResult(regionActionResultBuilder.build());
   }
   return builder.build();
 }
Ejemplo n.º 3
0
 /**
  * Wrap a throwable to an action result.
  *
  * @param t
  * @return an action result builder
  */
 public static ResultOrException.Builder buildActionResult(final Throwable t) {
   ResultOrException.Builder builder = ResultOrException.newBuilder();
   if (t != null) builder.setException(buildException(t));
   return builder;
 }