org.jboss.cache.interceptors
Class OptimisticInterceptor

java.lang.Object
  extended by org.jboss.cache.commands.AbstractVisitor
      extended by org.jboss.cache.interceptors.base.CommandInterceptor
          extended by org.jboss.cache.interceptors.OptimisticInterceptor
All Implemented Interfaces:
Visitor, InterceptorMBean
Direct Known Subclasses:
OptimisticCreateIfNotExistsInterceptor, OptimisticLockingInterceptor, OptimisticNodeInterceptor, OptimisticValidatorInterceptor

public abstract class OptimisticInterceptor
extends CommandInterceptor

Abstract interceptor for optimistic locking

Author:
Manik Surtani (manik@jboss.org)

Field Summary
protected  LockManager lockManager
           
protected  TransactionManager txManager
           
protected  TransactionTable txTable
           
 
Fields inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
OptimisticInterceptor()
           
 
Method Summary
protected  GlobalTransaction getGlobalTransaction(InvocationContext ctx)
           
protected  TransactionWorkspace getTransactionWorkspace(InvocationContext ctx)
           
protected  void greedyGetFqns(List<Fqn> list, NodeSPI<?,?> n, Fqn newBase)
          Adds the Fqn of the node as well as all children and childrens children to the list.
protected  WorkspaceNode lockAndCreateWorkspaceNode(NodeFactory nodeFactory, NodeSPI node, TransactionWorkspace workspace, GlobalTransaction gtx, long timeout)
           
protected  void undeleteWorkspaceNode(WorkspaceNode nodeToUndelete, TransactionWorkspace workspace)
           
protected  void undeleteWorkspaceNode(WorkspaceNode nodeToUndelete, WorkspaceNode parent)
          Undeletes a node that already exists in the workspace, by setting appropriate flags and re-adding to parent's child map.
 
Methods inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
dumpStatistics, getNext, getStatisticsEnabled, handleDefault, hasNext, invokeNextInterceptor, resetStatistics, setNext, setStatisticsEnabled
 
Methods inherited from class org.jboss.cache.commands.AbstractVisitor
visitClearDataCommand, visitCollection, visitCommitCommand, visitCreateNodeCommand, visitEvictFqnCommand, visitExistsNodeCommand, visitGetChildrenNamesCommand, visitGetDataMapCommand, visitGetKeysCommand, visitGetKeyValueCommand, visitGetNodeCommand, visitGravitateDataCommand, visitInvalidateCommand, visitMoveCommand, visitOptimisticPrepareCommand, visitPrepareCommand, visitPutDataMapCommand, visitPutForExternalReadCommand, visitPutKeyValueCommand, visitRemoveKeyCommand, visitRemoveNodeCommand, visitRollbackCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

txManager

protected TransactionManager txManager

txTable

protected TransactionTable txTable

lockManager

protected LockManager lockManager
Constructor Detail

OptimisticInterceptor

public OptimisticInterceptor()
Method Detail

getTransactionWorkspace

protected TransactionWorkspace getTransactionWorkspace(InvocationContext ctx)
                                                throws CacheException
Throws:
CacheException

greedyGetFqns

protected void greedyGetFqns(List<Fqn> list,
                             NodeSPI<?,?> n,
                             Fqn newBase)
Adds the Fqn of the node as well as all children and childrens children to the list.


getGlobalTransaction

protected GlobalTransaction getGlobalTransaction(InvocationContext ctx)
                                          throws CacheException
Returns:
the GlobalTransaction, extracted from the current InvocationContext.
Throws:
CacheException - if the GlobalTransaction or Transaction associated with the InvocationContext is null.

undeleteWorkspaceNode

protected void undeleteWorkspaceNode(WorkspaceNode nodeToUndelete,
                                     TransactionWorkspace workspace)

undeleteWorkspaceNode

protected void undeleteWorkspaceNode(WorkspaceNode nodeToUndelete,
                                     WorkspaceNode parent)
Undeletes a node that already exists in the workspace, by setting appropriate flags and re-adding to parent's child map.

Parameters:
nodeToUndelete - WorkspaceNode to undelete
parent - parent of node to undelete

lockAndCreateWorkspaceNode

protected WorkspaceNode lockAndCreateWorkspaceNode(NodeFactory nodeFactory,
                                                   NodeSPI node,
                                                   TransactionWorkspace workspace,
                                                   GlobalTransaction gtx,
                                                   long timeout)


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