#ignite-732: wip.

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b5b433a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b5b433a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b5b433a1

Branch: refs/heads/ignite-732
Commit: b5b433a1658ade2ff91916c507a0dc26d0f56bcf
Parents: b65aa1d
Author: ivasilinets <ivasilin...@gridgain.com>
Authored: Thu Apr 30 17:49:34 2015 +0300
Committer: ivasilinets <ivasilin...@gridgain.com>
Committed: Thu Apr 30 17:49:34 2015 +0300

----------------------------------------------------------------------
 .../GridDistributedCacheAdapter.java            | 29 ++++++++++++++------
 1 file changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5b433a1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
index 80aa809..3a685cc 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
@@ -230,13 +231,23 @@ public abstract class GridDistributedCacheAdapter<K, V> 
extends GridCacheAdapter
      * operation on a cache with the given name.
      */
     @GridInternal
-    private static class GlobalRemoveAllCallable<K,V> extends 
VersionComparable<K, V> implements Callable<Object> {
+    private static class GlobalRemoveAllCallable<K,V> implements 
Callable<Object>, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
+        /** Cache name. */
+        private String cacheName;
+
+        /** Topology version. */
+        private AffinityTopologyVersion topVer;
+
         /** Skip store flag. */
         private boolean skipStore;
 
+        /** Injected grid instance. */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
         /**
          * Empty constructor for serialization.
          */
@@ -250,7 +261,8 @@ public abstract class GridDistributedCacheAdapter<K, V> 
extends GridCacheAdapter
          * @param skipStore Skip store flag.
          */
         private GlobalRemoveAllCallable(String cacheName, @NotNull 
AffinityTopologyVersion topVer, boolean skipStore) {
-            super(cacheName, topVer);
+            this.cacheName = cacheName;
+            this.topVer = topVer;
             this.skipStore = skipStore;
         }
 
@@ -258,13 +270,12 @@ public abstract class GridDistributedCacheAdapter<K, V> 
extends GridCacheAdapter
          * {@inheritDoc}
          */
         @Override public Object call() throws Exception {
-            if (!compareTopologyVersions())
-                return null;
-
             GridCacheAdapter<K, V> cacheAdapter = 
((IgniteKernal)ignite).context().cache().internalCache(cacheName);
 
             final GridCacheContext<K, V> ctx = cacheAdapter.context();
 
+            ctx.affinity().affinityReadyFuture(topVer).get();
+
             ctx.gate().enter();
 
             try {
@@ -327,15 +338,15 @@ public abstract class GridDistributedCacheAdapter<K, V> 
extends GridCacheAdapter
 
         /** {@inheritDoc} */
         @Override public void writeExternal(ObjectOutput out) throws 
IOException {
-            super.writeExternal(out);
-
+            U.writeString(out, cacheName);
+            out.writeObject(topVer);
             out.writeBoolean(skipStore);
         }
 
         /** {@inheritDoc} */
         @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-            super.readExternal(in);
-
+            cacheName = U.readString(in);
+            topVer = (AffinityTopologyVersion)in.readObject();
             skipStore = in.readBoolean();
         }
     }

Reply via email to