public void exceptionOccurred(Exception exception) { // The search is considered as success if at least // one service could be found. // Otherwise search in a disconnected platform could // raise a timeout exception which is propagated here. if(ret.getIntermediateResults().size()>0) { ret.setFinishedIfUndone(); } else { ret.setExceptionIfUndone(exception); } } });
public void exceptionOccurred(Exception exception) { // System.out.println("search end: "+ret.hashCode()); opencalls.remove(ret); // If the future was terminated it is changed to finished to avoid // getting exceptions outside as termination is used also internally // to cut off the search when enough results have been found. if(exception instanceof FutureTerminatedException && ret.getIntermediateResults().size()>0) { finished(); } else { super.exceptionOccurred(exception); } } });
/** * Checks if the search is finished and then * automatically terminates the search future. */ protected boolean checkFinished(IResultSelector ressel, TerminableIntermediateFuture<IService> fut) { boolean ret = ressel.isFinished(fut.getIntermediateResults()); if(ret) { fut.terminate(); } return ret; }
public void exceptionOccurred(Exception exception) { // System.out.println("search end ex: "+ret.hashCode() + " " + tried); // if (selector instanceof TypeResultSelector) // { // if (((TypeResultSelector) selector).getType().getName().indexOf("IClockService") != -1) // { // Thread.dumpStack(); // } // System.out.println(((TypeResultSelector) selector).getType()); // } opencalls.remove(ret); // If the future was terminated it is changed to finished to avoid // getting exceptions outside as termination is used also internally // to cut off the search when enough results have been found. if(exception instanceof FutureTerminatedException && ret.getIntermediateResults().size()>0 && !tried) { tried = true; finished(); } else { super.exceptionOccurred(exception); } } });
/** * Checks if the search is finished and then * automatically terminates the search future. */ protected boolean checkFinished(IResultSelector ressel, TerminableIntermediateFuture<IService> fut) { boolean ret = ressel.isFinished(fut.getIntermediateResults()); if(ret) { fut.terminate(); } return ret; } }
public void resultAvailable(Collection<IService> result) { removeOpenCall(endret, fut); if(result!=null) { for(Iterator<IService> it=((Collection<IService>)result).iterator(); it.hasNext(); ) { IService next = it.next(); // Must recheck if already finished (otherwise duplicate results may occur). if(!endret.getIntermediateResults().contains(next) // && !selector.isFinished(endret.getIntermediateResults())) && !checkFinished(selector, endret)) { // System.out.println("found: "+next); endret.addIntermediateResult(next); } } } checkAndSetResults(ret, finished, 0); }
public void finished() if(ret.getIntermediateResults().size()!=0)
public void finished() if(ret.getIntermediateResults().size()!=0)
&& decider.searchNode(start==null? null: start.getId(), source==null? null: source.getId(), provider.getId(), endret.getIntermediateResults()))