public class GridDistributedTxRemoteAdapter<K,V> extends GridCacheTxAdapter<K,V> implements GridCacheTxRemoteEx<K,V>
GridCacheTxEx.FinalizationStatus| Modifier and Type | Field and Description |
|---|---|
protected Map<K,GridCacheTxEntry<K,V>> |
readMap
Read set.
|
protected Map<K,GridCacheTxEntry<K,V>> |
writeMap
Write map.
|
cctx, concurrency, endVer, grpLockKey, implicit, implicitSingle, internal, invalidate, isDone, isolation, loc, log, nodeId, onePhaseCommit, startTime, startVer, storeEnabled, subjId, swapOrOffheapEnabled, threadId, timeout, txSize, writeVer, xidVer| Constructor and Description |
|---|
GridDistributedTxRemoteAdapter()
Empty constructor required for
Externalizable. |
GridDistributedTxRemoteAdapter(GridCacheContext<K,V> ctx,
UUID nodeId,
long rmtThreadId,
GridCacheVersion xidVer,
GridCacheVersion commitVer,
GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation,
boolean invalidate,
long timeout,
int txSize,
Object grpLockKey,
UUID subjId) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addExplicit(GridCacheTxEntry<K,V> e)
Adds explicit version if there is one.
|
void |
addLocalCandidates(K key,
Collection<GridCacheMvccCandidate<K>> cands) |
void |
addRead(K key,
byte[] keyBytes,
GridCacheVersion drVer) |
void |
addRemoteCandidates(Map<K,Collection<GridCacheMvccCandidate<K>>> cands,
Collection<GridCacheVersion> committedVers,
Collection<GridCacheVersion> rolledbackVers)
Adds remote candidates and completed versions to all involved entries.
|
void |
addWrite(K key,
byte[] keyBytes,
GridCacheOperation op,
V val,
byte[] valBytes,
GridCacheVersion drVer) |
Collection<GridCacheTxEntry<K,V>> |
allEntries() |
Collection<GridCacheVersion> |
alternateVersions() |
void |
clearEntry(K key)
Clears entry from transaction as it never happened.
|
void |
commit()
Commits this transaction by initiating
two-phase-commit process. |
GridFuture<GridCacheTx> |
commitAsync()
Asynchronously commits this transaction by initiating
two-phase-commit process. |
void |
doneRemote(GridCacheVersion baseVer,
Collection<GridCacheVersion> committedVers,
Collection<GridCacheVersion> rolledbackVers,
Collection<GridCacheVersion> pendingVers) |
boolean |
empty() |
GridCacheTxEntry<K,V> |
entry(K key) |
UUID |
eventNodeId() |
void |
forceCommit()
Forces commit for this tx.
|
void |
groupLockKey(Object key)
Adds group lock key to remote transaction.
|
boolean |
hasReadKey(K key) |
boolean |
hasWriteKey(K key) |
void |
invalidate(boolean invalidate) |
boolean |
isStarted() |
Map<K,Collection<GridCacheMvccCandidate<K>>> |
localCandidates() |
Collection<UUID> |
masterNodeIds() |
boolean |
onOwnerChanged(GridCacheEntryEx<K,V> entry,
GridCacheMvccCandidate<K> owner)
Callback invoked whenever there is a lock that has been acquired
by this transaction for any of the participating entries.
|
UUID |
originatingNodeId()
Gets node ID which directly started this transaction.
|
GridTuple<V> |
peek(boolean failFast,
K key,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
void |
prepare()
Prepare phase.
|
GridFuture<GridCacheTxEx<K,V>> |
prepareAsync()
Prepare stage.
|
Collection<GridCacheTxEntry<K,V>> |
readEntries() |
Map<K,GridCacheTxEntry<K,V>> |
readMap() |
Set<K> |
readSet() |
long |
remoteThreadId() |
boolean |
removed(K key)
Checks whether given key has been removed within transaction.
|
void |
rollback()
Rolls back this transaction.
|
GridFuture<GridCacheTx> |
rollbackAsync()
TODO-gg-4004 Put rollback async on public API?
Asynchronously rollback this transaction.
|
void |
seal()
Seals transaction for updates.
|
boolean |
setWriteValue(GridCacheTxEntry<K,V> e) |
String |
toString() |
Collection<GridCacheTxEntry<K,V>> |
writeEntries() |
Map<K,GridCacheTxEntry<K,V>> |
writeMap() |
Set<K> |
writeSet() |
addInvalidPartition, applyTransformClosures, awaitCompletion, awaitSignal, awaitSignal, checkInternal, close, colocated, commitVersion, commitVersion, completedVersions, concurrency, dht, done, drResolveConflict, endTime, endVersion, endVersion, enforceSerializable, equals, evictNearEntry, finalizationStatus, finishFuture, groupLock, groupLockEntry, groupLockKey, hashCode, implicit, implicitSingle, initCommitVersion, internal, invalidPartitions, isInvalidate, isNearLocallyMapped, isolation, isRollbackOnly, isSystemInvalidate, local, lock, lockTimeout, log, markFinalizing, markPreparing, near, nearXidVersion, needsCompletedVersions, nodeId, onePhaseCommit, onePhaseCommit, onTimeout, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, readExternal, readResolve, recoveryWrites, recoveryWrites, remainingTime, repeatableRead, replicated, serializable, setRollbackOnly, signalAll, size, startTime, startVersion, state, state, subjectId, syncCommit, syncRollback, systemInvalidate, threadId, timedOut, timeout, timeout, timeoutId, topologyVersion, topologyVersion, transactionNodes, unlock, updateNearCache, user, writeExternal, writeVersion, writeVersion, xid, xidVersionaddMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, readExternalMeta, removeMeta, removeMeta, replaceMeta, writeExternalMetafinalize, getClass, notify, notifyAll, wait, wait, waitaddInvalidPartition, colocated, commitVersion, commitVersion, completedVersions, dht, done, endVersion, endVersion, enforceSerializable, finishFuture, groupLock, groupLockKey, implicitSingle, internal, invalidPartitions, isSystemInvalidate, local, markFinalizing, markPreparing, near, nearXidVersion, needsCompletedVersions, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, recoveryWrites, remainingTime, repeatableRead, replicated, serializable, size, startVersion, state, subjectId, syncCommit, syncRollback, systemInvalidate, timedOut, topologyVersion, topologyVersion, transactionNodes, user, writeVersion, writeVersion, xidVersionclose, concurrency, implicit, isInvalidate, isolation, isRollbackOnly, nodeId, setRollbackOnly, startTime, state, threadId, timeout, timeout, xidaddMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMetaendTime, onTimeout, timeoutId@GridToStringInclude protected Map<K,GridCacheTxEntry<K,V>> readMap
@GridToStringInclude protected Map<K,GridCacheTxEntry<K,V>> writeMap
public GridDistributedTxRemoteAdapter()
Externalizable.public GridDistributedTxRemoteAdapter(GridCacheContext<K,V> ctx, UUID nodeId, long rmtThreadId, GridCacheVersion xidVer, GridCacheVersion commitVer, GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, boolean invalidate, long timeout, int txSize, @Nullable Object grpLockKey, @Nullable UUID subjId)
ctx - Cache registry.nodeId - Node ID.rmtThreadId - Remote thread ID.xidVer - XID version.commitVer - Commit version.concurrency - Concurrency level (should be pessimistic).isolation - Transaction isolation.invalidate - Invalidate flag.timeout - Timeout.txSize - Expected transaction size.grpLockKey - Group lock key if this is a group-lock transaction.public UUID eventNodeId()
eventNodeId in interface GridCacheTxEx<K,V>public Collection<UUID> masterNodeIds()
masterNodeIds in interface GridCacheTxEx<K,V>public UUID originatingNodeId()
originatingNodeId in interface GridCacheTxEx<K,V>public boolean empty()
empty in interface GridCacheTxEx<K,V>public boolean removed(K key)
removed in interface GridCacheTxEx<K,V>key - Key to check.True if key has been removed.public void invalidate(boolean invalidate)
invalidate in interface GridCacheTxEx<K,V>invalidate in class GridCacheTxAdapter<K,V>invalidate - Invalidate flag.public Map<K,GridCacheTxEntry<K,V>> writeMap()
writeMap in interface GridCacheTxEx<K,V>public Map<K,GridCacheTxEntry<K,V>> readMap()
readMap in interface GridCacheTxEx<K,V>public void seal()
seal in interface GridCacheTxEx<K,V>public void groupLockKey(Object key)
key - Key.public GridTuple<V> peek(boolean failFast, K key, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridCacheFilterFailedException
peek in interface GridCacheTxEx<K,V>failFast - Fail-fast flag.key - Key to look up.filter - Filter to check.GridCacheFilterFailedException - If filter failed and failFast is true.public GridCacheTxEntry<K,V> entry(K key)
entry in interface GridCacheTxEx<K,V>key - Key for the entry.public void clearEntry(K key)
key - key to be removed.public void addRemoteCandidates(Map<K,Collection<GridCacheMvccCandidate<K>>> cands, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers)
addRemoteCandidates in interface GridCacheTxRemoteEx<K,V>cands - Candidates.committedVers - Committed versions.rolledbackVers - Rolled back versions.public void doneRemote(GridCacheVersion baseVer, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, Collection<GridCacheVersion> pendingVers)
doneRemote in interface GridCacheTxRemoteEx<K,V>baseVer - Base version.committedVers - Committed versions.rolledbackVers - Rolled back versions.pendingVers - Pending versions.public boolean onOwnerChanged(GridCacheEntryEx<K,V> entry, GridCacheMvccCandidate<K> owner)
onOwnerChanged in interface GridCacheTxEx<K,V>entry - Cache entry.owner - Lock candidate that won ownership of the lock.True if transaction cared about notification.public boolean isStarted()
isStarted in class GridCacheTxAdapter<K,V>True if transaction has at least one key enlisted.public long remoteThreadId()
remoteThreadId in interface GridCacheTxRemoteEx<K,V>public void addRead(K key, byte[] keyBytes, @Nullable GridCacheVersion drVer)
key - Key to add to read set.keyBytes - Key bytes.drVer - Data center replication version.public void addWrite(K key, byte[] keyBytes, GridCacheOperation op, V val, byte[] valBytes, @Nullable GridCacheVersion drVer)
key - Key to add to write set.keyBytes - Key bytes.op - Cache operation.val - Write value.valBytes - Write value bytes.drVer - Data center replication version.public boolean setWriteValue(GridCacheTxEntry<K,V> e)
setWriteValue in interface GridCacheTxRemoteEx<K,V>e - Transaction entry to set.True if value was set.public boolean hasReadKey(K key)
hasReadKey in interface GridCacheTxEx<K,V>key - Key to check.True if key is present.public boolean hasWriteKey(K key)
hasWriteKey in interface GridCacheTxEx<K,V>key - Key to check.True if key is present.public GridFuture<GridCacheTxEx<K,V>> prepareAsync()
prepareAsync in interface GridCacheTxEx<K,V>public Set<K> readSet()
readSet in interface GridCacheTxEx<K,V>public Set<K> writeSet()
writeSet in interface GridCacheTxEx<K,V>public Collection<GridCacheTxEntry<K,V>> allEntries()
allEntries in interface GridCacheTxEx<K,V>public Collection<GridCacheTxEntry<K,V>> writeEntries()
writeEntries in interface GridCacheTxEx<K,V>public Collection<GridCacheTxEntry<K,V>> readEntries()
readEntries in interface GridCacheTxEx<K,V>public void prepare()
throws GridException
prepare in interface GridCacheTxEx<K,V>GridException - If prepare failed.public void commit()
throws GridException
two-phase-commit process.commit in interface GridCacheTxGridException - If commit failed.public void forceCommit()
throws GridException
GridException - If commit failed.public GridFuture<GridCacheTx> commitAsync()
two-phase-commit process.commitAsync in interface GridCacheTxpublic void rollback()
rollback in interface GridCacheTxpublic GridFuture<GridCacheTx> rollbackAsync()
rollbackAsync in interface GridCacheTxEx<K,V>public void addLocalCandidates(K key, Collection<GridCacheMvccCandidate<K>> cands)
addLocalCandidates in interface GridCacheTxEx<K,V>key - Cache key.cands - Collection of lock candidates for that key.public Map<K,Collection<GridCacheMvccCandidate<K>>> localCandidates()
localCandidates in interface GridCacheTxEx<K,V>public Collection<GridCacheVersion> alternateVersions()
alternateVersions in interface GridCacheTxEx<K,V>protected void addExplicit(GridCacheTxEntry<K,V> e)
e - Transaction entry.public String toString()
toString in class GridCacheTxAdapter<K,V>Copyright © 2014. All rights reserved.