public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implements IgniteInternalTx, Externalizable
GridMetadataAwareAdapter.EntryKeyIgniteInternalTx.FinalizationStatus| Modifier and Type | Field and Description |
|---|---|
protected GridCacheSharedContext<?,?> |
cctx
Cache registry.
|
protected TransactionConcurrency |
concurrency
Concurrency.
|
protected GridCacheVersion |
endVer
End version (a.k.a.
|
protected boolean |
implicit
Implicit flag.
|
protected boolean |
internal
Internal flag.
|
protected boolean |
invalidate
Invalidate flag.
|
protected boolean |
isDone
Done marker.
|
protected TransactionIsolation |
isolation
Isolation.
|
protected boolean |
loc
Local flag.
|
protected static IgniteLogger |
log
Logger.
|
protected boolean |
needRetVal
Need return value.
|
protected UUID |
nodeId
Node ID.
|
protected boolean |
onePhaseCommit |
protected long |
startTime
Transaction start time.
|
protected GridCacheVersion |
startVer
Transaction counter value at the start of transaction.
|
protected boolean |
storeEnabled
Store used flag.
|
protected UUID |
subjId
Subject ID initiated this transaction.
|
protected String |
taskName
Task name.
|
protected int |
taskNameHash
Task name hash code.
|
protected long |
threadId
Thread ID.
|
protected long |
timeout
Transaction timeout.
|
protected AffinityTopologyVersion |
topVer
Topology version.
|
protected Map<UUID,Collection<UUID>> |
txNodes |
protected int |
txSize |
protected GridCacheVersion |
writeVer
Entries write version.
|
protected GridCacheVersion |
xidVer
Transaction ID.
|
| Modifier | Constructor and Description |
|---|---|
protected |
IgniteTxAdapter()
Empty constructor required for
Externalizable. |
protected |
IgniteTxAdapter(GridCacheSharedContext<?,?> cctx,
GridCacheVersion xidVer,
boolean implicit,
boolean loc,
boolean sys,
byte plc,
TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
boolean invalidate,
boolean storeEnabled,
boolean onePhaseCommit,
int txSize,
UUID subjId,
int taskNameHash) |
protected |
IgniteTxAdapter(GridCacheSharedContext<?,?> cctx,
UUID nodeId,
GridCacheVersion xidVer,
GridCacheVersion startVer,
long threadId,
boolean sys,
byte plc,
TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
int txSize,
UUID subjId,
int taskNameHash) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInvalidPartition(GridCacheContext<?,?> cacheCtx,
int part) |
protected IgniteBiTuple<GridCacheOperation,CacheObject> |
applyTransformClosures(IgniteTxEntry txEntry,
boolean metrics,
GridCacheReturn ret) |
protected void |
batchStoreCommit(Iterable<IgniteTxEntry> writeEntries)
Performs batch database operations.
|
protected boolean |
checkInternal(IgniteTxKey key) |
boolean |
colocated() |
GridCacheVersion |
commitVersion() |
void |
commitVersion(GridCacheVersion commitVer) |
void |
completedVersions(GridCacheVersion base,
Collection<GridCacheVersion> committed,
Collection<GridCacheVersion> txs) |
TransactionConcurrency |
concurrency()
Cache transaction concurrency mode.
|
protected IgniteBiTuple<GridCacheOperation,GridCacheVersionConflictContext> |
conflictResolve(GridCacheOperation op,
IgniteTxEntry txEntry,
CacheObject newVal,
GridCacheVersion newVer,
GridCacheEntryEx old)
Resolve DR conflict.
|
IgniteInternalFuture<?> |
currentPrepareFuture() |
boolean |
dht() |
boolean |
done() |
void |
endVersion(GridCacheVersion endVer) |
boolean |
equals(Object o) |
void |
errorWhenCommitting()
Changes transaction state from COMMITTING to MARKED_ROLLBACK.
|
protected boolean |
evictNearEntry(IgniteTxEntry e,
boolean primaryOnly) |
protected IgniteInternalTx.FinalizationStatus |
finalizationStatus() |
IgniteInternalFuture<IgniteInternalTx> |
finishFuture() |
int |
hashCode() |
boolean |
implicit()
Flag indicating whether transaction was started automatically by the
system or not.
|
boolean |
implicitSingle() |
boolean |
internal() |
void |
invalidate(boolean invalidate) |
Map<Integer,Set<Integer>> |
invalidPartitions() |
byte |
ioPolicy() |
boolean |
isInvalidate()
Get invalidation flag for this transaction.
|
protected boolean |
isNearLocallyMapped(IgniteTxEntry e,
boolean primaryOnly) |
TransactionIsolation |
isolation()
Cache transaction isolation level.
|
boolean |
isRollbackOnly()
If transaction was marked as rollback-only.
|
abstract boolean |
isStarted() |
boolean |
isSystemInvalidate() |
protected boolean |
isWriteToStoreFromDhtValid(Collection<CacheStoreManager> stores) |
boolean |
local() |
boolean |
localResult() |
protected IgniteLogger |
log() |
boolean |
markFinalizing(IgniteInternalTx.FinalizationStatus status) |
boolean |
near() |
GridCacheVersion |
nearXidVersion() |
boolean |
needReturnValue() |
void |
needReturnValue(boolean needRetVal) |
boolean |
needsCompletedVersions() |
UUID |
nodeId()
ID of the node on which this transaction started.
|
boolean |
onePhaseCommit() |
void |
onePhaseCommit(boolean onePhaseCommit) |
boolean |
optimistic() |
Collection<IgniteTxEntry> |
optimisticLockEntries()
Gets a list of entries that needs to be locked on the next step of prepare stage of
optimistic transaction.
|
UUID |
otherNodeId()
Gets ID of additional node involved.
|
GridCacheVersion |
ownedVersion(IgniteTxKey key)
Gets owned version for near remote transaction.
|
boolean |
ownsLock(GridCacheEntryEx entry) |
boolean |
ownsLockUnsafe(GridCacheEntryEx entry) |
boolean |
pessimistic() |
boolean |
readCommitted() |
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
long |
remainingTime()
Gets remaining allowed transaction time.
|
boolean |
repeatableRead() |
String |
resolveTaskName() |
boolean |
serializable() |
protected void |
sessionEnd(Collection<CacheStoreManager> stores,
boolean commit) |
boolean |
setRollbackOnly()
Modify the transaction associated with the current thread such that the
only possible outcome of the transaction is to roll back the
transaction.
|
int |
size() |
long |
startTime()
Start time of this transaction.
|
TransactionState |
state()
Gets current transaction state value.
|
boolean |
state(TransactionState state) |
protected boolean |
state(TransactionState state,
boolean timedOut) |
boolean |
storeEnabled() |
void |
storeEnabled(boolean storeEnabled) |
boolean |
storeWriteThrough() |
UUID |
subjectId() |
boolean |
system()
Checks if this is system cache transaction.
|
void |
systemInvalidate(boolean sysInvalidate) |
int |
taskNameHash()
Task name hash in case if transaction was initiated within task execution.
|
long |
threadId()
ID of the thread in which this transaction started.
|
boolean |
timedOut() |
long |
timeout()
Gets timeout value in milliseconds for this transaction.
|
long |
timeout(long timeout)
Sets transaction timeout value.
|
IgniteCheckedException |
timeoutException() |
AffinityTopologyVersion |
topologyVersion() |
AffinityTopologyVersion |
topologyVersion(AffinityTopologyVersion topVer)
Attempts to set topology version and returns the current value.
|
AffinityTopologyVersion |
topologyVersionSnapshot() |
String |
toString() |
Map<UUID,Collection<UUID>> |
transactionNodes() |
void |
transactionNodes(Map<UUID,Collection<UUID>> txNodes) |
protected void |
uncommit(boolean nodeStopping)
Uncommits transaction by invalidating all of its entries.
|
protected boolean |
updateNearCache(GridCacheContext<?,?> cacheCtx,
KeyCacheObject key,
AffinityTopologyVersion topVer)
Checks whether near cache should be updated.
|
boolean |
user() |
void |
writeExternal(ObjectOutput out) |
GridCacheVersion |
writeVersion() |
void |
writeVersion(GridCacheVersion writeVer)
Sets write version.
|
IgniteUuid |
xid()
Gets unique identifier for this transaction.
|
GridCacheVersion |
xidVersion() |
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, readExternalMeta, removeAllMeta, removeMeta, removeMeta, replaceMeta, writeExternalMetafinalize, getClass, notify, notifyAll, wait, wait, waitactiveCachesDeploymentEnabled, addMeta, allEntries, alternateVersions, commitAsync, commitError, empty, entry, eventNodeId, hasWriteKey, masterNodeIds, meta, onOwnerChanged, originatingNodeId, peek, readEntries, readMap, readSet, removeMeta, rollbackAsync, salvageTx, seal, txState, writeEntries, writeMap, writeSetprotected static IgniteLogger log
@GridToStringInclude protected GridCacheVersion xidVer
@GridToStringInclude protected GridCacheVersion writeVer
@GridToStringInclude protected boolean implicit
@GridToStringInclude protected boolean loc
@GridToStringInclude protected long threadId
@GridToStringInclude protected long startTime
@GridToStringInclude protected UUID nodeId
@GridToStringInclude protected GridCacheVersion startVer
@GridToStringExclude protected GridCacheSharedContext<?,?> cctx
protected boolean needRetVal
@GridToStringInclude protected GridCacheVersion endVer
@GridToStringInclude protected TransactionIsolation isolation
@GridToStringInclude protected TransactionConcurrency concurrency
@GridToStringInclude protected long timeout
protected volatile boolean invalidate
protected boolean internal
protected boolean onePhaseCommit
protected volatile boolean isDone
protected int txSize
@GridToStringInclude protected volatile AffinityTopologyVersion topVer
protected Map<UUID,Collection<UUID>> txNodes
protected UUID subjId
protected int taskNameHash
protected String taskName
protected boolean storeEnabled
protected IgniteTxAdapter()
Externalizable.protected IgniteTxAdapter(GridCacheSharedContext<?,?> cctx, GridCacheVersion xidVer, boolean implicit, boolean loc, boolean sys, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, boolean onePhaseCommit, int txSize, @Nullable UUID subjId, int taskNameHash)
cctx - Cache registry.xidVer - Transaction ID.implicit - Implicit flag.loc - Local flag.sys - System transaction flag.plc - IO policy.concurrency - Concurrency.isolation - Isolation.timeout - Timeout.txSize - Transaction size.protected IgniteTxAdapter(GridCacheSharedContext<?,?> cctx, UUID nodeId, GridCacheVersion xidVer, GridCacheVersion startVer, long threadId, boolean sys, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, int txSize, @Nullable UUID subjId, int taskNameHash)
cctx - Cache registry.nodeId - Node ID.xidVer - Transaction ID.startVer - Start version mark.threadId - Thread ID.sys - System transaction flag.plc - IO policy.concurrency - Concurrency.isolation - Isolation.timeout - Timeout.txSize - Transaction size.public boolean localResult()
localResult in interface IgniteInternalTxTrue if transaction started on the node initiated cache operation.protected boolean updateNearCache(GridCacheContext<?,?> cacheCtx, KeyCacheObject key, AffinityTopologyVersion topVer)
public Collection<IgniteTxEntry> optimisticLockEntries()
optimisticLockEntries in interface IgniteInternalTxpublic boolean storeEnabled()
storeEnabled in interface IgniteInternalTxTrue if transaction is allowed to use store.public void storeEnabled(boolean storeEnabled)
storeEnabled - Store enabled flag.public boolean system()
system in interface IgniteInternalTxTrue if transaction is started for system cache.public byte ioPolicy()
ioPolicy in interface IgniteInternalTxpublic boolean storeWriteThrough()
storeWriteThrough in interface IgniteInternalTxTrue if transaction is allowed to use store and transactions spans one or more caches with
store enabled.protected void uncommit(boolean nodeStopping)
nodeStopping - True if tx was cancelled during node stop.public UUID otherNodeId()
otherNodeId in interface IgniteInternalTxpublic UUID subjectId()
subjectId in interface IgniteInternalTxpublic int taskNameHash()
taskNameHash in interface IgniteInternalTxpublic AffinityTopologyVersion topologyVersion()
topologyVersion in interface IgniteInternalTxpublic final AffinityTopologyVersion topologyVersionSnapshot()
topologyVersionSnapshot in interface IgniteInternalTxpublic final AffinityTopologyVersion topologyVersion(AffinityTopologyVersion topVer)
topologyVersion in interface IgniteInternalTxtopVer - Topology version.public final boolean markFinalizing(IgniteInternalTx.FinalizationStatus status)
markFinalizing in interface IgniteInternalTxstatus - Finalization status to set.True if marked.protected IgniteInternalTx.FinalizationStatus finalizationStatus()
public abstract boolean isStarted()
True if transaction has at least one key enlisted.public int size()
size in interface IgniteInternalTxprotected IgniteLogger log()
public boolean near()
near in interface IgniteInternalTxTrue if near transaction.public boolean implicit()
put(..) or remove(..) operation is invoked
outside of transaction.implicit in interface IgniteInternalTxTrue if transaction was started implicitly.public boolean implicitSingle()
implicitSingle in interface IgniteInternalTxpublic boolean local()
local in interface IgniteInternalTxTrue if transaction is local, false if it's remote.public final boolean user()
user in interface IgniteInternalTxTrue if transaction is user transaction, which means:
public boolean dht()
dht in interface IgniteInternalTxTrue if DHT transaction.public boolean colocated()
colocated in interface IgniteInternalTxTrue if dht colocated transaction.public IgniteUuid xid()
xid in interface IgniteInternalTxpublic Map<Integer,Set<Integer>> invalidPartitions()
invalidPartitions in interface IgniteInternalTxpublic void addInvalidPartition(GridCacheContext<?,?> cacheCtx, int part)
addInvalidPartition in interface IgniteInternalTxcacheCtx - Cache context.part - Invalid partition.public GridCacheVersion ownedVersion(IgniteTxKey key)
ownedVersion in interface IgniteInternalTxkey - Key to get version for.public long startTime()
startTime in interface IgniteInternalTxpublic boolean needReturnValue()
public void needReturnValue(boolean needRetVal)
needRetVal - Need return value flag.public long remainingTime()
remainingTime in interface IgniteInternalTx0 if timeout isn't specified. -1 if time is out.public final IgniteCheckedException timeoutException()
public GridCacheVersion xidVersion()
xidVersion in interface IgniteInternalTxpublic long threadId()
threadId in interface IgniteInternalTxpublic UUID nodeId()
nodeId in interface IgniteInternalTxpublic TransactionIsolation isolation()
isolation in interface IgniteInternalTxpublic TransactionConcurrency concurrency()
concurrency in interface IgniteInternalTxpublic long timeout()
IgniteTxTimeoutCheckedException will be thrown.timeout in interface IgniteInternalTxpublic long timeout(long timeout)
timeout in interface IgniteInternalTxtimeout - Transaction timeout value.public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException
ownsLock in interface IgniteInternalTxentry - Entry to check.True if lock is owned.GridCacheEntryRemovedException - If entry has been removed.public boolean ownsLockUnsafe(GridCacheEntryEx entry)
ownsLockUnsafe in interface IgniteInternalTxentry - Entry to check.True if lock is owned.public TransactionState state()
state in interface IgniteInternalTxpublic final void errorWhenCommitting()
errorWhenCommitting in interface IgniteInternalTxpublic boolean setRollbackOnly()
setRollbackOnly in interface IgniteInternalTxTrue if rollback-only flag was set as a result of this operation,
false if it was already set prior to this call or could not be set
because transaction is already finishing up committing or rolling back.public boolean isRollbackOnly()
IgniteInternalTxisRollbackOnly in interface IgniteInternalTxTrue if rollback only flag is set.public boolean done()
done in interface IgniteInternalTxTrue if transaction had completed successfully or unsuccessfully.public GridCacheVersion commitVersion()
commitVersion in interface IgniteInternalTxpublic void commitVersion(GridCacheVersion commitVer)
commitVersion in interface IgniteInternalTxcommitVer - Commit version.public boolean needsCompletedVersions()
needsCompletedVersions in interface IgniteInternalTxTrue if transaction needs completed versions for processing.public void completedVersions(GridCacheVersion base, Collection<GridCacheVersion> committed, Collection<GridCacheVersion> txs)
completedVersions in interface IgniteInternalTxbase - Base for committed versions.committed - Committed transactions relative to base.txs - Rolled back transactions relative to base.public boolean internal()
internal in interface IgniteInternalTxTrue if transaction has at least one internal entry.protected boolean checkInternal(IgniteTxKey key)
key - Key.True if key is internal.public void onePhaseCommit(boolean onePhaseCommit)
onePhaseCommit - True if transaction commit should be performed in short-path way.public boolean onePhaseCommit()
onePhaseCommit in interface IgniteInternalTxpublic boolean optimistic()
optimistic in interface IgniteInternalTxTrue for OPTIMISTIC transactions.public boolean pessimistic()
pessimistic in interface IgniteInternalTxTrue for PESSIMISTIC transactions.public boolean serializable()
serializable in interface IgniteInternalTxTrue if serializable.public boolean repeatableRead()
repeatableRead in interface IgniteInternalTxTrue if repeatable-read.public boolean readCommitted()
readCommitted in interface IgniteInternalTxTrue if read-committed.public boolean state(TransactionState state)
state in interface IgniteInternalTxstate - Transaction state.True if transition was valid, false otherwise.public IgniteInternalFuture<IgniteInternalTx> finishFuture()
finishFuture in interface IgniteInternalTx@Nullable public IgniteInternalFuture<?> currentPrepareFuture()
currentPrepareFuture in interface IgniteInternalTxprotected boolean state(TransactionState state, boolean timedOut)
state - State to set.timedOut - Timeout flag.True if state changed.public void endVersion(GridCacheVersion endVer)
endVersion in interface IgniteInternalTxendVer - End version (a.k.a. 'tnc' or 'transaction number counter')
assigned to this transaction at the end of write phase.public GridCacheVersion writeVersion()
writeVersion in interface IgniteInternalTxIgniteInternalTx.xidVersion().public void writeVersion(GridCacheVersion writeVer)
writeVersion in interface IgniteInternalTxwriteVer - Write version.public boolean timedOut()
timedOut in interface IgniteInternalTxTrue if transaction timed out.public void invalidate(boolean invalidate)
invalidate in interface IgniteInternalTxinvalidate - Invalidate flag.public boolean isInvalidate()
true, then
remote values will be invalidated (set to null) instead
of updated.
Invalidation messages don't carry new values, so they are a lot lighter than update messages. However, when a value is accessed on a node after it's been invalidated, it must be loaded from persistent store.
isInvalidate in interface IgniteInternalTxpublic final boolean isSystemInvalidate()
isSystemInvalidate in interface IgniteInternalTxpublic final void systemInvalidate(boolean sysInvalidate)
systemInvalidate in interface IgniteInternalTxsysInvalidate - System invalidate flag.@Nullable public Map<UUID,Collection<UUID>> transactionNodes()
transactionNodes in interface IgniteInternalTxpublic void transactionNodes(Map<UUID,Collection<UUID>> txNodes)
txNodes - Transaction nodes.@Nullable public GridCacheVersion nearXidVersion()
nearXidVersion in interface IgniteInternalTxprotected boolean isWriteToStoreFromDhtValid(Collection<CacheStoreManager> stores)
stores - Store managers.isWriteToStoreFromDht value same for all stores.protected void sessionEnd(Collection<CacheStoreManager> stores, boolean commit) throws IgniteCheckedException
stores - Store managers.commit - Commit flag.IgniteCheckedException - In case of error.protected final void batchStoreCommit(Iterable<IgniteTxEntry> writeEntries) throws IgniteCheckedException
writeEntries - Transaction write set.IgniteCheckedException - If batch update failed.protected IgniteBiTuple<GridCacheOperation,CacheObject> applyTransformClosures(IgniteTxEntry txEntry, boolean metrics, @Nullable GridCacheReturn ret) throws GridCacheEntryRemovedException, IgniteCheckedException
txEntry - Entry to process.metrics - True if metrics should be updated.ret - Optional return value to initialize.IgniteCheckedException - If failed to get previous value for transform.GridCacheEntryRemovedException - If entry was concurrently deleted.public String resolveTaskName()
protected IgniteBiTuple<GridCacheOperation,GridCacheVersionConflictContext> conflictResolve(GridCacheOperation op, IgniteTxEntry txEntry, CacheObject newVal, GridCacheVersion newVer, GridCacheEntryEx old) throws IgniteCheckedException, GridCacheEntryRemovedException
op - Initially proposed operation.txEntry - TX entry being updated.newVal - New value.newVer - New version.old - Old entry.IgniteCheckedException - In case of eny exception.GridCacheEntryRemovedException - If entry got removed.protected boolean isNearLocallyMapped(IgniteTxEntry e, boolean primaryOnly)
e - Transaction entry.primaryOnly - Flag to include backups into check or not.True if entry is locally mapped as a primary or back up node.protected boolean evictNearEntry(IgniteTxEntry e, boolean primaryOnly)
e - Entry to evict if it qualifies for eviction.primaryOnly - Flag to try to evict only on primary node.True if attempt was made to evict the entry.public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionprotected Object readResolve() throws ObjectStreamException
ObjectStreamException - Thrown in case of unmarshalling error.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.2.0 Release Date : September 15 2017