|
[
Permalink
| « Hide
]
Mark Pollack added a comment - 14/Sep/05 12:42 AM
Compared Java/C# versions. Added additional lock in GetAliases(string name) in C#. Nothing looks blatently out of place in AbstractObjectFactory.
I use GetObject on IApplicationContext.GetObject to get a lazy-init singleton object from different threads. It seems that the method is not thread-safe. If I kick off two threads at the same time and get the object that takes time to initialize, one thread will get the object correctly while the other thread will get null back.
lazy-init singleton not tread-safe :
http://forum.springframework.net/viewtopic.php?t=440 Added back in synchronization code that accidentially got removed. Code is in line with Spring.Java semantics. Added test case that failed before current round of changes. Will confer with Jurgen as to why ObjectCurrentlyInCreationException will be thrown in corner cases instead of relying on singletonCache object locks to handle concurrency.
|
||||||||||||||||||||||||||||||||||||||