Package org.infinispan.interceptors.impl
Class TxInterceptor<K,V>
- java.lang.Object
-
- org.infinispan.interceptors.BaseAsyncInterceptor
-
- org.infinispan.interceptors.DDAsyncInterceptor
-
- org.infinispan.interceptors.impl.TxInterceptor<K,V>
-
- All Implemented Interfaces:
Visitor
,AsyncInterceptor
,JmxStatisticsExposer
public class TxInterceptor<K,V> extends DDAsyncInterceptor implements JmxStatisticsExposer
Interceptor in charge with handling transaction related operations, e.g enlisting cache as an transaction participant, propagating remotely initiated changes.- Since:
- 9.0
- Author:
- Manik Surtani (manik@jboss.org), Mircea.Markus@jboss.com
- See Also:
TransactionXaAdapter
-
-
Field Summary
-
Fields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration
-
-
Constructor Summary
Constructors Constructor Description TxInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalTransaction
enlist(TxInvocationContext ctx)
long
getCommits()
long
getPrepares()
long
getRollbacks()
boolean
getStatisticsEnabled()
Returns whether an interceptor's statistics are being captured.boolean
isStatisticsEnabled()
void
resetStatistics()
Resets an interceptor's cache statisticsvoid
setStatisticsEnabled(boolean enabled)
Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.void
start()
Object
visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command)
Object
visitCommitCommand(TxInvocationContext ctx, org.infinispan.commands.tx.CommitCommand command)
Object
visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command)
Object
visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command)
Object
visitEntrySetCommand(InvocationContext ctx, org.infinispan.commands.read.EntrySetCommand command)
Object
visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command)
Object
visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command)
Object
visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command)
Object
visitInvalidateCommand(InvocationContext ctx, org.infinispan.commands.write.InvalidateCommand invalidateCommand)
Object
visitKeySetCommand(InvocationContext ctx, org.infinispan.commands.read.KeySetCommand command)
Object
visitLockControlCommand(TxInvocationContext ctx, org.infinispan.commands.control.LockControlCommand command)
Object
visitPrepareCommand(TxInvocationContext ctx, org.infinispan.commands.tx.PrepareCommand command)
Object
visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command)
Object
visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command)
Object
visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command)
Object
visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command)
Object
visitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command)
Object
visitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command)
Object
visitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command)
Object
visitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command)
Object
visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command)
Object
visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command)
Object
visitRollbackCommand(TxInvocationContext ctx, org.infinispan.commands.tx.RollbackCommand command)
Object
visitSizeCommand(InvocationContext ctx, org.infinispan.commands.read.SizeCommand command)
Object
visitWriteOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyCommand command)
Object
visitWriteOnlyKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyValueCommand command)
Object
visitWriteOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyCommand command)
Object
visitWriteOnlyManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyEntriesCommand command)
-
Methods inherited from class org.infinispan.interceptors.DDAsyncInterceptor
handleDefault, visitCommand, visitDistributedExecuteCommand, visitEvictCommand, visitGetKeysInGroupCommand, visitInvalidateL1Command, visitUnknownCommand
-
Methods inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
asyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedValue, delayedValue, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.commands.Visitor
visitApplyDeltaCommand, visitRemoveExpiredCommand
-
-
-
-
Method Detail
-
start
public void start()
-
visitPrepareCommand
public Object visitPrepareCommand(TxInvocationContext ctx, org.infinispan.commands.tx.PrepareCommand command) throws Throwable
- Specified by:
visitPrepareCommand
in interfaceVisitor
- Overrides:
visitPrepareCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitCommitCommand
public Object visitCommitCommand(TxInvocationContext ctx, org.infinispan.commands.tx.CommitCommand command) throws Throwable
- Specified by:
visitCommitCommand
in interfaceVisitor
- Overrides:
visitCommitCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitRollbackCommand
public Object visitRollbackCommand(TxInvocationContext ctx, org.infinispan.commands.tx.RollbackCommand command) throws Throwable
- Specified by:
visitRollbackCommand
in interfaceVisitor
- Overrides:
visitRollbackCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitLockControlCommand
public Object visitLockControlCommand(TxInvocationContext ctx, org.infinispan.commands.control.LockControlCommand command) throws Throwable
- Specified by:
visitLockControlCommand
in interfaceVisitor
- Overrides:
visitLockControlCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command) throws Throwable
- Specified by:
visitPutKeyValueCommand
in interfaceVisitor
- Overrides:
visitPutKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitRemoveCommand
public Object visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command) throws Throwable
- Specified by:
visitRemoveCommand
in interfaceVisitor
- Overrides:
visitRemoveCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReplaceCommand
public Object visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command) throws Throwable
- Specified by:
visitReplaceCommand
in interfaceVisitor
- Overrides:
visitReplaceCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitComputeCommand
public Object visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command) throws Throwable
- Specified by:
visitComputeCommand
in interfaceVisitor
- Overrides:
visitComputeCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitComputeIfAbsentCommand
public Object visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command) throws Throwable
- Specified by:
visitComputeIfAbsentCommand
in interfaceVisitor
- Overrides:
visitComputeIfAbsentCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitClearCommand
public Object visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command) throws Throwable
- Specified by:
visitClearCommand
in interfaceVisitor
- Overrides:
visitClearCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitPutMapCommand
public Object visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command) throws Throwable
- Specified by:
visitPutMapCommand
in interfaceVisitor
- Overrides:
visitPutMapCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitSizeCommand
public Object visitSizeCommand(InvocationContext ctx, org.infinispan.commands.read.SizeCommand command) throws Throwable
- Specified by:
visitSizeCommand
in interfaceVisitor
- Overrides:
visitSizeCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitKeySetCommand
public Object visitKeySetCommand(InvocationContext ctx, org.infinispan.commands.read.KeySetCommand command) throws Throwable
- Specified by:
visitKeySetCommand
in interfaceVisitor
- Overrides:
visitKeySetCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitEntrySetCommand
public Object visitEntrySetCommand(InvocationContext ctx, org.infinispan.commands.read.EntrySetCommand command) throws Throwable
- Specified by:
visitEntrySetCommand
in interfaceVisitor
- Overrides:
visitEntrySetCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitInvalidateCommand
public Object visitInvalidateCommand(InvocationContext ctx, org.infinispan.commands.write.InvalidateCommand invalidateCommand) throws Throwable
- Specified by:
visitInvalidateCommand
in interfaceVisitor
- Overrides:
visitInvalidateCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetKeyValueCommand
public Object visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command) throws Throwable
- Specified by:
visitGetKeyValueCommand
in interfaceVisitor
- Overrides:
visitGetKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetCacheEntryCommand
public final Object visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command) throws Throwable
- Specified by:
visitGetCacheEntryCommand
in interfaceVisitor
- Overrides:
visitGetCacheEntryCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetAllCommand
public Object visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command) throws Throwable
- Specified by:
visitGetAllCommand
in interfaceVisitor
- Overrides:
visitGetAllCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadOnlyKeyCommand
public Object visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command) throws Throwable
- Specified by:
visitReadOnlyKeyCommand
in interfaceVisitor
- Overrides:
visitReadOnlyKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadOnlyManyCommand
public Object visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command) throws Throwable
- Specified by:
visitReadOnlyManyCommand
in interfaceVisitor
- Overrides:
visitReadOnlyManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyKeyCommand
public Object visitWriteOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyCommand command) throws Throwable
- Specified by:
visitWriteOnlyKeyCommand
in interfaceVisitor
- Overrides:
visitWriteOnlyKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteKeyValueCommand
public Object visitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command) throws Throwable
- Specified by:
visitReadWriteKeyValueCommand
in interfaceVisitor
- Overrides:
visitReadWriteKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteKeyCommand
public Object visitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command) throws Throwable
- Specified by:
visitReadWriteKeyCommand
in interfaceVisitor
- Overrides:
visitReadWriteKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyManyEntriesCommand
public Object visitWriteOnlyManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyEntriesCommand command) throws Throwable
- Specified by:
visitWriteOnlyManyEntriesCommand
in interfaceVisitor
- Overrides:
visitWriteOnlyManyEntriesCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyKeyValueCommand
public Object visitWriteOnlyKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyValueCommand command) throws Throwable
- Specified by:
visitWriteOnlyKeyValueCommand
in interfaceVisitor
- Overrides:
visitWriteOnlyKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyManyCommand
public Object visitWriteOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyCommand command) throws Throwable
- Specified by:
visitWriteOnlyManyCommand
in interfaceVisitor
- Overrides:
visitWriteOnlyManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteManyCommand
public Object visitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command) throws Throwable
- Specified by:
visitReadWriteManyCommand
in interfaceVisitor
- Overrides:
visitReadWriteManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteManyEntriesCommand
public Object visitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command) throws Throwable
- Specified by:
visitReadWriteManyEntriesCommand
in interfaceVisitor
- Overrides:
visitReadWriteManyEntriesCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
enlist
public LocalTransaction enlist(TxInvocationContext ctx) throws SystemException
- Throws:
SystemException
-
getStatisticsEnabled
public boolean getStatisticsEnabled()
Description copied from interface:JmxStatisticsExposer
Returns whether an interceptor's statistics are being captured.- Specified by:
getStatisticsEnabled
in interfaceJmxStatisticsExposer
- Returns:
- true if statistics are captured
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean enabled)
Description copied from interface:JmxStatisticsExposer
Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.- Specified by:
setStatisticsEnabled
in interfaceJmxStatisticsExposer
- Parameters:
enabled
- true if statistics should be captured
-
resetStatistics
public void resetStatistics()
Description copied from interface:JmxStatisticsExposer
Resets an interceptor's cache statistics- Specified by:
resetStatistics
in interfaceJmxStatisticsExposer
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
-
getPrepares
public long getPrepares()
-
getCommits
public long getCommits()
-
getRollbacks
public long getRollbacks()
-
-