ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/9] incubator-ignite git commit: IGNITE-35 Removed unnecessary injected resources.
Date Fri, 19 Dec 2014 13:32:55 GMT
IGNITE-35 Removed unnecessary injected resources.


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

Branch: refs/heads/ignite-35
Commit: 55936e4624cbff9e3b1e92febf281b64982afde2
Parents: 1812040
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Wed Dec 17 13:20:46 2014 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Fri Dec 19 16:28:15 2014 +0300

----------------------------------------------------------------------
 .../spi/checkpoint/s3/GridS3CheckpointSpi.java  |  13 ++-
 .../GridClientAbstractMultiNodeSelfTest.java    |   6 +-
 .../java/org/apache/ignite/IgniteCompute.java   |   5 -
 .../java/org/apache/ignite/IgniteManaged.java   |   5 -
 .../org/apache/ignite/compute/ComputeJob.java   |   5 -
 .../org/apache/ignite/compute/ComputeTask.java  |   5 -
 .../apache/ignite/lifecycle/LifecycleBean.java  |   5 -
 .../IgniteAddressResolverResource.java          |  50 ---------
 .../IgniteExecutorServiceResource.java          |  58 ----------
 .../ignite/resources/IgniteHomeResource.java    |  57 ----------
 .../resources/IgniteInstanceResource.java       |  18 +--
 .../resources/IgniteLocalHostResource.java      |  58 ----------
 .../resources/IgniteLocalNodeIdResource.java    |  58 ----------
 .../resources/IgniteMarshallerResource.java     |  57 ----------
 .../ignite/resources/IgniteNameResource.java    |  57 ----------
 .../ignite/resources/IgniteUserResource.java    |   6 -
 .../java/org/apache/ignite/spi/IgniteSpi.java   |   6 -
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  22 ++--
 .../sharedfs/SharedFsCheckpointSpi.java         |   7 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  55 +++++-----
 .../discovery/tcp/TcpClientDiscoverySpi.java    |  46 ++++----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 106 ++++++++++++------
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   |  30 +++--
 .../TcpDiscoveryMulticastIpFinder.java          |  10 +-
 .../spi/swapspace/file/FileSwapSpaceSpi.java    |  20 +---
 .../store/jdbc/GridCacheJdbcBlobStore.java      |   8 +-
 .../resource/GridResourceCustomInjector.java    |  11 --
 .../resource/GridResourceProcessor.java         | 110 +------------------
 .../GridIpcSharedMemoryServerEndpoint.java      |  21 +++-
 .../tcp/GridCacheDhtLockBackupSelfTest.java     |   4 -
 .../tcp/GridOrderedMessageCancelSelfTest.java   |   4 -
 .../tcp/GridTcpClientDiscoverySelfTest.java     |   6 +-
 .../kernal/GridCancelOnGridStopSelfTest.java    |   6 +-
 .../GridExplicitImplicitDeploymentSelfTest.java |   6 +-
 .../GridFailoverCustomTopologySelfTest.java     |  16 ++-
 .../grid/kernal/GridFailoverSelfTest.java       |   8 +-
 .../GridFailoverTaskWithPredicateSelfTest.java  |   4 -
 .../kernal/GridFailoverTopologySelfTest.java    |  18 ++-
 .../grid/kernal/GridJobContextSelfTest.java     |   8 +-
 .../kernal/GridJobMasterLeaveAwareSelfTest.java |   4 -
 .../grid/kernal/GridMultipleSpisSelfTest.java   |  10 +-
 .../GridMultipleVersionsDeploymentSelfTest.java |  12 +-
 .../kernal/GridRuntimeExceptionSelfTest.java    |   8 +-
 .../grid/kernal/GridStopWithCancelSelfTest.java |   8 +-
 .../grid/kernal/GridStopWithWaitSelfTest.java   |  20 ++--
 .../kernal/GridTaskInstantiationSelfTest.java   |   8 +-
 .../checkpoint/GridCheckpointTaskSelfTest.java  |  14 ++-
 .../continuous/GridMessageListenSelfTest.java   |  13 +--
 .../grid/p2p/GridP2PJobClassLoaderSelfTest.java |  15 +--
 .../p2p/GridP2PLocalDeploymentSelfTest.java     |   8 +-
 .../p2p/GridP2PRemoteClassLoadersSelfTest.java  |   8 +-
 .../org/gridgain/grid/p2p/GridP2PTestJob.java   |   9 +-
 .../org/gridgain/grid/p2p/GridP2PTestTask.java  |   8 +-
 .../GridSessionCheckpointAbstractSelfTest.java  |  15 +--
 .../session/GridSessionJobFailoverSelfTest.java |   5 +-
 .../stealing/GridStealingLoadTestJob.java       |   8 +-
 .../loadtests/job/GridJobLoadTestJob.java       |  12 +-
 .../testframework/junits/GridTestResources.java |  14 ---
 .../tests/p2p/GridP2PTestTaskExternalPath1.java |   6 +-
 .../tests/p2p/GridP2PTestTaskExternalPath2.java |   8 +-
 .../hibernate/GridCacheHibernateBlobStore.java  |  10 +-
 .../processors/query/h2/GridH2Indexing.java     |  23 ++--
 .../GridAbstractUserExternalResource.java       |  30 -----
 .../resource/GridUserExternalResourceTask2.java |   5 -
 .../grid/kernal/GridFactorySelfTest.java        |  31 +-----
 .../resource/GridAbstractUserResource.java      |  30 -----
 .../GridResourceEventFilterSelfTest.java        |   5 -
 .../GridResourceFieldInjectionSelfTest.java     |  63 -----------
 .../GridResourceMethodInjectionSelfTest.java    |  94 ----------------
 ...ResourceMethodOverrideInjectionSelfTest.java |  62 -----------
 .../resource/GridResourceProcessorSelfTest.java |   8 +-
 .../grid/p2p/GridP2PAbstractUserResource.java   |  24 ----
 .../deployment/uri/GridUriDeploymentSpi.java    |   7 +-
 73 files changed, 371 insertions(+), 1229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/GridS3CheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/GridS3CheckpointSpi.java b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/GridS3CheckpointSpi.java
index 316e014..55b4ba0 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/GridS3CheckpointSpi.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/GridS3CheckpointSpi.java
@@ -100,7 +100,6 @@ public class GridS3CheckpointSpi extends IgniteSpiAdapter implements CheckpointS
     private IgniteLogger log;
 
     /** Marshaller. */
-    @IgniteMarshallerResource
     private IgniteMarshaller marsh;
 
     /** Task that takes care about outdated files. */
@@ -132,10 +131,6 @@ public class GridS3CheckpointSpi extends IgniteSpiAdapter implements CheckpointS
     @GridToStringExclude
     private AWSCredentials cred;
 
-    @IgniteNameResource
-    /** Grid name. */
-    private String gridName;
-
     /** Mutex. */
     private final Object mux = new Object();
 
@@ -236,6 +231,12 @@ public class GridS3CheckpointSpi extends IgniteSpiAdapter implements CheckpointS
         this.cred = cred;
     }
 
+    @IgniteInstanceResource
+    public void setIgnite(Ignite ignite) {
+        if (ignite != null)
+            marsh = ignite.configuration().getMarshaller();
+    }
+
     /** {@inheritDoc} */
     @SuppressWarnings({"BusyWait"})
     @Override public void spiStart(String gridName) throws IgniteSpiException {
@@ -559,7 +560,7 @@ public class GridS3CheckpointSpi extends IgniteSpiAdapter implements CheckpointS
          * Constructor.
          */
         GridS3TimeoutWorker() {
-            super(gridName, "grid-s3-checkpoint-worker", log);
+            super(ignite.name(), "grid-s3-checkpoint-worker", log);
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractMultiNodeSelfTest.java
index 96fb9d6..84109fd 100644
--- a/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractMultiNodeSelfTest.java
@@ -752,10 +752,6 @@ public abstract class GridClientAbstractMultiNodeSelfTest extends GridCommonAbst
      */
     @SuppressWarnings("unchecked")
     private static class TestCommunicationSpi extends TcpCommunicationSpi {
-        /** Node ID. */
-        @IgniteLocalNodeIdResource
-        private UUID nodeId;
-
         /** {@inheritDoc} */
         @Override public void sendMessage(ClusterNode node, GridTcpCommunicationMessageAdapter msg)
             throws IgniteSpiException {
@@ -778,7 +774,7 @@ public abstract class GridClientAbstractMultiNodeSelfTest extends GridCommonAbst
             if (!(o instanceof GridDistributedLockRequest))
                 return;
 
-            GridKernal g = (GridKernal)G.ignite(nodeId);
+            GridKernal g = (GridKernal)G.ignite(ignite.configuration().getNodeId());
 
             GridCacheContext<Object, Object> cacheCtx = g.internalCache(REPLICATED_ASYNC_CACHE_NAME).context();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
index 613a521..ada2e0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
@@ -71,11 +71,6 @@ import java.util.concurrent.*;
  * <li>{@link org.apache.ignite.resources.IgniteTaskSessionResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteInstanceResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteLoggerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteHomeResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteExecutorServiceResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteLocalNodeIdResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMBeanServerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMarshallerResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringApplicationContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringResource}</li>
  * </ul>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/IgniteManaged.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteManaged.java b/modules/core/src/main/java/org/apache/ignite/IgniteManaged.java
index 9aaa644..c8fdd65 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteManaged.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteManaged.java
@@ -75,11 +75,6 @@ import java.util.*;
  * <ul>
  * <li>{@link org.apache.ignite.resources.IgniteInstanceResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteLoggerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteHomeResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteExecutorServiceResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteLocalNodeIdResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMBeanServerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMarshallerResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringApplicationContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringResource}</li>
  * </ul>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/compute/ComputeJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/compute/ComputeJob.java b/modules/core/src/main/java/org/apache/ignite/compute/ComputeJob.java
index 48926c6..29fd6b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeJob.java
@@ -90,11 +90,6 @@ import java.util.*;
  * <li>{@link org.apache.ignite.resources.IgniteJobContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteInstanceResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteLoggerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteHomeResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteExecutorServiceResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteLocalNodeIdResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMBeanServerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMarshallerResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringApplicationContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringResource}</li>
  * </ul>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java
index b3d90f3..0385c57 100644
--- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java
@@ -127,11 +127,6 @@ import java.util.*;
  * <li>{@link org.apache.ignite.resources.IgniteTaskSessionResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteInstanceResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteLoggerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteHomeResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteExecutorServiceResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteLocalNodeIdResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMBeanServerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMarshallerResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringApplicationContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringResource}</li>
  * </ul>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java b/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java
index ccca6ba..f521274 100644
--- a/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java
@@ -48,11 +48,6 @@ import org.apache.ignite.*;
  * The following grid resources can be injected:
  * <ul>
  * <li>{@link org.apache.ignite.resources.IgniteLoggerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteLocalNodeIdResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteHomeResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMBeanServerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteExecutorServiceResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMarshallerResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringApplicationContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteInstanceResource}</li>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteAddressResolverResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteAddressResolverResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteAddressResolverResource.java
deleted file mode 100644
index c08e43d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteAddressResolverResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Annotates a field or a setter method for injection of address resolver.
- * Address resolver is provided via {@link org.apache.ignite.configuration.IgniteConfiguration#getAddressResolver()}.
- * <p>
- * Address resolver can be injected into instances of {@link org.apache.ignite.spi.IgniteSpi}.
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class SomeGridSpi implements GridSpi {
- *      ...
- *      &#64;GridAddressResolverResource
- *      private GridAddressResolver addrsRslvr;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class SomeGridSpi implements GridSpi {
- *     ...
- *     private GridAddressResolver addrsRslvr;
- *     ...
- *     &#64;GridAddressResolverResource
- *     public void setAddressResolver(GridAddressResolver addrsRslvr) {
- *          this.addrsRslvr = addrsRslvr;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getAddressResolver()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteAddressResolverResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteExecutorServiceResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteExecutorServiceResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteExecutorServiceResource.java
deleted file mode 100644
index 8d6ba25..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteExecutorServiceResource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-import java.util.concurrent.*;
-
-/**
- * Annotates a field or a setter method for injection of {@link ExecutorService} resource.
- * {@code ExecutorService} is provided to grid via {@link org.apache.ignite.configuration.IgniteConfiguration}.
- * <p>
- * Executor service can be injected into instances of following classes:
- * <ul>
- * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
- * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
- * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
- * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
- * </ul>
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *      ...
- *      &#64;GridExecutorServiceResource
- *      private ExecutorService execSvc;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *     ...
- *     private ExecutorService execSvc;
- *     ...
- *     &#64;GridExecutorServiceResource
- *     public void setExecutor(GridExecutorService execSvc) {
- *          this.execSvc = execSvc;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getExecutorService()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteExecutorServiceResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteHomeResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteHomeResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteHomeResource.java
deleted file mode 100644
index d5e55cb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteHomeResource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Annotates a field or a setter method for injection of GridGain installation home path.
- * GridGain installation home is provided to grid via {@link org.apache.ignite.configuration.IgniteConfiguration}.
- * <p>
- * Home path can be injected into instances of following classes:
- * <ul>
- * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
- * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
- * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
- * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
- * </ul>
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *      ...
- *      &#64;GridHomeResource
- *      private String home;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *     ...
- *     private String home;
- *     ...
- *     &#64;GridHomeResource
- *     public void setGridGainHome(String home) {
- *          this.home = home;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getGridGainHome()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteHomeResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteInstanceResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteInstanceResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteInstanceResource.java
index d75026d..ec10b36 100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteInstanceResource.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/IgniteInstanceResource.java
@@ -22,27 +22,27 @@ import java.lang.annotation.*;
  * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
  * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
  * <li>All closures and predicates that can run on grid.</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
+ * <li>{@link IgniteUserResource @IgniteUserResource}</li>
  * </ul>
  * <p>
  * Here is how injection would typically happen:
  * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
+ * public class MyIgniteJob implements ComputeJob {
  *      ...
- *      &#64;GridInstanceResource
- *      private Grid grid;
+ *      &#64;IgniteInstanceResource
+ *      private Ignite ignite;
  *      ...
  *  }
  * </pre>
  * or
  * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
+ * public class MyIgniteJob implements ComputeJob {
  *     ...
- *     private Grid grid;
+ *     private Ignite ignite;
  *     ...
- *     &#64;GridInstanceResource
- *     public void setGrid(Grid grid) {
- *          this.grid = grid;
+ *     &#64;IgniteInstanceResource
+ *     public void setIgnite(Ignite ignite) {
+ *          this.ignite = ignite;
  *     }
  *     ...
  * }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalHostResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalHostResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalHostResource.java
deleted file mode 100644
index c67e58d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalHostResource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Annotates a field or a setter method for injection of local host address or host name for
- * connection binding. Local host is provided via {@link org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} or
- * via {@link org.apache.ignite.IgniteSystemProperties#GG_LOCAL_HOST} system or environment property.
- * <p>
- * Local node ID can be injected into instances of following classes:
- * <ul>
- * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
- * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
- * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
- * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
- * </ul>
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *      ...
- *      &#64;GridLocalHostResource
- *      private String locHost;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *     ...
- *     private String locHost;
- *     ...
- *     &#64;GridLocalHostResource
- *     public void setLocalHost(String locHost) {
- *          this.locHost = locHost;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteLocalHostResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalNodeIdResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalNodeIdResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalNodeIdResource.java
deleted file mode 100644
index e5525e3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteLocalNodeIdResource.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-import java.util.*;
-
-/**
- * Annotates a field or a setter method for injection of local node {@link UUID} resource. {@code Node UUID}
- * is a globally unique node identifier and is provided to grid via {@link org.apache.ignite.configuration.IgniteConfiguration}.
- * <p>
- * Local node ID can be injected into instances of following classes:
- * <ul>
- * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
- * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
- * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
- * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
- * </ul>
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *      ...
- *      &#64;GridLocalNodeIdResource
- *      private UUID nodeId;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *     ...
- *     private UUID nodeId;
- *     ...
- *     &#64;GridLocalNodeIdResource
- *     public void setLocalNodeId(UUID nodeId) {
- *          this.nodeId = nodeId;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getNodeId()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteLocalNodeIdResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteMarshallerResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteMarshallerResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteMarshallerResource.java
deleted file mode 100644
index eac1c48..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteMarshallerResource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Annotates a field or a setter method for injection of {@link org.apache.ignite.marshaller.IgniteMarshaller} resource. Grid marshaller
- * is provided to grid via {@link org.apache.ignite.configuration.IgniteConfiguration}.
- * <p>
- * Marshaller can be injected into instances of following classes:
- * <ul>
- * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
- * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
- * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
- * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
- * </ul>
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *      ...
- *      &#64;GridMarshallerResource
- *      private GridMarshaller marshaller;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *     ...
- *     private GridMarshaller marshaller;
- *     ...
- *     &#64;GridMarshallerResource
- *     public void setMarshaller(GridMarshaller marshaller) {
- *          this.marshaller = marshaller;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getMarshaller()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteMarshallerResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteNameResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteNameResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteNameResource.java
deleted file mode 100644
index 7c8e210..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteNameResource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Annotates a field or a setter method for injection of GridGain grid name.
- * GridGain name is provided to grid via {@link org.apache.ignite.configuration.IgniteConfiguration#getGridName()} method.
- * <p>
- * Grid name can be injected into instances of following classes:
- * <ul>
- * <li>{@link org.apache.ignite.compute.ComputeTask}</li>
- * <li>{@link org.apache.ignite.compute.ComputeJob}</li>
- * <li>{@link org.apache.ignite.spi.IgniteSpi}</li>
- * <li>{@link org.apache.ignite.lifecycle.LifecycleBean}</li>
- * <li>{@link IgniteUserResource @GridUserResource}</li>
- * </ul>
- * <p>
- * Here is how injection would typically happen:
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *      ...
- *      &#64;GridNameResource
- *      private String name;
- *      ...
- *  }
- * </pre>
- * or
- * <pre name="code" class="java">
- * public class MyGridJob implements ComputeJob {
- *     ...
- *     private String gridName;
- *     ...
- *     &#64;GridNameResource
- *     public void setGridName(String gridName) {
- *          this.gridName = gridName;
- *     }
- *     ...
- * }
- * </pre>
- * <p>
- * See {@link org.apache.ignite.configuration.IgniteConfiguration#getGridName()} for Grid configuration details.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.FIELD})
-public @interface IgniteNameResource {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/resources/IgniteUserResource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/IgniteUserResource.java b/modules/core/src/main/java/org/apache/ignite/resources/IgniteUserResource.java
index 7824ef2..3b8eb16 100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/IgniteUserResource.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/IgniteUserResource.java
@@ -22,12 +22,6 @@ import java.lang.annotation.*;
  * The following grid resources can be injected:
  * <ul>
  * <li>{@link IgniteLoggerResource}</li>
- * <li>{@link IgniteLocalNodeIdResource}</li>
- * <li>{@link IgniteHomeResource}</li>
- * <li>{@link IgniteNameResource}</li>
- * <li>{@link IgniteMBeanServerResource}</li>
- * <li>{@link IgniteExecutorServiceResource}</li>
- * <li>{@link IgniteMarshallerResource}</li>
  * <li>{@link IgniteSpringApplicationContextResource}</li>
  * <li>{@link IgniteSpringResource}</li>
  * <li>{@link IgniteInstanceResource}</li>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpi.java
index cd76d4b..5b923f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpi.java
@@ -21,14 +21,8 @@ import java.util.*;
  * The following grid resources can be injected:
  * <ul>
  * <li>{@link org.apache.ignite.resources.IgniteLoggerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteLocalNodeIdResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteHomeResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMBeanServerResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteExecutorServiceResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteMarshallerResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringApplicationContextResource}</li>
  * <li>{@link org.apache.ignite.resources.IgniteSpringResource}</li>
- * <li>{@link org.apache.ignite.resources.IgniteAddressResolverResource}</li>
  * </ul>
  * Refer to corresponding resource documentation for more information.
  */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/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 508e81e..2905182 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
@@ -49,17 +49,9 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
     @IgniteLoggerResource
     private IgniteLogger log;
 
-    /** */
-    @IgniteMBeanServerResource
-    private MBeanServer jmx;
-
-    /** */
-    @IgniteHomeResource
-    private String ggHome;
-
-    /** */
-    @IgniteLocalNodeIdResource
-    private UUID nodeId;
+    /** Ignite instance */
+    @IgniteInstanceResource
+    protected Ignite ignite;
 
     /** SPI name. */
     private String name;
@@ -108,12 +100,12 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
 
     /** {@inheritDoc} */
     @Override public UUID getLocalNodeId() {
-        return nodeId;
+        return ignite.configuration().getNodeId();
     }
 
     /** {@inheritDoc} */
     @Override public final String getGridGainHome() {
-        return ggHome;
+        return ignite.configuration().getGridGainHome();
     }
 
     /** {@inheritDoc} */
@@ -316,6 +308,8 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
      */
     protected final <T extends IgniteSpiManagementMBean> void registerMBean(String gridName, T impl, Class<T> mbeanItf)
         throws IgniteSpiException {
+        MBeanServer jmx = ignite.configuration().getMBeanServer();
+
         assert mbeanItf == null || mbeanItf.isInterface();
         assert jmx != null;
 
@@ -338,6 +332,8 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
     protected final void unregisterMBean() throws IgniteSpiException {
         // Unregister SPI MBean.
         if (spiMBean != null) {
+            MBeanServer jmx = ignite.configuration().getMBeanServer();
+
             assert jmx != null;
 
             try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
index 3c93370..1eab95a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
@@ -115,7 +115,6 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
     private IgniteLogger log;
 
     /** Grid marshaller. */
-    @IgniteMarshallerResource
     private IgniteMarshaller marsh;
 
     /** List of checkpoint directories where all files are stored. */
@@ -177,6 +176,12 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
         this.dirPaths.addAll(dirPaths);
     }
 
+    @IgniteInstanceResource
+    public void setIgnite(Ignite ignite) {
+        if (ignite != null)
+            marsh = ignite.configuration().getMarshaller();
+    }
+
     /** {@inheritDoc} */
     @Override public void spiStart(String gridName) throws IgniteSpiException {
         // Start SPI start stopwatch.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/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 9ba7c45..e8a16bd 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
@@ -619,14 +619,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     @IgniteLoggerResource
     private IgniteLogger log;
 
-    /** Node ID. */
-    @IgniteLocalNodeIdResource
-    private UUID locNodeId;
-
-    /** Marshaller. */
-    @IgniteMarshallerResource
-    private IgniteMarshaller marsh;
-
     /** Local IP address. */
     private String locAddr;
 
@@ -642,10 +634,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     /** Local port which node uses to accept shared memory connections. */
     private int shmemPort = DFLT_SHMEM_PORT;
 
-    /** Grid name. */
-    @IgniteNameResource
-    private String gridName;
-
     /** Allocate direct buffer or heap buffer. */
     private boolean directBuf = true;
 
@@ -877,7 +865,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * @param addrRslvr Address resolver.
      */
     @IgniteSpiConfiguration(optional = true)
-    @IgniteAddressResolverResource
     public void setAddressResolver(IgniteAddressResolver addrRslvr) {
         // Injection should not override value already set by Spring or user.
         if (this.addrRslvr == null)
@@ -885,6 +872,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     }
 
     /**
+     * Sets {@link Ignite ignite}.
+     *
+     * @param ignite Ignite.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    @IgniteInstanceResource
+    public void setIgnite(Ignite ignite) {
+        // Inject resources.
+        if (ignite != null && ignite.configuration() != null) {
+            setAddressResolver(ignite.configuration().getAddressResolver());
+            setLocalAddress(ignite.configuration().getLocalHost());
+        }
+    }
+
+    /**
      * Gets address resolver.
      *
      * @return Address resolver.
@@ -902,7 +904,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      *      IP address.
      */
     @IgniteSpiConfiguration(optional = true)
-    @IgniteLocalHostResource
     public void setLocalAddress(String locAddr) {
         // Injection should not override value already set by Spring or user.
         if (this.locAddr == null)
@@ -1353,7 +1354,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
     /** {@inheritDoc} */
     @Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
-        nodeIdMsg = new NodeIdMessage(locNodeId);
+        nodeIdMsg = new NodeIdMessage(ignite.configuration().getNodeId());
 
         assertParameter(locPort > 1023, "locPort > 1023");
         assertParameter(locPort <= 0xffff, "locPort < 0xffff");
@@ -1555,7 +1556,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         .listener(srvLsnr)
                         .logger(log)
                         .selectorCount(selectorsCnt)
-                        .gridName(gridName)
+                        .gridName(ignite.name())
                         .tcpNoDelay(tcpNoDelay)
                         .directBuffer(directBuf)
                         .byteOrder(ByteOrder.nativeOrder())
@@ -1612,7 +1613,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         // If configured TCP port is busy, find first available in range.
         for (int port = shmemPort; port < shmemPort + locPortRange; port++) {
             try {
-                GridIpcSharedMemoryServerEndpoint srv = new GridIpcSharedMemoryServerEndpoint(log, locNodeId, gridName);
+                GridIpcSharedMemoryServerEndpoint srv =
+                    new GridIpcSharedMemoryServerEndpoint(log, ignite.configuration().getNodeId(), ignite.name());
 
                 srv.setPort(port);
 
@@ -1752,6 +1754,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         if (log.isTraceEnabled())
             log.trace("Sending message to node [node=" + node + ", msg=" + msg + ']');
 
+        UUID locNodeId = ignite.configuration().getNodeId();
+
         if (node.id().equals(locNodeId))
             notifyListener(locNodeId, msg, NOOP);
         else {
@@ -2246,7 +2250,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     ch.write(ByteBuffer.wrap(U.GG_HEADER));
 
                     if (recovery != null) {
-                        HandshakeMessage msg = new HandshakeMessage(locNodeId,
+                        HandshakeMessage msg = new HandshakeMessage(ignite.configuration().getNodeId(),
                             recovery.incrementConnectCount(),
                             recovery.receivedCount());
 
@@ -2446,7 +2450,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          * @param srv Server.
          */
         ShmemAcceptWorker(GridIpcSharedMemoryServerEndpoint srv) {
-            super(gridName, "shmem-communication-acceptor", log);
+            super(ignite.name(), "shmem-communication-acceptor", log);
 
             this.srv = srv;
         }
@@ -2490,7 +2494,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          * @param endpoint Endpoint.
          */
         private ShmemWorker(GridIpcEndpoint endpoint) {
-            super(gridName, "shmem-worker", log);
+            super(ignite.name(), "shmem-worker", log);
 
             this.endpoint = endpoint;
         }
@@ -2545,7 +2549,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          *
          */
         IdleClientWorker() {
-            super(gridName, "nio-idle-client-collector", log);
+            super(ignite.name(), "nio-idle-client-collector", log);
         }
 
         /** {@inheritDoc} */
@@ -2658,7 +2662,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          *
          */
         ClientFlushWorker() {
-            super(gridName, "nio-client-flusher", log);
+            super(ignite.name(), "nio-client-flusher", log);
         }
 
         /** {@inheritDoc} */
@@ -2724,7 +2728,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          *
          */
         SocketTimeoutWorker() {
-            super(gridName, "tcp-comm-sock-timeout-worker", log);
+            super(ignite.name(), "tcp-comm-sock-timeout-worker", log);
         }
 
         /**
@@ -2807,7 +2811,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          *
          */
         private RecoveryWorker() {
-            super(gridName, "tcp-comm-recovery-worker", log);
+            super(ignite.name(), "tcp-comm-recovery-worker", log);
         }
 
         /** {@inheritDoc} */
@@ -3010,7 +3014,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 out.flush();
 
                 if (log.isDebugEnabled())
-                    log.debug("Sent local node ID [locNodeId=" + locNodeId + ", rmtNodeId=" + rmtNodeId + ']');
+                    log.debug("Sent local node ID [locNodeId=" + ignite.configuration().getNodeId() + ", rmtNodeId="
+                        + rmtNodeId + ']');
             }
             catch (IOException e) {
                 throw new IgniteCheckedException("Failed to perform handshake.", e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
index bf1b783..bb97ea6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
@@ -246,7 +246,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
         }
 
         locNode = new TcpDiscoveryNode(
-            locNodeId,
+            ignite.configuration().getNodeId(),
             addrs.get1(),
             addrs.get2(),
             0,
@@ -286,7 +286,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
             leaveLatch = new CountDownLatch(1);
 
             try {
-                TcpDiscoveryNodeLeftMessage msg = new TcpDiscoveryNodeLeftMessage(locNodeId);
+                TcpDiscoveryNodeLeftMessage msg = new TcpDiscoveryNodeLeftMessage(ignite.configuration().getNodeId());
 
                 msg.client(true);
 
@@ -335,7 +335,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
 
     /** {@inheritDoc} */
     @Nullable @Override public ClusterNode getNode(UUID nodeId) {
-        if (locNodeId.equals(nodeId))
+        if (ignite.configuration().getNodeId().equals(nodeId))
             return locNode;
 
         TcpDiscoveryNode node = rmtNodes.get(nodeId);
@@ -347,7 +347,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
     @Override public boolean pingNode(UUID nodeId) {
         assert nodeId != null;
 
-        if (nodeId.equals(locNodeId))
+        if (nodeId.equals(ignite.configuration().getNodeId()))
             return true;
 
         TcpDiscoveryNode node = rmtNodes.get(nodeId);
@@ -413,7 +413,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
                         locNode.clientRouterNodeId(rmtNodeId);
 
                         TcpDiscoveryAbstractMessage msg = recon ?
-                            new TcpDiscoveryClientReconnectMessage(locNodeId, rmtNodeId, lastMsgId) :
+                            new TcpDiscoveryClientReconnectMessage(ignite.configuration().getNodeId(), rmtNodeId, lastMsgId) :
                             new TcpDiscoveryJoinRequestMessage(locNode, null);
 
                         msg.client(true);
@@ -532,7 +532,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
 
         Socket sock = openSocket(addr);
 
-        TcpDiscoveryHandshakeRequest req = new TcpDiscoveryHandshakeRequest(locNodeId);
+        TcpDiscoveryHandshakeRequest req = new TcpDiscoveryHandshakeRequest(ignite.configuration().getNodeId());
 
         req.client(true);
 
@@ -543,7 +543,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
         UUID nodeId = res.creatorNodeId();
 
         assert nodeId != null;
-        assert !locNodeId.equals(nodeId);
+        assert !ignite.configuration().getNodeId().equals(nodeId);
 
         return F.t(sock, nodeId);
     }
@@ -552,7 +552,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
      * FOR TEST PURPOSE ONLY!
      */
     void simulateNodeFailure() {
-        U.warn(log, "Simulating client node failure: " + locNodeId);
+        U.warn(log, "Simulating client node failure: " + ignite.configuration().getNodeId());
 
         U.closeQuiet(sock);
 
@@ -576,7 +576,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
         /**
          */
         protected DisconnectHandler() {
-            super(gridName, "tcp-client-disco-disconnect-hnd", log);
+            super(ignite.name(), "tcp-client-disco-disconnect-hnd", log);
         }
 
         /** {@inheritDoc} */
@@ -629,7 +629,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
         /**
          */
         protected HeartbeatSender() {
-            super(gridName, "tcp-client-disco-heartbeat-sender", log);
+            super(ignite.name(), "tcp-client-disco-heartbeat-sender", log);
         }
 
         /** {@inheritDoc} */
@@ -647,7 +647,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
                 while (!isInterrupted()) {
                     U.sleep(hbFreq);
 
-                    TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(locNodeId);
+                    TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(ignite.configuration().getNodeId());
 
                     msg.client(true);
 
@@ -676,7 +676,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
          * @param msgWrk Message worker.
          */
         protected SocketReader(UUID nodeId, MessageWorker msgWrk) {
-            super(gridName, "tcp-client-disco-sock-reader", log);
+            super(ignite.name(), "tcp-client-disco-sock-reader", log);
 
             assert nodeId != null;
             assert msgWrk != null;
@@ -743,7 +743,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
                     }
                     catch (IgniteCheckedException e) {
                         if (log.isDebugEnabled())
-                            U.error(log, "Failed to read message [sock=" + sock0 + ", locNodeId=" + locNodeId +
+                            U.error(log, "Failed to read message [sock=" + sock0 + ", locNodeId=" + ignite.configuration().getNodeId() +
                                 ", rmtNodeId=" + nodeId + ']', e);
 
                         IOException ioEx = X.cause(e, IOException.class);
@@ -758,14 +758,14 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
                                 "(make sure same versions of all classes are available on all nodes) " +
                                 "[rmtNodeId=" + nodeId + ", err=" + clsNotFoundEx.getMessage() + ']');
                         else
-                            LT.error(log, e, "Failed to read message [sock=" + sock0 + ", locNodeId=" + locNodeId +
+                            LT.error(log, e, "Failed to read message [sock=" + sock0 + ", locNodeId=" + ignite.configuration().getNodeId() +
                                 ", rmtNodeId=" + nodeId + ']');
                     }
                 }
             }
             catch (IOException e) {
                 if (log.isDebugEnabled())
-                    U.error(log, "Connection failed [sock=" + sock0 + ", locNodeId=" + locNodeId +
+                    U.error(log, "Connection failed [sock=" + sock0 + ", locNodeId=" + ignite.configuration().getNodeId() +
                         ", rmtNodeId=" + nodeId + ']', e);
             }
             finally {
@@ -861,7 +861,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
 
             UUID newNodeId = node.id();
 
-            if (locNodeId.equals(newNodeId)) {
+            if (ignite.configuration().getNodeId().equals(newNodeId)) {
                 if (joinLatch.getCount() > 0) {
                     Collection<TcpDiscoveryNode> top = msg.topology();
 
@@ -917,7 +917,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
             if (leaveLatch != null)
                 return;
 
-            if (locNodeId.equals(msg.nodeId())) {
+            if (ignite.configuration().getNodeId().equals(msg.nodeId())) {
                 if (joinLatch.getCount() > 0) {
                     long topVer = msg.topologyVersion();
 
@@ -970,7 +970,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
          * @param msg Message.
          */
         private void processNodeLeftMessage(TcpDiscoveryNodeLeftMessage msg) {
-            if (locNodeId.equals(msg.creatorNodeId())) {
+            if (ignite.configuration().getNodeId().equals(msg.creatorNodeId())) {
                 if (log.isDebugEnabled())
                     log.debug("Received node left message for local node: " + msg);
 
@@ -1015,7 +1015,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
             if (leaveLatch != null)
                 return;
 
-            if (!locNodeId.equals(msg.creatorNodeId())) {
+            if (!ignite.configuration().getNodeId().equals(msg.creatorNodeId())) {
                 TcpDiscoveryNode node = rmtNodes.remove(msg.failedNodeId());
 
                 if (node == null) {
@@ -1047,12 +1047,12 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
             if (leaveLatch != null)
                 return;
 
-            if (locNodeId.equals(msg.creatorNodeId())) {
+            if (ignite.configuration().getNodeId().equals(msg.creatorNodeId())) {
                 if (msg.senderNodeId() == null) {
                     Socket sock0 = sock;
 
                     if (sock0 != null) {
-                        msg.setMetrics(locNodeId, metricsProvider.getMetrics());
+                        msg.setMetrics(ignite.configuration().getNodeId(), metricsProvider.getMetrics());
 
                         try {
                             writeToSocket(sock0, msg);
@@ -1101,7 +1101,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
             if (leaveLatch != null)
                 return;
 
-            if (locNodeId.equals(msg.creatorNodeId())) {
+            if (ignite.configuration().getNodeId().equals(msg.creatorNodeId())) {
                 if (msg.success()) {
                     pending = true;
 
@@ -1142,7 +1142,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp
             assert nodeId != null;
             assert metrics != null;
 
-            TcpDiscoveryNode node = nodeId.equals(locNodeId) ? locNode : rmtNodes.get(nodeId);
+            TcpDiscoveryNode node = nodeId.equals(ignite.configuration().getNodeId()) ? locNode : rmtNodes.get(nodeId);
 
             if (node != null && node.visible()) {
                 node.setMetrics(metrics);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/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 35aec0e..b8a4ddf 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
@@ -197,10 +197,6 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     private int reconCnt = DFLT_RECONNECT_CNT;
 
-    /** Grid marshaller. */
-    @IgniteMarshallerResource
-    private IgniteMarshaller gridMarsh;
-
     /** Nodes ring. */
     @GridToStringExclude
     private final TcpDiscoveryNodesRing ring = new TcpDiscoveryNodesRing();
@@ -279,13 +275,22 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private ConcurrentLinkedDeque<String> debugLog;
 
+    /** {@inheritDoc} */
+    @IgniteInstanceResource
+    @Override public void setIgnite(Ignite ignite) {
+        super.setIgnite(ignite);
+
+        // Inject resource.
+        if (ignite != null)
+            setAddressResolver(ignite.configuration().getAddressResolver());
+    }
+
     /**
      * Sets address resolver.
      *
      * @param addrRslvr Address resolver.
      */
     @IgniteSpiConfiguration(optional = true)
-    @IgniteAddressResolverResource
     public void setAddressResolver(IgniteAddressResolver addrRslvr) {
         // Injection should not override value already set by Spring or user.
         if (this.addrRslvr == null)
@@ -609,7 +614,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     @Nullable @Override public ClusterNode getNode(UUID nodeId) {
         assert nodeId != null;
 
-        UUID locNodeId0 = locNodeId;
+        UUID locNodeId0 = ignite.configuration().getNodeId();
 
         if (locNodeId0 != null && locNodeId0.equals(nodeId))
             // Return local node directly.
@@ -691,7 +696,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         }
 
         locNode = new TcpDiscoveryNode(
-            locNodeId,
+            ignite.configuration().getNodeId(),
             addrs.get1(),
             addrs.get2(),
             tcpSrvr.port,
@@ -849,7 +854,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         if (hbFreq < 2000)
             U.warn(log, "Heartbeat frequency is too high (at least 2000 ms recommended): " + hbFreq);
 
-        registerMBean(gridName, this, TcpDiscoverySpiMBean.class);
+        registerMBean(ignite.name(), this, TcpDiscoverySpiMBean.class);
 
         if (ipFinder instanceof TcpDiscoveryMulticastIpFinder) {
             TcpDiscoveryMulticastIpFinder mcastIpFinder = ((TcpDiscoveryMulticastIpFinder)ipFinder);
@@ -919,7 +924,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
         if (msgWorker != null && msgWorker.isAlive() && !disconnect) {
             // Send node left message only if it is final stop.
-            msgWorker.addMessage(new TcpDiscoveryNodeLeftMessage(locNodeId));
+            msgWorker.addMessage(new TcpDiscoveryNodeLeftMessage(ignite.configuration().getNodeId()));
 
             synchronized (mux) {
                 long threshold = U.currentTimeMillis() + netTimeout;
@@ -1080,7 +1085,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     @Override public boolean pingNode(UUID nodeId) {
         assert nodeId != null;
 
-        if (nodeId == locNodeId)
+        if (nodeId == ignite.configuration().getNodeId())
             return true;
 
         TcpDiscoveryNode node = ring.node(nodeId);
@@ -1108,7 +1113,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     private boolean pingNode(TcpDiscoveryNode node) {
         assert node != null;
 
-        if (node.id().equals(locNodeId))
+        if (node.id().equals(ignite.configuration().getNodeId()))
             return true;
 
         UUID clientNodeId = null;
@@ -1151,8 +1156,10 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         throws IgniteCheckedException {
         assert addr != null;
 
+        UUID locNodeId = ignite.configuration().getNodeId();
+
         if (F.contains(locNodeAddrs, addr))
-            return F.t(locNodeId, false);
+            return F.t(ignite.configuration().getNodeId(), false);
 
         GridFutureAdapterEx<IgniteBiTuple<UUID, Boolean>> fut = new GridFutureAdapterEx<>();
 
@@ -1265,7 +1272,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
                     Map<String, Object> attrs = new HashMap<>(locNode.attributes());
 
-                    attrs.put(GridNodeAttributes.ATTR_SECURITY_SUBJECT, gridMarsh.marshal(subj));
+                    attrs.put(GridNodeAttributes.ATTR_SECURITY_SUBJECT,
+                            ignite.configuration().getMarshaller().marshal(subj));
                     attrs.remove(GridNodeAttributes.ATTR_SECURITY_CREDENTIALS);
 
                     locNode.setAttributes(attrs);
@@ -1394,7 +1402,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
     @SuppressWarnings({"BusyWait"})
     private boolean sendJoinRequestMessage() throws IgniteSpiException {
         TcpDiscoveryAbstractMessage joinReq = new TcpDiscoveryJoinRequestMessage(locNode,
-            exchange.collect(locNodeId));
+            exchange.collect(ignite.configuration().getNodeId()));
 
         // Time when it has been detected, that addresses from IP finder do not respond.
         long noResStart = 0;
@@ -1531,6 +1539,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
         boolean joinReqSent = false;
 
+        UUID locNodeId = ignite.configuration().getNodeId();
+
         for (int i = 0; i < reconCnt; i++) {
             // Need to set to false on each new iteration,
             // since remote node may leave in the middle of the first iteration.
@@ -1949,7 +1959,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
      * This method is intended for test purposes only.
      */
     void simulateNodeFailure() {
-        U.warn(log, "Simulating node failure: " + locNodeId);
+        U.warn(log, "Simulating node failure: " + ignite.configuration().getNodeId());
 
         U.interrupt(tcpSrvr);
         U.join(tcpSrvr, log);
@@ -1998,7 +2008,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         }
 
         if (next != null)
-            msgWorker.addMessage(new TcpDiscoveryNodeFailedMessage(locNodeId, next.id(), next.internalOrder()));
+            msgWorker.addMessage(new TcpDiscoveryNodeFailedMessage(ignite.configuration().getNodeId(), next.id(),
+                next.internalOrder()));
     }
 
     /**
@@ -2048,7 +2059,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
             b.append(">>>").append("Dumping discovery SPI debug info.").append(U.nl());
             b.append(">>>").append(U.nl());
 
-            b.append("Local node ID: ").append(locNodeId).append(U.nl()).append(U.nl());
+            b.append("Local node ID: ").append(ignite.configuration().getNodeId()).append(U.nl()).append(U.nl());
             b.append("Local node: ").append(locNode).append(U.nl()).append(U.nl());
             b.append("SPI state: ").append(spiState).append(U.nl()).append(U.nl());
 
@@ -2104,7 +2115,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         assert debugMode;
 
         String msg0 = new SimpleDateFormat("[HH:mm:ss,SSS]").format(new Date(System.currentTimeMillis())) +
-            '[' + Thread.currentThread().getName() + "][" + locNodeId + "-" + locNode.internalOrder() + "] " +
+            '[' + Thread.currentThread().getName() + "][" + ignite.configuration().getNodeId() +
+            "-" + locNode.internalOrder() + "] " +
             msg;
 
         debugLog.add(msg0);
@@ -2167,7 +2179,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * Constructor.
          */
         private HeartbeatsSender() {
-            super(gridName, "tcp-disco-hb-sender", log);
+            super(ignite.name(), "tcp-disco-hb-sender", log);
 
             setPriority(threadPri);
         }
@@ -2189,9 +2201,9 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                     return;
                 }
 
-                TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(locNodeId);
+                TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(ignite.configuration().getNodeId());
 
-                msg.verify(locNodeId);
+                msg.verify(ignite.configuration().getNodeId());
 
                 msgWorker.addMessage(msg);
 
@@ -2211,7 +2223,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * Constructor.
          */
         private CheckStatusSender() {
-            super(gridName, "tcp-disco-status-check-sender", log);
+            super(ignite.name(), "tcp-disco-status-check-sender", log);
 
             setPriority(threadPri);
         }
@@ -2275,7 +2287,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * Constructor.
          */
         private IpFinderCleaner() {
-            super(gridName, "tcp-disco-ip-finder-cleaner", log);
+            super(ignite.name(), "tcp-disco-ip-finder-cleaner", log);
 
             setPriority(threadPri);
         }
@@ -2541,7 +2553,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                     ClientMessageWorker wrk = clientMsgWorkers.get(msg.creatorNodeId());
 
                     if (wrk != null) {
-                        msg.verify(locNodeId);
+                        msg.verify(ignite.configuration().getNodeId());
 
                         wrk.addMessage(msg);
                     }
@@ -2597,6 +2609,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
             boolean searchNext = true;
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             while (true) {
                 if (searchNext) {
                     TcpDiscoveryNode newNext = ring.nextNode(failedNodes);
@@ -2987,6 +3001,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
             TcpDiscoveryNode node = msg.node();
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             if (!msg.client()) {
                 boolean rmtHostLoopback = node.socketAddresses().size() == 1 &&
                     node.socketAddresses().iterator().next().getAddress().isLoopbackAddress();
@@ -3127,7 +3143,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                         // Stick in authentication subject to node (use security-safe attributes for copy).
                         Map<String, Object> attrs = new HashMap<>(node.getAttributes());
 
-                        attrs.put(GridNodeAttributes.ATTR_SECURITY_SUBJECT, gridMarsh.marshal(subj));
+                        attrs.put(GridNodeAttributes.ATTR_SECURITY_SUBJECT,
+                                ignite.configuration().getMarshaller().marshal(subj));
 
                         node.setAttributes(attrs);
                     }
@@ -3433,6 +3450,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * @param msg Client reconnect message.
          */
         private void processClientReconnectMessage(TcpDiscoveryClientReconnectMessage msg) {
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             boolean isLocalNodeRouter = locNodeId.equals(msg.routerNodeId());
 
             if (!msg.verified()) {
@@ -3513,6 +3532,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                 return;
             }
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             if (isLocalNodeCoordinator()) {
                 if (msg.verified()) {
                     stats.onRingMessageReceived(msg);
@@ -3562,7 +3583,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                         else {
                             GridSecurityContext subj = nodeAuth.authenticateNode(node, cred);
 
-                            GridSecurityContext coordSubj = gridMarsh.unmarshal(
+                            GridSecurityContext coordSubj = ignite.configuration().getMarshaller().unmarshal(
                                 node.<byte[]>attribute(GridNodeAttributes.ATTR_SECURITY_SUBJECT), U.gridClassLoader());
 
                             if (!permissionsEqual(coordSubj.subject().permissions(), subj.subject().permissions())) {
@@ -3721,6 +3742,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
             boolean locNodeCoord = isLocalNodeCoordinator();
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             if (locNodeCoord) {
                 if (msg.verified()) {
                     stats.onRingMessageReceived(msg);
@@ -3825,6 +3848,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         private void processNodeLeftMessage(TcpDiscoveryNodeLeftMessage msg) {
             assert msg != null;
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             UUID leavingNodeId = msg.creatorNodeId();
 
             if (locNodeId.equals(leavingNodeId)) {
@@ -4063,6 +4088,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
             boolean locNodeCoord = isLocalNodeCoordinator();
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             if (locNodeCoord) {
                 if (msg.verified()) {
                     stats.onRingMessageReceived(msg);
@@ -4147,6 +4174,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         private void processStatusCheckMessage(TcpDiscoveryStatusCheckMessage msg) {
             assert msg != null;
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             if (msg.failedNodeId() != null) {
                 if (locNodeId.equals(msg.failedNodeId())) {
                     if (log.isDebugEnabled())
@@ -4264,6 +4293,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
         private void processHeartbeatMessage(TcpDiscoveryHeartbeatMessage msg) {
             assert msg != null;
 
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             if (ring.node(msg.creatorNodeId()) == null) {
                 if (log.isDebugEnabled())
                     log.debug("Discarding heartbeat message issued by unknown node [msg=" + msg +
@@ -4393,9 +4424,9 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
             assert msgId != null;
 
             if (isLocalNodeCoordinator()) {
-                if (!locNodeId.equals(msg.verifierNodeId()))
+                if (!ignite.configuration().getNodeId().equals(msg.verifierNodeId()))
                     // Message is not verified or verified by former coordinator.
-                    msg.verify(locNodeId);
+                    msg.verify(ignite.configuration().getNodeId());
                 else
                     // Discard the message.
                     return;
@@ -4428,7 +4459,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * @throws org.apache.ignite.spi.IgniteSpiException In case of error.
          */
         TcpServer() throws IgniteSpiException {
-            super(gridName, "tcp-disco-srvr", log);
+            super(ignite.name(), "tcp-disco-srvr", log);
 
             setPriority(threadPri);
 
@@ -4521,7 +4552,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * @param sock Socket to read data from.
          */
         SocketReader(Socket sock) {
-            super(gridName, "tcp-disco-sock-reader", log);
+            super(ignite.name(), "tcp-disco-sock-reader", log);
 
             this.sock = sock;
 
@@ -4532,6 +4563,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
 
         /** {@inheritDoc} */
         @Override protected void body() throws InterruptedException {
+            UUID locNodeId = ignite.configuration().getNodeId();
+
             try {
                 InputStream in;
 
@@ -4977,7 +5010,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                 SocketAddress rmtAddr = sock.getRemoteSocketAddress();
 
                 if (state == CONNECTING) {
-                    if (noResAddrs.contains(rmtAddr) || locNodeId.compareTo(msg.creatorNodeId()) < 0)
+                    if (noResAddrs.contains(rmtAddr) ||
+                        ignite.configuration().getNodeId().compareTo(msg.creatorNodeId()) < 0)
                         // Remote node node has not responded to join request or loses UUID race.
                         res = RES_WAIT;
                     else
@@ -5035,7 +5069,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
          * Constructor.
          */
         StatisticsPrinter() {
-            super(gridName, "tcp-disco-stats-printer", log);
+            super(ignite.name(), "tcp-disco-stats-printer", log);
 
             assert statsPrintFreq > 0;
 
@@ -5111,8 +5145,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                 assert msg.verified() : msg;
 
                 if (log.isDebugEnabled())
-                    log.debug("Redirecting message to client [sock=" + sock + ", locNodeId=" + locNodeId +
-                        ", rmtNodeId=" + nodeId + ", msg=" + msg + ']');
+                    log.debug("Redirecting message to client [sock=" + sock + ", locNodeId=" +
+                            ignite.configuration().getNodeId() + ", rmtNodeId=" + nodeId + ", msg=" + msg + ']');
 
                 try {
                     prepareNodeAddedMessage(msg, nodeId, null, null);
@@ -5125,8 +5159,8 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
             }
             catch (IgniteCheckedException | IOException e) {
                 if (log.isDebugEnabled())
-                    U.error(log, "Client connection failed [sock=" + sock + ", locNodeId=" + locNodeId +
-                        ", rmtNodeId=" + nodeId + ", msg=" + msg + ']', e);
+                    U.error(log, "Client connection failed [sock=" + sock + ", locNodeId=" +
+                        ignite.configuration().getNodeId() + ", rmtNodeId=" + nodeId + ", msg=" + msg + ']', e);
 
                 U.interrupt(clientMsgWorkers.remove(nodeId));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/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 fa45f64..7fe9ce4 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
@@ -132,19 +132,28 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
     /** Statistics. */
     protected final TcpDiscoveryStatistics stats = new TcpDiscoveryStatistics();
 
-    /** Local node ID. */
-    @IgniteLocalNodeIdResource
-    protected UUID locNodeId;
-
-    /** Name of the grid. */
-    @IgniteNameResource
-    protected String gridName;
+    /** Grid instance. */
+    protected Ignite ignite;
 
     /** Logger. */
     @IgniteLoggerResource
     protected IgniteLogger log;
 
     /**
+     * Sets {@link Ignite ignite}.
+     *
+     * @param ignite Ignite.
+     */
+    @IgniteInstanceResource
+    public void setIgnite(Ignite ignite) {
+        this.ignite = ignite;
+
+        // Inject resource.
+        if (ignite != null)
+            setLocalAddress(ignite.configuration().getLocalHost());
+    }
+
+    /**
      * Sets local host IP address that discovery SPI uses.
      * <p>
      * If not provided, by default a first found non-loopback address
@@ -154,7 +163,6 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
      * @param locAddr IP address.
      */
     @IgniteSpiConfiguration(optional = true)
-    @IgniteLocalHostResource
     public void setLocalAddress(String locAddr) {
         // Injection should not override value already set by Spring or user.
         if (this.locAddr == null)
@@ -755,7 +763,7 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
          *
          */
         SocketTimeoutWorker() {
-            super(gridName, "tcp-disco-sock-timeout-worker", log);
+            super(ignite.name(), "tcp-disco-sock-timeout-worker", log);
 
             setPriority(threadPri);
         }
@@ -923,7 +931,7 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
          * @param name Thread name.
          */
         protected MessageWorkerAdapter(String name) {
-            super(gridName, name, log);
+            super(ignite.name(), name, log);
 
             setPriority(threadPri);
         }
@@ -931,7 +939,7 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
         /** {@inheritDoc} */
         @Override protected void body() throws InterruptedException {
             if (log.isDebugEnabled())
-                log.debug("Message worker started [locNodeId=" + locNodeId + ']');
+                log.debug("Message worker started [locNodeId=" + ignite.configuration().getNodeId() + ']');
 
             while (!isInterrupted()) {
                 TcpDiscoveryAbstractMessage msg = queue.poll(2000, TimeUnit.MILLISECONDS);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index b3e1327..e03bd10 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -75,10 +75,10 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
     @IgniteLoggerResource
     private IgniteLogger log;
 
-    /** Grid name. */
-    @IgniteNameResource
+    /** Ignite instance . */
+    @IgniteInstanceResource
     @GridToStringExclude
-    private String gridName;
+    private Ignite ignite;
 
     /** Multicast IP address as string. */
     private String mcastGrp = DFLT_MCAST_GROUP;
@@ -589,7 +589,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
          * @param sockAddr Optional address multicast socket should be bound to.
          */
         private AddressReceiver(InetAddress mcastAddr, InetAddress sockAddr) {
-            super(gridName, "tcp-disco-multicast-addr-rcvr", log);
+            super(ignite.name(), "tcp-disco-multicast-addr-rcvr", log);
             this.mcastAddr = mcastAddr;
             this.sockAddr = sockAddr;
         }
@@ -633,7 +633,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
          */
         private AddressSender(InetAddress mcastGrp, @Nullable InetAddress sockItf, Collection<InetSocketAddress> addrs)
             throws IOException {
-            super(gridName, "tcp-disco-multicast-addr-sender", log);
+            super(ignite.name(), "tcp-disco-multicast-addr-sender", log);
             this.mcastGrp = mcastGrp;
             this.addrs = addrs;
             this.sockItf = sockItf;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
index 45406dc..693a6e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
@@ -144,18 +144,6 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
     @IgniteLoggerResource
     private IgniteLogger log;
 
-    /** Local node ID. */
-    @IgniteLocalNodeIdResource
-    private UUID locNodeId;
-
-    /** Name of the grid. */
-    @IgniteNameResource
-    private String gridName;
-
-    /** Marshaller. */
-    @IgniteMarshallerResource
-    private IgniteMarshaller marsh;
-
     /** {@inheritDoc} */
     @Override public String getBaseDirectory() {
         return baseDir;
@@ -262,7 +250,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
 
         registerMBean(gridName, this, FileSwapSpaceSpiMBean.class);
 
-        String path = baseDir + File.separator + gridName + File.separator + locNodeId;
+        String path = baseDir + File.separator + gridName + File.separator + ignite.configuration().getNodeId();
 
         try {
             dir = U.resolveWorkDirectory(path, true);
@@ -554,7 +542,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
 
         if (keyBytes == null) {
             try {
-                keyBytes = marsh.marshal(key.key());
+                keyBytes = ignite.configuration().getMarshaller().marshal(key.key());
             }
             catch (IgniteCheckedException e) {
                 throw new IgniteSpiException("Failed to marshal key: " + key.key(), e);
@@ -1422,7 +1410,9 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
 
                         final Object mux = new Object();
 
-                        writer = new IgniteSpiThread(gridName,  "Swap writer: " + name, log) {
+                        String gridName = ignite.name();
+
+                        writer = new IgniteSpiThread(gridName, "Swap writer: " + name, log) {
                             @Override protected void body() throws InterruptedException {
                                 while (!isInterrupted()) {
                                     SwapValues vals = que.take();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55936e46/modules/core/src/main/java/org/gridgain/grid/cache/store/jdbc/GridCacheJdbcBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/store/jdbc/GridCacheJdbcBlobStore.java b/modules/core/src/main/java/org/gridgain/grid/cache/store/jdbc/GridCacheJdbcBlobStore.java
index ffd324d..178eb92 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/store/jdbc/GridCacheJdbcBlobStore.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/store/jdbc/GridCacheJdbcBlobStore.java
@@ -137,8 +137,8 @@ public class GridCacheJdbcBlobStore<K, V> extends GridCacheStoreAdapter<K, V> {
     private IgniteLogger log;
 
     /** Marshaller. */
-    @IgniteMarshallerResource
-    private IgniteMarshaller marsh;
+    @IgniteInstanceResource
+    private Ignite ignite;
 
     /** Init guard. */
     @GridToStringExclude
@@ -525,7 +525,7 @@ public class GridCacheJdbcBlobStore<K, V> extends GridCacheStoreAdapter<K, V> {
      * @throws IgniteCheckedException If failed to convert.
      */
     protected byte[] toBytes(Object obj) throws IgniteCheckedException {
-        return marsh.marshal(obj);
+        return ignite.configuration().getMarshaller().marshal(obj);
     }
 
     /**
@@ -540,6 +540,6 @@ public class GridCacheJdbcBlobStore<K, V> extends GridCacheStoreAdapter<K, V> {
         if (bytes == null || bytes.length == 0)
             return null;
 
-        return marsh.unmarshal(bytes, getClass().getClassLoader());
+        return ignite.configuration().getMarshaller().unmarshal(bytes, getClass().getClassLoader());
     }
 }


Mime
View raw message