use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.
the class GridCacheAdapter method commitTxAsync.
/**
* Asynchronously commits transaction after all previous asynchronous operations are completed.
*
* @param tx Transaction to commit.
* @return Transaction commit future.
*/
@SuppressWarnings("unchecked")
IgniteInternalFuture<IgniteInternalTx> commitTxAsync(final GridNearTxLocal tx) {
FutureHolder holder = lastFut.get();
holder.lock();
try {
IgniteInternalFuture fut = holder.future();
if (fut != null && !fut.isDone()) {
IgniteInternalFuture<IgniteInternalTx> f = new GridEmbeddedFuture<>(fut, new C2<Object, Exception, IgniteInternalFuture<IgniteInternalTx>>() {
@Override
public IgniteInternalFuture<IgniteInternalTx> apply(Object o, Exception e) {
return tx.commitNearTxLocalAsync();
}
});
saveFuture(holder, f, /*retry*/
false);
return f;
}
IgniteInternalFuture<IgniteInternalTx> f = tx.commitNearTxLocalAsync();
saveFuture(holder, f, /*retry*/
false);
ctx.tm().resetContext();
return f;
} finally {
holder.unlock();
}
}
use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.
the class GridCacheMapEntry method peek.
/** {@inheritDoc} */
@Nullable
@Override
public CacheObject peek(@Nullable IgniteCacheExpiryPolicy plc) throws GridCacheEntryRemovedException, IgniteCheckedException {
IgniteInternalTx tx = cctx.tm().localTxx();
AffinityTopologyVersion topVer = tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion();
return peek(true, false, topVer, plc);
}
use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.
the class GridCacheEventManager method addEvent.
/**
* @param part Partition.
* @param key Key for the event.
* @param evtNodeId Node ID.
* @param owner Possible surrounding lock.
* @param type Event type.
* @param newVal New value.
* @param hasNewVal Whether new value is present or not.
* @param oldVal Old value.
* @param hasOldVal Whether old value is present or not.
* @param subjId Subject ID.
* @param cloClsName Closure class name.
* @param taskName Task name.
*/
public void addEvent(int part, KeyCacheObject key, UUID evtNodeId, @Nullable GridCacheMvccCandidate owner, int type, @Nullable CacheObject newVal, boolean hasNewVal, CacheObject oldVal, boolean hasOldVal, UUID subjId, String cloClsName, String taskName, boolean keepBinary) {
IgniteInternalTx tx = owner == null ? null : cctx.tm().tx(owner.version());
addEvent(part, key, evtNodeId, tx == null ? null : tx.xid(), owner == null ? null : owner.version(), type, newVal, hasNewVal, oldVal, hasOldVal, subjId, cloClsName, taskName, keepBinary);
}
use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.
the class GridCommonAbstractTest method dumpCacheDebugInfo.
/**
* @param ignite Node.
*/
public void dumpCacheDebugInfo(Ignite ignite) {
GridKernalContext ctx = ((IgniteKernal) ignite).context();
log.error("Cache information update [node=" + ignite.name() + ", client=" + ignite.configuration().isClientMode() + ']');
GridCacheSharedContext cctx = ctx.cache().context();
log.error("Pending transactions:");
for (IgniteInternalTx tx : cctx.tm().activeTransactions()) log.error(">>> " + tx);
log.error("Pending explicit locks:");
for (GridCacheExplicitLockSpan lockSpan : cctx.mvcc().activeExplicitLocks()) log.error(">>> " + lockSpan);
log.error("Pending cache futures:");
for (GridCacheFuture<?> fut : cctx.mvcc().activeFutures()) log.error(">>> " + fut);
log.error("Pending atomic cache futures:");
for (GridCacheFuture<?> fut : cctx.mvcc().atomicFutures()) log.error(">>> " + fut);
}
use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.
the class GridNearTxFinishFuture method finishOnePhase.
/**
* @param commit Commit flag.
*/
private void finishOnePhase(boolean commit) {
assert Thread.holdsLock(this);
if (finishOnePhaseCalled)
return;
finishOnePhaseCalled = true;
GridDistributedTxMapping locMapping = mappings.localMapping();
if (locMapping != null) {
// No need to send messages as transaction was already committed on remote node.
// Finish local mapping only as we need send commit message to backups.
IgniteInternalFuture<IgniteInternalTx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx);
// Add new future.
if (fut != null)
add(fut);
}
}
Aggregations