Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CalculationListener.calculationsStarted #1455

Merged
merged 2 commits into from Dec 22, 2016
Merged

Conversation

@cjkent
Copy link
Member

@cjkent 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.

@cjkent cjkent force-pushed the topic/calculations-started branch from f3c6575 to 3ebbd39 Dec 22, 2016
@cjkent cjkent force-pushed the topic/calculations-started branch from 3ebbd39 to 2cfa536 Dec 22, 2016
@@ -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.

This comment has been minimized.

@cjkent

cjkent Dec 22, 2016
Author 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?

This comment has been minimized.

@cjkent

cjkent Dec 22, 2016
Author 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.

Copy link
Member

@jodastephen jodastephen left a comment

Looks good

@jodastephen jodastephen merged commit 0805c27 into master Dec 22, 2016
2 checks passed
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.