Monday, June 26, 2006

Locking Issues in Bodington

Currently most of the locking that is performed in Bodington is done using synchronized blocks in the Java code. Examples of this can be found in org.bodington.server.resources.ResoureTree and org.bodington.server.resources.UploadedFileManager. This works reasonably well except when you want to scale your application across multiple JVMs as the locking only applies to one JVM. The two ways around this are either to use explicit locks in the database or to code optimistic locks in your application. As deploying Bodington across multiple JVMs isn't important at the moment we are continuing to develop using the existing pattern of synchronized blocks. This is important to me because in my quota implementation I need to lock sections of the tree while I calculate the current quota usage. While I am calculating the usage I don't want that section of the tree to change. As long as the locking is ok the quota calculations should stay in sync with the usage.

No comments: