ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [5/7] ignite git commit: Minors.
Date Thu, 28 Apr 2016 14:20:11 GMT
Minors.


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

Branch: refs/heads/ignite-2523-1-resp-dht
Commit: 31604dd11768ac1d8a7c4959909e44157712a079
Parents: f32f1d8
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Apr 28 16:47:48 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Apr 28 16:47:48 2016 +0300

----------------------------------------------------------------------
 .../GridDhtAtomicAbstractUpdateFuture.java      | 38 ++++++++++++++------
 .../atomic/GridDhtAtomicSingleUpdateFuture.java | 24 +++++++++++++
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   | 29 ---------------
 3 files changed, 52 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/31604dd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
index e930d1a..3fc36cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheE
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CI2;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -42,6 +43,7 @@ import javax.cache.processor.EntryProcessor;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -89,8 +91,13 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
     /** Response count. */
     protected volatile int resCnt;
 
-    /** Continuous query closures. */
     // TODO: Optimize.
+    /** Mappings. */
+    @GridToStringInclude
+    private Map<UUID, GridDhtAtomicUpdateRequest> mappings;
+
+    // TODO: Optimize.
+    /** Continuous query closures. */
     private Collection<CI1<Boolean>> cntQryClsrs;
 
     /**
@@ -120,6 +127,8 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
         this.writeVer = writeVer;
 
         waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() &&
!updateReq.clientRequest()));
+
+        mappings = U.newHashMap(updateReq.keysCount());
     }
 
     /**
@@ -333,7 +342,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
      */
     public void map() {
         if (mappingsCount() > 0)
-            map0();
+            mapAll();
         else
             onDone();
 
@@ -344,6 +353,14 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
     }
 
     /**
+     * Internal mapping routine.
+     */
+    private void mapAll() {
+        for (GridDhtAtomicUpdateRequest req : mappings.values())
+            sendRequest(req);
+    }
+
+    /**
      * @param clsr Continuous query closure.
      */
     public void addContinuousQueryClosure(CI1<Boolean> clsr){
@@ -394,17 +411,14 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
     protected abstract void markAllKeysFailed(@Nullable Throwable err);
 
     /**
-     * Internal mapping routine.
-     */
-    protected abstract void map0();
-
-    /**
      * Add mapping.
      *
      * @param nodeId Node ID.
      * @param req Request.
      */
-    protected abstract void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req);
+    private void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+        mappings.put(nodeId, req);
+    }
 
     /**
      * Get mapping for the given node ID.
@@ -412,12 +426,16 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
      * @param nodeId Node ID.
      * @return Mapping (if any).
      */
-    @Nullable protected abstract GridDhtAtomicUpdateRequest mapping(UUID nodeId);
+    @Nullable protected GridDhtAtomicUpdateRequest mapping(UUID nodeId) {
+        return mappings.get(nodeId);
+    }
 
     /**
      * @return Mappings number.
      */
-    protected abstract int mappingsCount();
+    protected int mappingsCount() {
+        return mappings != null ? mappings.size() : 0;
+    }
 
     /**
      * Add near reader entry.

http://git-wip-us.apache.org/repos/asf/ignite/blob/31604dd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
new file mode 100644
index 0000000..17b1d7f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+/**
+ * DHT atomic cache backup update future.
+ */
+public class GridDhtAtomicSingleUpdateFuture {
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/31604dd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index bf118ab..5f0e267 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -21,15 +21,12 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.UUID;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.CI2;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -39,10 +36,6 @@ public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Mappings. */
-    @GridToStringInclude
-    private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
-
     /** Entries with readers. */
     private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
 
@@ -66,7 +59,6 @@ public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
         super(cctx, updateReq, updateRes, completionCb, writeVer);
 
         keys = new ArrayList<>(updateReq.keysCount());
-        mappings = U.newHashMap(updateReq.keysCount());
     }
 
     /**
@@ -85,27 +77,6 @@ public class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
     }
 
     /** {@inheritDoc} */
-    @Override protected void map0() {
-        for (GridDhtAtomicUpdateRequest req : mappings.values())
-            sendRequest(req);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void mapping(UUID nodeId, GridDhtAtomicUpdateRequest req) {
-        mappings.put(nodeId, req);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nullable protected GridDhtAtomicUpdateRequest mapping(UUID nodeId) {
-        return mappings.get(nodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int mappingsCount() {
-        return mappings != null ? mappings.size() : 0;
-    }
-
-    /** {@inheritDoc} */
     @Override protected void nearReaderEntry(KeyCacheObject key, GridDhtCacheEntry entry)
{
         if (nearReadersEntries == null)
             nearReadersEntries = new HashMap<>();


Mime
View raw message