-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve synchronization on the R2
RequestContext
local attributes.
It is possible to cause a `ConcurrentModificationException` in the `RequestContext` because we synchronize it by using `Collections.synchronizedMap()`, which only synchronizes individual reads/writes. When making a `RequestContext` copy we must iterate over the collection, allowing other threads to interrupt it by modifying the map during the operation. This fix synchronizes the whole copy operation as well. The default mutex used for synchronizing in a `SynchronizedMap` is `this`, so synchronizing on the map itself guards against modification.
- Loading branch information
Showing
3 changed files
with
11 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters