Skip to content

Conversation

@npathai
Copy link
Contributor

@npathai npathai commented Oct 15, 2018

Resolves #643

Root Cause

Test cases failed due to presence of global state in CallsCount. Because AppTest was executed before B2BServiceTest, it scheduled 1 sec timer using ThrottleTimerImpl class. While resetting it used that global CallCount.reset() method, which reset all counters. So that causes thread safety issue because of unintended sharing of application state between test cases, which is not a good practice.

Solution

Solution was not to have global state using static map. Rather global state should be maintained using single object and passing that as dependency wherever needed.

Todos

  • Update class diagram. (Once solution is approved)

…allsCount. Because AppTest was executed before B2BServiceTest, it scheduled 1 sec timer using ThrottleTimerImpl class. While resetting it used that global CallCount class reset() method, which reset all counters. So that causes thread safety issue because of unintended sharing of application state between test cases, which is not a good practice.
@iluwatar
Copy link
Owner

The proposed solution looks good

@npathai
Copy link
Contributor Author

npathai commented Oct 21, 2018

@iluwatar Updated the class diagram. Ready to merge!

@iluwatar iluwatar merged commit 922fd62 into master Oct 21, 2018
@iluwatar iluwatar deleted the Issue#643 branch December 30, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants