Hi list, I am currently involved in a research project where we are looking at uses of the java.util.concurrent.locks library in real-world code. Hsqldb caught our eye as one of the few large programs to make use of these locks, in particular ReadWriteLocks.
I am trying to get an understanding of the use of read locks vs. write locks in class org.hsqldb.index.IndexAVL, and I have noted some peculiarities that I would appreciate anybody shedding some light on. In method size(Session, PersistentStore), for instance, the method body is protected by a read lock. Now all that method does is to invoke PersistentStore.elementCount(Session) on its argument "session". If that argument should have runtime type RowStoreAVLDisk, this invocation will dispatch to RowStoreAVLDisk's implementation of that method, which reads and writes the field "elementCount" without further synchronisation, potentially leading to a race condition. My question is: can this actually happen? Is method size just never invoked with an argument of that type? Or is it never invoked from more than one thread concurrently? In a similar manner, methods isEmpty(PersistentStore), checkIndex(PersistentStore), firstRow, lastRow, and findNode invoke IndexAVL.getAccessor, which in turn (given the right dynamic types) could invoke RowStoreAVLDisk.getAcessor; that method reads and writes the array accessorList without further synchronisation. Thanks in advance for your help, -- Max Schaefer ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ hsqldb-developers mailing list hsqldb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hsqldb-developers