Class GridNearTxLocal
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
-
- org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
-
- org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
-
- org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
-
- org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal
-
- All Implemented Interfaces:
AutoCloseable,IgniteInternalTx,IgniteTxLocalEx,GridTimeoutObject
public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeoutObject, AutoCloseable
Replicated user transaction.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classGridNearTxLocal.FinishClosure<T>Post-lock closure.-
Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
IgniteTxLocalAdapter.PLC1<T>, IgniteTxLocalAdapter.PLC2<T>, IgniteTxLocalAdapter.PostLockClosure1<T>, IgniteTxLocalAdapter.PostLockClosure2<T>
-
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 booleantransformIf this transaction contains transform entries.-
Fields inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
dhtMap, explicitLock, lockFut, mapped, nearMap, ROLLBACK_FUT
-
Fields inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
COMMIT_ERR_UPD, DONE_FLAG_UPD, implicitRes, minVer, txState
-
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 Constructor Description GridNearTxLocal(GridCacheSharedContext ctx, boolean implicit, boolean implicitSingle, boolean sys, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean storeEnabled, int txSize, @Nullable UUID subjId, int taskNameHash, @Nullable String lb, IgniteTxManager.TxDumpsThrottling txDumpsThrottling)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IgniteCacheExpiryPolicyaccessPolicy(GridCacheContext cacheCtx, Collection<KeyCacheObject> keys)protected IgniteCacheExpiryPolicyaccessPolicy(GridCacheContext ctx, IgniteTxKey key, @Nullable javax.cache.expiry.ExpiryPolicy expiryPlc)voidaddKeyMapping(IgniteTxKey key, ClusterNode node)Adds key mapping to dht mapping.protected IgniteInternalFuture<Boolean>addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)Adds reader to cached entry.protected voidclearPrepareFuture(GridDhtTxPrepareFuture fut)Removes previously created prepare future from atomic reference.voidclose()voidclose(boolean clearThreadMap)booleancolocated()booleancolocatedLocallyMapped()voidcolocatedLocallyMapped(boolean colocatedLocallyMapped)voidcommit()IgniteInternalFuture<IgniteInternalTx>commitAsync()Asynchronously commits this transaction by initiatingtwo-phase-commitprocess.IgniteInternalFuture<IgniteInternalTx>commitAsyncLocal()Commits local part of colocated transaction.IgniteInternalFuture<IgniteInternalTx>commitNearTxLocalAsync()@Nullable IgniteInternalFuture<?>currentPrepareFuture()longendTime()voidenterSystemSection()Enters the section when system time for this transaction is counted.protected GridCacheEntryExentryEx(GridCacheContext cacheCtx, IgniteTxKey key, AffinityTopologyVersion topVer)Gets cache entry for given key and topology version.<K,V>
IgniteInternalFuture<Map<K,V>>getAllAsync(GridCacheContext cacheCtx, @Nullable AffinityTopologyVersion entryTopVer, Collection<KeyCacheObject> keys, boolean deserializeBinary, boolean skipVals, boolean keepCacheObjects, boolean skipStore, boolean recovery, ReadRepairStrategy readRepairStrategy, boolean needVer)booleanhasRemoteLocks()voidhasRemoteLocks(boolean hasRemoteLocks)<K,V,T>
IgniteInternalFuture<GridCacheReturn>invokeAsync(GridCacheContext cacheCtx, @Nullable AffinityTopologyVersion entryTopVer, @Nullable Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,Object>> map, Object... invokeArgs)<K,V>
IgniteInternalFuture<GridCacheReturn>invokeAsync(GridCacheContext cacheCtx, @Nullable AffinityTopologyVersion entryTopVer, K key, javax.cache.processor.EntryProcessor<K,V,Object> entryProc, Object... invokeArgs)Stringlabel()Returns label of transactions.voidleaveSystemSection()Leaves the section when system time for this transaction is counted.booleanlocalFinish(boolean commit, boolean clearThreadMap)Finishes transaction (either commit or rollback).<K> IgniteInternalFuture<GridCacheReturn>lockAllAsync(GridCacheContext cacheCtx, Collection<? extends K> keys, boolean retval, boolean read, long createTtl, long accessTtl, boolean skipStore, boolean keepBinary)IgniteTxMappingsmappings()booleanmarkExplicit(UUID nodeId)booleannear()protected IgniteUuidnearFutureId()booleannearLocallyMapped()protected UUIDnearNodeId()GridCacheVersionnearXidVersion()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.voidonRemap(AffinityTopologyVersion topVer, boolean reset)voidonTimeout()Timeout callback.Collection<IgniteTxEntry>optimisticLockEntries()Gets a list of entries that needs to be locked on the next step of prepare stage of optimistic transaction.booleanownsLock(GridCacheEntryEx entry)booleanownsLockUnsafe(GridCacheEntryEx entry)voidprepare(boolean awaitLastFut)IgniteInternalFuture<GridNearTxPrepareResponse>prepareAsyncLocal(GridNearTxPrepareRequest req)Prepares next batch of entries in dht transaction.IgniteInternalFuture<?>prepareNearTxLocal()TransactionProxyproxy()<K,V>
IgniteInternalFuture<GridCacheReturn>putAllAsync(GridCacheContext cacheCtx, @Nullable AffinityTopologyVersion entryTopVer, Map<? extends K,? extends V> map, boolean retval)IgniteInternalFuture<?>putAllDrAsync(GridCacheContext cacheCtx, Map<KeyCacheObject,GridCacheDrInfo> drMap)<K,V>
IgniteInternalFuture<GridCacheReturn>putAsync(GridCacheContext cacheCtx, @Nullable AffinityTopologyVersion entryTopVer, K key, V val, boolean retval, CacheEntryPredicate filter)<K,V>
IgniteInternalFuture<GridCacheReturn>removeAllAsync(GridCacheContext cacheCtx, @Nullable AffinityTopologyVersion entryTopVer, Collection<? extends K> keys, boolean retval, CacheEntryPredicate filter, boolean singleRmv)IgniteInternalFuture<?>removeAllDrAsync(GridCacheContext cacheCtx, Map<KeyCacheObject,GridCacheVersion> drMap)booleanremoveMapping(UUID nodeId)voidresume()Resumes transaction (possibly in another thread) if it was previously suspended.voidrollback()IgniteInternalFuture<IgniteInternalTx>rollbackAsync()Asynchronously rollback this transaction.IgniteInternalFuture<IgniteInternalTx>rollbackAsyncLocal()Rolls back local part of colocated transaction.IgniteInternalFuture<IgniteInternalTx>rollbackNearTxLocalAsync()IgniteInternalFuture<IgniteInternalTx>rollbackNearTxLocalAsync(boolean clearThreadMap, boolean onTimeout)TransactionProxyrollbackOnlyProxy()IgniteInternalFuture<?>salvageTx()protected voidsendFinishReply(@Nullable Throwable err)booleanstate(TransactionState state)voidsuspend()Suspends transaction.longsystemTimeCurrent()Returns current amount of time that transaction has spent on system activities (acquiring locks, commiting, rolling back, etc.)voidthreadId(long threadId)longtimeout(long timeout)Sets transaction timeout value.IgniteUuidtimeoutId()StringtoString()protected voidupdateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry)Updates explicit version for tx entry based on current entry lock owner.-
Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
addEntry, addInvalidPartition, chainOnePhasePrepare, clearLockFuture, commitOnPrepare, explicitLock, explicitLock, finishFuture, mapExplicitLocks, nearOnOriginatingNode, needsCompletedVersions, pendingVersions, tryRollbackAsync, updateLockFuture
-
Methods inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
activeCachesDeploymentEnabled, activeCachesDeploymentEnabled, addActiveCache, addEntry, addInvokeResult, allEntries, alternateVersions, calculatePartitionUpdateCounters, checkValid, checkValid, commitAfterLock, commitError, commitError, committedVersions, completedBase, completedVersions, empty, entry, entryExpireTime, entryTtl, eventNodeId, hasInterceptor, hasWriteKey, implicitSingleResult, init, initResult, isStarted, masterNodeIds, minVersion, originatingNodeId, peek, postLockWrite, readEntries, readMap, readSet, rolledbackVersions, seal, syncMode, syncMode, tmFinish, txState, userCommit, userPrepare, userRollback, writeEntries, writeMap, writeSet
-
Methods inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
applyTransformClosures, applyTxSizes, batchStoreCommit, chainState, checkInternal, commitVersion, commitVersion, concurrency, conflictResolve, context, dht, done, equals, errorWhenCommitting, evictNearEntry, finalizationStatus, finishFuture, hashCode, heuristicException, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isNearLocallyMapped, isolation, isRollbackOnly, isSystemInvalidate, isWriteToStoreFromDhtValid, local, localResult, log, logTxFinishErrorSafe, markFinalizing, needReturnValue, needReturnValue, nodeId, onePhaseCommit, onePhaseCommit, optimistic, otherNodeId, ownedVersion, pessimistic, readCommitted, recordStateChangedEvent, remainingTime, remote, repeatableRead, resolveTaskName, rollbackException, serializable, sessionEnd, setParentTx, setRollbackOnly, size, skipCompletedVersions, skipCompletedVersions, startTime, startTimeNanos, state, state, storeEnabled, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, 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
addMeta, commitVersion, commitVersion, concurrency, dht, done, errorWhenCommitting, finalizationStatus, finishFuture, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isolation, isRollbackOnly, isSystemInvalidate, local, localResult, markFinalizing, meta, nodeId, onePhaseCommit, optimistic, otherNodeId, ownedVersion, pessimistic, readCommitted, remainingTime, removeMeta, repeatableRead, serializable, setRollbackOnly, size, startTime, startTimeNanos, state, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, txCounters, user, writeVersion, writeVersion, xid, xidVersion
-
-
-
-
Constructor Detail
-
GridNearTxLocal
public GridNearTxLocal(GridCacheSharedContext ctx, boolean implicit, boolean implicitSingle, boolean sys, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean storeEnabled, int txSize, @Nullable @Nullable UUID subjId, int taskNameHash, @Nullable @Nullable String lb, IgniteTxManager.TxDumpsThrottling txDumpsThrottling)
- Parameters:
ctx- Cache registry.implicit- Implicit flag.implicitSingle- Implicit with one key flag.sys- System flag.plc- IO policy.concurrency- Concurrency.isolation- Isolation.timeout- Timeout.storeEnabled- Store enabled flag.txSize- Transaction size.subjId- Subject ID.taskNameHash- Task name hash code.lb- Label.txDumpsThrottling- Log throttling information.
-
-
Method Detail
-
near
public boolean near()
- Specified by:
nearin interfaceIgniteInternalTx- Overrides:
nearin classIgniteTxAdapter- Returns:
Trueif near transaction.
-
colocated
public boolean colocated()
- Specified by:
colocatedin interfaceIgniteInternalTx- Overrides:
colocatedin classIgniteTxAdapter- Returns:
Trueif dht colocated transaction.
-
nearXidVersion
public GridCacheVersion nearXidVersion()
- Specified by:
nearXidVersionin interfaceIgniteInternalTx- Overrides:
nearXidVersionin classIgniteTxAdapter- Returns:
- Near transaction ID.
-
nearNodeId
protected UUID nearNodeId()
- Specified by:
nearNodeIdin classGridDhtTxLocalAdapter- Returns:
- Near node id.
-
nearFutureId
protected IgniteUuid nearFutureId()
- Specified by:
nearFutureIdin classGridDhtTxLocalAdapter- Returns:
- Near future ID.
-
addReader
protected IgniteInternalFuture<Boolean> addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)
Adds reader to cached entry.- Specified by:
addReaderin classGridDhtTxLocalAdapter- Parameters:
msgId- Message ID.cached- Cached entry.entry- Transaction entry.topVer- Topology version.- Returns:
Trueif reader was added as a result of this call.
-
sendFinishReply
protected void sendFinishReply(@Nullable @Nullable Throwable err)- Specified by:
sendFinishReplyin classGridDhtTxLocalAdapter- Parameters:
err- Error, if any.
-
clearPrepareFuture
protected void clearPrepareFuture(GridDhtTxPrepareFuture fut)
Removes previously created prepare future from atomic reference.- Specified by:
clearPrepareFuturein classGridDhtTxLocalAdapter- Parameters:
fut- Expected future.
-
nearLocallyMapped
public boolean nearLocallyMapped()
- Returns:
Trueif transaction contains at least one near cache key mapped to the local node.
-
colocatedLocallyMapped
public boolean colocatedLocallyMapped()
- Returns:
Trueif transaction contains colocated key mapped to the local node.
-
colocatedLocallyMapped
public void colocatedLocallyMapped(boolean colocatedLocallyMapped)
- Parameters:
colocatedLocallyMapped-Trueif transaction contains colocated key mapped to the local node.
-
ownsLockUnsafe
public boolean ownsLockUnsafe(GridCacheEntryEx entry)
- Specified by:
ownsLockUnsafein interfaceIgniteInternalTx- Overrides:
ownsLockUnsafein classIgniteTxAdapter- Parameters:
entry- Entry to check.- Returns:
Trueif lock is owned.
-
timeout
public long timeout(long timeout)
Sets transaction timeout value. This value can be set only before a first operation on transaction has been performed.- Specified by:
timeoutin interfaceIgniteInternalTx- Overrides:
timeoutin classIgniteTxAdapter- Parameters:
timeout- Transaction timeout value.- Returns:
- Previous timeout.
-
ownsLock
public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException
- Specified by:
ownsLockin interfaceIgniteInternalTx- Overrides:
ownsLockin classIgniteTxAdapter- Parameters:
entry- Entry to check.- Returns:
Trueif lock is owned.- Throws:
GridCacheEntryRemovedException- If entry has been removed.
-
putAllAsync
public <K,V> IgniteInternalFuture<GridCacheReturn> putAllAsync(GridCacheContext cacheCtx, @Nullable @Nullable AffinityTopologyVersion entryTopVer, Map<? extends K,? extends V> map, boolean retval)
- Parameters:
cacheCtx- Cache context.map- Map to put.retval- Flag indicating whether a value should be returned.- Returns:
- Future for put operation.
-
putAsync
public final <K,V> IgniteInternalFuture<GridCacheReturn> putAsync(GridCacheContext cacheCtx, @Nullable @Nullable AffinityTopologyVersion entryTopVer, K key, V val, boolean retval, CacheEntryPredicate filter)
- Parameters:
cacheCtx- Cache context.key- Key.val- Value.retval- Return value flag.filter- Filter.- Returns:
- Future for put operation.
-
invokeAsync
public <K,V> IgniteInternalFuture<GridCacheReturn> invokeAsync(GridCacheContext cacheCtx, @Nullable @Nullable AffinityTopologyVersion entryTopVer, K key, javax.cache.processor.EntryProcessor<K,V,Object> entryProc, Object... invokeArgs)
- Parameters:
cacheCtx- Cache context.key- Key.entryProc- Entry processor.invokeArgs- Optional arguments for entry processor.- Returns:
- Operation future.
-
invokeAsync
public <K,V,T> IgniteInternalFuture<GridCacheReturn> invokeAsync(GridCacheContext cacheCtx, @Nullable @Nullable AffinityTopologyVersion entryTopVer, @Nullable @Nullable Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,Object>> map, Object... invokeArgs)
- Parameters:
cacheCtx- Cache context.map- Entry processors map.invokeArgs- Optional arguments for entry processor.- Returns:
- Operation future.
-
putAllDrAsync
public IgniteInternalFuture<?> putAllDrAsync(GridCacheContext cacheCtx, Map<KeyCacheObject,GridCacheDrInfo> drMap)
- Parameters:
cacheCtx- Cache context.drMap- DR map to put.- Returns:
- Future for DR put operation.
-
removeAllDrAsync
public IgniteInternalFuture<?> removeAllDrAsync(GridCacheContext cacheCtx, Map<KeyCacheObject,GridCacheVersion> drMap)
- Parameters:
cacheCtx- Cache context.drMap- DR map.- Returns:
- Future for asynchronous remove.
-
removeAllAsync
public <K,V> IgniteInternalFuture<GridCacheReturn> removeAllAsync(GridCacheContext cacheCtx, @Nullable @Nullable AffinityTopologyVersion entryTopVer, Collection<? extends K> keys, boolean retval, CacheEntryPredicate filter, boolean singleRmv)
- Parameters:
cacheCtx- Cache context.keys- Keys to remove.retval- Flag indicating whether a value should be returned.filter- Filter.singleRmv-Truefor single key remove operation (Cache.remove(Object).- Returns:
- Future for asynchronous remove.
-
getAllAsync
public <K,V> IgniteInternalFuture<Map<K,V>> getAllAsync(GridCacheContext cacheCtx, @Nullable @Nullable AffinityTopologyVersion entryTopVer, Collection<KeyCacheObject> keys, boolean deserializeBinary, boolean skipVals, boolean keepCacheObjects, boolean skipStore, boolean recovery, ReadRepairStrategy readRepairStrategy, boolean needVer)
- Parameters:
cacheCtx- Cache context.keys- Keys to get.deserializeBinary- Deserialize binary flag.skipVals- Skip values flag.keepCacheObjects- Keep cache objectsskipStore- Skip store flag.readRepairStrategy- Read Repair strategy.- Returns:
- Future for this get.
-
optimisticLockEntries
public Collection<IgniteTxEntry> optimisticLockEntries()
Gets a list of entries that needs to be locked on the next step of prepare stage of optimistic transaction.- Specified by:
optimisticLockEntriesin interfaceIgniteInternalTx- Overrides:
optimisticLockEntriesin classIgniteTxAdapter- Returns:
- List of tx entries for optimistic locking.
-
updateExplicitVersion
protected void updateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry) throws GridCacheEntryRemovedException
Updates explicit version for tx entry based on current entry lock owner.- Overrides:
updateExplicitVersionin classIgniteTxLocalAdapter- Parameters:
txEntry- Tx entry to update.entry- Entry.- Throws:
GridCacheEntryRemovedException- If entry was concurrently removed.
-
mappings
public IgniteTxMappings mappings()
- Returns:
- DHT map.
-
removeMapping
public boolean removeMapping(UUID nodeId)
- Overrides:
removeMappingin classGridDhtTxLocalAdapter- Parameters:
nodeId- Undo mapping.- Returns:
Trueif mapping was removed.
-
addKeyMapping
public void addKeyMapping(IgniteTxKey key, ClusterNode node)
Adds key mapping to dht mapping.- Parameters:
key- Key to add.node- Node this key mapped to.
-
suspend
public void suspend() throws IgniteCheckedExceptionSuspends transaction. It could be resumed later.- Throws:
IgniteCheckedException- If the transaction is in an incorrect state, or timed out.
-
resume
public void resume() throws IgniteCheckedExceptionResumes transaction (possibly in another thread) if it was previously suspended.- Throws:
IgniteCheckedException- If the transaction is in an incorrect state, or timed out.
-
markExplicit
public boolean markExplicit(UUID nodeId)
- Parameters:
nodeId- Node ID to mark with explicit lock.- Returns:
Trueif mapping was found.
-
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- Overrides:
onOwnerChangedin classIgniteTxLocalAdapter- Parameters:
entry- Cache entry.owner- Lock candidate that won ownership of the lock.- Returns:
Trueif transaction cared about notification.
-
localFinish
public boolean localFinish(boolean commit, boolean clearThreadMap) throws IgniteCheckedExceptionFinishes transaction (either commit or rollback).- Specified by:
localFinishin interfaceIgniteTxLocalEx- Overrides:
localFinishin classGridDhtTxLocalAdapter- Parameters:
commit-Trueif commit,falseif rollback.clearThreadMap- IftrueremovesGridNearTxLocalfrom thread map.- Returns:
Trueif state has been changed.- Throws:
IgniteCheckedException- If finish failed.
-
systemTimeCurrent
public long systemTimeCurrent()
Returns current amount of time that transaction has spent on system activities (acquiring locks, commiting, rolling back, etc.)- Returns:
- Amount of time in milliseconds.
-
state
public boolean state(TransactionState state)
- Specified by:
statein interfaceIgniteInternalTx- Overrides:
statein classIgniteTxAdapter- Parameters:
state- Transaction state.- Returns:
Trueif transition was valid,falseotherwise.
-
prepareNearTxLocal
public IgniteInternalFuture<?> prepareNearTxLocal()
- Returns:
- Tx prepare future.
-
salvageTx
public IgniteInternalFuture<?> salvageTx()
- Specified by:
salvageTxin interfaceIgniteInternalTx- Returns:
- Future.
-
prepare
public final void prepare(boolean awaitLastFut) throws IgniteCheckedException- Parameters:
awaitLastFut- If true - method will wait until transaction finish every action started before.- Throws:
IgniteCheckedException- If failed.
-
commit
public void commit() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
commitNearTxLocalAsync
public IgniteInternalFuture<IgniteInternalTx> commitNearTxLocalAsync()
- Returns:
- Finish future.
-
commitAsync
public IgniteInternalFuture<IgniteInternalTx> commitAsync()
Asynchronously commits this transaction by initiatingtwo-phase-commitprocess.- Specified by:
commitAsyncin interfaceIgniteInternalTx- Returns:
- Future for commit operation.
-
rollback
public void rollback() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
rollbackNearTxLocalAsync
public IgniteInternalFuture<IgniteInternalTx> rollbackNearTxLocalAsync()
- Returns:
- Rollback future.
-
rollbackNearTxLocalAsync
public IgniteInternalFuture<IgniteInternalTx> rollbackNearTxLocalAsync(boolean clearThreadMap, boolean onTimeout)
- Parameters:
clearThreadMap-Trueif needed to clear thread map.onTimeout-Trueif called from timeout handler. Note: For async rollbacks (from timeouts or another thread) should not clear thread map since thread started tx still should be able to see this tx to prevent subsequent operations.- Returns:
- Rollback future.
-
rollbackAsync
public IgniteInternalFuture<IgniteInternalTx> rollbackAsync()
Asynchronously rollback this transaction.- Specified by:
rollbackAsyncin interfaceIgniteInternalTx- Returns:
- Rollback future.
-
prepareAsyncLocal
public IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsyncLocal(GridNearTxPrepareRequest req)
Prepares next batch of entries in dht transaction.- Parameters:
req- Prepare request.- Returns:
- Future that will be completed when locks are acquired.
-
commitAsyncLocal
public IgniteInternalFuture<IgniteInternalTx> commitAsyncLocal()
Commits local part of colocated transaction.- Returns:
- Commit future.
-
rollbackAsyncLocal
public IgniteInternalFuture<IgniteInternalTx> rollbackAsyncLocal()
Rolls back local part of colocated transaction.- Returns:
- Commit future.
-
lockAllAsync
public <K> IgniteInternalFuture<GridCacheReturn> lockAllAsync(GridCacheContext cacheCtx, Collection<? extends K> keys, boolean retval, boolean read, long createTtl, long accessTtl, boolean skipStore, boolean keepBinary)
- Type Parameters:
K- Key type.- Parameters:
cacheCtx- Cache context.keys- Keys.retval- Return value flag.read- Read flag.createTtl- Create ttl.accessTtl- Access ttl.skipStore- Skip store flag.keepBinary- Keep binary flag.- Returns:
- Future with respond.
-
entryEx
protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key, AffinityTopologyVersion topVer)
Gets cache entry for given key and topology version.- Overrides:
entryExin classIgniteTxLocalAdapter- Parameters:
cacheCtx- Cache context.key- Key.topVer- Topology version.- Returns:
- Cache entry.
-
accessPolicy
protected IgniteCacheExpiryPolicy accessPolicy(GridCacheContext ctx, IgniteTxKey key, @Nullable @Nullable javax.cache.expiry.ExpiryPolicy expiryPlc)
- Overrides:
accessPolicyin classIgniteTxLocalAdapter- Parameters:
ctx- Cache context.key- Key.expiryPlc- Expiry policy.- Returns:
- Expiry policy wrapper for entries accessed locally in optimistic transaction.
-
accessPolicy
protected IgniteCacheExpiryPolicy accessPolicy(GridCacheContext cacheCtx, Collection<KeyCacheObject> keys)
- Overrides:
accessPolicyin classIgniteTxLocalAdapter- Parameters:
cacheCtx- Cache context.keys- Keys.- Returns:
- Expiry policy.
-
close
public void close() throws IgniteCheckedException- Specified by:
closein interfaceAutoCloseable- Throws:
IgniteCheckedException
-
close
public void close(boolean clearThreadMap) throws IgniteCheckedException- Parameters:
clearThreadMap- Clear thread map.- Throws:
IgniteCheckedException
-
currentPrepareFuture
@Nullable public @Nullable IgniteInternalFuture<?> currentPrepareFuture()
- Specified by:
currentPrepareFuturein interfaceIgniteInternalTx- Overrides:
currentPrepareFuturein classIgniteTxAdapter- Returns:
- Future for transaction prepare if prepare is in progress.
-
onRemap
public void onRemap(AffinityTopologyVersion topVer, boolean reset)
- Parameters:
topVer- New topology version.reset-Trueif need to reset tx state.
-
hasRemoteLocks
public void hasRemoteLocks(boolean hasRemoteLocks)
- Parameters:
hasRemoteLocks-Trueif tx has remote locks acquired.
-
hasRemoteLocks
public boolean hasRemoteLocks()
- Returns:
Trueif tx has remote locks acquired.
-
proxy
public TransactionProxy proxy()
- Returns:
- Public API proxy.
-
rollbackOnlyProxy
public TransactionProxy rollbackOnlyProxy()
- Returns:
- Public API proxy.
-
threadId
public void threadId(long threadId)
- Parameters:
threadId- new owner of transaction.
-
timeoutId
public IgniteUuid timeoutId()
- Specified by:
timeoutIdin interfaceGridTimeoutObject- Returns:
- ID of the object.
-
endTime
public long endTime()
- Specified by:
endTimein interfaceGridTimeoutObject- Returns:
- End time.
-
label
public String label()
Returns label of transactions.- Specified by:
labelin interfaceIgniteInternalTx- Returns:
- Label of transaction or
nullif there was not set.
-
onTimeout
public void onTimeout()
Timeout callback.- Specified by:
onTimeoutin interfaceGridTimeoutObject
-
enterSystemSection
public void enterSystemSection()
Enters the section when system time for this transaction is counted.
-
leaveSystemSection
public void leaveSystemSection()
Leaves the section when system time for this transaction is counted.
-
toString
public String toString()
- Overrides:
toStringin classGridDhtTxLocalAdapter
-
-