Introduces a sync point for all outstanding RPCs. All RPCs known to this RegionClient, whether they are buffered, in flight, pending, etc., will get grouped together in the Deferred returned, thereby introducing a sync point past which we can guarantee that all RPCs have completed (succe
()
| 424 | * everything that was buffered at the time of the call has been flushed. |
| 425 | */ |
| 426 | Deferred<Object> sync() { |
| 427 | flush(); |
| 428 | |
| 429 | ArrayList<Deferred<Object>> rpcs = getInflightRpcs(); // Never null. |
| 430 | // There are only two cases to handle here thanks to the invariant that |
| 431 | // says that if we inflight isn't empty, then pending is null. |
| 432 | if (rpcs.isEmpty()) { |
| 433 | rpcs = getPendingRpcs(); |
| 434 | } |
| 435 | |
| 436 | if (rpcs == null) { |
| 437 | return Deferred.fromResult(null); |
| 438 | } |
| 439 | @SuppressWarnings("unchecked") |
| 440 | final Deferred<Object> sync = (Deferred) Deferred.group(rpcs); |
| 441 | return sync; |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * Returns a possibly empty list of all the RPCs that are in-flight. |
no test coverage detected