Skip to content

Commit

Permalink
Adding in blocking check for failure from function when using all row…
Browse files Browse the repository at this point in the history
…s reader
  • Loading branch information
opuneet committed Nov 5, 2013
1 parent 2982998 commit a50e84b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,26 +600,35 @@ public Boolean call() throws Exception {
* @return true if all tasks returned true or false otherwise.
*/
private boolean waitForTasksToFinish() throws Exception {

Boolean succeeded = true;
Exception ex = null;

for (Future<Boolean> future : futures) {
try {
if (!future.get()) {
cancel();
return false;
succeeded = false;
}
}
catch (Exception e) {
error.compareAndSet(null, e);
cancel();
throw e;
succeeded = false;
ex = e;
}
}

if (this.rowFunction instanceof Flushable) {
((Flushable)rowFunction).flush();
}
return true;

if (ex != null) {
throw ex;
}
return succeeded;
}

/**
* Submit all the callables to the executor by synchronize their execution so they all start
* AFTER the have all been submitted.
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ project(':astyanax-examples') {
project(':astyanax-contrib') {
apply plugin: 'java'
dependencies {
compile project(':astyanax-cassandra')
compile project(':astyanax-core')
compile 'com.netflix.eureka:eureka-client:1.1.110'
compile 'com.netflix.archaius:archaius-core:0.5.12'
}
}

0 comments on commit a50e84b

Please sign in to comment.