You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/01 16:33:25 UTC
[38/50] incubator-ignite git commit: # ignite-943 fixed client
futures remap
# ignite-943 fixed client futures remap
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d10fe3e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d10fe3e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d10fe3e9
Branch: refs/heads/ignite-876-2
Commit: d10fe3e9013bc9ecd27823ff00443983b7c066c2
Parents: b3d8e1e
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 29 17:29:28 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 29 17:29:28 2015 +0300
----------------------------------------------------------------------
.../dht/colocated/GridDhtColocatedLockFuture.java | 18 ++++++++++++------
.../near/GridNearOptimisticTxPrepareFuture.java | 18 ++++++++++++------
2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d10fe3e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 5a4c91d..c784948 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -549,7 +549,7 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
}
// Must get topology snapshot and map on that version.
- mapOnTopology(false);
+ mapOnTopology(false, null);
}
/**
@@ -557,8 +557,9 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
* will asynchronously wait for it's completeness and then try again.
*
* @param remap Remap flag.
+ * @param c Optional closure to run after map.
*/
- private void mapOnTopology(final boolean remap) {
+ private void mapOnTopology(final boolean remap, @Nullable final Runnable c) {
// We must acquire topology snapshot from the topology version future.
cctx.topology().readLock();
@@ -597,12 +598,15 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
map(keys, remap);
+ if (c != null)
+ c.run();
+
markInitialized();
}
else {
fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
@Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
- mapOnTopology(remap);
+ mapOnTopology(remap, c);
}
});
}
@@ -1366,9 +1370,11 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
for (KeyCacheObject key : GridDhtColocatedLockFuture.this.keys)
cctx.mvcc().removeExplicitLock(threadId, key, lockVer);
- mapOnTopology(true);
-
- onDone(true);
+ mapOnTopology(true, new Runnable() {
+ @Override public void run() {
+ onDone(true);
+ }
+ });
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d10fe3e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 0a92112..44b7997 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -226,13 +226,14 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
return;
}
- prepareOnTopology(false);
+ prepareOnTopology(false, null);
}
/**
* @param remap Remap flag.
+ * @param c Optional closure to run after map.
*/
- private void prepareOnTopology(final boolean remap) {
+ private void prepareOnTopology(final boolean remap, @Nullable final Runnable c) {
GridDhtTopologyFuture topFut = topologyReadLock();
try {
@@ -271,13 +272,16 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
tx.topologyVersion(topFut.topologyVersion());
prepare0(remap);
+
+ if (c != null)
+ c.run();
}
else {
topFut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
@Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
cctx.kernalContext().closure().runLocalSafe(new GridPlainRunnable() {
@Override public void run() {
- prepareOnTopology(remap);
+ prepareOnTopology(remap, c);
}
});
}
@@ -796,9 +800,11 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
*
*/
private void remap() {
- prepareOnTopology(true);
-
- onDone(tx);
+ prepareOnTopology(true, new Runnable() {
+ @Override public void run() {
+ onDone(tx);
+ }
+ });
}
/** {@inheritDoc} */