public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implements IgniteInternalTx, Externalizable
IgniteInternalTx.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 IgniteTxKey |
grpLockKey
Group lock key, if any.
|
protected boolean |
implicit
Implicit flag.
|
protected boolean |
implicitSingle
Implicit with one key flag.
|
protected boolean |
internal
Internal flag.
|
protected boolean |
invalidate
Invalidate flag.
|
protected AtomicBoolean |
isDone
Done marker.
|
protected TransactionIsolation |
isolation
Isolation.
|
protected boolean |
loc
Local flag.
|
protected static IgniteLogger |
log
Logger.
|
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 boolean |
syncCommit |
protected boolean |
syncRollback |
protected String |
taskName
Task name.
|
protected int |
taskNameHash
Task name hash code.
|
protected long |
threadId
Thread ID.
|
protected long |
timeout
Transaction timeout.
|
protected boolean |
transform
If this transaction contains transform entries.
|
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 implicitSingle,
boolean loc,
boolean sys,
GridIoPolicy plc,
TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
boolean invalidate,
boolean storeEnabled,
int txSize,
IgniteTxKey grpLockKey,
UUID subjId,
int taskNameHash) |
protected |
IgniteTxAdapter(GridCacheSharedContext<?,?> cctx,
UUID nodeId,
GridCacheVersion xidVer,
GridCacheVersion startVer,
long threadId,
boolean sys,
GridIoPolicy plc,
TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
int txSize,
IgniteTxKey grpLockKey,
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) |
protected void |
awaitCompletion()
Awaits transaction completion.
|
protected void |
awaitSignal()
Waits for signal.
|
protected boolean |
checkInternal(IgniteTxKey key) |
void |
close()
Ends the transaction.
|
boolean |
colocated() |
GridCacheVersion |
commitVersion() |
boolean |
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.
|
boolean |
dht() |
boolean |
done() |
long |
endTime() |
GridCacheVersion |
endVersion() |
void |
endVersion(GridCacheVersion endVer) |
boolean |
enforceSerializable()
For Partitioned caches, this flag is
false for remote DHT and remote NEAR
transactions because serializability of transaction is enforced on primary node. |
boolean |
equals(Object o) |
protected boolean |
evictNearEntry(IgniteTxEntry e,
boolean primaryOnly) |
protected IgniteInternalTx.FinalizationStatus |
finalizationStatus() |
IgniteInternalFuture<IgniteInternalTx> |
finishFuture() |
boolean |
groupLock() |
IgniteTxEntry |
groupLockEntry()
This method uses unchecked assignment to cast group lock key entry to transaction generic signature.
|
IgniteTxKey |
groupLockKey() |
int |
hashCode() |
boolean |
hasTransforms() |
boolean |
implicit()
Flag indicating whether transaction was started automatically by the
system or not.
|
boolean |
implicitSingle() |
void |
initCommitVersion() |
boolean |
internal() |
void |
invalidate(boolean invalidate) |
Set<Integer> |
invalidPartitions() |
GridIoPolicy |
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() |
boolean |
local() |
boolean |
localResult() |
protected void |
lock()
Acquires lock.
|
protected long |
lockTimeout() |
protected IgniteLogger |
log() |
boolean |
markFinalizing(IgniteInternalTx.FinalizationStatus status) |
boolean |
markPreparing() |
boolean |
near() |
GridCacheVersion |
nearXidVersion() |
boolean |
needsCompletedVersions() |
UUID |
nodeId()
ID of the node on which this transaction started.
|
boolean |
onePhaseCommit() |
void |
onePhaseCommit(boolean onePhaseCommit) |
void |
onTimeout()
Timeout callback.
|
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() |
TransactionProxy |
proxy() |
boolean |
readCommitted() |
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
long |
remainingTime()
Gets remaining allowed transaction time.
|
boolean |
repeatableRead() |
boolean |
replicated() |
String |
resolveTaskName() |
boolean |
serializable() |
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.
|
protected void |
signalAll()
Signals all waiters.
|
int |
size() |
long |
startTime()
Start time of this transaction.
|
GridCacheVersion |
startVersion() |
TransactionState |
state()
Gets current transaction state value.
|
boolean |
state(TransactionState state) |
protected GridCacheStoreManager |
store()
Store manager for current transaction.
|
boolean |
storeEnabled() |
void |
storeEnabled(boolean storeEnabled) |
boolean |
storeUsed() |
UUID |
subjectId() |
boolean |
syncCommit() |
void |
syncCommit(boolean syncCommit) |
boolean |
syncRollback() |
void |
syncRollback(boolean syncRollback) |
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.
|
IgniteUuid |
timeoutId() |
long |
topologyVersion() |
long |
topologyVersion(long topVer)
Attempts to set topology version and returns the current value.
|
String |
toString() |
Map<UUID,Collection<UUID>> |
transactionNodes() |
void |
transactionNodes(Map<UUID,Collection<UUID>> txNodes) |
protected void |
uncommit()
Uncommits transaction by invalidating all of its entries.
|
protected void |
unlock()
Releases lock.
|
protected boolean |
updateNearCache(GridCacheContext<?,?> cacheCtx,
KeyCacheObject key,
long 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, removeMeta, removeMeta, replaceMeta, writeExternalMetafinalize, getClass, notify, notifyAll, wait, wait, waitactiveCacheIds, addMeta, allEntries, alternateVersions, commit, commitAsync, empty, entry, eventNodeId, hasWriteKey, masterNodeIds, meta, onOwnerChanged, originatingNodeId, peek, prepare, prepareAsync, readEntries, readMap, readSet, removed, removeMeta, rollback, rollbackAsync, seal, writeEntries, writeMap, writeSetprotected static IgniteLogger log
@GridToStringInclude protected GridCacheVersion xidVer
@GridToStringInclude protected GridCacheVersion writeVer
@GridToStringInclude protected boolean implicit
@GridToStringInclude protected boolean implicitSingle
@GridToStringInclude protected boolean loc
@GridToStringInclude protected long threadId
@GridToStringInclude protected long startTime
@GridToStringInclude protected UUID nodeId
@GridToStringInclude protected GridCacheVersion startVer
@GridToStringExclude protected GridCacheSharedContext<?,?> cctx
@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 boolean syncCommit
protected boolean syncRollback
protected boolean transform
protected final AtomicBoolean isDone
protected int txSize
protected IgniteTxKey grpLockKey
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 implicitSingle, boolean loc, boolean sys, GridIoPolicy plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, int txSize, @Nullable IgniteTxKey grpLockKey, @Nullable UUID subjId, int taskNameHash)
cctx - Cache registry.xidVer - Transaction ID.implicit - Implicit flag.implicitSingle - Implicit with one key flag.loc - Local flag.sys - System transaction flag.plc - IO policy.concurrency - Concurrency.isolation - Isolation.timeout - Timeout.txSize - Transaction size.grpLockKey - Group lock key if this is group-lock transaction.protected IgniteTxAdapter(GridCacheSharedContext<?,?> cctx, UUID nodeId, GridCacheVersion xidVer, GridCacheVersion startVer, long threadId, boolean sys, GridIoPolicy plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, int txSize, @Nullable IgniteTxKey grpLockKey, @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.grpLockKey - Group lock key if this is group-lock transaction.public boolean localResult()
localResult in interface IgniteInternalTxTrue if transaction started on the node initiated cache operation.protected final void lock()
protected final void unlock()
protected final void signalAll()
protected final void awaitSignal()
throws InterruptedException
InterruptedException - If interrupted.protected boolean updateNearCache(GridCacheContext<?,?> cacheCtx, KeyCacheObject key, long 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 GridIoPolicy ioPolicy()
ioPolicy in interface IgniteInternalTxpublic boolean storeUsed()
storeUsed in interface IgniteInternalTxTrue if transaction is allowed to use store and transactions spans one or more caches with
store enabled.protected GridCacheStoreManager store()
protected void uncommit()
public IgniteTxEntry groupLockEntry()
public UUID otherNodeId()
otherNodeId in interface IgniteInternalTxpublic UUID subjectId()
subjectId in interface IgniteInternalTxpublic int taskNameHash()
taskNameHash in interface IgniteInternalTxpublic long topologyVersion()
topologyVersion in interface IgniteInternalTxpublic long topologyVersion(long topVer)
topologyVersion in interface IgniteInternalTxtopVer - Topology version.public boolean hasTransforms()
hasTransforms in interface IgniteInternalTxTrue if transaction has transform entries. This flag will be only set for local
transactions.public boolean markPreparing()
markPreparing in interface IgniteInternalTxTrue if preparing flag was set with this call.public 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 boolean groupLock()
groupLock in interface IgniteInternalTxTrue if transaction group-locked.public IgniteTxKey groupLockKey()
groupLockKey in interface IgniteInternalTxIgniteInternalTx.groupLock() is true.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 boolean replicated()
replicated in interface IgniteInternalTxTrue if transaction is replicated.public boolean enforceSerializable()
false for remote DHT and remote NEAR
transactions because serializability of transaction is enforced on primary node. All
other transaction types must enforce it.enforceSerializable in interface IgniteInternalTxpublic boolean syncCommit()
syncCommit in interface IgniteInternalTxTrue if transaction is configured with synchronous commit flag.public boolean syncRollback()
syncRollback in interface IgniteInternalTxTrue if transaction is configured with synchronous rollback flag.public void syncCommit(boolean syncCommit)
syncCommit - Synchronous commit flag.public void syncRollback(boolean syncRollback)
syncRollback - Synchronous rollback flag.public IgniteUuid xid()
xid in interface IgniteInternalTxpublic 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 long remainingTime()
remainingTime in interface IgniteInternalTxprotected long lockTimeout()
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 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 boolean commitVersion(GridCacheVersion commitVer)
commitVersion in interface IgniteInternalTxcommitVer - Commit version.True if set to not null value.public void initCommitVersion()
public void close()
throws IgniteCheckedException
IgniteInternalTxclose in interface AutoCloseableclose in interface IgniteInternalTxIgniteCheckedException - If transaction could not be gracefully ended.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.protected void awaitCompletion()
throws IgniteCheckedException
IgniteCheckedException - If waiting failed.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 IgniteInternalTxpublic GridCacheVersion startVersion()
startVersion in interface IgniteInternalTxpublic GridCacheVersion endVersion()
endVersion in interface IgniteInternalTxpublic 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 IgniteUuid timeoutId()
timeoutId in interface GridTimeoutObjectpublic long endTime()
endTime in interface GridTimeoutObjectpublic void onTimeout()
onTimeout in interface GridTimeoutObjectpublic 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 boolean isSystemInvalidate()
isSystemInvalidate in interface IgniteInternalTxpublic 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 IgniteBiTuple<GridCacheOperation,CacheObject> applyTransformClosures(IgniteTxEntry txEntry, boolean metrics) throws GridCacheEntryRemovedException, IgniteCheckedException
txEntry - Entry to process.metrics - True if metrics should be updated.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) throws IgniteCheckedException
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.IgniteCheckedException - If failed.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.public TransactionProxy proxy()
proxy in interface IgniteInternalTx
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015