If one or more of the scanners throws an exception then we should close it and pass the exception here so that we can catch and return it to the caller. If all of the scanners have finished, this will callback to the caller immediately. @param e The exception to store.
(final Exception e)
| 970 | * @param e The exception to store. |
| 971 | */ |
| 972 | private void handleException(final Exception e) { |
| 973 | // make sure only one scanner can set the exception |
| 974 | finished_multi_get_cnt.incrementAndGet(); |
| 975 | if (exception == null) { |
| 976 | synchronized (this) { |
| 977 | if (exception == null) { |
| 978 | exception = e; |
| 979 | // fail once and fast on the first scanner to throw an exception |
| 980 | try { |
| 981 | if (exception != null) { |
| 982 | mergeAndReturnResults(); |
| 983 | } |
| 984 | } catch (Exception ex) { |
| 985 | |
| 986 | LOG.error("Failed merging and returning results, " |
| 987 | + "calling back with exception", ex); |
| 988 | results.callback(ex); |
| 989 | |
| 990 | } |
| 991 | } else { |
| 992 | // TODO - it would be nice to close and cancel the other scanners but |
| 993 | // for now we have to wait for them to finish and/or throw exceptions. |
| 994 | LOG.error("Another scanner threw an exception", e); |
| 995 | } |
| 996 | } |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | /** |
| 1001 | * Generates a list of Unix Epoch Timestamps for the row key base times given |
no test coverage detected