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

Resolves thread-safety issues surrounding keyPool #83

Closed
wants to merge 1 commit into from
Closed

Resolves thread-safety issues surrounding keyPool #83

wants to merge 1 commit into from

Conversation

jsonryan
Copy link

@jsonryan jsonryan commented Jun 5, 2013

Uses ConcurrentHashMap instead of HashMap to prevent corruption of the keyPool when used by multiple threads concurrently.
Double-checked locking of keyPool when size has exceeded max size and is being replaced. Without this, in the event of multiple threads performing puts to the JSONObject with a high key miss rate, many new keyPool maps will be allocated in rapid succession.

Uses ConcurrentHashMap instead of HashMap to prevent corruption of the keyPool when used by multiple threads concurrently.
Double-checked locking of keyPool when size has exceeded max size and is being replaced. Without this, in the event of multiple threads performing puts to the JSONObject with a high key miss rate, many new keyPool maps will be allocated in rapid succession.
@jsonryan jsonryan closed this Jun 19, 2013
BGehrels pushed a commit to BGehrels/JSON-java that referenced this pull request Apr 29, 2020
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.

1 participant