Skip to content

GH-2873: Preserve mapping order in the router #2877

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

Merged
merged 3 commits into from
Apr 1, 2019

Conversation

artembilan
Copy link
Member

Fixes #2873

Sometime it is important to map to most specific exception instead of
its super class.

  • Use LinkedHashMap for mapping keys in the
    ErrorMessageExceptionTypeRouter, as well as in its
    AbstractMappingMessageRouter superclass.
    Since we don't do that internal map modification, there is no reason to
    worry about concurrent access: we just replace an internal instance
    atomically with a new LinkedHashMap every time we modify a mapping
    for router

Cherry-pick to 5.1.x

Fixes spring-projects#2873

Sometime it is important to map to most specific exception instead of
its super class.

* Use `LinkedHashMap` for mapping keys in the
`ErrorMessageExceptionTypeRouter`, as well as in its
`AbstractMappingMessageRouter` superclass.
Since we don't do that internal map modification, there is no reason to
worry about concurrent access: we just replace an internal instance
atomically with a new `LinkedHashMap` every time we modify a mapping
for router

**Cherry-pick to 5.1.x**
* Polishing for `AbstractMappingMessageRouter` hierarchy, so we don't
use `protected channelMappings` field access any more
@artembilan
Copy link
Member Author

Should be OK now.
Thanks

@garyrussell garyrussell merged commit 23a73fa into spring-projects:master Apr 1, 2019
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.

Exception match order in ErrorMessageExceptionTypeRouter
2 participants