Skip to content

Conversation

@nabarunnag
Copy link
Contributor

  • Using queueConnection snapshot for multiple if checks
  • As it is a volatile variable, the value may become null mid checks.

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

@nabarunnag nabarunnag marked this pull request as ready for review May 31, 2022 17:54
@nabarunnag nabarunnag force-pushed the feature/GEODE-10106 branch from 259ad01 to 5cd3e6e Compare June 1, 2022 22:44
Copy link
Contributor

@jake-at-work jake-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see more tests to cover all the branches in this method.

}
}

private boolean isPrimaryRecoveryNeeded(final ConnectionList queueConnectionList) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make this static you could easily create unit tests that could test all the paths in this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pivotal-jbarrett done, all branches are covered now.

@nabarunnag nabarunnag force-pushed the feature/GEODE-10106 branch 4 times, most recently from d294487 to 8f78eeb Compare June 2, 2022 05:29
}

@VisibleForTesting
public static boolean isPrimaryRecoveryNeeded(final ConnectionList queueConnectionList) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For unit tests in the same package this doesn't need to be public. Then you can also drop the annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* Using queueConnection local ref for multiple if checks
* As it is a volatile variable, the value may become null mid checks.
@nabarunnag nabarunnag force-pushed the feature/GEODE-10106 branch from 8f78eeb to 86a4472 Compare June 2, 2022 16:43
@nabarunnag nabarunnag merged commit b16dafa into apache:develop Jun 2, 2022
nabarunnag added a commit that referenced this pull request Jun 7, 2022
* Using queueConnection local ref for multiple if checks
* As it is a volatile variable, the value may become null mid checks.

(cherry picked from commit b16dafa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants