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 2017/03/17 15:04:48 UTC

[03/10] ignite git commit: ignite-4680-2 wip

ignite-4680-2 wip


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

Branch: refs/heads/ignite-4680-sb
Commit: d8fa6dd4fae51532a4e04ffbfe6c6fa3584520bf
Parents: d1b4ebd
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Wed Mar 15 20:44:46 2017 +0300
Committer: Konstantin Dudkov <kd...@ya.ru>
Committed: Wed Mar 15 20:44:46 2017 +0300

----------------------------------------------------------------------
 .../dht/atomic/GridDhtAtomicCache.java          | 14 +++---
 .../ignite/internal/util/StripedExecutor.java   |  5 ++-
 .../ignite/thread/IgniteStripeThread.java       | 47 --------------------
 3 files changed, 10 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d8fa6dd4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 4ab5000..aeb379a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -101,7 +101,7 @@ import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.security.SecurityPermission;
-import org.apache.ignite.thread.IgniteStripeThread;
+import org.apache.ignite.thread.IgniteThread;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 
@@ -280,11 +280,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     GridNearAtomicAbstractUpdateRequest req
                 ) {
                     int stripeIdx;
-
-                    if (req instanceof GridNearAtomicFullUpdateRequest && Thread.currentThread() instanceof IgniteStripeThread)
-                        stripeIdx = ((IgniteStripeThread)Thread.currentThread()).stripeIndex();
+                    Thread curTrd = Thread.currentThread();
+                    if (req instanceof GridNearAtomicFullUpdateRequest && curTrd instanceof IgniteThread)
+                        stripeIdx = ((IgniteThread)curTrd).stripe();
                     else
-                        stripeIdx = IgniteStripeThread.GRP_IDX_UNASSIGNED;
+                        stripeIdx = IgniteThread.GRP_IDX_UNASSIGNED;
 
                     processNearAtomicUpdateRequest(
                         nodeId,
@@ -1660,7 +1660,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
         final GridNearAtomicAbstractUpdateRequest req,
         final UpdateReplyClosure completionCb
     ) {
-        updateAllAsyncInternal(nodeId, req, IgniteStripeThread.GRP_IDX_UNASSIGNED, completionCb);
+        updateAllAsyncInternal(nodeId, req, IgniteThread.GRP_IDX_UNASSIGNED, completionCb);
     }
 
     /**
@@ -1772,7 +1772,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
         int[] stripeIdxs = null;
 
-        if (stripeIdx != IgniteStripeThread.GRP_IDX_UNASSIGNED
+        if (stripeIdx != IgniteThread.GRP_IDX_UNASSIGNED
             && req.directType() == GridNearAtomicFullUpdateRequest.DIRECT_TYPE
             && ((GridNearAtomicFullUpdateRequest)req).stripeMap() != null) {
             stripeIdxs = ((GridNearAtomicFullUpdateRequest)req).stripeMap().get(stripeIdx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d8fa6dd4/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
index af474ff..28bb584 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
@@ -38,7 +38,7 @@ import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.thread.IgniteStripeThread;
+import org.apache.ignite.thread.IgniteThread;
 import org.jetbrains.annotations.NotNull;
 import org.jsr166.LongAdder8;
 
@@ -461,9 +461,10 @@ public class StripedExecutor implements ExecutorService {
          * Starts the stripe.
          */
         void start() {
-            thread = new IgniteStripeThread(igniteInstanceName,
+            thread = new IgniteThread(igniteInstanceName,
                 poolName + "-stripe-" + idx,
                 this,
+                IgniteThread.GRP_IDX_UNASSIGNED,
                 idx);
 
             thread.start();

http://git-wip-us.apache.org/repos/asf/ignite/blob/d8fa6dd4/modules/core/src/main/java/org/apache/ignite/thread/IgniteStripeThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/thread/IgniteStripeThread.java b/modules/core/src/main/java/org/apache/ignite/thread/IgniteStripeThread.java
deleted file mode 100644
index 75b655f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/thread/IgniteStripeThread.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.thread;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Class for use within {@link IgniteThreadPoolExecutor} class.
- */
-public class IgniteStripeThread extends IgniteThread {
-
-    /** Group index. */
-    private final int stripeIdx;
-
-    /** {@inheritDoc} */
-    public IgniteStripeThread(String gridName, String threadName, Runnable r, int stripeIdx) {
-        super(gridName, threadName, r);
-        this.stripeIdx = stripeIdx;
-    }
-
-    /**
-     * @return Group index.
-     */
-    public int stripeIndex() {
-        return stripeIdx;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(IgniteStripeThread.class, this, "name", getName());
-    }
-}