PrimeApplicationContext is not thread safe
See original GitHub issue1) Environment
- PrimeFaces version:
7.0.RC3
- Does it work on the newest released PrimeFaces version? No
- Does it work on the newest sources in GitHub? No
2) Explanation
The PrimeApplicationContext
is an application scoped object that is lazily initialized. However, its initialization is not protected by any synchronized
blocks or other thread safety code. So if X threads call PrimeApplicationContext.getCurrentInstance(facesContext)
at the same time, they may instantiate as many as X PrimeApplicationContext
instances.
Another aspect of PrimeApplicationContext
that isn’t thread safe is the lazy initialization of member data (such as VirusScanner
). This article explains the issue in detail, but essentially the current implementation may allow threads to access partially initialized objects.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Is the following utility class thread-safe? - java - Stack Overflow
No. It's not thread safe. Writes to the context class variable are not guaranteed to be visible to threads that read that variable...
Read more >Concurrent creation of the same Configuration class ... - GitHub
Vivien HENRIET opened SPR-10307 and commented The refresh() method of AnnotationConfigApplicationContext is not thread safe anymore. It works fine in 3.1.2.
Read more >Spring Framework Reference Documentation - xy2401.github.io
Deploying a Spring ApplicationContext as a Java EE RAR file ... As of Spring 3.0, a thread scope is available, but is not...
Read more >5 Ways to debug thread-safety issues in Java
Debugging concurrency issues are not easy. 5 Ways to debug Java thread-safety issues the tutorial style. You need top-notch developers.
Read more >Core Technologies - Spring
ApplicationContext interface represents the Spring IoC container and is ... As of Spring 3.0, a thread scope is available but is not registered...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
done! @stiemannkj1 @melloware @cnsgithub @jxmai @Rapster it would be great if you could give my changes a try in your applications, if everything works as expected before we release the final.
@tandraschko just ran all the Faces tests and everything is working great!