Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.transaction.xa
Interface CacheTransaction

All Known Subinterfaces:
RecoveryAwareTransaction
All Known Implementing Classes:
AbstractCacheTransaction, LocalTransaction, LocalXaTransaction, RecoveryAwareLocalTransaction, RecoveryAwareRemoteTransaction, RemoteTransaction, SyncLocalTransaction

public interface CacheTransaction

Defines the state a infinispan transaction should have.

Since:
4.0
Author:
Mircea.Markus@jboss.com

Method Summary
 void addBackupLockForKey(Object key)
           
 void addReadKey(Object key)
           
 void clearLockedKeys()
           
 void clearLookedUpEntries()
           
 List<WriteCommand> getAllModifications()
          Returns all the modifications visible within the current transaction, including those using Flag#CACHE_MODE_LOCAL.
 Set<Object> getBackupLockedKeys()
           
 GlobalTransaction getGlobalTransaction()
          Returns the transaction identifier.
 Set<Object> getLockedKeys()
           
 Map<Object,CacheEntry> getLookedUpEntries()
           
 EntryVersion getLookedUpRemoteVersion(Object key)
           
 List<WriteCommand> getModifications()
          Returns the modifications visible within the current transaction.
 int getTopologyId()
           
 EntryVersionsMap getUpdatedEntryVersions()
           
 boolean hasModification(Class<?> modificationClass)
          Checks if a modification of the given class (or subclass) is present in this transaction.
 boolean isMarkedForRollback()
           
 boolean keyRead(Object key)
           
 CacheEntry lookupEntry(Object key)
           
 void markForRollback(boolean markForRollback)
           
 void notifyOnTransactionFinished()
           
 boolean ownsLock(Object key)
           
 void putLookedUpEntries(Map<Object,CacheEntry> entries)
           
 void putLookedUpEntry(Object key, CacheEntry e)
           
 void putLookedUpRemoteVersion(Object key, EntryVersion version)
           
 void removeLookedUpEntry(Object key)
           
 void setUpdatedEntryVersions(EntryVersionsMap updatedEntryVersions)
           
 boolean waitForLockRelease(Object key, long lockAcquisitionTimeout)
          Checks if this transaction holds a lock on the given key and then waits until the transaction completes or until the timeout expires and returns true if the transaction is complete or false otherwise.
 

Method Detail

getGlobalTransaction

GlobalTransaction getGlobalTransaction()
Returns the transaction identifier.


getModifications

List<WriteCommand> getModifications()
Returns the modifications visible within the current transaction. Any modifications using Flag#CACHE_MODE_LOCAL are excluded. The returned list is never null.


getAllModifications

List<WriteCommand> getAllModifications()
Returns all the modifications visible within the current transaction, including those using Flag#CACHE_MODE_LOCAL. The returned list is never null.


hasModification

boolean hasModification(Class<?> modificationClass)
Checks if a modification of the given class (or subclass) is present in this transaction. Any modifications using Flag#CACHE_MODE_LOCAL are ignored.

Parameters:
modificationClass - the modification type to look for
Returns:
true if found, false otherwise

lookupEntry

CacheEntry lookupEntry(Object key)

getLookedUpEntries

Map<Object,CacheEntry> getLookedUpEntries()

putLookedUpEntry

void putLookedUpEntry(Object key,
                      CacheEntry e)

putLookedUpEntries

void putLookedUpEntries(Map<Object,CacheEntry> entries)

removeLookedUpEntry

void removeLookedUpEntry(Object key)

clearLookedUpEntries

void clearLookedUpEntries()

ownsLock

boolean ownsLock(Object key)

clearLockedKeys

void clearLockedKeys()

getLockedKeys

Set<Object> getLockedKeys()

getTopologyId

int getTopologyId()

getBackupLockedKeys

Set<Object> getBackupLockedKeys()

addBackupLockForKey

void addBackupLockForKey(Object key)

notifyOnTransactionFinished

void notifyOnTransactionFinished()
See Also:
org.infinispan.interceptors.locking.AbstractTxLockingInterceptor#lockKeyAndCheckOwnership(org.infinispan.context.InvocationContext, Object)

waitForLockRelease

boolean waitForLockRelease(Object key,
                           long lockAcquisitionTimeout)
                           throws InterruptedException
Checks if this transaction holds a lock on the given key and then waits until the transaction completes or until the timeout expires and returns true if the transaction is complete or false otherwise. If the key is not locked or if the transaction is already completed it returns true immediately.

This method is subject to spurious returns in a way similar to Object.wait(). It can sometimes return before the specified time has elapsed and without guaranteeing that this transaction is complete. The caller is responsible to call the method again if transaction completion was not reached and the time budget was not spent.

Throws:
InterruptedException
See Also:
org.infinispan.interceptors.locking.AbstractTxLockingInterceptor#lockKeyAndCheckOwnership(org.infinispan.context.InvocationContext, Object)

getUpdatedEntryVersions

EntryVersionsMap getUpdatedEntryVersions()

setUpdatedEntryVersions

void setUpdatedEntryVersions(EntryVersionsMap updatedEntryVersions)

putLookedUpRemoteVersion

void putLookedUpRemoteVersion(Object key,
                              EntryVersion version)

getLookedUpRemoteVersion

EntryVersion getLookedUpRemoteVersion(Object key)

keyRead

boolean keyRead(Object key)

addReadKey

void addReadKey(Object key)

isMarkedForRollback

boolean isMarkedForRollback()

markForRollback

void markForRollback(boolean markForRollback)

Infinispan Distribution 5.2.6.Final-redhat-2

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