-
Notifications
You must be signed in to change notification settings - Fork 69
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
Decouple routing logic from address set #200
Conversation
This commit introduces a separate load balancing strategy abstraction responsible for address selection.
Commit changes `TryAcquire` with out parameter to simple `Acquire` that either returns a connection or null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes looks ok. A few comments only.
value = _items[_index++]; | ||
} | ||
return true; | ||
_items = new List<T>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also make this assignment a critical section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good point. It is fine for #Clear()
to assign because it is an atomic action, but it is not fine for it to not coordinate with other modification methods like #Add()
or #Remove()
.
/// Not thread safe | ||
/// </summary> | ||
/// <returns></returns> | ||
string ToString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need for a ToString()
declaration as it is part of Object
class that can be overrided.
Re-assignment of the internal list needs to be done while holding a lock so that it is coordinated and isolated from other modifications like `#Add()` or `#Remove()`.
@ali-ince comments should now be addresses. Thank you. |
No description provided.