De-serializes a MultiResponse. This is only used when talking to HBase 0.92 and above.
(final ChannelBuffer buf)
| 374 | * This is only used when talking to HBase 0.92 and above. |
| 375 | */ |
| 376 | ActionResp[] decodeMultiResponse(final ChannelBuffer buf) { |
| 377 | byte code = buf.readByte(); // this should be code of MultiResponse 67. |
| 378 | |
| 379 | final int nregions = buf.readInt(); // num regions |
| 380 | HBaseRpc.checkNonEmptyArrayLength(buf, nregions); |
| 381 | final ActionResp[] resps = new ActionResp[batch.size()]; |
| 382 | int n = 0; |
| 383 | for (int i = 0; i < nregions; i++) { |
| 384 | final byte[] region_name = HBaseRpc.readByteArray(buf); // region name |
| 385 | final int nrpcs = buf.readInt(); // rpcs in this region. |
| 386 | HBaseRpc.checkNonEmptyArrayLength(buf, nrpcs); |
| 387 | for (int j = 0; j < nrpcs; j++) { |
| 388 | final int nrpcs_index = buf.readInt(); // index of this rpc as passed to the server. |
| 389 | final ActionEntry entry = batch.get(nrpcs_index); |
| 390 | boolean error = buf.readByte() != 0x00; // success code. |
| 391 | Object resp; // Response for the current region. |
| 392 | if (error) { |
| 393 | final HBaseException e = RegionClient.deserializeException(buf, entry.rpc); |
| 394 | resp = e; |
| 395 | } else { |
| 396 | resp = RegionClient.deserializeObject(buf, this); |
| 397 | if (resp == null) { |
| 398 | // This is NSRE |
| 399 | resp = new NotServingRegionException( |
| 400 | "Not serving region: " + Bytes.pretty(region_name), entry.rpc); |
| 401 | } |
| 402 | } |
| 403 | resps[n++] = new ActionResp(resp, entry.order); |
| 404 | } |
| 405 | } |
| 406 | return resps; |
| 407 | } |
| 408 | } |
nothing calls this directly
no test coverage detected