Add CalculationListener.calculationsStarted #1455

Merged
merged 2 commits into from Dec 22, 2016

Conversation

Projects
None yet
2 participants
@cjkent
Member

cjkent commented Dec 21, 2016

Adds a method to CalculationListener that is invoked before any results are calculated. This allows the listener to know about the columns without the user having to pass the columns to both the listener and the calculation runner.

@@ -32,16 +32,16 @@
private final List<CalculationResult> results = new ArrayList<>();
/** The columns that define what values are calculated. */
- private final List<Column> columns;
+ private List<Column> columns;

This comment has been minimized.

@jodastephen

jodastephen Dec 22, 2016

Member

volatile? Since the listener may be called from different threads.

@jodastephen

jodastephen Dec 22, 2016

Member

volatile? Since the listener may be called from different threads.

This comment has been minimized.

@cjkent

cjkent Dec 22, 2016

Member

The calling code goes to great lengths to ensure everything is synchronised so all changes are visible to all threads. The Javadoc on CalculationListener specifies that implementations don't have to be thread safe.

@cjkent

cjkent Dec 22, 2016

Member

The calling code goes to great lengths to ensure everything is synchronised so all changes are visible to all threads. The Javadoc on CalculationListener specifies that implementations don't have to be thread safe.

+ *
+ * @param columns the columns for which values are being calculated
+ */
+ public default void calculationsStarted(List<Column> columns) {

This comment has been minimized.

@jodastephen

jodastephen Dec 22, 2016

Member

Take list of targets as well as columns?

@jodastephen

jodastephen Dec 22, 2016

Member

Take list of targets as well as columns?

This comment has been minimized.

@cjkent

cjkent Dec 22, 2016

Member

Seems reasonable. Our implementations won't use it but there's no harm adding it and I can see why it might be useful. It's also available at the call site so it's easy to add.

@cjkent

cjkent Dec 22, 2016

Member

Seems reasonable. Our implementations won't use it but there's no harm adding it and I can see why it might be useful. It's also available at the call site so it's easy to add.

@jodastephen

Looks good

@jodastephen jodastephen merged commit 0805c27 into master Dec 22, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jodastephen jodastephen deleted the topic/calculations-started branch Dec 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment