Bugs item #658060, was opened at 2002-12-24 01:03 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=658060&group_id=22866
Category: JBossCX Group: v3.0 Rabbit Hole >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Stefan Reich (sreich) >Assigned to: David Jencks (d_jencks) Summary: Several locking problems in connectors Initial Comment: While browsing the 3.0.5RC1 source I discovered several places with inconsistent locking: * org/jboss/resource/adapter/jdbc/local/LocalManagedConnection: field cels is locked on "this" in add/removeConnectionEventListener, but locked on cels in closeHandle and connectionError. The field "handles" is accessed w/o a lock in getConnection() * org/jboss/resource/connectionmanager/BaseConnectionManager2 The fields "handleCount" and "handles" are accessed w/o holding the lock on "this" in isManagedConnectionFree() and unregisterConnections() * main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool exception gets logged at the wrong level in returnConnection() * org/jboss/resource/connectionmanager/JBossManagedConnectionPool All methods iterating over the "pools" field must lock to avoid ConcurrentModificationExceptions or otherwise inconsistent state. Diffs attached. ---------------------------------------------------------------------- >Comment By: David Jencks (d_jencks) Date: 2002-12-24 05:05 Message: Logged In: YES user_id=60525 Thanks very much. I've applied these to 3.0, 3.2, and 4 with the following exception: I retained the non-synchronized collections in LocalManagedConnection and applied explicit synchronization. According to the discussion of locks and memory in the Java Virtual Machine Specification section 8.6 (more or less copied from the Java Language Spec), every lock/unlock operation requires synchronizing a threads local memore with main memory, not just the outermost lock/unlock. Using explicit synchronization everywhere avoids this double memory synch when iterating through the collection. I also find it clearer to show al the synchronization explicitly. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=658060&group_id=22866 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development