Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E60E118560 for ; Tue, 3 Nov 2015 15:38:36 +0000 (UTC) Received: (qmail 25865 invoked by uid 500); 3 Nov 2015 15:38:36 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 25833 invoked by uid 500); 3 Nov 2015 15:38:36 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 25824 invoked by uid 99); 3 Nov 2015 15:38:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Nov 2015 15:38:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B3A6BE00C5; Tue, 3 Nov 2015 15:38:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.apache.org Message-Id: <5cfe50ae0ca54a1e9b0561040504414b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: IGNITE-950 - Fixing context for async ops. Debug is enabled. Date: Tue, 3 Nov 2015 15:38:36 +0000 (UTC) Repository: ignite Updated Branches: refs/heads/ignite-950-new ab32d0af7 -> f261704c3 IGNITE-950 - Fixing context for async ops. Debug is enabled. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f261704c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f261704c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f261704c Branch: refs/heads/ignite-950-new Commit: f261704c3b83b97d95b2dabecfaf35096a6a4f9f Parents: ab32d0a Author: Alexey Goncharuk Authored: Tue Nov 3 18:37:55 2015 +0300 Committer: Alexey Goncharuk Committed: Tue Nov 3 18:37:55 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheAdapter.java | 82 ++++++++++++-------- .../dht/colocated/GridDhtColocatedCache.java | 2 +- .../near/GridNearTransactionalCache.java | 2 +- 3 files changed, 50 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/f261704c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 9a61bdb..07a4ac7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -1823,7 +1823,7 @@ public abstract class GridCacheAdapter implements IgniteInternalCache> op(IgniteTxLocalAdapter tx) { return tx.getAllAsync(ctx, keys, deserializePortable, skipVals, false, !readThrough); } - }); + }, ctx.operationContextPerCall()); } } @@ -3987,11 +3987,11 @@ public abstract class GridCacheAdapter implements IgniteInternalCache implements IgniteInternalCache fut = new AsyncOpRetryFuture<>(op, skipStore, retries); + AsyncOpRetryFuture fut = new AsyncOpRetryFuture<>(op, retries, opCtx); fut.execute(); @@ -4016,7 +4016,7 @@ public abstract class GridCacheAdapter implements IgniteInternalCache implements IgniteInternalCache IgniteInternalFuture asyncOp(IgniteTxLocalAdapter tx, final AsyncOp op) { + protected IgniteInternalFuture asyncOp( + IgniteTxLocalAdapter tx, + final AsyncOp op, + final CacheOperationContext opCtx + ) { IgniteInternalFuture fail = asyncOpAcquire(); if (fail != null) @@ -4049,24 +4053,31 @@ public abstract class GridCacheAdapter implements IgniteInternalCache( new IgniteCheckedException("Operation has been cancelled (node is stopping).")); - return op.op(tx0).chain(new CX1, T>() { - @Override public T applyx(IgniteInternalFuture tFut) throws IgniteCheckedException { - try { - return tFut.get(); - } - catch (IgniteTxRollbackCheckedException e) { - throw e; - } - catch (IgniteCheckedException e1) { - tx0.rollbackAsync(); + ctx.operationContextPerCall(opCtx); - throw e1; - } - finally { - ctx.shared().txContextReset(); + try { + return op.op(tx0).chain(new CX1, T>() { + @Override public T applyx(IgniteInternalFuture tFut) throws IgniteCheckedException { + try { + return tFut.get(); + } + catch (IgniteTxRollbackCheckedException e) { + throw e; + } + catch (IgniteCheckedException e1) { + tx0.rollbackAsync(); + + throw e1; + } + finally { + ctx.shared().txContextReset(); + } } - } - }); + }); + } + finally { + ctx.operationContextPerCall(null); + } } }); @@ -4631,28 +4642,31 @@ public abstract class GridCacheAdapter implements IgniteInternalCache op; /** */ - private boolean skipStore; - - /** */ private int retries; /** */ private IgniteTxLocalAdapter tx; + /** */ + private CacheOperationContext opCtx; + /** * @param op Operation. - * @param skipStore Skip store flag. * @param retries Number of retries. + * @param opCtx Operation context per call to save. */ - public AsyncOpRetryFuture(AsyncOp op, - boolean skipStore, - int retries) { + public AsyncOpRetryFuture( + AsyncOp op, + int retries, + CacheOperationContext opCtx + ) { assert retries > 1 : retries; + tx = null; + this.op = op; - this.tx = null; - this.skipStore = skipStore; this.retries = retries; + this.opCtx = opCtx; } /** @@ -4666,10 +4680,10 @@ public abstract class GridCacheAdapter implements IgniteInternalCache fut = asyncOp(tx, op); + IgniteInternalFuture fut = asyncOp(tx, op, opCtx); fut.listen(new IgniteInClosure>() { @Override public void apply(IgniteInternalFuture fut) { http://git-wip-us.apache.org/repos/asf/ignite/blob/f261704c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java index efc10b2..907c68d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java @@ -216,7 +216,7 @@ public class GridDhtColocatedCache extends GridDhtTransactionalCacheAdapte false, opCtx != null && opCtx.skipStore()); } - }); + }, opCtx); } AffinityTopologyVersion topVer = tx == null ? http://git-wip-us.apache.org/repos/asf/ignite/blob/f261704c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index 8740e44..65a054c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -147,7 +147,7 @@ public class GridNearTransactionalCache extends GridNearCacheAdapter false, skipStore); } - }); + }, opCtx); } subjId = ctx.subjectIdPerCall(subjId, opCtx);