Repository: incubator-ignite
Updated Branches:
  refs/heads/sprint-2 7440aba1c -> f589cfa64


 IGNITE-187 Refactoring of node attributes.


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

Branch: refs/heads/sprint-2
Commit: 6cdeb5754a8fca4ab50ba3bdcfd6088218459c18
Parents: 7bbfeb1
Author: AKuznetsov <akuznet...@gridgain.com>
Authored: Wed Feb 25 09:13:45 2015 +0700
Committer: AKuznetsov <akuznet...@gridgain.com>
Committed: Wed Feb 25 09:13:45 2015 +0700

----------------------------------------------------------------------
 .../ignite/internal/GridKernalContext.java      |  37 ++++
 .../ignite/internal/GridKernalContextImpl.java  |  32 +++
 .../apache/ignite/internal/IgniteKernal.java    | 201 +++++++++----------
 .../ignite/internal/managers/GridManager.java   |   5 +-
 .../internal/managers/GridManagerAdapter.java   |   6 +-
 .../discovery/GridDiscoveryManager.java         |   7 +-
 .../internal/processors/GridProcessor.java      |   7 -
 .../processors/GridProcessorAdapter.java        |   5 -
 .../processors/cache/GridCacheProcessor.java    |  56 +++---
 .../clock/GridClockSyncProcessor.java           |   9 +-
 .../internal/processors/igfs/IgfsProcessor.java | 102 +++++-----
 .../processors/rest/GridRestProcessor.java      |  54 ++---
 .../streamer/GridStreamProcessor.java           |  31 ++-
 .../apache/ignite/plugin/PluginProvider.java    |   3 +-
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   |   2 +-
 .../internal/GridReleaseTypeSelfTest.java       |  10 +-
 ...unctionExcludeNeighborsAbstractSelfTest.java |   7 +-
 17 files changed, 296 insertions(+), 278 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 40421d1..b824218 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
@@ -500,4 +500,41 @@ public interface GridKernalContext extends 
Iterable<GridComponent> {
      *      messages.
      */
     public ExecutorService getRestExecutorService();
+
+    /**
+     * Get node attribute by name.
+     *
+     * @param key Attribute name.
+     * @return Attribute value.
+     */
+    public Object nodeAttribute(String key);
+
+    /**
+     * Check if node has specified attribute.
+     *
+     * @param key Attribute name.
+     * @return {@code true} If node has attribute with specified name.
+     */
+    public boolean hasNodeAttribute(String key);
+
+    /**
+     * Add attribute to node attributes.
+     *
+     * @param key Attribute name.
+     * @param val Attribute value.
+     * @return Previous attribute value associated with attribute name.
+     */
+    public Object addNodeAttribute(String key, Object val);
+
+    /**
+     * Add attributes to node attributes.
+     *
+     * @param attrs Attributes to add.
+     */
+    public void addNodeAttributes(Map<String, String> attrs);
+
+    /**
+     * Seal node attributes for modification.
+     */
+    public Map<String, Object> sealNodeAttributes();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 6f31bf7..76f2700 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
@@ -274,6 +274,10 @@ public class GridKernalContextImpl implements 
GridKernalContext, Externalizable
     @GridToStringExclude
     protected ExecutorService restExecSvc;
 
+    /** */
+    @GridToStringExclude
+    private Map<String, Object> attrs = new HashMap<>(150);
+
 
     /** */
     private IgniteEx grid;
@@ -843,6 +847,34 @@ public class GridKernalContextImpl implements 
GridKernalContext, Externalizable
     }
 
     /** {@inheritDoc} */
+    @Override public Object nodeAttribute(String key) {
+        return attrs.get(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean hasNodeAttribute(String key) {
+        return attrs.containsKey(key);
+    }
+
+
+    /** {@inheritDoc} */
+    @Override public Object addNodeAttribute(String key, Object val) {
+        return attrs.put(key, val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addNodeAttributes(Map<String, String> attrs) {
+        this.attrs.putAll(attrs);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<String, Object> sealNodeAttributes() {
+        attrs = Collections.unmodifiableMap(attrs);
+
+        return attrs;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridKernalContextImpl.class, this);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 a5d19c0..538c91c 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
@@ -472,16 +472,14 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     }
 
     /**
-     * @param attrs Current attributes.
      * @param name  New attribute name.
      * @param val New attribute value.
      * @throws IgniteCheckedException If duplicated SPI name found.
      */
-    private void add(Map<String, Object> attrs, String name, @Nullable 
Serializable val) throws IgniteCheckedException {
-        assert attrs != null;
+    private void add(String name, @Nullable Serializable val) throws 
IgniteCheckedException {
         assert name != null;
 
-        if (attrs.put(name, val) != null) {
+        if (ctx.addNodeAttribute(name, val) != null) {
             if (name.endsWith(ATTR_SPI_CLASS))
                 // User defined duplicated names for the different SPIs.
                 throw new IgniteCheckedException("Failed to set SPI attribute. 
Duplicated SPI name found: " +
@@ -656,8 +654,6 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
         // Ack configuration.
         ackSpis();
 
-        Map<String, Object> attrs = createNodeAttributes(cfg, 
BUILD_TSTAMP_STR);
-
         // Spin out SPIs & managers.
         try {
             ctx = new GridKernalContextImpl(log,
@@ -672,6 +668,8 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                 igfsExecSvc,
                 restExecSvc);
 
+            fillNodeAttributes();
+
             cluster = new IgniteClusterImpl(ctx);
 
             U.onGridStart();
@@ -684,7 +682,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
 
             scheduler = new IgniteSchedulerImpl(ctx);
 
-            startProcessor(ctx, rsrcProc, attrs);
+            startProcessor(ctx, rsrcProc);
 
             // Inject resources into lifecycle beans.
             if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null) {
@@ -702,69 +700,69 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
 
             addHelper(ctx, 
IGFS_HELPER.create(F.isEmpty(cfg.getIgfsConfiguration())));
 
-            startProcessor(ctx, new IgnitePluginProcessor(ctx, cfg), attrs);
+            startProcessor(ctx, new IgnitePluginProcessor(ctx, cfg));
 
             // Off-heap processor has no dependencies.
-            startProcessor(ctx, new GridOffHeapProcessor(ctx), attrs);
+            startProcessor(ctx, new GridOffHeapProcessor(ctx));
 
             // Closure processor should be started before all others
             // (except for resource processor), as many components can depend 
on it.
-            startProcessor(ctx, new GridClosureProcessor(ctx), attrs);
+            startProcessor(ctx, new GridClosureProcessor(ctx));
 
             // Start some other processors (order & place is important).
-            startProcessor(ctx, new GridPortProcessor(ctx), attrs);
-            startProcessor(ctx, new GridJobMetricsProcessor(ctx), attrs);
+            startProcessor(ctx, new GridPortProcessor(ctx));
+            startProcessor(ctx, new GridJobMetricsProcessor(ctx));
 
             // Timeout processor needs to be started before managers,
             // as managers may depend on it.
-            startProcessor(ctx, new GridTimeoutProcessor(ctx), attrs);
+            startProcessor(ctx, new GridTimeoutProcessor(ctx));
 
             // Start security processors.
-            startProcessor(ctx, createComponent(GridSecurityProcessor.class, 
ctx), attrs);
+            startProcessor(ctx, createComponent(GridSecurityProcessor.class, 
ctx));
 
             // Start SPI managers.
             // NOTE: that order matters as there are dependencies between 
managers.
-            startManager(ctx, new GridIoManager(ctx), attrs);
-            startManager(ctx, new GridCheckpointManager(ctx), attrs);
+            startManager(ctx, new GridIoManager(ctx));
+            startManager(ctx, new GridCheckpointManager(ctx));
 
-            startManager(ctx, new GridEventStorageManager(ctx), attrs);
-            startManager(ctx, new GridDeploymentManager(ctx), attrs);
-            startManager(ctx, new GridLoadBalancerManager(ctx), attrs);
-            startManager(ctx, new GridFailoverManager(ctx), attrs);
-            startManager(ctx, new GridCollisionManager(ctx), attrs);
-            startManager(ctx, new GridSwapSpaceManager(ctx), attrs);
-            startManager(ctx, new GridIndexingManager(ctx), attrs);
+            startManager(ctx, new GridEventStorageManager(ctx));
+            startManager(ctx, new GridDeploymentManager(ctx));
+            startManager(ctx, new GridLoadBalancerManager(ctx));
+            startManager(ctx, new GridFailoverManager(ctx));
+            startManager(ctx, new GridCollisionManager(ctx));
+            startManager(ctx, new GridSwapSpaceManager(ctx));
+            startManager(ctx, new GridIndexingManager(ctx));
 
             ackSecurity(ctx);
 
             // Start processors before discovery manager, so they will
             // be able to start receiving messages once discovery completes.
-            startProcessor(ctx, new GridClockSyncProcessor(ctx), attrs);
-            startProcessor(ctx, new GridAffinityProcessor(ctx), attrs);
-            startProcessor(ctx, 
createComponent(GridSegmentationProcessor.class, ctx), attrs);
-            startProcessor(ctx, createComponent(GridPortableProcessor.class, 
ctx), attrs);
-            startProcessor(ctx, new GridQueryProcessor(ctx), attrs);
-            startProcessor(ctx, new GridCacheProcessor(ctx), attrs);
-            startProcessor(ctx, new GridTaskSessionProcessor(ctx), attrs);
-            startProcessor(ctx, new GridJobProcessor(ctx), attrs);
-            startProcessor(ctx, new GridTaskProcessor(ctx), attrs);
-            startProcessor(ctx, (GridProcessor)SCHEDULE.createOptional(ctx), 
attrs);
-            startProcessor(ctx, new GridRestProcessor(ctx), attrs);
-            startProcessor(ctx, new GridDataLoaderProcessor(ctx), attrs);
-            startProcessor(ctx, new GridStreamProcessor(ctx), attrs);
-            startProcessor(ctx, (GridProcessor) IGFS.create(ctx, 
F.isEmpty(cfg.getIgfsConfiguration())), attrs);
-            startProcessor(ctx, new GridContinuousProcessor(ctx), attrs);
+            startProcessor(ctx, new GridClockSyncProcessor(ctx));
+            startProcessor(ctx, new GridAffinityProcessor(ctx));
+            startProcessor(ctx, 
createComponent(GridSegmentationProcessor.class, ctx));
+            startProcessor(ctx, createComponent(GridPortableProcessor.class, 
ctx));
+            startProcessor(ctx, new GridQueryProcessor(ctx));
+            startProcessor(ctx, new GridCacheProcessor(ctx));
+            startProcessor(ctx, new GridTaskSessionProcessor(ctx));
+            startProcessor(ctx, new GridJobProcessor(ctx));
+            startProcessor(ctx, new GridTaskProcessor(ctx));
+            startProcessor(ctx, (GridProcessor)SCHEDULE.createOptional(ctx));
+            startProcessor(ctx, new GridRestProcessor(ctx));
+            startProcessor(ctx, new GridDataLoaderProcessor(ctx));
+            startProcessor(ctx, new GridStreamProcessor(ctx));
+            startProcessor(ctx, (GridProcessor) IGFS.create(ctx, 
F.isEmpty(cfg.getIgfsConfiguration())));
+            startProcessor(ctx, new GridContinuousProcessor(ctx));
             startProcessor(ctx, 
(GridProcessor)(cfg.isPeerClassLoadingEnabled() ?
                 IgniteComponentType.HADOOP.create(ctx, true): // No-op when 
peer class loading is enabled.
-                IgniteComponentType.HADOOP.createIfInClassPath(ctx, 
cfg.getHadoopConfiguration() != null)), attrs);
-            startProcessor(ctx, new GridServiceProcessor(ctx), attrs);
-            startProcessor(ctx, new DataStructuresProcessor(ctx), attrs);
+                IgniteComponentType.HADOOP.createIfInClassPath(ctx, 
cfg.getHadoopConfiguration() != null)));
+            startProcessor(ctx, new GridServiceProcessor(ctx));
+            startProcessor(ctx, new DataStructuresProcessor(ctx));
 
             // Start plugins.
             for (PluginProvider provider : ctx.plugins().allProviders()) {
                 ctx.add(new GridPluginComponent(provider));
 
-                
provider.start(ctx.plugins().pluginContextForProvider(provider), attrs);
+                
provider.start(ctx.plugins().pluginContextForProvider(provider));
             }
 
             gw.writeLock();
@@ -773,7 +771,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                 gw.setState(STARTED);
 
                 // Start discovery manager last to make sure that grid is 
fully initialized.
-                startManager(ctx, new GridDiscoveryManager(ctx), attrs);
+                startManager(ctx, new GridDiscoveryManager(ctx));
             }
             finally {
                 gw.writeUnlock();
@@ -878,12 +876,10 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                 private long lastCompletedCnt;
 
                 @Override protected void safeRun() {
-                    ExecutorService e = execSvc;
-
-                    if (!(e instanceof ThreadPoolExecutor))
+                    if (!(execSvc instanceof ThreadPoolExecutor))
                         return;
 
-                    ThreadPoolExecutor exec = (ThreadPoolExecutor)e;
+                    ThreadPoolExecutor exec = (ThreadPoolExecutor)execSvc;
 
                     long completedCnt = exec.getCompletedTaskCount();
 
@@ -945,10 +941,8 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                         int pubPoolIdleThreads = 0;
                         int pubPoolQSize = 0;
 
-                        ExecutorService pubExec = execSvc;
-
-                        if (pubExec instanceof ThreadPoolExecutor) {
-                            ThreadPoolExecutor exec = 
(ThreadPoolExecutor)pubExec;
+                        if (execSvc instanceof ThreadPoolExecutor) {
+                            ThreadPoolExecutor exec = 
(ThreadPoolExecutor)execSvc;
 
                             int poolSize = exec.getPoolSize();
 
@@ -961,10 +955,8 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                         int sysPoolIdleThreads = 0;
                         int sysPoolQSize = 0;
 
-                        ExecutorService sysExec = sysExecSvc;
-
-                        if (sysExec instanceof ThreadPoolExecutor) {
-                            ThreadPoolExecutor exec = 
(ThreadPoolExecutor)sysExec;
+                        if (sysExecSvc instanceof ThreadPoolExecutor) {
+                            ThreadPoolExecutor exec = 
(ThreadPoolExecutor)sysExecSvc;
 
                             int poolSize = exec.getPoolSize();
 
@@ -1098,20 +1090,15 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     /**
      * Creates attributes map and fills it in.
      *
-     * @param cfg Grid configuration.
-     * @param build Build string.
-     * @return Map of all node attributes.
      * @throws IgniteCheckedException thrown if was unable to set up attribute.
      */
     @SuppressWarnings({"SuspiciousMethodCalls", "unchecked", 
"TypeMayBeWeakened"})
-    private Map<String, Object> createNodeAttributes(IgniteConfiguration cfg, 
String build) throws IgniteCheckedException {
-        Map<String, Object> attrs = new HashMap<>();
-
+    private void fillNodeAttributes() throws IgniteCheckedException {
         final String[] incProps = cfg.getIncludeProperties();
 
         try {
             // Stick all environment settings into node attributes.
-            attrs.putAll(F.view(System.getenv(), new P1<String>() {
+            ctx.addNodeAttributes(F.view(System.getenv(), new P1<String>() {
                 @Override public boolean apply(String name) {
                     return incProps == null || U.containsStringArray(incProps, 
name, true) ||
                         U.isVisorNodeStartProperty(name) || 
U.isVisorRequiredProperty(name);
@@ -1137,13 +1124,14 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                         U.isVisorRequiredProperty(name);
                 }
             }).entrySet()) {
-                Object val = attrs.get(e.getKey());
+                String key = (String)e.getKey();
+
+                Object val = ctx.nodeAttribute(key);
 
                 if (val != null && !val.equals(e.getValue()))
-                    U.warn(log, "System property will override environment 
variable with the same name: "
-                        + e.getKey());
+                    U.warn(log, "System property will override environment 
variable with the same name: " + key);
 
-                attrs.put((String)e.getKey(), e.getValue());
+                ctx.addNodeAttribute(key, e.getValue());
             }
 
             if (log.isDebugEnabled())
@@ -1171,23 +1159,23 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                 "Ignite is starting on loopback address...");
 
         // Stick in network context into attributes.
-        add(attrs, ATTR_IPS, (ips.isEmpty() ? "" : ips));
-        add(attrs, ATTR_MACS, (macs.isEmpty() ? "" : macs));
+        add(ATTR_IPS, (ips.isEmpty() ? "" : ips));
+        add(ATTR_MACS, (macs.isEmpty() ? "" : macs));
 
         // Stick in some system level attributes
-        add(attrs, ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : 
U.getCompilerMx().getName());
-        add(attrs, ATTR_BUILD_VER, VER_STR);
-        add(attrs, ATTR_BUILD_DATE, build);
-        add(attrs, ATTR_COMPATIBLE_VERS, (Serializable)compatibleVersions());
-        add(attrs, ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
-        add(attrs, ATTR_USER_NAME, System.getProperty("user.name"));
-        add(attrs, ATTR_GRID_NAME, gridName);
+        add(ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : 
U.getCompilerMx().getName());
+        add(ATTR_BUILD_VER, VER_STR);
+        add(ATTR_BUILD_DATE, BUILD_TSTAMP_STR);
+        add(ATTR_COMPATIBLE_VERS, (Serializable)compatibleVersions());
+        add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
+        add(ATTR_USER_NAME, System.getProperty("user.name"));
+        add(ATTR_GRID_NAME, gridName);
 
-        add(attrs, ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
-        add(attrs, ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());
-        add(attrs, ATTR_LANG_RUNTIME, getLanguage());
+        add(ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
+        add(ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());
+        add(ATTR_LANG_RUNTIME, getLanguage());
 
-        add(attrs, ATTR_JVM_PID, U.jvmPid());
+        add(ATTR_JVM_PID, U.jvmPid());
 
         // Build a string from JVM arguments, because parameters with spaces 
are split.
         SB jvmArgs = new SB(512);
@@ -1201,11 +1189,11 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
             jvmArgs.a(arg);
         }
         // Add it to attributes.
-        add(attrs, ATTR_JVM_ARGS, jvmArgs.toString());
+        add(ATTR_JVM_ARGS, jvmArgs.toString());
 
         // Check daemon system property and override configuration if it's set.
         if (isDaemon())
-            add(attrs, ATTR_DAEMON, "true");
+            add(ATTR_DAEMON, "true");
 
         // In case of the parsing error, JMX remote disabled or port not being 
set
         // node attribute won't be set.
@@ -1214,7 +1202,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
 
             if (portStr != null)
                 try {
-                    add(attrs, ATTR_JMX_PORT, Integer.parseInt(portStr));
+                    add(ATTR_JMX_PORT, Integer.parseInt(portStr));
                 }
                 catch (NumberFormatException ignore) {
                     // No-op.
@@ -1222,49 +1210,46 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
         }
 
         // Whether restart is enabled and stick the attribute.
-        add(attrs, ATTR_RESTART_ENABLED, Boolean.toString(isRestartEnabled()));
+        add(ATTR_RESTART_ENABLED, Boolean.toString(isRestartEnabled()));
 
         // Save port range, port numbers will be stored by rest processor at 
runtime.
         if (cfg.getConnectorConfiguration() != null)
-            add(attrs, ATTR_REST_PORT_RANGE, 
cfg.getConnectorConfiguration().getPortRange());
+            add(ATTR_REST_PORT_RANGE, 
cfg.getConnectorConfiguration().getPortRange());
 
         // Stick in SPI versions and classes attributes.
-        addAttributes(attrs, cfg.getCollisionSpi());
-        addAttributes(attrs, cfg.getSwapSpaceSpi());
-        addAttributes(attrs, cfg.getDiscoverySpi());
-        addAttributes(attrs, cfg.getFailoverSpi());
-        addAttributes(attrs, cfg.getCommunicationSpi());
-        addAttributes(attrs, cfg.getEventStorageSpi());
-        addAttributes(attrs, cfg.getCheckpointSpi());
-        addAttributes(attrs, cfg.getLoadBalancingSpi());
-        addAttributes(attrs, cfg.getDeploymentSpi());
+        addSpiAttributes(cfg.getCollisionSpi());
+        addSpiAttributes(cfg.getSwapSpaceSpi());
+        addSpiAttributes(cfg.getDiscoverySpi());
+        addSpiAttributes(cfg.getFailoverSpi());
+        addSpiAttributes(cfg.getCommunicationSpi());
+        addSpiAttributes(cfg.getEventStorageSpi());
+        addSpiAttributes(cfg.getCheckpointSpi());
+        addSpiAttributes(cfg.getLoadBalancingSpi());
+        addSpiAttributes(cfg.getDeploymentSpi());
 
         // Set user attributes for this node.
         if (cfg.getUserAttributes() != null) {
             for (Map.Entry<String, ?> e : cfg.getUserAttributes().entrySet()) {
-                if (attrs.containsKey(e.getKey()))
+                if (ctx.hasNodeAttribute(e.getKey()))
                     U.warn(log, "User or internal attribute has the same name 
as environment or system " +
                         "property and will take precedence: " + e.getKey());
 
-                attrs.put(e.getKey(), e.getValue());
+                ctx.addNodeAttribute(e.getKey(), e.getValue());
             }
         }
-
-        return attrs;
     }
 
     /**
      * Add SPI version and class attributes into node attributes.
      *
-     * @param attrs Node attributes map to add SPI attributes to.
      * @param spiList Collection of SPIs to get attributes from.
      * @throws IgniteCheckedException Thrown if was unable to set up attribute.
      */
-    private void addAttributes(Map<String, Object> attrs, IgniteSpi... 
spiList) throws IgniteCheckedException {
+    private void addSpiAttributes(IgniteSpi... spiList) throws 
IgniteCheckedException {
         for (IgniteSpi spi : spiList) {
             Class<? extends IgniteSpi> spiCls = spi.getClass();
 
-            add(attrs, U.spiAttribute(spi, ATTR_SPI_CLASS), spiCls.getName());
+            add(U.spiAttribute(spi, ATTR_SPI_CLASS), spiCls.getName());
         }
     }
 
@@ -1383,17 +1368,16 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     /**
      * @param ctx Kernal context.
      * @param mgr Manager to start.
-     * @param attrs SPI attributes to set.
      * @throws IgniteCheckedException Throw in case of any errors.
      */
-    private void startManager(GridKernalContextImpl ctx, GridManager mgr, 
Map<String, Object> attrs)
+    private void startManager(GridKernalContextImpl ctx, GridManager mgr)
         throws IgniteCheckedException {
-        mgr.addSpiAttributes(attrs);
+        mgr.addSpiAttributes();
 
         // Set all node attributes into discovery manager,
         // so they can be distributed to all nodes.
         if (mgr instanceof GridDiscoveryManager)
-            ((GridDiscoveryManager)mgr).setNodeAttributes(attrs, VER);
+            ((GridDiscoveryManager)mgr).setNodeAttributes(VER);
 
         // Add manager to registry before it starts to avoid
         // cases when manager is started but registry does not
@@ -1411,17 +1395,14 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     /**
      * @param ctx Kernal context.
      * @param proc Processor to start.
-     * @param attrs Attributes.
      * @throws IgniteCheckedException Thrown in case of any error.
      */
-    private void startProcessor(GridKernalContextImpl ctx, GridProcessor proc, 
Map<String, Object> attrs)
+    private void startProcessor(GridKernalContextImpl ctx, GridProcessor proc)
         throws IgniteCheckedException {
         ctx.add(proc);
 
         try {
             proc.start();
-
-            proc.addAttributes(attrs);
         }
         catch (IgniteCheckedException e) {
             throw new IgniteCheckedException("Failed to start processor: " + 
proc, e);
@@ -1766,7 +1747,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
                     if (gw.tryWriteLock(10))
                         break;
                 }
-                catch (InterruptedException e) {
+                catch (InterruptedException ignored) {
                     // Preserve interrupt status & ignore.
                     // Note that interrupted flag is cleared.
                     interrupted = true;
@@ -2191,7 +2172,7 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean, Externalizable {
     @SuppressWarnings("unchecked")
     @Override public String executeTask(String taskName, String arg) throws 
JMException {
         try {
-            return compute().<String, String>execute(taskName, arg);
+            return compute().execute(taskName, arg);
         }
         catch (IgniteException e) {
             throw U.jmException(e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManager.java
index 15148e0..55cfc89 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManager.java
@@ -31,12 +31,11 @@ import java.util.*;
 @GridToStringExclude
 public interface GridManager extends GridComponent {
     /**
-     * Adds attributes from underlying SPI to map of all attributes.
+     * Adds attributes from underlying SPI to node attributes.
      *
-     * @param attrs Map of all attributes gotten from SPI's so far.
      * @throws IgniteCheckedException Wrapper for exception thrown by 
underlying SPI.
      */
-    public void addSpiAttributes(Map<String, Object> attrs) throws 
IgniteCheckedException;
+    public void addSpiAttributes() throws IgniteCheckedException;
 
     /**
      * @return Returns {@code true} if at least one SPI does not have a {@code 
NO-OP}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 30ea854..820041a 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
@@ -130,7 +130,7 @@ public abstract class GridManagerAdapter<T extends 
IgniteSpi> implements GridMan
     }
 
     /** {@inheritDoc} */
-    @Override public final void addSpiAttributes(Map<String, Object> attrs) 
throws IgniteCheckedException {
+    @Override public final void addSpiAttributes() throws 
IgniteCheckedException {
         for (T spi : spis) {
             // Inject all spi resources.
             ctx.resource().inject(spi);
@@ -143,7 +143,7 @@ public abstract class GridManagerAdapter<T extends 
IgniteSpi> implements GridMan
 
                 if (retval != null) {
                     for (Map.Entry<String, Object> e : retval.entrySet()) {
-                        if (attrs.containsKey(e.getKey()))
+                        if (ctx.hasNodeAttribute(e.getKey()))
                             throw new IgniteCheckedException("SPI attribute 
collision for attribute [spi=" + spi +
                                 ", attr=" + e.getKey() + ']' +
                                 ". Attribute set by one SPI implementation has 
the same name (name collision) as " +
@@ -151,7 +151,7 @@ public abstract class GridManagerAdapter<T extends 
IgniteSpi> implements GridMan
                                 "Please check your Ignite configuration and/or 
SPI implementation to avoid " +
                                 "attribute name collisions.");
 
-                        attrs.put(e.getKey(), e.getValue());
+                        ctx.addNodeAttribute(e.getKey(), e.getValue());
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 711229a..5e3d53a 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
@@ -191,10 +191,9 @@ public class GridDiscoveryManager extends 
GridManagerAdapter<DiscoverySpi> {
     /**
      * Sets local node attributes into discovery SPI.
      *
-     * @param attrs Attributes to set.
      * @param ver Version.
      */
-    public void setNodeAttributes(Map<String, Object> attrs, 
IgniteProductVersion ver) {
+    public void setNodeAttributes(IgniteProductVersion ver) {
         // TODO GG-7574 move to metrics processor?
         long totSysMemory = -1;
 
@@ -205,9 +204,9 @@ public class GridDiscoveryManager extends 
GridManagerAdapter<DiscoverySpi> {
             // No-op.
         }
 
-        attrs.put(IgniteNodeAttributes.ATTR_PHY_RAM, totSysMemory);
+        ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_PHY_RAM, totSysMemory);
 
-        getSpi().setNodeAttributes(attrs, ver);
+        getSpi().setNodeAttributes(ctx.sealNodeAttributes(), ver);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessor.java
index 5d9181e..eb9f192 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessor.java
@@ -28,11 +28,4 @@ import java.util.*;
  */
 @GridToStringExclude
 public interface GridProcessor extends GridComponent {
-    /**
-     * Adds attributes from this component to map of all node attributes.
-     *
-     * @param attrs Map of all attributes.
-     * @throws IgniteCheckedException If failed.
-     */
-    public void addAttributes(Map<String, Object> attrs) throws 
IgniteCheckedException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
index f3d0a81..cbd8991 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
@@ -113,11 +113,6 @@ public abstract class GridProcessorAdapter implements 
GridProcessor {
     }
 
     /** {@inheritDoc} */
-    @Override public void addAttributes(Map<String, Object> attrs)  throws 
IgniteCheckedException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public IgniteSpiNodeValidationResult 
validateNode(ClusterNode node) {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index e99c706..a4e8e52 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -896,6 +896,32 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
 
         transactions = new IgniteTransactionsImpl(sharedCtx);
 
+        if (!(ctx.isDaemon() || 
F.isEmpty(ctx.config().getCacheConfiguration()))) {
+            GridCacheAttributes[] attrVals = new 
GridCacheAttributes[ctx.config().getCacheConfiguration().length];
+
+            Map<String, String> interceptors = new HashMap<>();
+
+            int i = 0;
+
+            for (CacheConfiguration cfg : 
ctx.config().getCacheConfiguration()) {
+                assert caches.containsKey(cfg.getName()) : cfg.getName();
+
+                GridCacheContext ctx = caches.get(cfg.getName()).context();
+
+                attrVals[i++] = new GridCacheAttributes(cfg, 
ctx.store().configuredStore());
+
+                if (cfg.getInterceptor() != null)
+                    interceptors.put(cfg.getName(), 
cfg.getInterceptor().getClass().getName());
+            }
+
+            ctx.addNodeAttribute(ATTR_CACHE, attrVals);
+
+            ctx.addNodeAttribute(ATTR_TX_CONFIG, 
ctx.config().getTransactionConfiguration());
+
+            if (!interceptors.isEmpty())
+                ctx.addNodeAttribute(ATTR_CACHE_INTERCEPTORS, interceptors);
+        }
+
         if (log.isDebugEnabled())
             log.debug("Started cache processor.");
     }
@@ -926,36 +952,6 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
         );
     }
 
-    /** {@inheritDoc} */
-    @Override public void addAttributes(Map<String, Object> attrs) throws 
IgniteCheckedException {
-        if (ctx.isDaemon() || F.isEmpty(ctx.config().getCacheConfiguration()))
-            return;
-
-        GridCacheAttributes[] attrVals = new 
GridCacheAttributes[ctx.config().getCacheConfiguration().length];
-
-        Map<String, String> interceptors = new HashMap<>();
-
-        int i = 0;
-
-        for (CacheConfiguration cfg : ctx.config().getCacheConfiguration()) {
-            assert caches.containsKey(cfg.getName()) : cfg.getName();
-
-            GridCacheContext ctx = caches.get(cfg.getName()).context();
-
-            attrVals[i++] = new GridCacheAttributes(cfg, 
ctx.store().configuredStore());
-
-            if (cfg.getInterceptor() != null)
-                interceptors.put(cfg.getName(), 
cfg.getInterceptor().getClass().getName());
-        }
-
-        attrs.put(ATTR_CACHE, attrVals);
-
-        attrs.put(ATTR_TX_CONFIG, ctx.config().getTransactionConfiguration());
-
-        if (!interceptors.isEmpty())
-            attrs.put(ATTR_CACHE_INTERCEPTORS, interceptors);
-    }
-
     /**
      * Checks that preload-order-dependant caches has SYNC or ASYNC preloading 
mode.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
index 5beef88..19b4f5f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
@@ -109,14 +109,9 @@ public class GridClockSyncProcessor extends 
GridProcessorAdapter {
                     timeCoord0.onDiscoveryEvent(discoEvt);
             }
         }, EVT_NODE_LEFT, EVT_NODE_FAILED, EVT_NODE_JOINED);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void addAttributes(Map<String, Object> attrs) throws 
IgniteCheckedException {
-        super.addAttributes(attrs);
 
-        attrs.put(ATTR_TIME_SERVER_HOST, srv.host());
-        attrs.put(ATTR_TIME_SERVER_PORT, srv.port());
+        ctx.addNodeAttribute(ATTR_TIME_SERVER_HOST, srv.host());
+        ctx.addNodeAttribute(ATTR_TIME_SERVER_PORT, srv.port());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 847cd50..4c161ed 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -98,6 +98,54 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
 
         if (log.isDebugEnabled())
             log.debug("IGFS processor started.");
+
+        IgniteConfiguration gridCfg = ctx.config();
+
+        // Node doesn't have IGFS if it:
+        // is daemon;
+        // doesn't have configured IGFS;
+        // doesn't have configured caches.
+        if (gridCfg.isDaemon() || F.isEmpty(gridCfg.getIgfsConfiguration()) ||
+            F.isEmpty(gridCfg.getCacheConfiguration()))
+            return;
+
+        final Map<String, CacheConfiguration> cacheCfgs = new HashMap<>();
+
+        F.forEach(gridCfg.getCacheConfiguration(), new 
CI1<CacheConfiguration>() {
+            @Override public void apply(CacheConfiguration c) {
+                cacheCfgs.put(c.getName(), c);
+            }
+        });
+
+        Collection<IgfsAttributes> attrVals = new ArrayList<>();
+
+        assert gridCfg.getIgfsConfiguration() != null;
+
+        for (IgfsConfiguration igfsCfg : gridCfg.getIgfsConfiguration()) {
+            CacheConfiguration cacheCfg = 
cacheCfgs.get(igfsCfg.getDataCacheName());
+
+            if (cacheCfg == null)
+                continue; // No cache for the given IGFS configuration.
+
+            CacheAffinityKeyMapper affMapper = cacheCfg.getAffinityMapper();
+
+            if (!(affMapper instanceof IgfsGroupDataBlocksKeyMapper))
+                // Do not create IGFS attributes for such a node nor throw 
error about invalid configuration.
+                // Configuration will be validated later, while starting 
IgfsProcessor.
+                continue;
+
+            attrVals.add(new IgfsAttributes(
+                igfsCfg.getName(),
+                igfsCfg.getBlockSize(),
+                ((IgfsGroupDataBlocksKeyMapper)affMapper).groupSize(),
+                igfsCfg.getMetaCacheName(),
+                igfsCfg.getDataCacheName(),
+                igfsCfg.getDefaultMode(),
+                igfsCfg.getPathModes(),
+                igfsCfg.isFragmentizerEnabled()));
+        }
+
+        ctx.addNodeAttribute(ATTR_IGFS, attrVals.toArray(new 
IgfsAttributes[attrVals.size()]));
     }
 
     /** {@inheritDoc} */
@@ -191,60 +239,6 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
         return new IgfsJobImpl(job, igfsName, path, start, len, recRslv);
     }
 
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public void addAttributes(Map<String, Object> attrs) throws 
IgniteCheckedException {
-        super.addAttributes(attrs);
-
-        IgniteConfiguration gridCfg = ctx.config();
-
-        // Node doesn't have IGFS if it:
-        // is daemon;
-        // doesn't have configured IGFS;
-        // doesn't have configured caches.
-        if (gridCfg.isDaemon() || F.isEmpty(gridCfg.getIgfsConfiguration()) ||
-            F.isEmpty(gridCfg.getCacheConfiguration()))
-            return;
-
-        final Map<String, CacheConfiguration> cacheCfgs = new HashMap<>();
-
-        F.forEach(gridCfg.getCacheConfiguration(), new 
CI1<CacheConfiguration>() {
-            @Override public void apply(CacheConfiguration c) {
-                cacheCfgs.put(c.getName(), c);
-            }
-        });
-
-        Collection<IgfsAttributes> attrVals = new ArrayList<>();
-
-        assert gridCfg.getIgfsConfiguration() != null;
-
-        for (IgfsConfiguration igfsCfg : gridCfg.getIgfsConfiguration()) {
-            CacheConfiguration cacheCfg = 
cacheCfgs.get(igfsCfg.getDataCacheName());
-
-            if (cacheCfg == null)
-                continue; // No cache for the given IGFS configuration.
-
-            CacheAffinityKeyMapper affMapper = cacheCfg.getAffinityMapper();
-
-            if (!(affMapper instanceof IgfsGroupDataBlocksKeyMapper))
-                // Do not create IGFS attributes for such a node nor throw 
error about invalid configuration.
-                // Configuration will be validated later, while starting 
IgfsProcessor.
-                continue;
-
-            attrVals.add(new IgfsAttributes(
-                igfsCfg.getName(),
-                igfsCfg.getBlockSize(),
-                ((IgfsGroupDataBlocksKeyMapper)affMapper).groupSize(),
-                igfsCfg.getMetaCacheName(),
-                igfsCfg.getDataCacheName(),
-                igfsCfg.getDefaultMode(),
-                igfsCfg.getPathModes(),
-                igfsCfg.isFragmentizerEnabled()));
-        }
-
-        attrs.put(ATTR_IGFS, attrVals.toArray(new 
IgfsAttributes[attrVals.size()]));
-    }
-
     /**
      * @param name Cache name.
      * @return Masked name accounting for {@code nulls}.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 8c9ef1d..5e11996 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
@@ -55,6 +55,9 @@ public class GridRestProcessor extends GridProcessorAdapter {
     private static final String HTTP_PROTO_CLS =
         
"org.apache.ignite.internal.processors.rest.protocols.http.jetty.GridJettyRestProtocol";
 
+    /** */
+    public static final byte[] ZERO_BYTES = new byte[0];
+
     /** Protocols. */
     private final Collection<GridRestProtocol> protos = new ArrayList<>();
 
@@ -179,9 +182,9 @@ public class GridRestProcessor extends GridProcessorAdapter 
{
 
                 try {
                     updateSession(req, subjCtx);
-                    res.sessionTokenBytes(new byte[0]);
+                    res.sessionTokenBytes(ZERO_BYTES);
                 }
-                catch (IgniteCheckedException e1) {
+                catch (Exception e1) {
                     U.warn(log, "Cannot update response session token: " + 
e1.getMessage());
                 }
 
@@ -225,9 +228,9 @@ public class GridRestProcessor extends GridProcessorAdapter 
{
                 if (ctx.security().enabled()) {
                     try {
                         updateSession(req, subjCtx0);
-                        res.sessionTokenBytes(new byte[0]);
+                        res.sessionTokenBytes(ZERO_BYTES);
                     }
-                    catch (IgniteCheckedException e) {
+                    catch (Exception e) {
                         U.warn(log, "Cannot update response session token: " + 
e.getMessage());
                     }
                 }
@@ -260,6 +263,25 @@ public class GridRestProcessor extends 
GridProcessorAdapter {
             // Start protocols.
             startTcpProtocol();
             startHttpProtocol();
+
+            for (GridRestProtocol proto : protos) {
+                Collection<IgniteBiTuple<String, Object>> props = 
proto.getProperties();
+
+                if (props != null) {
+                    for (IgniteBiTuple<String, Object> p : props) {
+                        String key = p.getKey();
+
+                        if (key == null)
+                            continue;
+
+                        if (ctx.hasNodeAttribute(key))
+                            throw new IgniteCheckedException(
+                                "Node attribute collision for attribute 
[processor=GridRestProcessor, attr=" + key + ']');
+
+                        ctx.addNodeAttribute(key, p.getValue());
+                    }
+                }
+            }
         }
     }
 
@@ -307,28 +329,6 @@ public class GridRestProcessor extends 
GridProcessorAdapter {
         }
     }
 
-    /** {@inheritDoc} */
-    @Override public void addAttributes(Map<String, Object> attrs)  throws 
IgniteCheckedException {
-        for (GridRestProtocol proto : protos) {
-            Collection<IgniteBiTuple<String, Object>> props = 
proto.getProperties();
-
-            if (props != null) {
-                for (IgniteBiTuple<String, Object> p : props) {
-                    String key = p.getKey();
-
-                    if (key == null)
-                        continue;
-
-                    if (attrs.containsKey(key))
-                        throw new IgniteCheckedException(
-                            "Node attribute collision for attribute 
[processor=GridRestProcessor, attr=" + key + ']');
-
-                    attrs.put(key, p.getValue());
-                }
-            }
-        }
-    }
-
     /**
      * Applies {@link ConnectorMessageInterceptor}
      * from {@link ConnectorConfiguration#getMessageInterceptor()} ()}
@@ -514,7 +514,7 @@ public class GridRestProcessor extends GridProcessorAdapter 
{
      * @param req REST request.
      * @param sCtx Security context.
      */
-    private void updateSession(GridRestRequest req, SecurityContext sCtx) 
throws IgniteCheckedException {
+    private void updateSession(GridRestRequest req, SecurityContext sCtx) {
         if (sCtx != null) {
             UUID id = req.clientId();
             sesMap.put(id, sCtx);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamProcessor.java
index 030a3ea..fb6cb85 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamProcessor.java
@@ -255,6 +255,18 @@ public class GridStreamProcessor extends 
GridProcessorAdapter {
                     "assign unique name to each streamer): " + c.getName());
             }
         }
+
+        if (F.isEmpty(cfg))
+            return;
+
+        GridStreamerAttributes[] arr = new GridStreamerAttributes[cfg.length];
+
+        int i = 0;
+
+        for (StreamerConfiguration c : cfg)
+            arr[i++] = new GridStreamerAttributes(c);
+
+        ctx.addNodeAttribute(ATTR_STREAMER, arr);
     }
 
     /** {@inheritDoc} */
@@ -290,25 +302,6 @@ public class GridStreamProcessor extends 
GridProcessorAdapter {
             s.stop(cancel);
     }
 
-    /** {@inheritDoc} */
-    @Override public void addAttributes(Map<String, Object> attrs) throws 
IgniteCheckedException {
-        super.addAttributes(attrs);
-
-        StreamerConfiguration[] cfg = ctx.config().getStreamerConfiguration();
-
-        if (F.isEmpty(cfg))
-            return;
-
-        GridStreamerAttributes[] arr = new GridStreamerAttributes[cfg.length];
-
-        int i = 0;
-
-        for (StreamerConfiguration c : cfg)
-            arr[i++] = new GridStreamerAttributes(c);
-
-        attrs.put(ATTR_STREAMER, arr);
-    }
-
     /**
      * @return Default no-name streamer.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java 
b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
index 41b7216..b10048d 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
@@ -62,10 +62,9 @@ public interface PluginProvider<C extends 
PluginConfiguration> {
      * Starts grid component.
      *
      * @param ctx Plugin context.
-     * @param attrs Attributes.
      * @throws IgniteCheckedException Throws in case of any errors.
      */
-    public void start(PluginContext ctx, Map<String, Object> attrs) throws 
IgniteCheckedException;
+    public void start(PluginContext ctx) throws IgniteCheckedException;
 
     /**
      * Stops grid component.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 52156a4..c16a208 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 = attrs;
+        locNodeAttrs = new HashMap<>(attrs); // TODO: IGNITE-187 attrs is a 
sealed map, but modified in TcpDiscoverySpi.spiStart0()
         locNodeVer = ver;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 284aa0c..11b267c 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,15 +51,17 @@ 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) {
-                super.setNodeAttributes(attrs, ver);
+                // Override node attributes in discovery spi.
+                Map<String, Object> overrideAttrs = new HashMap<>(attrs);
 
                 if (idx % 2 == 0)
-                    attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, 
firstNodeVer);
+                    overrideAttrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, 
firstNodeVer);
                 else
-                    attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, 
secondNodeVer);
+                    overrideAttrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, 
secondNodeVer);
+
+                super.setNodeAttributes(overrideAttrs, ver);
             }
         };
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6cdeb575/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 7470174..8147973 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
@@ -55,14 +55,17 @@ public abstract class 
GridCacheAffinityFunctionExcludeNeighborsAbstractSelfTest
 
         TcpDiscoverySpi spi = new TcpDiscoverySpi() {
             @Override public void setNodeAttributes(Map<String, Object> attrs, 
IgniteProductVersion ver) {
-                super.setNodeAttributes(attrs, ver);
+                // Override node attributes in discovery spi.
+                Map<String, Object> overrideAttrs = new HashMap<>(attrs);
 
                 // Set unique mac addresses for every group of three nodes.
                 String macAddrs = "MOCK_MACS_" + (gridInstanceNum / 3);
 
-                attrs.put(IgniteNodeAttributes.ATTR_MACS, macAddrs);
+                overrideAttrs.put(IgniteNodeAttributes.ATTR_MACS, macAddrs);
 
                 gridInstanceNum++;
+
+                super.setNodeAttributes(overrideAttrs, ver);
             }
         };
 

Reply via email to