/** * Declare that the future is finished. */ protected synchronized boolean doSetFinished(boolean undone) { boolean ret; Collection<E> res = getIntermediateResults(); ret = super.doSetResult(res, undone); if(ret) { // Hack!!! Set results to avoid inconsistencies between super.result and this.results, // because getIntermediateResults() returns empty list when results==null. if(results==null) { results = res; } } return ret; }
public void resultAvailable(T result) { // If already had exception do nothing. // Cannot cause race conditions as the checker is called only if all tasks have been done. if(future.isDone()) return; // if(!binding.isDynamic()) DefaultServiceFetcher.this.result = future.getIntermediateResults(); // no service not found exception for multiple search! // if(future.getIntermediateResults().size()==0) // { // StoreIntermediateDelegationResultListener.this.exceptionOccurred(new ServiceNotFoundException("no results")); // } // else // { StoreIntermediateDelegationResultListener.super.finished(); // } } });
public void resultAvailable(T result) { // If already had exception do nothing. // Cannot cause race conditions as the checker is called only if all tasks have been done. if(future.isDone()) return; // if(!binding.isDynamic()) DefaultServiceFetcher.this.result = future.getIntermediateResults(); if(future.getIntermediateResults().size()==0) { StoreIntermediateDelegationResultListener.this.exceptionOccurred(new ServiceNotFoundException("no results")); } else { StoreIntermediateDelegationResultListener.super.finished(); } } });
public void customResultAvailable(Boolean result) { if(result.booleanValue() && !ret.getIntermediateResults().contains(services[i])) { ret.addIntermediateResult(services[i]); } if(i+1<services.length) { getAllResults(filter, services, i+1) .addResultListener(new IntermediateDelegationResultListener<IService>(ret)); } else { ret.setFinished(); } } });