ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [11/50] incubator-ignite git commit: # ignite-654
Date Wed, 01 Apr 2015 08:32:29 GMT
# ignite-654


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

Branch: refs/heads/ignite-639
Commit: 3821f002956b14f7404b8943e320909f3d6c0067
Parents: 768ca6a
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Mar 31 10:20:51 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Mar 31 10:38:54 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridKernalContextImpl.java    |  6 +++---
 .../org/apache/ignite/internal/IgniteKernal.java  |  7 +++++++
 .../internal/managers/GridManagerAdapter.java     |  4 ++++
 .../distributed/dht/GridPartitionedGetFuture.java |  3 ++-
 .../cache/distributed/near/GridNearGetFuture.java |  3 ++-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java   | 16 +++++++++++++---
 .../org/apache/ignite/spi/IgniteSpiContext.java   |  5 +++++
 .../communication/tcp/TcpCommunicationSpi.java    | 13 ++++---------
 .../ignite/spi/discovery/tcp/TcpDiscoverySpi.java | 14 +++++++++-----
 .../cache/GridCacheAbstractFailoverSelfTest.java  |  2 +-
 .../ignite/testframework/GridSpiTestContext.java  | 18 +++++++++---------
 11 files changed, 59 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 0c3f41f..059a576 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -319,6 +319,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
      * @param cfg Grid configuration.
      * @param gw Kernal gateway.
      * @param utilityCachePool Utility cache pool.
+     * @param marshCachePool Marshaller cache pool.
      * @param execSvc Public executor service.
      * @param sysExecSvc System executor service.
      * @param p2pExecSvc P2P executor service.
@@ -387,6 +388,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
 
     /**
      * @param comp Manager to add.
+     * @param addToList If {@code true} component is added to components list.
      */
     public void add(GridComponent comp, boolean addToList) {
         assert comp != null;
@@ -495,9 +497,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
 
     /** {@inheritDoc} */
     @Override public boolean isStopping() {
-        GridKernalState state = gw.getState();
-
-        return state == GridKernalState.STOPPING || state == GridKernalState.STOPPED;
+        return ((IgniteKernal)grid).isStopping();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index c9c3b8d..6899af9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1671,6 +1671,13 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     }
 
     /**
+     * @return {@code True} if node started shutdown sequence.
+     */
+    public boolean isStopping() {
+        return stopGuard.get();
+    }
+
+    /**
      * @param cancel Whether or not to cancel running jobs.
      */
     private void stop0(boolean cancel) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
index b965ea3..982ca86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
@@ -281,6 +281,10 @@ public abstract class GridManagerAdapter<T extends IgniteSpi> implements
GridMan
         for (final IgniteSpi spi : spis) {
             try {
                 spi.onContextInitialized(new IgniteSpiContext() {
+                    @Override public boolean isStopping() {
+                        return ctx.isStopping();
+                    }
+
                     @Override public Collection<ClusterNode> remoteNodes() {
                         return ctx.discovery().remoteNodes();
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 9b23dd2..da2105d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -607,7 +607,8 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
             if (log.isDebugEnabled())
                 log.debug("Remote node left grid while sending or waiting for reply (will
retry): " + this);
 
-            final AffinityTopologyVersion updTopVer = new AffinityTopologyVersion(cctx.discovery().topologyVersion());
+            final AffinityTopologyVersion updTopVer =
+                new AffinityTopologyVersion(Math.max(topVer.topologyVersion() + 1, cctx.discovery().topologyVersion()));
 
             final GridFutureRemapTimeoutObject timeout = new GridFutureRemapTimeoutObject(this,
                 cctx.kernalContext().config().getNetworkTimeout(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 615d02e..b1017d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -725,7 +725,8 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
             if (log.isDebugEnabled())
                 log.debug("Remote node left grid while sending or waiting for reply (will
retry): " + this);
 
-            final AffinityTopologyVersion updTopVer = new AffinityTopologyVersion(cctx.discovery().topologyVersion());
+            final AffinityTopologyVersion updTopVer =
+                new AffinityTopologyVersion(Math.max(topVer.topologyVersion() + 1, cctx.discovery().topologyVersion()));
 
             final GridFutureRemapTimeoutObject timeout = new GridFutureRemapTimeoutObject(this,
                 cctx.kernalContext().config().getNetworkTimeout(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 2235895..bb66872 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -62,7 +62,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
     private String name;
 
     /** Grid SPI context. */
-    private volatile IgniteSpiContext spiCtx = new GridDummySpiContext(null);
+    private volatile IgniteSpiContext spiCtx = new GridDummySpiContext(null, false);
 
     /** Discovery listener. */
     private GridLocalEventListener paramsLsnr;
@@ -185,7 +185,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
         ClusterNode locNode = spiCtx == null ? null : spiCtx.localNode();
 
         // Set dummy no-op context.
-        spiCtx = new GridDummySpiContext(locNode);
+        spiCtx = new GridDummySpiContext(locNode, true);
     }
 
     /**
@@ -523,13 +523,18 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
         /** */
         private final ClusterNode locNode;
 
+        /** */
+        private final boolean stopping;
+
         /**
          * Create temp SPI context.
          *
          * @param locNode Local node.
+         * @param stopping Node stopping flag.
          */
-        GridDummySpiContext(ClusterNode locNode) {
+        GridDummySpiContext(ClusterNode locNode, boolean stopping) {
             this.locNode = locNode;
+            this.stopping = stopping;
         }
 
         /** {@inheritDoc} */
@@ -688,5 +693,10 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
         @Override public MessageFactory messageFactory() {
             return null;
         }
+
+        /** {@inheritDoc} */
+        @Override public boolean isStopping() {
+            return stopping;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
index cdc5492..75b637d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
@@ -346,4 +346,9 @@ public interface IgniteSpiContext {
      * @return Message factory.
      */
     public MessageFactory messageFactory();
+
+    /**
+     * @return {@code True} if node started shutdown sequence.
+     */
+    public boolean isStopping();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 01eb72f..0ab0cf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -257,7 +257,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         clients.remove(id, rmv)) {
                         rmv.forceClose();
 
-                        if (!stopping) {
+                        if (!getSpiContext().isStopping()) {
                             GridNioRecoveryDescriptor recoveryData = ses.recoveryDescriptor();
 
                             if (recoveryData != null) {
@@ -695,9 +695,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     /** Context initialization latch. */
     private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
 
-    /** Stopping flag. */
-    private volatile boolean stopping;
-
     /** metrics listener. */
     private final GridNioMetricsListener metricsLsnr = new GridNioMetricsListener() {
         @Override public void onBytesSent(int bytesCnt) {
@@ -1463,7 +1460,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
     /** {@inheritDoc} */
     @Override public void spiStop() throws IgniteSpiException {
-        assert stopping;
+        assert getSpiContext().isStopping();
 
         unregisterMBean();
 
@@ -1498,8 +1495,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
     /** {@inheritDoc} */
     @Override protected void onContextDestroyed0() {
-        stopping = true;
-
         if (ctxInitLatch.getCount() > 0)
             // Safety.
             ctxInitLatch.countDown();
@@ -1624,8 +1619,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
             GridCommunicationClient client = clients.get(nodeId);
 
             if (client == null) {
-                if (stopping)
-                    throw new IgniteSpiException("Grid is stopping.");
+                if (getSpiContext().isStopping())
+                    throw new IgniteSpiException("Node is stopping.");
 
                 // Do not allow concurrent connects.
                 GridFutureAdapter<GridCommunicationClient> fut = new ConnectFuture();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 03cf665..02d373c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -4695,14 +4695,18 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
 
                     // Ping.
                     if (msg instanceof TcpDiscoveryPingRequest) {
-                        TcpDiscoveryPingRequest req = (TcpDiscoveryPingRequest)msg;
+                        if (!getSpiContext().isStopping()) {
+                            TcpDiscoveryPingRequest req = (TcpDiscoveryPingRequest)msg;
 
-                        TcpDiscoveryPingResponse res = new TcpDiscoveryPingResponse(locNodeId);
+                            TcpDiscoveryPingResponse res = new TcpDiscoveryPingResponse(locNodeId);
 
-                        if (req.clientNodeId() != null)
-                            res.clientExists(clientMsgWorkers.containsKey(req.clientNodeId()));
+                            if (req.clientNodeId() != null)
+                                res.clientExists(clientMsgWorkers.containsKey(req.clientNodeId()));
 
-                        writeToSocket(sock, res);
+                            writeToSocket(sock, res);
+                        }
+                        else if (log.isDebugEnabled())
+                            log.debug("Ignore ping request, node is stopping.");
 
                         return;
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 42b3293..4025265 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -46,7 +46,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
     private static final int ENTRY_CNT = 100;
 
     /** */
-    private static final int TOP_CHANGE_CNT = 5;
+    private static final int TOP_CHANGE_CNT = 10;
 
     /** */
     private static final int TOP_CHANGE_THREAD_CNT = 3;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3821f002/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
index 80e5c42..a754910 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.direct.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.plugin.extensions.communication.*;
@@ -108,8 +107,7 @@ public class GridSpiTestContext implements IgniteSpiContext {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override
-    public ClusterNode node(UUID nodeId) {
+    @Nullable @Override public ClusterNode node(UUID nodeId) {
         if (locNode != null && locNode.id().equals(nodeId))
             return locNode;
 
@@ -240,9 +238,8 @@ public class GridSpiTestContext implements IgniteSpiContext {
     public void updateAllMetrics() {
         notifyListener(new DiscoveryEvent(locNode, "Metrics updated", EVT_NODE_METRICS_UPDATED,
locNode));
 
-        for (ClusterNode node : rmtNodes) {
+        for (ClusterNode node : rmtNodes)
             notifyListener(new DiscoveryEvent(locNode, "Metrics updated", EVT_NODE_METRICS_UPDATED,
node));
-        }
     }
 
     /**
@@ -290,9 +287,8 @@ public class GridSpiTestContext implements IgniteSpiContext {
      */
     @SuppressWarnings("deprecation")
     public void triggerMessage(ClusterNode node, Object msg) {
-        for (GridMessageListener lsnr : msgLsnrs) {
+        for (GridMessageListener lsnr : msgLsnrs)
             lsnr.onMessage(node.id(), msg);
-        }
     }
 
     /** {@inheritDoc} */
@@ -333,9 +329,8 @@ public class GridSpiTestContext implements IgniteSpiContext {
         assert typeSet != null;
 
         if (types != null) {
-            for (int type : types) {
+            for (int type : types)
                 typeSet.add(type);
-            }
         }
     }
 
@@ -519,6 +514,11 @@ public class GridSpiTestContext implements IgniteSpiContext {
         return factory;
     }
 
+    /** {@inheritDoc} */
+    @Override public boolean isStopping() {
+        return false;
+    }
+
     /**
      * @param cacheName Cache name.
      * @return Map representing cache.


Mime
View raw message