org.jboss.cache.interceptors
Class OptimisticReplicationInterceptor
java.lang.Object
org.jboss.cache.interceptors.Interceptor
org.jboss.cache.interceptors.MethodDispacherInterceptor
org.jboss.cache.interceptors.BaseRpcInterceptor
org.jboss.cache.interceptors.OptimisticReplicationInterceptor
- All Implemented Interfaces:
- InterceptorMBean
public class OptimisticReplicationInterceptor
- extends BaseRpcInterceptor
Replication interceptor for the optimistically locked interceptor chain. Responsible for replicating
state to remote nodes. Unlike it's cousin, the ReplicationInterceptor
, this interceptor
only deals with transactional calls. Just like all things to do with Optimistic Locking, it is a requirement that
everything is done in a transaction and the transaction context is available via InvocationContext.getTransaction()
and InvocationContext.getGlobalTransaction()
.
- Author:
- Manik Surtani (manik@jboss.org), Steve Woodcock (stevew@jofti.com)
Method Summary |
protected void |
broadcastCommit(GlobalTransaction gtx,
InvocationContext ctx)
|
protected void |
broadcastPrepare(MethodCall methodCall,
GlobalTransaction gtx,
InvocationContext ctx)
|
protected void |
broadcastRollback(GlobalTransaction gtx,
InvocationContext ctx)
|
protected TransactionWorkspace |
getTransactionWorkspace(GlobalTransaction gtx)
|
protected Object |
handleCommitMethod(InvocationContext ctx,
GlobalTransaction gtx)
Handles CacheImpl.commit(org.jboss.cache.transaction.GlobalTransaction) |
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 |
handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value)
Handles CacheImpl._putForExternalRead(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, Object) |
protected Object |
handlePutForExternalReadVersionedMethod(InvocationContext ctx,
GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value,
DataVersion dv)
Handles CacheImpl._putForExternalRead(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, Object, org.jboss.cache.optimistic.DataVersion) |
protected Object |
handleRollbackMethod(InvocationContext ctx,
GlobalTransaction gtx)
Handles CacheImpl.rollback(org.jboss.cache.transaction.GlobalTransaction) |
protected boolean |
skipMethodCall(InvocationContext ctx)
Each interceptor should extend this if it does not need any processing for current call. |
Methods inherited from class org.jboss.cache.interceptors.BaseRpcInterceptor |
containsModifications, checkResponses, isSynchronous, isTransactionalAndLocal, putCallOnAsyncReplicationQueue, replicateCall, replicateCall, replicateCall, replicateCall, setCache, skipReplicationOfTransactionMethod |
Methods inherited from class org.jboss.cache.interceptors.MethodDispacherInterceptor |
handleAddChildMethod, handleBlockChannelMethod, handleDataGravitationCleanupMethod, handleEvictMethod, handleEvictVersionedNodeMethod, handleExistsMethod, handleGetDataMapMethod, handleGetChildrenNamesMethod, handleGetKeysMethod, handleGetKeyValueMethod, handleGetNodeMethod, handleLockMethod, handleMoveMethod, handlePrepareMethod, handlePrintMethod, handlePutDataEraseMethod, handlePutDataEraseVersionedMethod, handlePutDataMethod, handlePutDataVersionedMethod, handlePutKeyValueMethod, handlePutKeyValueVersionedMethod, handleReleaseAllLocksMethod, handleRemoveDataMethod, handleRemoveDataVersionedMethod, handleRemoveKeyMethod, handleRemoveKeyVersionedMethod, handleRemoveNodeMethod, handleRemoveNodeVersionedMethod, handleUnblockChannelMethod, invoke |
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 |
OptimisticReplicationInterceptor
public OptimisticReplicationInterceptor()
skipMethodCall
protected boolean skipMethodCall(InvocationContext ctx)
- Description copied from class:
MethodDispacherInterceptor
- Each interceptor should extend this if it does not need any processing for current call.
An sample usage would be: this interceptor is only interested if thre is one transaction going on. If so all
handleXYZ would know that we have a transaction going and would not check its state.
- Overrides:
skipMethodCall
in class MethodDispacherInterceptor
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 gtx)
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 gtx)
throws Throwable
- Description copied from class:
MethodDispacherInterceptor
- Handles
CacheImpl.rollback(org.jboss.cache.transaction.GlobalTransaction)
- Overrides:
handleRollbackMethod
in class MethodDispacherInterceptor
- Throws:
Throwable
handlePutForExternalReadVersionedMethod
protected Object handlePutForExternalReadVersionedMethod(InvocationContext ctx,
GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value,
DataVersion dv)
throws Throwable
- Description copied from class:
MethodDispacherInterceptor
- Handles
CacheImpl._putForExternalRead(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, Object, org.jboss.cache.optimistic.DataVersion)
- Overrides:
handlePutForExternalReadVersionedMethod
in class MethodDispacherInterceptor
- Throws:
Throwable
handlePutForExternalReadMethod
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value)
throws Throwable
- Description copied from class:
MethodDispacherInterceptor
- Handles
CacheImpl._putForExternalRead(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, Object, Object)
- Overrides:
handlePutForExternalReadMethod
in class MethodDispacherInterceptor
- Throws:
Throwable
broadcastPrepare
protected void broadcastPrepare(MethodCall methodCall,
GlobalTransaction gtx,
InvocationContext ctx)
throws Throwable
- Throws:
Throwable
broadcastCommit
protected void broadcastCommit(GlobalTransaction gtx,
InvocationContext ctx)
throws Throwable
- Throws:
Throwable
broadcastRollback
protected void broadcastRollback(GlobalTransaction gtx,
InvocationContext ctx)
throws Throwable
- Throws:
Throwable
getTransactionWorkspace
protected TransactionWorkspace getTransactionWorkspace(GlobalTransaction gtx)
throws CacheException
- Throws:
CacheException
Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.