Package-private access point for Scanners to close themselves. @param scanner The scanner to close. @return A deferred object that indicates the completion of the request. The Object has not special meaning and can be null.
(final Scanner scanner)
| 1614 | * The {@link Object} has not special meaning and can be {@code null}. |
| 1615 | */ |
| 1616 | Deferred<Object> closeScanner(final Scanner scanner) { |
| 1617 | final RegionInfo region = scanner.currentRegion(); |
| 1618 | final RegionClient client = clientFor(region); |
| 1619 | if (client == null) { |
| 1620 | // Oops, we no longer know anything about this client or region. Our |
| 1621 | // cache was probably invalidated while the client was scanning. So |
| 1622 | // we can't close this scanner properly. |
| 1623 | LOG.warn("Cannot close " + scanner + " properly, no connection open for " |
| 1624 | + Bytes.pretty(region == null ? null : region.name())); |
| 1625 | return Deferred.fromResult(null); |
| 1626 | } |
| 1627 | final HBaseRpc close_request = scanner.getCloseRequest(); |
| 1628 | final Deferred<Object> d = close_request.getDeferred(); |
| 1629 | client.sendRpc(close_request); |
| 1630 | return d; |
| 1631 | } |
| 1632 | |
| 1633 | /** |
| 1634 | * Atomically and durably increments a value in HBase. |
no test coverage detected