public void resultAvailable(Boolean result) { if(!isFinished() && result) { if(Boolean.FALSE.equals(finished)) finished = null; // set finishing rankResults(); } }
/** * */ protected void notifyException(Exception exception) { if(!isFinished()) { finished = Boolean.TRUE; future.setException(exception); } } }
/** * */ protected void notifyException(Exception exception) { if(!isFinished()) { finished = Boolean.TRUE; future.setException(exception); } } }
public void resultAvailable(Boolean result) { if(!isFinished() && result) { if(Boolean.FALSE.equals(finished)) finished = null; // set finishing rankResults(); } }
/** * */ protected void notifyResults(List<Tuple2<S, Double>> results) { if(!isFinished()) { finished = Boolean.TRUE; for(Tuple2<S, Double> res: results) { future.addIntermediateResult(res.getFirstEntity()); } future.setFinished(); } }
if(!isFinished() && !isFinishing())
/** * */ protected void notifyResults(List<Tuple2<S, Double>> results) { if(!isFinished()) { finished = Boolean.TRUE; for(Tuple2<S, Double> res: results) { future.addIntermediateResult(res.getFirstEntity()); } future.setFinished(); } }
if(!isFinished() && !isFinishing())
/** * Rank the results and announce them */ protected void rankResults() { if(!isFinished()) { // Terminate the source ((TerminableIntermediateDelegationFuture<S>)future).getSource().terminate(); ranker.rankWithScores(results).addResultListener(new IResultListener<List<Tuple2<S, Double>>>() { public void resultAvailable(List<Tuple2<S, Double>> result) { notifyResults(result); } public void exceptionOccurred(Exception exception) { notifyException(exception); } }); } }
/** * Rank the results and announce them */ protected void rankResults() { if(!isFinished()) { // Terminate the source ((TerminableIntermediateDelegationFuture<S>)future).getSource().terminate(); ranker.rankWithScores(results).addResultListener(new IResultListener<List<Tuple2<S, Double>>>() { public void resultAvailable(List<Tuple2<S, Double>> result) { notifyResults(result); } public void exceptionOccurred(Exception exception) { notifyException(exception); } }); } }