We faced the issue of multithreading when a developer introduced variability into a Spring component. Something like that:
@Component //singleton public class MyComponent { ... private String intermediateResults; public String businessMethod() { ... fills in intermediateResults; } public String thisGetterShouldNotBeHere() { return intermediateResults; } }
which led to an error in multithreading - access to field intermediate results was available from different threads.
Is there a way to prevent the addition of state in Spring Singleton, for example. some kind of static analyzer? SonarQube plugins? Eclipse plugins? Thanks for the suggestions.
java spring eclipse multithreading
leokom
source share