T - the type of the aggregate resultpublic abstract class AggregatingCalculationListener<T> extends Object implements CalculationListener
| Constructor and Description |
|---|
AggregatingCalculationListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
calculationsComplete()
Invoked when all calculations have completed.
|
protected abstract T |
createAggregateResult()
Invoked to create the aggregate result when the individual calculations are complete.
|
CompletableFuture<T> |
getFuture()
A future providing asynchronous notification when the results are available.
|
T |
result()
Returns the aggregate result of the calculations, blocking until it is available.
|
abstract void |
resultReceived(CalculationTarget target,
CalculationResult result)
Invoked when a calculation completes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcalculationsStartedpublic final void calculationsComplete()
CalculationListener
This is guaranteed to be called after all results have been passed to CalculationListener.resultReceived(com.opengamma.strata.basics.CalculationTarget, com.opengamma.strata.calc.runner.CalculationResult).
This method will be called immediately after CalculationListener.calculationsStarted(List, List) and without any calls
to CalculationListener.resultReceived(CalculationTarget, CalculationResult) if there are no calculations to be performed.
This can happen if an empty list of targets is passed to the calculation runner.
calculationsComplete in interface CalculationListenerpublic T result()
If the thread is interrupted while this method is blocked, then a runtime exception
is thrown, but with the interrupt flag set.
For additional control, use getFuture().
public CompletableFuture<T> getFuture()
public abstract void resultReceived(CalculationTarget target, CalculationResult result)
CalculationListener
It is guaranteed that CalculationListener.calculationsStarted(List, List) will be called before
this method and that this method will never be called after CalculationListener.calculationsComplete().
It is possible that this method will never be called. This can happen if an empty list of targets is passed to the calculation runner.
resultReceived in interface CalculationListenertarget - the calculation target, such as a traderesult - the result of the calculationprotected abstract T createAggregateResult()
This is guaranteed to be invoked after all results have been passed to resultReceived(com.opengamma.strata.basics.CalculationTarget, com.opengamma.strata.calc.runner.CalculationResult).
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.