| 492 | } |
| 493 | |
| 494 | @Override |
| 495 | /** |
| 496 | * Compares two RPCs. |
| 497 | */ |
| 498 | public int compare(final BatchableRpc a, final BatchableRpc b) { |
| 499 | int d; |
| 500 | if ((d = Bytes.memcmp(a.getRegion().name(), b.getRegion().name())) != 0) { |
| 501 | return d; |
| 502 | } else if ((d = a.code() - b.code()) != 0) { // Sort by code before key. |
| 503 | // Note that DeleteRequest.code() < PutRequest.code() and this matters |
| 504 | // as the RegionServer processes deletes before puts, and we want to |
| 505 | // send RPCs in the same order as they will be processed. |
| 506 | return d; |
| 507 | } else if ((d = Bytes.memcmp(a.key, b.key)) != 0) { |
| 508 | return d; |
| 509 | } |
| 510 | return Bytes.memcmp(a.family(), b.family()); |
| 511 | } |
| 512 | |
| 513 | } |
| 514 | |