org.jboss.ejb.plugins.lock
Class JDBCOptimisticLock

java.lang.Object
  extended by org.jboss.ejb.plugins.lock.BeanLockSupport
      extended by org.jboss.ejb.plugins.lock.NoLock
          extended by org.jboss.ejb.plugins.lock.JDBCOptimisticLock
All Implemented Interfaces:
BeanLock, BeanLockExt, org.jboss.util.deadlock.Resource

public final class JDBCOptimisticLock
extends NoLock

This class is an optmistic lock implementation. It locks tableFields and their values during transaction. Locked tableFields and their values are added to the WHERE clause of the UPDATE SQL statement when entity is stored. The following strategies are supported: - fixed group of tableFields Fixed group of tableFields is used for locking . The tableFields and their values are locked at the beginning of a transaction. The group name must match one of the entity's load-group-name. - modified strategy The tableFields that were modified during transaction are used as lock. All entity's field values are locked at the beginning of the transaction. The tableFields are locked only after its actual change. - read strategy The tableFields that were read/modified during transaction. All entity's field values are locked at the beginning of the transaction. The tableFields are locked only after they were accessed. - version-column strategy This adds additional version field of type java.lang.Long. Each update of the entity will increase the version value by 1. - timestamp-column strategy Adds additional timestamp column of type java.util.Date. Each update of the entity will set the field to the current time. - key-generator column strategy Adds additional column. The type is defined by user. The key generator is used to set the next value. Note: all optimistic locking related code should be rewritten when in the new CMP design. Note2: done.

Version:
$Revision: 1.9.6.1 $
Author:
Alex Loubyansky

Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.lock.BeanLockSupport
container, id, refs, synched, synchedDepth, tx, txTimeout
 
Constructor Summary
JDBCOptimisticLock()
           
 
Method Summary
 
Methods inherited from class org.jboss.ejb.plugins.lock.NoLock
endInvocation, endTransaction, schedule, wontSynchronize
 
Methods inherited from class org.jboss.ejb.plugins.lock.BeanLockSupport
addRef, attemptSync, getId, getRefs, getResourceHolder, getTransaction, releaseSync, removeRef, setContainer, setId, setTimeout, setTransaction, sync
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCOptimisticLock

public JDBCOptimisticLock()


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.