Skip to content

Resolves thread-safety issues surrounding keyPool#83

Closed
jsonryan wants to merge 1 commit intostleary:masterfrom
jsonryan:master
Closed

Resolves thread-safety issues surrounding keyPool#83
jsonryan wants to merge 1 commit intostleary:masterfrom
jsonryan:master

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