ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [9/9] incubator-ignite git commit: # IGNITE-187 Code cleanup.
Date Wed, 25 Feb 2015 10:14:13 GMT
# IGNITE-187 Code cleanup.


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

Branch: refs/heads/ignite-187
Commit: 8fcc91e245f3f955095e7497306e86367e9bd2cb
Parents: a6177d4
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Wed Feb 25 17:13:45 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Wed Feb 25 17:13:45 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/internal/GridKernalContext.java |  4 ++--
 .../ignite/internal/GridKernalContextImpl.java    |  5 +----
 .../org/apache/ignite/internal/IgniteKernal.java  |  6 +++---
 .../managers/discovery/GridDiscoveryManager.java  |  2 +-
 .../processors/rest/GridRestProcessor.java        | 18 ++++--------------
 .../spi/discovery/tcp/TcpDiscoverySpiAdapter.java |  2 +-
 .../ignite/internal/GridReleaseTypeSelfTest.java  | 10 ++++------
 ...yFunctionExcludeNeighborsAbstractSelfTest.java |  8 +++-----
 8 files changed, 19 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index b824218..e40c1a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@ -534,7 +534,7 @@ public interface GridKernalContext extends Iterable<GridComponent>
{
     public void addNodeAttributes(Map<String, String> attrs);
 
     /**
-     * Seal node attributes for modification.
+     * @return Node attributes.
      */
-    public Map<String, Object> sealNodeAttributes();
+    public Map<String, Object> nodeAttributes();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/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 76f2700..9370100 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
@@ -278,7 +278,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
     @GridToStringExclude
     private Map<String, Object> attrs = new HashMap<>(150);
 
-
     /** */
     private IgniteEx grid;
 
@@ -868,9 +867,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
     }
 
     /** {@inheritDoc} */
-    @Override public Map<String, Object> sealNodeAttributes() {
-        attrs = Collections.unmodifiableMap(attrs);
-
+    @Override public Map<String, Object> nodeAttributes() {
         return attrs;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/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 5b17666..d3edad7 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
@@ -2507,9 +2507,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public <V, T> IgniteAtomicStamped<V, T> atomicStamped(String
name,
-        @Nullable V initVal,
-        @Nullable T initStamp,
+    @Nullable @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String
name,
+        @Nullable T initVal,
+        @Nullable S initStamp,
         boolean create)
     {
         guard();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 5e3d53a..fd980da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -206,7 +206,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
 
         ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_PHY_RAM, totSysMemory);
 
-        getSpi().setNodeAttributes(ctx.sealNodeAttributes(), ver);
+        getSpi().setNodeAttributes(ctx.nodeAttributes(), ver);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 5e11996..97d3aa0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -180,13 +180,8 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
                 GridRestResponse res = new GridRestResponse(STATUS_SECURITY_CHECK_FAILED,
e.getMessage());
 
-                try {
-                    updateSession(req, subjCtx);
-                    res.sessionTokenBytes(ZERO_BYTES);
-                }
-                catch (Exception e1) {
-                    U.warn(log, "Cannot update response session token: " + e1.getMessage());
-                }
+                updateSession(req, subjCtx);
+                res.sessionTokenBytes(ZERO_BYTES);
 
                 return new GridFinishedFuture<>(ctx, res);
             }
@@ -226,13 +221,8 @@ public class GridRestProcessor extends GridProcessorAdapter {
                 assert res != null;
 
                 if (ctx.security().enabled()) {
-                    try {
-                        updateSession(req, subjCtx0);
-                        res.sessionTokenBytes(ZERO_BYTES);
-                    }
-                    catch (Exception e) {
-                        U.warn(log, "Cannot update response session token: " + e.getMessage());
-                    }
+                    updateSession(req, subjCtx0);
+                    res.sessionTokenBytes(ZERO_BYTES);
                 }
 
                 interceptResponse(res, req);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index c16a208..52156a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -306,7 +306,7 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements
Discov
             log.debug("Node version to set: " + ver);
         }
 
-        locNodeAttrs = new HashMap<>(attrs); // TODO: IGNITE-187 attrs is a sealed
map, but modified in TcpDiscoverySpi.spiStart0()
+        locNodeAttrs = attrs;
         locNodeVer = ver;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
index 11b267c..284aa0c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
@@ -51,17 +51,15 @@ public class GridReleaseTypeSelfTest extends GridCommonAbstractTest {
 
         final int idx = cnt.getAndIncrement();
 
+        // Override node attributes in discovery spi.
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {
             @Override public void setNodeAttributes(Map<String, Object> attrs, IgniteProductVersion
ver) {
-                // Override node attributes in discovery spi.
-                Map<String, Object> overrideAttrs = new HashMap<>(attrs);
+                super.setNodeAttributes(attrs, ver);
 
                 if (idx % 2 == 0)
-                    overrideAttrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, firstNodeVer);
+                    attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, firstNodeVer);
                 else
-                    overrideAttrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, secondNodeVer);
-
-                super.setNodeAttributes(overrideAttrs, ver);
+                    attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, secondNodeVer);
             }
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8fcc91e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java
index 8147973..d5fcddf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest.java
@@ -53,19 +53,17 @@ public abstract class GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest
     @Override protected IgniteConfiguration getConfiguration(final String gridName) throws
Exception {
         IgniteConfiguration c = super.getConfiguration(gridName);
 
+        // Override node attributes in discovery spi.
         TcpDiscoverySpi spi = new TcpDiscoverySpi() {
             @Override public void setNodeAttributes(Map<String, Object> attrs, IgniteProductVersion
ver) {
-                // Override node attributes in discovery spi.
-                Map<String, Object> overrideAttrs = new HashMap<>(attrs);
+                super.setNodeAttributes(attrs, ver);
 
                 // Set unique mac addresses for every group of three nodes.
                 String macAddrs = "MOCK_MACS_" + (gridInstanceNum / 3);
 
-                overrideAttrs.put(IgniteNodeAttributes.ATTR_MACS, macAddrs);
+                attrs.put(IgniteNodeAttributes.ATTR_MACS, macAddrs);
 
                 gridInstanceNum++;
-
-                super.setNodeAttributes(overrideAttrs, ver);
             }
         };
 


Mime
View raw message