Callback+Errback invoked when the RegionServer closed our scanner.
()
| 899 | |
| 900 | /** Callback+Errback invoked when the RegionServer closed our scanner. */ |
| 901 | private Callback<Object, Object> closedCallback() { |
| 902 | return new Callback<Object, Object>() { |
| 903 | public Object call(Object arg) { |
| 904 | if (arg instanceof Exception) { |
| 905 | final Exception error = (Exception) arg; |
| 906 | // NotServingRegionException: |
| 907 | // If the region isn't serving, then our scanner is already broken |
| 908 | // somehow, because while it's open it holds a read lock on the |
| 909 | // region, which prevents it from splitting (among other things). |
| 910 | // So if we get this error, our scanner is already dead anyway. |
| 911 | // UnknownScannerException: |
| 912 | // If this region doesn't know anything about this scanner then we |
| 913 | // don't have anything to do to close it! |
| 914 | if (error instanceof NotServingRegionException |
| 915 | || error instanceof UnknownScannerException) { |
| 916 | if (LOG.isDebugEnabled()) { |
| 917 | LOG.debug("Ignoring exception when closing " + Scanner.this, |
| 918 | error); |
| 919 | } |
| 920 | arg = null; // Clear the error. |
| 921 | } // else: the `return arg' below will propagate the error. |
| 922 | } else if (LOG.isDebugEnabled()) { |
| 923 | LOG.debug("Scanner " + Bytes.hex(scanner_id) + " closed on " |
| 924 | + region); |
| 925 | } |
| 926 | region = DONE; |
| 927 | scanner_id = 0xDEAD000CC000DEADL; // Make debugging easier. |
| 928 | return arg; |
| 929 | } |
| 930 | public String toString() { |
| 931 | return "scanner closed"; |
| 932 | } |
| 933 | }; |
| 934 | } |
| 935 | |
| 936 | private Deferred<ArrayList<ArrayList<KeyValue>>> scanFinished(boolean end) { |
| 937 | final byte[] region_stop_key = region.stopKey(); |