org.jboss.cache.interceptors
Class OptimisticLockingInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.MethodDispacherInterceptor
          extended by org.jboss.cache.interceptors.OptimisticInterceptor
              extended by org.jboss.cache.interceptors.OptimisticLockingInterceptor
All Implemented Interfaces:
InterceptorMBean

public class OptimisticLockingInterceptor
extends OptimisticInterceptor

Locks nodes during transaction boundaries. Only affects prepare/commit/rollback method calls; other method calls are simply passed up the interceptor stack.

Author:
Manik Surtani (manik@jboss.org), Steve Woodcock (stevew@jofti.com)

Field Summary
 
Fields inherited from class org.jboss.cache.interceptors.OptimisticInterceptor
txManager, txTable
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next, trace
 
Constructor Summary
OptimisticLockingInterceptor()
           
 
Method Summary
protected  Object handleCommitMethod(InvocationContext ctx, GlobalTransaction globalTransaction)
          Handles CacheImpl.commit(org.jboss.cache.transaction.GlobalTransaction)
protected  Object handleLockMethod(InvocationContext ctx, Fqn fqn, NodeLock.LockType lockType, boolean recursive)
          Handles CacheImpl._lock(org.jboss.cache.Fqn, org.jboss.cache.lock.NodeLock.LockType, boolean)
protected  Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, org.jgroups.Address address, boolean onePhaseCommit)
          Handles CacheImpl.optimisticPrepare(org.jboss.cache.transaction.GlobalTransaction, java.util.List, java.util.Map, org.jgroups.Address, boolean)
protected  Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction)
          Handles CacheImpl.rollback(org.jboss.cache.transaction.GlobalTransaction)
 void setCache(CacheSPI cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.OptimisticInterceptor
getGlobalTransaction, getTransactionWorkspace, greedyGetFqns, lockAndCreateWorkspaceNode, undeleteWorkspaceNode, undeleteWorkspaceNode
 
Methods inherited from class org.jboss.cache.interceptors.MethodDispacherInterceptor
handleAddChildMethod, handleBlockChannelMethod, handleDataGravitationCleanupMethod, handleEvictMethod, handleEvictVersionedNodeMethod, handleExistsMethod, handleGetDataMapMethod, handleGetChildrenNamesMethod, handleGetKeysMethod, handleGetKeyValueMethod, handleGetNodeMethod, handleMoveMethod, handlePrepareMethod, handlePrintMethod, handlePutDataEraseMethod, handlePutDataEraseVersionedMethod, handlePutDataMethod, handlePutDataVersionedMethod, handlePutForExternalReadMethod, handlePutForExternalReadVersionedMethod, handlePutKeyValueMethod, handlePutKeyValueVersionedMethod, handleReleaseAllLocksMethod, handleRemoveDataMethod, handleRemoveDataVersionedMethod, handleRemoveKeyMethod, handleRemoveKeyVersionedMethod, handleRemoveNodeMethod, handleRemoveNodeVersionedMethod, handleUnblockChannelMethod, invoke, skipMethodCall
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
assertTransactionValid, dumpStatistics, getLast, getNext, getStatisticsEnabled, initLogger, isActive, isPreparing, isValid, nextInterceptor, peekNode, resetStatistics, setLast, setNext, setStatisticsEnabled, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OptimisticLockingInterceptor

public OptimisticLockingInterceptor()
Method Detail

setCache

public void setCache(CacheSPI cache)
Overrides:
setCache in class Interceptor

handleOptimisticPrepareMethod

protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
                                               GlobalTransaction gtx,
                                               List modifications,
                                               Map data,
                                               org.jgroups.Address address,
                                               boolean onePhaseCommit)
                                        throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl.optimisticPrepare(org.jboss.cache.transaction.GlobalTransaction, java.util.List, java.util.Map, org.jgroups.Address, boolean)

Overrides:
handleOptimisticPrepareMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleCommitMethod

protected Object handleCommitMethod(InvocationContext ctx,
                                    GlobalTransaction globalTransaction)
                             throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl.commit(org.jboss.cache.transaction.GlobalTransaction)

Overrides:
handleCommitMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleRollbackMethod

protected Object handleRollbackMethod(InvocationContext ctx,
                                      GlobalTransaction globalTransaction)
                               throws Throwable
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl.rollback(org.jboss.cache.transaction.GlobalTransaction)

Overrides:
handleRollbackMethod in class MethodDispacherInterceptor
Throws:
Throwable

handleLockMethod

protected Object handleLockMethod(InvocationContext ctx,
                                  Fqn fqn,
                                  NodeLock.LockType lockType,
                                  boolean recursive)
Description copied from class: MethodDispacherInterceptor
Handles CacheImpl._lock(org.jboss.cache.Fqn, org.jboss.cache.lock.NodeLock.LockType, boolean)

Overrides:
handleLockMethod in class MethodDispacherInterceptor


Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.