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

Replace non threaded safe List with a ConcurrentDictionary in bulkhead factory. #74

Merged
merged 2 commits into from
Oct 26, 2018

Conversation

damtur
Copy link
Contributor

@damtur damtur commented Oct 26, 2018

Description

A List is not thread-safe. This PR is changing bulkheads subscriptions to a thread-safe concurrent dictionary.

That will eliminate race condition while creating bulkheads.

factory. That will eliminate race condition while creating bulkheads.
@damtur damtur requested a review from robhruska October 26, 2018 16:05

private readonly ConcurrentDictionary<IObserver<MjolnirConfiguration>, IObserver<MjolnirConfiguration>>
_observers = new ConcurrentDictionary<IObserver<MjolnirConfiguration>, IObserver<MjolnirConfiguration>>();

Copy link
Member

Choose a reason for hiding this comment

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

Is there a better option than using the observer as both the key and the value? Not that I think this is wrong, just curious on alternatives.

Choose a reason for hiding this comment

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

Joining the party a bit late but it seems like a ConcurrentBag would suffice here, seeing as you just add/remove.

@codypeck codypeck merged commit c36885a into master Oct 26, 2018
@robhruska
Copy link
Member

robhruska commented Oct 26, 2018

This needs tagged as a Release.

@codypeck codypeck deleted the MARVEL-2040-FixConcurencyProblem branch October 26, 2018 19:02
@robhruska robhruska mentioned this pull request Oct 26, 2018
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.

4 participants