org.infinispan.interceptors
Class TxInterceptor
java.lang.Object
org.infinispan.commands.AbstractVisitor
org.infinispan.interceptors.base.CommandInterceptor
org.infinispan.interceptors.BaseTransactionalContextInterceptor
org.infinispan.interceptors.TxInterceptor
- All Implemented Interfaces:
- Visitor
public class TxInterceptor
- extends BaseTransactionalContextInterceptor
This interceptor is the new default at the head of all interceptor chains, and makes transactional attributes
available to all interceptors in the chain. This interceptor is also responsible for registering for synchronisation
on transaction completion.
- Since:
- 4.0
- Author:
- Manik Surtani (manik@jboss.org), Steve Woodcock (stevew@jofti.com)
Method Summary |
protected void |
assertTxIsStillValid(Transaction tx)
|
protected Object |
attachGtxAndPassUpChain(InvocationContext ctx,
VisitableCommand command)
|
protected PrepareCommand |
buildPrepareCommand(GlobalTransaction gtx,
List<WriteCommand> modifications,
boolean onePhaseCommit)
|
protected void |
cleanupStaleLocks(InvocationContext ctx)
|
protected Transaction |
createLocalTx()
Creates and starts a local tx |
long |
getCommits()
|
long |
getPrepares()
|
long |
getRollbacks()
|
boolean |
getStatisticsEnabled()
|
Object |
handleDefault(InvocationContext ctx,
VisitableCommand command)
The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next
interceptor in the chain. |
void |
intialize(CacheManager cacheManager,
ContextFactory contextFactory,
CacheNotifier notifier,
InvocationContextContainer icc,
CommandsFactory factory,
ComponentRegistry componentRegistry,
LockManager lockManager,
TransactionLog transactionLog)
|
protected void |
replayModifications(InvocationContext ctx,
Transaction ltx,
PrepareCommand command)
Replays modifications |
void |
resetStatistics()
|
protected void |
runCommitPhase(InvocationContext ctx,
GlobalTransaction gtx,
List<WriteCommand> modifications,
boolean onePhaseCommit)
creates a commit() |
Object |
runPreparePhase(InvocationContext ctx,
GlobalTransaction gtx,
List<WriteCommand> modifications)
Handles a local prepare - invoked by the sync handler. |
protected void |
runRollbackPhase(InvocationContext ctx,
GlobalTransaction gtx,
Transaction tx)
creates a rollback() |
void |
setStatisticsEnabled(boolean enabled)
|
Object |
visitCommitCommand(InvocationContext ctx,
CommitCommand command)
|
Object |
visitPrepareCommand(InvocationContext ctx,
PrepareCommand command)
|
Object |
visitRollbackCommand(InvocationContext ctx,
RollbackCommand command)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
commandsFactory
protected CommandsFactory commandsFactory
TxInterceptor
public TxInterceptor()
intialize
public void intialize(CacheManager cacheManager,
ContextFactory contextFactory,
CacheNotifier notifier,
InvocationContextContainer icc,
CommandsFactory factory,
ComponentRegistry componentRegistry,
LockManager lockManager,
TransactionLog transactionLog)
visitPrepareCommand
public Object visitPrepareCommand(InvocationContext ctx,
PrepareCommand command)
throws Throwable
- Specified by:
visitPrepareCommand
in interface Visitor
- Overrides:
visitPrepareCommand
in class AbstractVisitor
- Throws:
Throwable
visitCommitCommand
public Object visitCommitCommand(InvocationContext ctx,
CommitCommand command)
throws Throwable
- Specified by:
visitCommitCommand
in interface Visitor
- Overrides:
visitCommitCommand
in class AbstractVisitor
- Throws:
Throwable
visitRollbackCommand
public Object visitRollbackCommand(InvocationContext ctx,
RollbackCommand command)
throws Throwable
- Specified by:
visitRollbackCommand
in interface Visitor
- Overrides:
visitRollbackCommand
in class AbstractVisitor
- Throws:
Throwable
handleDefault
public Object handleDefault(InvocationContext ctx,
VisitableCommand command)
throws Throwable
- Description copied from class:
CommandInterceptor
- The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next
interceptor in the chain.
- Overrides:
handleDefault
in class CommandInterceptor
- Parameters:
ctx
- invocation contextcommand
- command to invoke
- Returns:
- return value
- Throws:
Throwable
- in the event of problems
attachGtxAndPassUpChain
protected Object attachGtxAndPassUpChain(InvocationContext ctx,
VisitableCommand command)
throws Throwable
- Throws:
Throwable
replayModifications
protected void replayModifications(InvocationContext ctx,
Transaction ltx,
PrepareCommand command)
throws Throwable
- Replays modifications
- Throws:
Throwable
buildPrepareCommand
protected PrepareCommand buildPrepareCommand(GlobalTransaction gtx,
List<WriteCommand> modifications,
boolean onePhaseCommit)
runCommitPhase
protected void runCommitPhase(InvocationContext ctx,
GlobalTransaction gtx,
List<WriteCommand> modifications,
boolean onePhaseCommit)
- creates a commit()
cleanupStaleLocks
protected void cleanupStaleLocks(InvocationContext ctx)
throws Throwable
- Throws:
Throwable
runRollbackPhase
protected void runRollbackPhase(InvocationContext ctx,
GlobalTransaction gtx,
Transaction tx)
- creates a rollback()
runPreparePhase
public Object runPreparePhase(InvocationContext ctx,
GlobalTransaction gtx,
List<WriteCommand> modifications)
throws Throwable
- Handles a local prepare - invoked by the sync handler. Tests if the current tx matches the gtx passed in to the
method call and passes the prepare() call up the chain.
- Throws:
Throwable
assertTxIsStillValid
protected void assertTxIsStillValid(Transaction tx)
createLocalTx
protected Transaction createLocalTx()
throws Exception
- Creates and starts a local tx
- Throws:
Exception
resetStatistics
public void resetStatistics()
getStatisticsEnabled
public boolean getStatisticsEnabled()
setStatisticsEnabled
public void setStatisticsEnabled(boolean enabled)
getPrepares
public long getPrepares()
getCommits
public long getCommits()
getRollbacks
public long getRollbacks()
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.