Hi, I just joined this d-list. What is the preferred way to raise bugs discovered in reading the code? Do you wish to have a JIRA ticket opened or a note sent to this d-list?
Issue in 1.2.5: LifeCycleFactoryImpl is not thread-safe. _lifecycles Map must be locked for all read and write accesses and a race condition exists due to failure to lock in getLifecycleIds and purgeLifecycle. Similarly, 1.2.5 FactoryFinder is not thread-safe - the binary predicate on the 2 instance variables should be documented as below, and requires lock protection which the synch on either variable alone does not provide. /* * //JAH: _registeredFactoryNames and _factories are the only non-final instance variables and share a binary predicate: * The former is a map (classloader object, (string factoryname, List of strings of factory class names)) * The latter is a map (classloader object, (string factoryname, List of instances of the factory classes)) * The predicate is "For each string factory class name in _registeredFactoryNames, there exists, at the same index in its list as the name, an instance of the * class in _factories. This binary predicate is in addition to the standard requirement to synch all read/writes to the non-threadsafe HashMaps. * Every predicate requires a unique lock for thread safety. Since these 2 instance variables are the ONLY mutable state of the object, all reads and writes can * be synch'd via the object monitor - use synchronized methods on all methods reading or writing from either variable, thereby making the object monitor the lock * for protection of all 3 predicates. */ A simple solution is to synchronize all 3 public methods: getFactory, setFactory and releaseFactories, then document the binary predicate over the instance variable and ensure the code is correctly honoring the predicate within the synch'd methods. Thanks in advance, Jondean.
