/** * Overwritten to change result, if necessary. */ @Override protected synchronized boolean doSetFinished(boolean undone) { try { func.handleFinished(getIntermediateResults()); return DelegatingIntermediateFuture.super.doSetFinished(func.isUndone(undone)); } catch(Exception e) { return doSetException(e, func.isUndone(undone)); } }
/** * Overwritten to change result, if necessary. */ @Override protected boolean doSetResult(Collection<Object> result, boolean undone) { try { result = (Collection<Object>)func.handleResult(result); return DelegatingIntermediateFuture.super.doSetResult(result, func.isUndone(undone)); } catch(Exception e) { return doSetException(e, func.isUndone(undone)); } }
IntermediateFuture<Object> fut = new DelegatingIntermediateFuture(func); ((IntermediateFuture<Object>)orig).addResultListener(new IntermediateDelegationResultListener<Object>(fut)); ret = fut;
/** * */ public void setFinished() { // System.out.println("finished: "+result+" "+this); try { func.setFinished((Collection<Object>)getIntermediateResults()); DelegatingIntermediateFuture.super.setFinished(); } catch(Exception e) { DelegatingIntermediateFuture.super.setExceptionIfUndone(e); } }
/** * Overwritten to change result, if necessary. */ @Override protected boolean doAddIntermediateResult(Object result, boolean undone) { try { result = func.handleIntermediateResult(result); return DelegatingIntermediateFuture.super.doAddIntermediateResult(result, func.isUndone(undone)); } catch(Exception e) { return doSetException(e, func.isUndone(undone)); } }
/** * */ public boolean setFinishedIfUndone() { boolean ret = false; try { func.setFinishedIfUndone((Collection<Object>)getIntermediateResults()); ret = DelegatingIntermediateFuture.super.setFinishedIfUndone(); } catch(Exception e) { DelegatingIntermediateFuture.super.setExceptionIfUndone(e); } return ret; }
IntermediateFuture<Object> fut = new DelegatingIntermediateFuture(func); ((IntermediateFuture<Object>)orig).addResultListener(new IntermediateDelegationResultListener<Object>(fut)); ret = fut;