Skip to content

make shared state thread-safe#39

Open
alivenotions wants to merge 1 commit intozach-m:masterfrom
alivenotions:alivenotions/concurrency-improvements
Open

make shared state thread-safe#39
alivenotions wants to merge 1 commit intozach-m:masterfrom
alivenotions:alivenotions/concurrency-improvements

Conversation

@alivenotions
Copy link
Copy Markdown

What

The static caches in JPU (emptyListOfOnix*) were using HashMap with computeIfAbsent, which causes java.util.ConcurrentModificationException under concurrent access from multiple JonixRecords instances. switched to ConcurrentHashMap.

Continued looking to ensure other places that can also be problematic for concurrency are fixed:

  • globalConfig and sourceDict to ConcurrentHashMap
  • skipSourceRequested to AtomicBoolean
  • event listener lists to CopyOnWriteArrayList
  • fields written post-construction (onixVersion, header, encoding, etc.) to volatile

Odd thing which is maybe platform specific?

the json test fixtures had \r\n escapes baked in from a different (windows?) platform, normalized those so tests pass cleanly on a Mac and hopefully across other platforms too.

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