Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.0-beta-3
-
Fix Version/s: None
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Number of attachments :
Description
The method DefaultComponentAdapter.getComponentInstance is not thread-safe. The code block under "if (componentInstance == null)" suffers from the same issues as the "Double-Checked Locking" anti-pattern (http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html). Synchronization would need to be used to ensure the method will not return a half-baked (not fully initialized) component instance under certain conditions (e.g., with an optimizing compiler or on multi-processor machines). This issue also occurs in: BeanPropertyComponentAdapterFactory.Adapter.getComponentInstance, DefaultLifecyclePicoAdapter.initializeIfNotInitialized, InvokingComponentAdapterFactory.Adapter.getComponentInstance (this is not necessarily an exhaustive list).
Activity
Field | Original Value | New Value |
---|---|---|
Resolution | Won't Fix [ 2 ] | |
Status | Unassigned [ 1 ] | Closed [ 6 ] |
From Jon Tirsen:
I think all thread-safety stuff should be handled by having thread-safe decorators to the PicoContainer interfaces that limits the number of threads inside the PicoContainer to one at a time.