(boolean end)
| 934 | } |
| 935 | |
| 936 | private Deferred<ArrayList<ArrayList<KeyValue>>> scanFinished(boolean end) { |
| 937 | final byte[] region_stop_key = region.stopKey(); |
| 938 | final byte[] region_start_key = RegionInfo.startKeyFromRegionName( |
| 939 | region.name()); |
| 940 | // Check to see if this region is the last we should scan (either |
| 941 | // because (1) it's the last region or (3) because its stop_key is |
| 942 | // greater than or equal to the stop_key of this scanner provided |
| 943 | // that (2) we're not trying to scan until the end of the table). |
| 944 | // or if the scanner is reversed, (4) it's the first region or |
| 945 | // (6) scanner is in reverse and stop_key is after the region start_key |
| 946 | // provided that (5) we are not trying to scan until the beginning. |
| 947 | if ((!is_reversed && |
| 948 | (region_stop_key == EMPTY_ARRAY || // (1) |
| 949 | (stop_key != EMPTY_ARRAY && // (2) |
| 950 | Bytes.memcmp(stop_key, region_stop_key) <= 0 ))) // (3) |
| 951 | || (is_reversed && |
| 952 | (region_start_key == EMPTY_ARRAY || // (4) |
| 953 | (stop_key != EMPTY_ARRAY && // (5) |
| 954 | Bytes.memcmp(stop_key, region_start_key) >= 0)))){ // (6) |
| 955 | |
| 956 | get_next_rows_request = null; // free(); |
| 957 | families = null; // free(); |
| 958 | qualifiers = null; // free(); |
| 959 | start_key = stop_key = EMPTY_ARRAY; // free() but mustn't be null. |
| 960 | if (end) { |
| 961 | return Deferred.fromResult(null); // The server already closed the scanner for us. |
| 962 | } |
| 963 | return close() // Auto-close the scanner. |
| 964 | .addCallback(new Callback<ArrayList<ArrayList<KeyValue>>, Object>() { |
| 965 | public ArrayList<ArrayList<KeyValue>> call(final Object arg) { |
| 966 | return null; // Tell the user there's nothing more to scan. |
| 967 | } |
| 968 | public String toString() { |
| 969 | return "auto-close scanner " + Bytes.hex(scanner_id); |
| 970 | } |
| 971 | }); |
| 972 | } |
| 973 | return continueScanOnNextRegion(); |
| 974 | } |
| 975 | |
| 976 | /** |
| 977 | * Continues scanning on the next region. |
no test coverage detected