Skip to content

Commit

Permalink
futures: api cleanup - fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakov Zhdanov committed Mar 6, 2015
1 parent 6a96fd4 commit a14d0f3
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
Expand Up @@ -4467,7 +4467,7 @@ public IgniteInternalFuture<IgniteInternalTx> commitTxAsync(final IgniteInternal

saveFuture(holder, f);

ctx.tm().txContextReset();
ctx.tm().resetContext();

return f;
}
Expand Down Expand Up @@ -4602,10 +4602,10 @@ private int globalSize(boolean primaryOnly) throws IgniteCheckedException {
throw e;
}
finally {
ctx.tm().txContextReset();
ctx.tm().resetContext();

if (ctx.isNear())
ctx.near().dht().context().tm().txContextReset();
ctx.near().dht().context().tm().resetContext();
}
}
else
Expand Down Expand Up @@ -4714,7 +4714,7 @@ protected <T> IgniteInternalFuture<T> asyncOp(IgniteTxLocalAdapter<K, V> tx, fin
saveFuture(holder, f);

if (tx.implicit())
ctx.tm().txContextReset();
ctx.tm().resetContext();

return f;
}
Expand Down
Expand Up @@ -73,6 +73,9 @@ public void enter() {
*/
public void leave() {
try {
ctx.tm().resetContext();
ctx.mvcc().contextReset();

// Unwind eviction notifications.
CU.unwindEvicts(ctx);
}
Expand Down Expand Up @@ -142,6 +145,9 @@ public void leave() {
*/
public void leave(GridCacheProjectionImpl<K, V> prev) {
try {
ctx.tm().resetContext();
ctx.mvcc().contextReset();

// Unwind eviction notifications.
CU.unwindEvicts(ctx);

Expand Down
Expand Up @@ -306,7 +306,7 @@ private void processMessage(UUID nodeId, GridCacheMessage<K, V> msg,
}
finally {
// Reset thread local context.
cctx.tm().txContextReset();
cctx.tm().resetContext();
cctx.mvcc().contextReset();

// Unwind eviction notifications.
Expand Down
Expand Up @@ -1218,7 +1218,7 @@ public static IgniteInternalTx txStartInternal(GridCacheContext ctx, CacheProjec
assert ctx != null;
assert prj != null;

ctx.tm().txContextReset();
ctx.tm().resetContext();

return prj.txStartEx(concurrency, isolation);
}
Expand Down
Expand Up @@ -831,7 +831,7 @@ private IgniteInternalFuture<GridCacheReturn<V>> obtainLockAsync(
rollbackAsync().get();
}
finally {
cctx.tm().txContextReset();
cctx.tm().resetContext();
}
}

Expand Down
Expand Up @@ -429,7 +429,7 @@ public void userPrepare() throws IgniteCheckedException {
commitAsync().get();
}
finally {
cctx.tm().txContextReset();
cctx.tm().resetContext();
}
}

Expand Down Expand Up @@ -974,7 +974,7 @@ else if (op == READ) {
}
}
finally {
cctx.tm().txContextReset();
cctx.tm().resetContext();
}
}
else {
Expand Down
Expand Up @@ -393,7 +393,7 @@ public IgniteTxLocalAdapter<K, V> newTx(
ConcurrentMap<GridCacheVersion, IgniteInternalTx<K, V>> txIdMap = transactionMap(tx);

// Start clean.
txContextReset();
resetContext();

if (isCompleted(tx)) {
if (log.isDebugEnabled())
Expand Down Expand Up @@ -1233,7 +1233,7 @@ public void commitTx(IgniteInternalTx<K, V> tx) {
}

// 14. Clear context.
txContextReset();
resetContext();

// 15. Update metrics.
if (!tx.dht() && tx.local()) {
Expand Down Expand Up @@ -1308,7 +1308,7 @@ public void rollbackTx(IgniteInternalTx<K, V> tx) {
mappedVers.remove(((GridCacheMappedVersion)tx).mappedVersion());

// 10. Clear context.
txContextReset();
resetContext();

// 11. Update metrics.
if (!tx.dht() && tx.local()) {
Expand Down Expand Up @@ -1372,7 +1372,7 @@ public void uncommitTx(IgniteInternalTx<K, V> tx) {
mappedVers.remove(((GridCacheMappedVersion)tx).mappedVersion());

// 8. Clear context.
txContextReset();
resetContext();

if (log.isDebugEnabled())
log.debug("Uncommitted from TM: " + tx);
Expand Down Expand Up @@ -1717,7 +1717,7 @@ private IgniteInternalTx<K, V> txContext() {
/**
* Commit ended.
*/
public void txContextReset() {
public void resetContext() {
threadCtx.set(null);
}

Expand Down
Expand Up @@ -292,7 +292,7 @@ public void checkReferenceCleanup(Callable<Collection<WeakReference<Object>>> ca
System.gc();

for (WeakReference<?> ref : refs)
assertNull(ref.get());
assertNull("" + ref.get(), ref.get());
}
});
}
Expand Down

0 comments on commit a14d0f3

Please sign in to comment.