JBoss.org Community Documentation

10.1.3.3. Configuration

Optimistic locking is enabled by using the NodeLockingScheme XML attribute, and setting it to "OPTIMISTIC":



...
   <!--
   Node locking scheme:
   OPTIMISTIC
   PESSIMISTIC (default)
   -->
   <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
...
   

It is generally advisable that if you have an eviction policy defined along with optimistic locking, you define the eviction policy's minTimeToLiveSeconds parameter to be slightly greater than the transaction timeout value set in your transaction manager. This ensures that data versions in the cache are not evicted while transactions are in progress [8] .



[8] See JBCACHE-1155