public class GridCacheTxManager<K,V> extends GridCacheManagerAdapter<K,V>
cctx, log| Constructor and Description |
|---|
GridCacheTxManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAlternateVersion(GridCacheVersion ver,
GridCacheTxEx<K,V> tx) |
boolean |
addCommittedTx(GridCacheTxEx<K,V> tx) |
boolean |
addCommittedTx(GridCacheVersion xidVer,
GridCacheVersion nearXidVer) |
boolean |
addRolledbackTx(GridCacheTxEx<K,V> tx) |
boolean |
addRolledbackTx(GridCacheVersion xidVer) |
void |
addSynchronizations(GridCacheTxSynchronization... sync) |
GridFuture<?> |
awaitFinishAckAsync(UUID rmtNodeId,
long threadId)
Asynchronously waits for last finish request ack.
|
void |
beforeFinishRemote(UUID rmtNodeId,
long threadId)
Callback called by near finish future before sending near finish request to remote node.
|
int |
commitQueueSize() |
Collection<GridCacheVersion> |
committedVersions(GridCacheVersion min)
Gets committed transactions starting from the given version (inclusive).
|
int |
committedVersionsSize() |
void |
commitTx(GridCacheTxEx<K,V> tx)
Commits a transaction.
|
void |
finishOptimisticTxOnRecovery(GridCacheTxEx<K,V> tx,
boolean commit)
Commits or rolls back prepared transaction.
|
void |
finishPessimisticTxOnRecovery(GridCacheTxEx<K,V> tx,
GridCacheCommittedTxInfo<K,V> commitInfo)
Commits or rolls back pessimistic transaction.
|
void |
finishSyncDisabled(boolean finishSyncDisabled)
For test purposes only.
|
GridFuture<Boolean> |
finishTxs(Collection<Integer> parts,
long topVer)
Creates a future that will wait for all ongoing transactions that maybe affected by topology update
to be finished.
|
int |
idMapSize() |
boolean |
inUserTx() |
boolean |
isCompleted(GridCacheTxEx<K,V> tx) |
<T> T |
localTx() |
GridCacheTxEx<K,V> |
localTxForRecovery(GridCacheVersion nearXidVer)
Gets local transaction for pessimistic tx recovery.
|
GridCacheTxEx<K,V> |
localTxx() |
GridCacheVersion |
mappedVersion(GridCacheVersion from) |
GridCacheVersion |
nearVersion(GridCacheVersion dhtVer)
Reverse mapped version look up.
|
<T extends GridCacheTxEx<K,V>> |
onCreated(T tx) |
void |
onFinishedRemote(UUID rmtNodeId,
long threadId)
Callback invoked when near finish response is received from remote node.
|
protected void |
onKernalStart0() |
boolean |
onOwnerChanged(GridCacheEntryEx<K,V> entry,
GridCacheMvccCandidate<K> owner)
Callback invoked whenever a member of a transaction acquires
lock ownership.
|
boolean |
onStarted(GridCacheTxEx<K,V> tx)
Transaction start callback (has to do with when any operation was
performed on this transaction).
|
void |
onTxStateChange(GridCacheTxState prevState,
GridCacheTxState newState,
GridCacheTx tx) |
int |
prepareQueueSize() |
void |
prepareTx(GridCacheTxEx<K,V> tx)
Handles prepare stage of 2PC.
|
void |
printMemoryStats()
Prints out memory stats to standard out.
|
void |
removeCommittedTx(GridCacheTxEx<K,V> tx) |
void |
removeSynchronizations(GridCacheTxSynchronization... sync) |
void |
rollbackTx(GridCacheTxEx<K,V> tx)
Rolls back a transaction.
|
Collection<GridCacheVersion> |
rolledbackVersions(GridCacheVersion min)
Gets rolledback transactions starting from the given version (inclusive).
|
int |
rolledbackVersionsSize() |
boolean |
salvageTx(GridCacheTxEx<K,V> tx)
Invalidates transaction.
|
int |
slowTxWarnTimeout() |
void |
slowTxWarnTimeout(int slowTxWarnTimeout) |
protected void |
start0() |
int |
startVersionCountsSize() |
Collection<GridCacheTxSynchronization> |
synchronizations() |
<T> T |
threadLocalTx() |
int |
threadMapSize() |
<T> T |
tx() |
<T extends GridCacheTxEx<K,V>> |
tx(GridCacheVersion txId) |
<T> T |
tx(long threadId) |
GridCacheCommittedTxInfo<K,V> |
txCommitted(GridCacheVersion nearTxVer,
UUID originatingNodeId,
long originatingThreadId)
Checks whether transaction with given near version was committed on this node and returns commit info.
|
void |
txContext(GridCacheTxEx tx) |
void |
txContextReset()
Commit ended.
|
GridCacheVersion |
txContextVersion()
Gets version of transaction in tx context or
null
if tx context is empty. |
Collection<GridCacheTxEx<K,V>> |
txs() |
boolean |
txsPreparedOrCommitted(GridCacheVersion nearVer,
int txNum)
Checks if transactions with given near version ID was prepared or committed.
|
GridCacheTxEx<K,V> |
txx() |
GridCacheTxEx<K,V> |
txx(GridCacheVersion txId) |
void |
uncommitTx(GridCacheTxEx<K,V> tx)
Tries to minimize damage from partially-committed transaction.
|
GridCacheTx |
userTx() |
<T extends GridCacheTxLocalEx<K,V>> |
userTxx() |
context, kernalStartInfo, kernalStopInfo, log, onKernalStart, onKernalStop, onKernalStop0, start, startInfo, stop, stop0, stopInfo, toStringprotected void onKernalStart0()
onKernalStart0 in class GridCacheManagerAdapter<K,V>protected void start0()
throws GridException
start0 in class GridCacheManagerAdapter<K,V>GridException - If failed.public boolean salvageTx(GridCacheTxEx<K,V> tx)
tx - Transaction.True if transaction was salvaged by this call.public void printMemoryStats()
USE ONLY FOR MEMORY PROFILING DURING TESTS.
printMemoryStats in interface GridCacheManager<K,V>printMemoryStats in class GridCacheManagerAdapter<K,V>public int threadMapSize()
public int idMapSize()
public int commitQueueSize()
public int prepareQueueSize()
public int startVersionCountsSize()
public int committedVersionsSize()
public int rolledbackVersionsSize()
public boolean isCompleted(GridCacheTxEx<K,V> tx)
tx - Transaction to check.True if transaction has been committed or rolled back,
false otherwise.@Nullable public <T extends GridCacheTxEx<K,V>> T onCreated(T tx)
tx - Created transaction.public GridFuture<Boolean> finishTxs(Collection<Integer> parts, long topVer)
GridCacheTxConcurrency.PESSIMISTIC transactions with topology version
less or equal to topVer.
GridCacheTxConcurrency.OPTIMISTIC transactions in PREPARING state with topology
version less or equal to topVer and having transaction key with entry that belongs to
one of partitions in parts.
parts - Moving partitions to check for.topVer - Topology version.public boolean onStarted(GridCacheTxEx<K,V> tx)
tx - Started transaction.True if transaction is not in completed set.@Nullable public GridCacheVersion nearVersion(GridCacheVersion dhtVer)
dhtVer - Dht version.public GridCacheVersion mappedVersion(GridCacheVersion from)
from - Near version.public void addAlternateVersion(GridCacheVersion ver, GridCacheTxEx<K,V> tx)
ver - Alternate version.tx - Transaction.@Nullable public <T> T localTx()
public <T> T threadLocalTx()
public <T> T tx()
@Nullable public GridCacheTxEx<K,V> localTxx()
public GridCacheTxEx<K,V> txx()
@Nullable public GridCacheTx userTx()
@Nullable public <T extends GridCacheTxLocalEx<K,V>> T userTxx()
public <T> T tx(long threadId)
threadId - Id of thread for transaction.public boolean inUserTx()
True if current thread is currently within transaction.@Nullable public <T extends GridCacheTxEx<K,V>> T tx(GridCacheVersion txId)
txId - Transaction ID.@Nullable public GridCacheTxEx<K,V> txx(GridCacheVersion txId)
txId - Transaction ID.public void prepareTx(GridCacheTxEx<K,V> tx) throws GridException
tx - Transaction to prepare.GridException - If preparation failed.public Collection<GridCacheVersion> committedVersions(GridCacheVersion min)
min - Start (or minimum) version.public Collection<GridCacheVersion> rolledbackVersions(GridCacheVersion min)
min - Start (or minimum) version.public void removeCommittedTx(GridCacheTxEx<K,V> tx)
tx - Tx to remove.public boolean addCommittedTx(GridCacheTxEx<K,V> tx)
tx - Committed transaction.public boolean addRolledbackTx(GridCacheTxEx<K,V> tx)
tx - Committed transaction.public boolean addCommittedTx(GridCacheVersion xidVer, @Nullable GridCacheVersion nearXidVer)
xidVer - Completed transaction version.nearXidVer - Optional near transaction ID.public boolean addRolledbackTx(GridCacheVersion xidVer)
xidVer - Completed transaction version.public void commitTx(GridCacheTxEx<K,V> tx)
tx - Transaction to commit.public void rollbackTx(GridCacheTxEx<K,V> tx)
tx - Transaction to rollback.public void uncommitTx(GridCacheTxEx<K,V> tx)
tx - Tx to uncommit.public boolean onOwnerChanged(GridCacheEntryEx<K,V> entry, GridCacheMvccCandidate<K> owner)
entry - Cache entry.owner - Candidate that won ownership.True if transaction was notified, false otherwise.public void beforeFinishRemote(UUID rmtNodeId, long threadId)
rmtNodeId - Remote node ID for which finish request is being sent.threadId - Near tx thread ID.public void onFinishedRemote(UUID rmtNodeId, long threadId)
rmtNodeId - Remote node ID from which response is received.threadId - Near tx thread ID.@Nullable public GridFuture<?> awaitFinishAckAsync(UUID rmtNodeId, long threadId)
rmtNodeId - Remote node ID.threadId - Near tx thread ID.null if ack was received or future that will be completed when ack is received.public void finishSyncDisabled(boolean finishSyncDisabled)
finishSyncDisabled - True if finish sync should be disabled.public void addSynchronizations(GridCacheTxSynchronization... sync)
sync - Transaction synchronizations to add.public void removeSynchronizations(GridCacheTxSynchronization... sync)
sync - Transaction synchronizations to remove.public Collection<GridCacheTxSynchronization> synchronizations()
public void onTxStateChange(@Nullable GridCacheTxState prevState, GridCacheTxState newState, GridCacheTx tx)
prevState - Previous state.newState - New state.tx - Cache transaction.public void txContext(GridCacheTxEx tx)
tx - Committing transaction.@Nullable public GridCacheVersion txContextVersion()
null
if tx context is empty.
This is a convenience method provided mostly for debugging.
public void txContextReset()
public Collection<GridCacheTxEx<K,V>> txs()
public int slowTxWarnTimeout()
public void slowTxWarnTimeout(int slowTxWarnTimeout)
slowTxWarnTimeout - Slow tx warn timeout.public boolean txsPreparedOrCommitted(GridCacheVersion nearVer, int txNum)
nearVer - Near version ID.txNum - Number of transactions.True if transactions were prepared or committed.@Nullable public GridCacheCommittedTxInfo<K,V> txCommitted(GridCacheVersion nearTxVer, UUID originatingNodeId, long originatingThreadId)
nearTxVer - Near tx version.originatingNodeId - Originating node ID.originatingThreadId - Originating thread ID.@Nullable public GridCacheTxEx<K,V> localTxForRecovery(GridCacheVersion nearXidVer)
nearXidVer - Near tx ID.public void finishOptimisticTxOnRecovery(GridCacheTxEx<K,V> tx, boolean commit)
tx - Transaction.commit - Whether transaction should be committed or rolled back.public void finishPessimisticTxOnRecovery(GridCacheTxEx<K,V> tx, GridCacheCommittedTxInfo<K,V> commitInfo)
tx - Transaction to finish.commitInfo - Commit information.Copyright © 2014. All rights reserved.