You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/01/16 16:48:17 UTC
[GitHub] milleruntime commented on a change in pull request #889: fixes #736
avoid dropping exceptions in scanner
milleruntime commented on a change in pull request #889: fixes #736 avoid dropping exceptions in scanner
URL: https://github.com/apache/accumulo/pull/889#discussion_r248362094
##########
File path: core/src/main/java/org/apache/accumulo/core/clientImpl/ScannerIterator.java
##########
@@ -134,55 +98,66 @@ public void run() {
}
private void initiateReadAhead() {
- readaheadInProgress = true;
- readaheadPool.execute(new Reader());
+ Preconditions.checkState(readAheadOperation == null);
+ readAheadOperation = readaheadPool.submit(this::readBatch);
}
- @Override
- @SuppressWarnings("unchecked")
- public boolean hasNext() {
- if (finished)
- return false;
-
- if (iter != null && iter.hasNext()) {
- return true;
- }
+ private List<KeyValue> getNextBatch() {
- // this is done in order to find see if there is another batch to get
+ List<KeyValue> nextBatch;
try {
- if (!readaheadInProgress) {
+ if (readAheadOperation == null) {
// no read ahead run, fetch the next batch right now
- new Reader().run();
+ nextBatch = readBatch();
+ } else {
+ nextBatch = readAheadOperation.get();
+ readAheadOperation = null;
}
-
- Object obj = synchQ.take();
-
- if (obj instanceof Exception) {
- finished = true;
- if (obj instanceof RuntimeException)
- throw (RuntimeException) obj;
- else
- throw new RuntimeException((Exception) obj);
+ } catch (ExecutionException ee) {
Review comment:
Could create handleExecutionException() to make this a bit easier to read.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services