Class GridDistributedTxRemoteAdapter
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
-
- org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
-
- org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxRemoteAdapter
-
- All Implemented Interfaces:
IgniteInternalTx,IgniteTxRemoteEx
- Direct Known Subclasses:
GridDhtTxRemote,GridNearTxRemote
public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter implements IgniteTxRemoteEx
Transaction created by system implicitly on remote nodes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
GridMetadataAwareAdapter.EntryKey
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
IgniteInternalTx.FinalizationStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected IgniteTxRemoteStatetxState-
Fields inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
cctx, concurrency, consistentIdMapper, deploymentLdrId, implicit, invalidate, isDone, isolation, log, nodeId, onePhaseCommit, startTime, taskName, threadId, topVer, txNodes, txSize, xidVer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridDistributedTxRemoteAdapter(GridCacheSharedContext<?,?> ctx, UUID nodeId, GridCacheVersion xidVer, GridCacheVersion commitVer, boolean sys, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, boolean invalidate, long timeout, int txSize, @Nullable UUID subjId, int taskNameHash, @Nullable String txLbl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanactiveCachesDeploymentEnabled()voidactiveCachesDeploymentEnabled(boolean depEnabled)voidaddActiveCache(GridCacheContext<?,?> cacheCtx, boolean recovery)Adds cache to the list of active caches in transaction.protected voidaddExplicit(IgniteTxEntry e)Adds explicit version if there is one.Collection<IgniteTxEntry>allEntries()Collection<GridCacheVersion>alternateVersions()voidclearEntry(IgniteTxKey key)Clears entry from transaction as it never happened.IgniteInternalFuture<IgniteInternalTx>commitAsync()Asynchronously commits this transaction by initiatingtwo-phase-commitprocess.voidcommitError(Throwable e)voidcommitRemoteTx()voiddoneRemote(GridCacheVersion baseVer, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, Collection<GridCacheVersion> pendingVers)booleanempty()IgniteTxEntryentry(IgniteTxKey key)UUIDeventNodeId()voidforceCommit()Forces commit for this tx.booleanhasWriteKey(IgniteTxKey key)voidinvalidate(boolean invalidate)booleanisStarted()Stringlabel()Returns label of transactions.booleanonOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner)Callback invoked whenever there is a lock that has been acquired by this transaction for any of the participating entries.UUIDoriginatingNodeId()Gets node ID which directly started this transaction.GridTuple<CacheObject>peek(GridCacheContext cacheCtx, boolean failFast, KeyCacheObject key)voidprepareRemoteTx()Collection<IgniteTxEntry>readEntries()Map<IgniteTxKey,IgniteTxEntry>readMap()Set<IgniteTxKey>readSet()IgniteInternalFuture<IgniteInternalTx>rollbackAsync()Asynchronously rollback this transaction.voidrollbackRemoteTx()IgniteInternalFuture<?>salvageTx()voidseal()Seals transaction for updates.StringtoString()IgniteTxStatetxState()Collection<IgniteTxEntry>writeEntries()Map<IgniteTxKey,IgniteTxEntry>writeMap()Set<IgniteTxKey>writeSet()-
Methods inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
addInvalidPartition, applyTransformClosures, applyTxSizes, batchStoreCommit, chainState, checkInternal, colocated, commitVersion, commitVersion, completedVersions, concurrency, conflictResolve, context, currentPrepareFuture, dht, done, equals, errorWhenCommitting, evictNearEntry, finalizationStatus, finishFuture, hashCode, heuristicException, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidPartitions, ioPolicy, isInvalidate, isNearLocallyMapped, isolation, isRollbackOnly, isSystemInvalidate, isWriteToStoreFromDhtValid, local, localResult, log, logTxFinishErrorSafe, markFinalizing, near, nearXidVersion, needReturnValue, needReturnValue, needsCompletedVersions, nodeId, onePhaseCommit, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, recordStateChangedEvent, remainingTime, remote, repeatableRead, resolveTaskName, rollbackException, serializable, sessionEnd, setParentTx, setRollbackOnly, size, skipCompletedVersions, skipCompletedVersions, startTime, startTimeNanos, state, state, state, storeEnabled, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, timeout, timeoutException, timeoutException, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, transactionNodes, txCounters, uncommit, updateNearCache, user, writeVersion, writeVersion, xid, xidVersion
-
Methods inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, removeAllMeta, removeMeta, removeMeta, replaceMeta
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
addInvalidPartition, addMeta, colocated, commitVersion, commitVersion, completedVersions, concurrency, currentPrepareFuture, dht, done, errorWhenCommitting, finalizationStatus, finishFuture, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidPartitions, ioPolicy, isInvalidate, isolation, isRollbackOnly, isSystemInvalidate, local, localResult, markFinalizing, masterNodeIds, meta, near, nearXidVersion, needsCompletedVersions, nodeId, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, remainingTime, removeMeta, repeatableRead, serializable, setRollbackOnly, size, startTime, startTimeNanos, state, state, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, timeout, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, txCounters, user, writeVersion, writeVersion, xid, xidVersion
-
-
-
-
Field Detail
-
txState
@GridToStringInclude protected IgniteTxRemoteState txState
-
-
Constructor Detail
-
GridDistributedTxRemoteAdapter
protected GridDistributedTxRemoteAdapter(GridCacheSharedContext<?,?> ctx, UUID nodeId, GridCacheVersion xidVer, GridCacheVersion commitVer, boolean sys, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, boolean invalidate, long timeout, int txSize, @Nullable @Nullable UUID subjId, int taskNameHash, @Nullable @Nullable String txLbl)
- Parameters:
ctx- Cache registry.nodeId- Node ID.xidVer- XID version.commitVer- Commit version.sys- System flag.plc- IO policy.concurrency- Concurrency level (should be pessimistic).isolation- Transaction isolation.invalidate- Invalidate flag.timeout- Timeout.txSize- Expected transaction size.subjId- Subject ID.taskNameHash- Task name hash code.txLbl- Transaction label.
-
-
Method Detail
-
txState
public IgniteTxState txState()
- Specified by:
txStatein interfaceIgniteInternalTx- Returns:
- Transaction state.
-
eventNodeId
public UUID eventNodeId()
- Specified by:
eventNodeIdin interfaceIgniteInternalTx- Returns:
- Event node ID.
-
originatingNodeId
public UUID originatingNodeId()
Gets node ID which directly started this transaction. In case of DHT local transaction it will be near node ID, in case of DHT remote transaction it will be primary node ID.- Specified by:
originatingNodeIdin interfaceIgniteInternalTx- Returns:
- Originating node ID.
-
activeCachesDeploymentEnabled
public boolean activeCachesDeploymentEnabled()
- Specified by:
activeCachesDeploymentEnabledin interfaceIgniteInternalTx- Returns:
trueorfalseif the deployment is enabled or disabled for all active caches involved in this transaction.
-
activeCachesDeploymentEnabled
public void activeCachesDeploymentEnabled(boolean depEnabled)
- Specified by:
activeCachesDeploymentEnabledin interfaceIgniteInternalTx- Parameters:
depEnabled- Flag indicating whether deployment is enabled for caches from this transaction or not.
-
addActiveCache
public void addActiveCache(GridCacheContext<?,?> cacheCtx, boolean recovery) throws IgniteCheckedException
Adds cache to the list of active caches in transaction.- Specified by:
addActiveCachein classIgniteTxAdapter- Parameters:
cacheCtx- Cache context to add.recovery- Recovery flag. SeeCacheOperationContext.setRecovery(boolean).- Throws:
IgniteCheckedException- If caches already enlisted in this transaction are not compatible with given cache (e.g. they have different stores).
-
empty
public boolean empty()
- Specified by:
emptyin interfaceIgniteInternalTx- Returns:
- Checks if transaction has no entries.
-
invalidate
public void invalidate(boolean invalidate)
- Specified by:
invalidatein interfaceIgniteInternalTx- Overrides:
invalidatein classIgniteTxAdapter- Parameters:
invalidate- Invalidate flag.
-
writeMap
public Map<IgniteTxKey,IgniteTxEntry> writeMap()
- Specified by:
writeMapin interfaceIgniteInternalTx- Returns:
- Transaction write map.
-
readMap
public Map<IgniteTxKey,IgniteTxEntry> readMap()
- Specified by:
readMapin interfaceIgniteInternalTx- Returns:
- Transaction read map.
-
seal
public void seal()
Seals transaction for updates.- Specified by:
sealin interfaceIgniteInternalTx
-
peek
public GridTuple<CacheObject> peek(GridCacheContext cacheCtx, boolean failFast, KeyCacheObject key)
- Specified by:
peekin interfaceIgniteInternalTx- Parameters:
cacheCtx- Cache context.failFast- Fail-fast flag.key- Key to look up.- Returns:
- Current value for the key within transaction.
-
entry
public IgniteTxEntry entry(IgniteTxKey key)
- Specified by:
entryin interfaceIgniteInternalTx- Parameters:
key- Key for the entry.- Returns:
- Entry for the key (either from write set or read set).
-
clearEntry
public void clearEntry(IgniteTxKey key)
Clears entry from transaction as it never happened.- Parameters:
key- key to be removed.
-
doneRemote
public void doneRemote(GridCacheVersion baseVer, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, Collection<GridCacheVersion> pendingVers) throws GridDhtInvalidPartitionException
- Specified by:
doneRemotein interfaceIgniteTxRemoteEx- Parameters:
baseVer- Base version.committedVers- Committed versions.rolledbackVers- Rolled back versions.pendingVers- Pending versions.- Throws:
GridDhtInvalidPartitionException- If partition was invalidated.
-
onOwnerChanged
public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner)
Callback invoked whenever there is a lock that has been acquired by this transaction for any of the participating entries.- Specified by:
onOwnerChangedin interfaceIgniteInternalTx- Parameters:
entry- Cache entry.owner- Lock candidate that won ownership of the lock.- Returns:
Trueif transaction cared about notification.
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin classIgniteTxAdapter- Returns:
Trueif transaction has at least one key enlisted.
-
hasWriteKey
public boolean hasWriteKey(IgniteTxKey key)
- Specified by:
hasWriteKeyin interfaceIgniteInternalTx- Parameters:
key- Key to check.- Returns:
Trueif key is present.
-
readSet
public Set<IgniteTxKey> readSet()
- Specified by:
readSetin interfaceIgniteInternalTx- Returns:
- Read set.
-
writeSet
public Set<IgniteTxKey> writeSet()
- Specified by:
writeSetin interfaceIgniteInternalTx- Returns:
- Write set.
-
allEntries
public Collection<IgniteTxEntry> allEntries()
- Specified by:
allEntriesin interfaceIgniteInternalTx- Returns:
- All transaction entries.
-
writeEntries
public Collection<IgniteTxEntry> writeEntries()
- Specified by:
writeEntriesin interfaceIgniteInternalTx- Returns:
- Write entries.
-
readEntries
public Collection<IgniteTxEntry> readEntries()
- Specified by:
readEntriesin interfaceIgniteInternalTx- Returns:
- Read entries.
-
prepareRemoteTx
public final void prepareRemoteTx() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
commitRemoteTx
public final void commitRemoteTx() throws IgniteCheckedException- Specified by:
commitRemoteTxin interfaceIgniteTxRemoteEx- Throws:
IgniteCheckedException- If failed.
-
forceCommit
public void forceCommit() throws IgniteCheckedExceptionForces commit for this tx.- Throws:
IgniteCheckedException- If commit failed.
-
commitAsync
public IgniteInternalFuture<IgniteInternalTx> commitAsync()
Asynchronously commits this transaction by initiatingtwo-phase-commitprocess.- Specified by:
commitAsyncin interfaceIgniteInternalTx- Returns:
- Future for commit operation.
-
salvageTx
public final IgniteInternalFuture<?> salvageTx()
- Specified by:
salvageTxin interfaceIgniteInternalTx- Returns:
- Future.
-
rollbackRemoteTx
public final void rollbackRemoteTx()
- Specified by:
rollbackRemoteTxin interfaceIgniteTxRemoteEx
-
rollbackAsync
public IgniteInternalFuture<IgniteInternalTx> rollbackAsync()
Asynchronously rollback this transaction.- Specified by:
rollbackAsyncin interfaceIgniteInternalTx- Returns:
- Rollback future.
-
alternateVersions
public Collection<GridCacheVersion> alternateVersions()
- Specified by:
alternateVersionsin interfaceIgniteInternalTx- Returns:
- Alternate transaction versions.
-
commitError
public void commitError(Throwable e)
- Specified by:
commitErrorin interfaceIgniteInternalTx- Parameters:
e- Commit error.
-
addExplicit
protected void addExplicit(IgniteTxEntry e)
Adds explicit version if there is one.- Parameters:
e- Transaction entry.
-
label
public String label()
Returns label of transactions.- Specified by:
labelin interfaceIgniteInternalTx- Returns:
- Label of transaction or
nullif there was not set.
-
toString
public String toString()
- Overrides:
toStringin classIgniteTxAdapter
-
-