You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/03/31 16:22:35 UTC

[01/18] ignite git commit: IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.

Repository: ignite
Updated Branches:
  refs/heads/ignite-3477-master d0665c17e -> db10c451e


http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
index 7afaaee..cfd4fc7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
@@ -50,6 +50,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import org.jetbrains.annotations.Nullable;
@@ -254,8 +255,7 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi,
-    AdaptiveLoadBalancingSpiMBean {
+public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi {
     /** Random number generator. */
     private static final Random RAND = new Random();
 
@@ -279,8 +279,12 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBa
     /** */
     private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
 
-    /** {@inheritDoc} */
-    @Override public String getLoadProbeFormatted() {
+    /**
+     * Gets text description of current load probing implementation used.
+     *
+     * @return Text description of current load probing implementation used.
+     */
+    public String getLoadProbeFormatted() {
         return probe.toString();
     }
 
@@ -290,12 +294,15 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBa
      * time on every node.
      *
      * @param probe Implementation of node load probe
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setLoadProbe(AdaptiveLoadProbe probe) {
+    public AdaptiveLoadBalancingSpi setLoadProbe(AdaptiveLoadProbe probe) {
         A.ensure(probe != null, "probe != null");
 
         this.probe = probe;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -307,7 +314,8 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBa
         if (log.isDebugEnabled())
             log.debug(configInfo("loadProbe", probe));
 
-        registerMBean(igniteInstanceName, this, AdaptiveLoadBalancingSpiMBean.class);
+        registerMBean(igniteInstanceName, new AdaptiveLoadBalancingSpiMBeanImpl(this),
+            AdaptiveLoadBalancingSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -606,7 +614,30 @@ public class AdaptiveLoadBalancingSpi extends IgniteSpiAdapter implements LoadBa
     }
 
     /** {@inheritDoc} */
+    @Override public AdaptiveLoadBalancingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(AdaptiveLoadBalancingSpi.class, this);
     }
+
+    /**
+     * MBean implementation for AdaptiveLoadBalancingSpi.
+     */
+    private class AdaptiveLoadBalancingSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements AdaptiveLoadBalancingSpiMBean {
+        /** {@inheritDoc} */
+        AdaptiveLoadBalancingSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getLoadProbeFormatted() {
+            return AdaptiveLoadBalancingSpi.this.getLoadProbeFormatted();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
index 40af99a..5472811 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java
@@ -39,6 +39,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import org.jetbrains.annotations.Nullable;
@@ -172,8 +173,7 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi,
-    RoundRobinLoadBalancingSpiMBean {
+public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi {
     /** Grid logger. */
     @LoggerResource
     private IgniteLogger log;
@@ -204,8 +204,13 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements Load
         }
     };
 
-    /** {@inheritDoc} */
-    @Override public boolean isPerTask() {
+    /**
+     * See {@link #setPerTask(boolean)}.
+     *
+     * @return Configuration parameter indicating whether a new round robin order should
+     *      be created for every task. Default is {@code false}.
+     */
+    public boolean isPerTask() {
         return isPerTask;
     }
 
@@ -223,10 +228,13 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements Load
      *
      * @param isPerTask Configuration parameter indicating whether a new round robin order should
      *      be created for every task. Default is {@code false}.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setPerTask(boolean isPerTask) {
+    public RoundRobinLoadBalancingSpi setPerTask(boolean isPerTask) {
         this.isPerTask = isPerTask;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -236,7 +244,8 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements Load
         if (log.isDebugEnabled())
             log.debug(configInfo("isPerTask", isPerTask));
 
-        registerMBean(igniteInstanceName, this, RoundRobinLoadBalancingSpiMBean.class);
+        registerMBean(igniteInstanceName, new RoundRobinLoadBalancingSpiMBeanImpl(this),
+            RoundRobinLoadBalancingSpiMBean.class);
 
         balancer = new RoundRobinGlobalLoadBalancer(log);
 
@@ -331,7 +340,30 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements Load
     }
 
     /** {@inheritDoc} */
+    @Override public RoundRobinLoadBalancingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(RoundRobinLoadBalancingSpi.class, this);
     }
+
+    /**
+     * MBean implementation for RoundRobinLoadBalancingSpi.
+     */
+    private class RoundRobinLoadBalancingSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements RoundRobinLoadBalancingSpiMBean {
+        /** {@inheritDoc} */
+        RoundRobinLoadBalancingSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isPerTask() {
+            return RoundRobinLoadBalancingSpi.this.isPerTask();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
index 6e67b80..2af6d44 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java
@@ -44,6 +44,7 @@ import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import org.jetbrains.annotations.Nullable;
@@ -176,8 +177,7 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = true)
-public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi,
-    WeightedRandomLoadBalancingSpiMBean {
+public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements LoadBalancingSpi {
     /** Random number generator. */
     private static final Random RAND = new Random();
 
@@ -216,14 +216,21 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements
      *
      * @param isUseWeights If {@code true} then random load is distributed according
      *      to node weights.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setUseWeights(boolean isUseWeights) {
+    public WeightedRandomLoadBalancingSpi setUseWeights(boolean isUseWeights) {
         this.isUseWeights = isUseWeights;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isUseWeights() {
+    /**
+     * See {@link #setUseWeights(boolean)}.
+     *
+     * @return Maximum sparsity.
+     */
+    public boolean isUseWeights() {
         return isUseWeights;
     }
 
@@ -233,14 +240,21 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements
      * is {@link #DFLT_NODE_WEIGHT} and is equal for all nodes.
      *
      * @param nodeWeight Weight of this node.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setNodeWeight(int nodeWeight) {
+    public WeightedRandomLoadBalancingSpi setNodeWeight(int nodeWeight) {
         this.nodeWeight = nodeWeight;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getNodeWeight() {
+    /**
+     * See {@link #setNodeWeight(int)}.
+     *
+     * @return Maximum sparsity.
+     */
+    public int getNodeWeight() {
         return nodeWeight;
     }
 
@@ -260,7 +274,8 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements
             log.debug(configInfo("nodeWeight", nodeWeight));
         }
 
-        registerMBean(igniteInstanceName, this, WeightedRandomLoadBalancingSpiMBean.class);
+        registerMBean(igniteInstanceName, new WeightedRandomLoadBalancingSpiMBeanImpl(this),
+            WeightedRandomLoadBalancingSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -413,7 +428,35 @@ public class WeightedRandomLoadBalancingSpi extends IgniteSpiAdapter implements
     }
 
     /** {@inheritDoc} */
+    @Override public WeightedRandomLoadBalancingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(WeightedRandomLoadBalancingSpi.class, this);
     }
+
+    /**
+     * MBean implementation for WeightedRandomLoadBalancingSpi.
+     */
+    private class WeightedRandomLoadBalancingSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements WeightedRandomLoadBalancingSpiMBean {
+        /** {@inheritDoc} */
+        WeightedRandomLoadBalancingSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isUseWeights() {
+            return WeightedRandomLoadBalancingSpi.this.isUseWeights();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getNodeWeight() {
+            return WeightedRandomLoadBalancingSpi.this.getNodeWeight();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 142b31a..b41fb4b 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
@@ -63,6 +63,7 @@ import org.apache.ignite.spi.IgniteSpiCloseableIterator;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.IgniteSpiThread;
 import org.apache.ignite.spi.swapspace.SwapContext;
@@ -140,7 +141,7 @@ import static org.apache.ignite.events.EventType.EVT_SWAP_SPACE_DATA_STORED;
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false, checkClient = false)
 @SuppressWarnings({"PackageVisibleInnerClass", "PackageVisibleField"})
-public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, FileSwapSpaceSpiMBean {
+public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi {
     /**
      * Default base directory. Note that this path is relative to {@code IGNITE_HOME/work} folder
      * if {@code IGNITE_HOME} system or environment variable specified, otherwise it is relative to
@@ -190,8 +191,12 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
     @LoggerResource
     private IgniteLogger log;
 
-    /** {@inheritDoc} */
-    @Override public String getBaseDirectory() {
+    /**
+     * Gets base directory.
+     *
+     * @return Base directory.
+     */
+    public String getBaseDirectory() {
         return baseDir;
     }
 
@@ -199,14 +204,21 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * Sets base directory.
      *
      * @param baseDir Base directory.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setBaseDirectory(String baseDir) {
+    public FileSwapSpaceSpi setBaseDirectory(String baseDir) {
         this.baseDir = baseDir;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public float getMaximumSparsity() {
+    /**
+     * See {@link #setMaximumSparsity(float)}.
+     *
+     * @return Maximum sparsity.
+     */
+    public float getMaximumSparsity() {
         return maxSparsity;
     }
 
@@ -215,13 +227,20 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * When this ratio becomes higher than specified number compacting thread starts working.
      *
      * @param maxSparsity Maximum sparsity. Must be between 0 and 1, default is {@link #DFLT_MAX_SPARSITY}.
+     * @return {@code this} for chaining.
      */
-    public void setMaximumSparsity(float maxSparsity) {
+    public FileSwapSpaceSpi setMaximumSparsity(float maxSparsity) {
         this.maxSparsity = maxSparsity;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getWriteBufferSize() {
+    /**
+     * See {@link #setWriteBufferSize(int)}.
+     *
+     * @return Write buffer size in bytes.
+     */
+    public int getWriteBufferSize() {
         return writeBufSize;
     }
 
@@ -230,13 +249,20 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * {@link #DFLT_BUF_SIZE}.
      *
      * @param writeBufSize Write buffer size in bytes.
+     * @return {@code this} for chaining.
      */
-    public void setWriteBufferSize(int writeBufSize) {
+    public FileSwapSpaceSpi setWriteBufferSize(int writeBufSize) {
         this.writeBufSize = writeBufSize;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMaxWriteQueueSize() {
+    /**
+     * See {@link #setMaxWriteQueueSize(int)}.
+     *
+     * @return Max write queue size in bytes.
+     */
+    public int getMaxWriteQueueSize() {
         return maxWriteQueSize;
     }
 
@@ -246,13 +272,20 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * {@link #DFLT_QUE_SIZE}.
      *
      * @param maxWriteQueSize Max write queue size in bytes.
+     * @return {@code this} for chaining.
      */
-    public void setMaxWriteQueueSize(int maxWriteQueSize) {
+    public FileSwapSpaceSpi setMaxWriteQueueSize(int maxWriteQueSize) {
         this.maxWriteQueSize = maxWriteQueSize;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getReadStripesNumber() {
+    /**
+     * See {@link #setReadStripesNumber(int)}.
+     *
+     * @return Read pool size.
+     */
+    public int getReadStripesNumber() {
         return readStripesNum;
     }
 
@@ -261,12 +294,15 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
      * CPU cores available to this JVM.
      *
      * @param readStripesNum Read stripe number.
+     * @return {@code this} for chaining.
      */
-    public void setReadStripesNumber(int readStripesNum) {
+    public FileSwapSpaceSpi setReadStripesNumber(int readStripesNum) {
         A.ensure(readStripesNum == -1 || (readStripesNum & (readStripesNum - 1)) == 0,
             "readStripesNum must be positive and power of two");
 
         this.readStripesNum = readStripesNum;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -294,7 +330,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
 
         startStopwatch();
 
-        registerMBean(igniteInstanceName, this, FileSwapSpaceSpiMBean.class);
+        registerMBean(igniteInstanceName, new FileSwapSpaceSpiMBeanImpl(this), FileSwapSpaceSpiMBean.class);
 
         String path = baseDir + File.separator + igniteInstanceName + File.separator + ignite.configuration().getNodeId();
 
@@ -695,6 +731,13 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
     }
 
     /** {@inheritDoc} */
+    @Override public FileSwapSpaceSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(FileSwapSpaceSpi.class, this);
     }
@@ -1944,4 +1987,39 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
             };
         }
     }
+
+    /**
+     * MBean implementation for LocalDeploymentSpi.
+     */
+    private class FileSwapSpaceSpiMBeanImpl extends IgniteSpiMBeanAdapter implements FileSwapSpaceSpiMBean {
+        /** {@inheritDoc} */
+        FileSwapSpaceSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getBaseDirectory() {
+            return FileSwapSpaceSpi.this.getBaseDirectory();
+        }
+
+        /** {@inheritDoc} */
+        @Override public float getMaximumSparsity() {
+            return FileSwapSpaceSpi.this.getMaximumSparsity();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getWriteBufferSize() {
+            return FileSwapSpaceSpi.this.getWriteBufferSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxWriteQueueSize() {
+            return FileSwapSpaceSpi.this.getMaxWriteQueueSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getReadStripesNumber() {
+            return FileSwapSpaceSpi.this.getReadStripesNumber();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
index a3649b2..a6618b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/noop/NoopSwapSpaceSpi.java
@@ -146,6 +146,13 @@ public class NoopSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi {
     }
 
     /** {@inheritDoc} */
+    @Override public NoopSwapSpaceSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(NoopSwapSpaceSpi.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
index 71074c0..c238998 100644
--- a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
+++ b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
@@ -40,6 +40,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
@@ -198,10 +199,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      * For details refer to Google Cloud Platform API reference.
      *
      * @param projectName Project name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setProjectName(String projectName) {
+    public TcpDiscoveryGoogleStorageIpFinder setProjectName(String projectName) {
         this.projectName = projectName;
+
+        return this;
     }
 
     /**
@@ -211,10 +215,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      * perform this operation.
      *
      * @param bucketName Bucket name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setBucketName(String bucketName) {
+    public TcpDiscoveryGoogleStorageIpFinder setBucketName(String bucketName) {
         this.bucketName = bucketName;
+
+        return this;
     }
 
 
@@ -226,10 +233,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      *     Service Account Authentication</a>.
      *
      * @param p12FileName Private key file full path.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setServiceAccountP12FilePath(String p12FileName) {
+    public TcpDiscoveryGoogleStorageIpFinder setServiceAccountP12FilePath(String p12FileName) {
         this.srvcAccountP12FilePath = p12FileName;
+
+        return this;
     }
 
     /**
@@ -240,10 +250,13 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
      *     Service Account Authentication</a>.
      *
      * @param id Service account ID.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setServiceAccountId(String id) {
+    public TcpDiscoveryGoogleStorageIpFinder setServiceAccountId(String id) {
         this.srvcAccountId = id;
+
+        return this;
     }
 
     /**
@@ -403,4 +416,16 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
             throw new IgniteSpiException("Failed to remove the bucket: " + bucketName, e);
         }
     }
+
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryGoogleStorageIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryGoogleStorageIpFinder.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 674cca7..ee71503 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -142,9 +142,12 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * Sets default user name. See {@link #getDefaultUserName()} for details.
      *
      * @param dfltUsrName Default user name.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultUserName(@Nullable String dfltUsrName) {
+    public IgniteHadoopIgfsSecondaryFileSystem setDefaultUserName(@Nullable String dfltUsrName) {
         this.dfltUsrName = dfltUsrName;
+
+        return this;
     }
 
     /**
@@ -164,9 +167,12 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * Sets secondary file system factory. See {@link #getFileSystemFactory()} for details.
      *
      * @param factory Secondary file system factory.
+     * @return {@code this} for chaining.
      */
-    public void setFileSystemFactory(HadoopFileSystemFactory factory) {
+    public IgniteHadoopIgfsSecondaryFileSystem setFileSystemFactory(HadoopFileSystemFactory factory) {
         this.factory = factory;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
index bb0b47f..1d72c4b 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/mapreduce/IgniteHadoopWeightedMapReducePlanner.java
@@ -637,9 +637,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set local mapper weight. See {@link #getLocalMapperWeight()} for more information.
      *
      * @param locMapperWeight Local mapper weight.
+     * @return {@code this} for chaining.
      */
-    public void setLocalMapperWeight(int locMapperWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setLocalMapperWeight(int locMapperWeight) {
         this.locMapperWeight = locMapperWeight;
+
+        return this;
     }
 
     /**
@@ -658,9 +661,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set remote mapper weight. See {@link #getRemoteMapperWeight()} for more information.
      *
      * @param rmtMapperWeight Remote mapper weight.
+     * @return {@code this} for chaining.
      */
-    public void setRemoteMapperWeight(int rmtMapperWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setRemoteMapperWeight(int rmtMapperWeight) {
         this.rmtMapperWeight = rmtMapperWeight;
+
+        return this;
     }
 
     /**
@@ -679,9 +685,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set local reducer weight. See {@link #getLocalReducerWeight()} for more information.
      *
      * @param locReducerWeight Local reducer weight.
+     * @return {@code this} for chaining.
      */
-    public void setLocalReducerWeight(int locReducerWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setLocalReducerWeight(int locReducerWeight) {
         this.locReducerWeight = locReducerWeight;
+
+        return this;
     }
 
     /**
@@ -700,9 +709,12 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * Set remote reducer weight. See {@link #getRemoteReducerWeight()} for more information.
      *
      * @param rmtReducerWeight Remote reducer weight.
+     * @return {@code this} for chaining.
      */
-    public void setRemoteReducerWeight(int rmtReducerWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setRemoteReducerWeight(int rmtReducerWeight) {
         this.rmtReducerWeight = rmtReducerWeight;
+
+        return this;
     }
 
     /**
@@ -722,9 +734,13 @@ public class IgniteHadoopWeightedMapReducePlanner extends HadoopAbstractMapReduc
      * information.
      *
      * @param reducerMigrationThresholdWeight Reducer migration threshold weight.
+     * @return {@code this} for chaining.
      */
-    public void setPreferLocalReducerThresholdWeight(int reducerMigrationThresholdWeight) {
+    public IgniteHadoopWeightedMapReducePlanner setPreferLocalReducerThresholdWeight(
+        int reducerMigrationThresholdWeight) {
         this.preferLocReducerThresholdWeight = reducerMigrationThresholdWeight;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
index ce69ce1..b49e2c5 100644
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
+++ b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
@@ -52,6 +52,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.deployment.DeploymentListener;
 import org.apache.ignite.spi.deployment.DeploymentResource;
@@ -307,7 +308,7 @@ import org.jetbrains.annotations.Nullable;
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false)
 @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
-public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi, UriDeploymentSpiMBean {
+public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi {
     /**
      * Default deployment directory where SPI will pick up GAR files. Note that this path is relative to
      * {@code IGNITE_HOME/work} folder if {@code IGNITE_HOME} system or environment variable specified,
@@ -382,10 +383,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * If not provided, default value is {@code java.io.tmpdir} system property value.
      *
      * @param tmpDirPath Temporary directory path.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setTemporaryDirectoryPath(String tmpDirPath) {
+    public UriDeploymentSpi setTemporaryDirectoryPath(String tmpDirPath) {
         this.tmpDirPath = tmpDirPath;
+
+        return this;
     }
 
     /**
@@ -398,10 +402,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * For unknown {@code IGNITE_HOME} list of URI must be provided explicitly.
      *
      * @param uriList GAR file URIs.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setUriList(List<String> uriList) {
+    public UriDeploymentSpi setUriList(List<String> uriList) {
         this.uriList = uriList;
+
+        return this;
     }
 
     /**
@@ -409,10 +416,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * Otherwise it should try to load new unit regardless to possible file duplication.
      *
      * @param checkMd5 new value for the property
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setCheckMd5(boolean checkMd5) {
+    public UriDeploymentSpi setCheckMd5(boolean checkMd5) {
         this.checkMd5 = checkMd5;
+
+        return this;
     }
 
     /**
@@ -420,7 +430,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      *
      * @return value of the {@code checkMd5} property.
      */
-    @Override public boolean isCheckMd5() {
+    public boolean isCheckMd5() {
         return checkMd5;
     }
 
@@ -433,19 +443,30 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      *
      * @param encodeUri {@code true} if every URI should be encoded and
      *      {@code false} otherwise.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setEncodeUri(boolean encodeUri) {
+    public UriDeploymentSpi setEncodeUri(boolean encodeUri) {
         this.encodeUri = encodeUri;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getTemporaryDirectoryPath() {
+    /**
+     * Gets temporary directory path.
+     *
+     * @return Temporary directory path.
+     */
+    public String getTemporaryDirectoryPath() {
         return tmpDirPath;
     }
 
-    /** {@inheritDoc} */
-    @Override public List<String> getUriList() {
+    /**
+     * Gets list of URIs that are processed by SPI.
+     *
+     * @return List of URIs.
+     */
+    public List<String> getUriList() {
         return Collections.unmodifiableList(uriList);
     }
 
@@ -467,10 +488,13 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
      * Sets scanners.
      *
      * @param scanners Scanners.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setScanners(UriDeploymentScanner... scanners) {
+    public UriDeploymentSpi setScanners(UriDeploymentScanner... scanners) {
         this.scanners = scanners;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -523,7 +547,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
 
         initializeTemporaryDirectoryPath();
 
-        registerMBean(igniteInstanceName, this, UriDeploymentSpiMBean.class);
+        registerMBean(igniteInstanceName, new UriDeploymentSpiMBeanImpl(this), UriDeploymentSpiMBean.class);
 
         FilenameFilter filter = new FilenameFilter() {
             @Override public boolean accept(File dir, String name) {
@@ -1343,7 +1367,39 @@ public class UriDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi,
     }
 
     /** {@inheritDoc} */
+    public IgniteSpiAdapter setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(UriDeploymentSpi.class, this);
     }
+
+    /**
+     * MBean implementation for UriDeploymentSpi.
+     */
+    private class UriDeploymentSpiMBeanImpl extends IgniteSpiMBeanAdapter implements UriDeploymentSpiMBean {
+        /** {@inheritDoc} */
+        UriDeploymentSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getTemporaryDirectoryPath() {
+            return UriDeploymentSpi.this.getTemporaryDirectoryPath();
+        }
+
+        /** {@inheritDoc} */
+        @Override public List<String> getUriList() {
+            return  UriDeploymentSpi.this.getUriList();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isCheckMd5() {
+            return  UriDeploymentSpi.this.isCheckMd5();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
index e7a732a..f96a762 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/TcpDiscoveryZookeeperIpFinder.java
@@ -274,9 +274,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter {
 
     /**
      * @param curator A {@link CuratorFramework} instance to use. It can already be in <tt>STARTED</tt> state.
+     * @return {@code this} for chaining.
      */
-    public void setCurator(CuratorFramework curator) {
+    public TcpDiscoveryZookeeperIpFinder setCurator(CuratorFramework curator) {
         this.curator = curator;
+
+        return this;
     }
 
     /**
@@ -289,9 +292,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter {
     /**
      * @param zkConnectionString ZooKeeper connection string in case a {@link CuratorFramework} is not being set
      * explicitly.
+     * @return {@code this} for chaining.
      */
-    public void setZkConnectionString(String zkConnectionString) {
+    public TcpDiscoveryZookeeperIpFinder setZkConnectionString(String zkConnectionString) {
         this.zkConnectionString = zkConnectionString;
+
+        return this;
     }
 
     /**
@@ -304,9 +310,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter {
     /**
      * @param retryPolicy {@link RetryPolicy} to use in case a ZK Connection String is being injected, or if using a
      * system property.
+     * @return {@code this} for chaining.
      */
-    public void setRetryPolicy(RetryPolicy retryPolicy) {
+    public TcpDiscoveryZookeeperIpFinder setRetryPolicy(RetryPolicy retryPolicy) {
         this.retryPolicy = retryPolicy;
+
+        return this;
     }
 
     /**
@@ -318,9 +327,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter {
 
     /**
      * @param basePath Base path for service registration in ZK. If not passed, {@link #BASE_PATH} will be used.
+     * @return {@code this} for chaining.
      */
-    public void setBasePath(String basePath) {
+    public TcpDiscoveryZookeeperIpFinder setBasePath(String basePath) {
         this.basePath = basePath;
+
+        return this;
     }
 
     /**
@@ -333,9 +345,12 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter {
     /**
      * @param serviceName Service name to use, as defined by Curator's {#link ServiceDiscovery} recipe. In physical ZK
      * terms, it represents the node under {@link #basePath}, under which services will be registered.
+     * @return {@code this} for chaining.
      */
-    public void setServiceName(String serviceName) {
+    public TcpDiscoveryZookeeperIpFinder setServiceName(String serviceName) {
         this.serviceName = serviceName;
+
+        return this;
     }
 
     /**
@@ -350,9 +365,19 @@ public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter {
      * allowed. Nodes will attempt to register themselves, plus those they know about. By default, duplicate
      * registrations are not allowed, but you might want to set this property to <tt>true</tt> if you have multiple
      * network interfaces or if you are facing troubles.
+     * @return {@code this} for chaining.
      */
-    public void setAllowDuplicateRegistrations(boolean allowDuplicateRegistrations) {
+    public TcpDiscoveryZookeeperIpFinder setAllowDuplicateRegistrations(boolean allowDuplicateRegistrations) {
         this.allowDuplicateRegistrations = allowDuplicateRegistrations;
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryZookeeperIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
     }
 
     /**


[12/18] ignite git commit: IGNITE-2703 .NET: Dynamic type registration

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
index 19e68a6..56a17a3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
@@ -131,7 +131,7 @@ namespace Apache.Ignite.Core.Tests.Examples
 
                 var proc = new IgniteProcess(args.ToArray());
 
-                Assert.IsTrue(ignite.WaitTopology(2), 
+                Assert.IsTrue(ignite.WaitTopology(2),
                     string.Format("Standalone node failed to join topology: [{0}]", proc.GetInfo()));
 
                 Assert.IsTrue(proc.Alive, string.Format("Standalone node stopped unexpectedly: [{0}]",

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
index 636e0fe..0aebd78 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
@@ -49,28 +49,6 @@ namespace Apache.Ignite.Core.Tests
         private IIgnite _grid;
 
         /// <summary>
-        /// Test fixture set-up routine.
-        /// </summary>
-        [TestFixtureSetUp]
-        public void TestFixtureSetUp()
-        {
-            TestUtils.KillProcesses();
-
-            _grid = Ignition.Start(Configuration(SpringCfgPath));
-        }
-
-        /// <summary>
-        /// Test fixture tear-down routine.
-        /// </summary>
-        [TestFixtureTearDown]
-        public void TestFixtureTearDown()
-        {
-            Ignition.StopAll(true);
-
-            TestUtils.KillProcesses();
-        }
-
-        /// <summary>
         /// Set-up routine.
         /// </summary>
         [SetUp]
@@ -78,6 +56,8 @@ namespace Apache.Ignite.Core.Tests
         {
             TestUtils.KillProcesses();
 
+            _grid = Ignition.Start(Configuration(SpringCfgPath));
+
             Assert.IsTrue(_grid.WaitTopology(1));
 
             IgniteProcess.SaveConfigurationBackup();
@@ -89,6 +69,10 @@ namespace Apache.Ignite.Core.Tests
         [TearDown]
         public void TearDown()
         {
+            Ignition.StopAll(true);
+
+            TestUtils.KillProcesses();
+
             IgniteProcess.RestoreConfigurationBackup();
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
deleted file mode 100644
index 2812468..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Tests
-{
-    using System;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Reflection;
-    using System.Reflection.Emit;
-    using System.Runtime.Serialization;
-    using System.Xml;
-    using Apache.Ignite.Core.Cluster;
-    using Apache.Ignite.Core.Compute;
-    using Apache.Ignite.Core.Impl;
-    using NUnit.Framework;
-
-    /// <summary>
-    /// Tests for native serialization.
-    /// </summary>
-    public class SerializationTest
-    {
-        /** Grid name. */
-        private const string GridName = "SerializationTest";
-
-        /// <summary>
-        /// Set up routine.
-        /// </summary>
-        [TestFixtureSetUp]
-        public void SetUp()
-        {
-            var cfg = new IgniteConfiguration
-            {
-                IgniteInstanceName = GridName,
-                JvmClasspath = TestUtils.CreateTestClasspath(),
-                JvmOptions = TestUtils.TestJavaOptions(),
-                SpringConfigUrl = "config\\native-client-test-cache.xml"
-            };
-
-            Ignition.Start(cfg);
-        }
-
-        /// <summary>
-        /// Tear down routine.
-        /// </summary>
-        [TestFixtureTearDown]
-        public void TearDown()
-        {
-            Ignition.StopAll(true);
-        }
-
-        /// <summary>
-        /// Test complex file serialization.
-        /// </summary>
-        [Test]
-        public void TestSerializableXmlDoc()
-        {
-            var grid = Ignition.GetIgnite(GridName);
-            var cache = grid.GetCache<int, SerializableXmlDoc>("replicated");
-
-            var doc = new SerializableXmlDoc();
-
-            doc.LoadXml("<document><test1>val</test1><test2 attr=\"x\" /></document>");
-
-            for (var i = 0; i < 50; i++)
-            {
-                // Test cache
-                cache.Put(i, doc);
-
-                var resultDoc = cache.Get(i);
-
-                Assert.AreEqual(doc.OuterXml, resultDoc.OuterXml);
-
-                // Test task with document arg
-                CheckTask(grid, doc);
-            }
-        }
-
-        /// <summary>
-        /// Checks task execution.
-        /// </summary>
-        /// <param name="grid">Grid.</param>
-        /// <param name="arg">Task arg.</param>
-        private static void CheckTask(IIgnite grid, object arg)
-        {
-            var jobResult = grid.GetCompute().Execute(new CombineStringsTask(), arg);
-
-            var nodeCount = grid.GetCluster().GetNodes().Count;
-
-            var expectedRes =
-                CombineStringsTask.CombineStrings(Enumerable.Range(0, nodeCount).Select(x => arg.ToString()));
-
-            Assert.AreEqual(expectedRes, jobResult.InnerXml);
-        }
-
-        /// <summary>
-        /// Tests custom serialization binder.
-        /// </summary>
-        [Test]
-        public void TestSerializationBinder()
-        {
-            const int count = 50;
-
-            var cache = Ignition.GetIgnite(GridName).GetCache<int, object>("local");
-
-            // Put multiple objects from muliple same-named assemblies to cache
-            for (var i = 0; i < count; i++)
-            {
-                dynamic val = Activator.CreateInstance(GenerateDynamicType());
-                
-                val.Id = i;
-                val.Name = "Name_" + i;
-
-                cache.Put(i, val);
-            }
-
-            // Verify correct deserialization
-            for (var i = 0; i < count; i++)
-            {
-                dynamic val = cache.Get(i);
-
-                Assert.AreEqual(val.Id, i);
-                Assert.AreEqual(val.Name, "Name_" + i);
-            }
-        }
-
-        /// <summary>
-        /// Generates a Type in runtime, puts it into a dynamic assembly.
-        /// </summary>
-        /// <returns></returns>
-        public static Type GenerateDynamicType()
-        {
-            var asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
-                new AssemblyName("GridSerializationTestDynamicAssembly"), AssemblyBuilderAccess.Run);
-
-            var moduleBuilder = asmBuilder.DefineDynamicModule("GridSerializationTestDynamicModule");
-
-            var typeBuilder = moduleBuilder.DefineType("GridSerializationTestDynamicType",
-                TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Serializable);
-
-            typeBuilder.DefineField("Id", typeof (int), FieldAttributes.Public);
-            
-            typeBuilder.DefineField("Name", typeof (string), FieldAttributes.Public);
-
-            return typeBuilder.CreateType();
-        }
-    }
-
-    [Serializable]
-    [DataContract]
-    public sealed class SerializableXmlDoc : XmlDocument, ISerializable
-    {
-        /// <summary>
-        /// Default ctor.
-        /// </summary>
-        public SerializableXmlDoc()
-        {
-            // No-op
-        }
-
-        /// <summary>
-        /// Serialization ctor.
-        /// </summary>
-        private SerializableXmlDoc(SerializationInfo info, StreamingContext context)
-        {
-            LoadXml(info.GetString("xmlDocument"));
-        }
-
-        /** <inheritdoc /> */
-        public void GetObjectData(SerializationInfo info, StreamingContext context)
-        {
-            info.AddValue("xmlDocument", OuterXml, typeof(string));
-        }
-    }
-
-    [Serializable]
-    public class CombineStringsTask : IComputeTask<object, string, SerializableXmlDoc>
-    {
-        public IDictionary<IComputeJob<string>, IClusterNode> Map(IList<IClusterNode> subgrid, object arg)
-        {
-            return subgrid.ToDictionary(x => (IComputeJob<string>) new ToStringJob {Arg = arg}, x => x);
-        }
-
-        public ComputeJobResultPolicy OnResult(IComputeJobResult<string> res, IList<IComputeJobResult<string>> rcvd)
-        {
-            return ComputeJobResultPolicy.Wait;
-        }
-
-        public SerializableXmlDoc Reduce(IList<IComputeJobResult<string>> results)
-        {
-            var result = new SerializableXmlDoc();
-
-            result.LoadXml(CombineStrings(results.Select(x => x.Data)));
-
-            return result;
-        }
-
-        public static string CombineStrings(IEnumerable<string> strings)
-        {
-            var text = string.Concat(strings.Select(x => string.Format("<val>{0}</val>", x)));
-
-            return string.Format("<document>{0}</document>", text);
-        }
-    }
-
-    [Serializable]
-    public class ToStringJob : IComputeJob<string>
-    {
-        /// <summary>
-        /// Job argument.
-        /// </summary>
-        public object Arg { get; set; }
-
-        /** <inheritdoc /> */
-        public string Execute()
-        {
-            return Arg.ToString();
-        }
-
-        /** <inheritdoc /> */
-        public void Cancel()
-        {
-            // No-op.
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
index dcb5393..eb6192d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
@@ -110,8 +110,13 @@ namespace Apache.Ignite.Core.Tests.Services
             Assert.IsNull(_svc.ObjProp);
 
             prx.ObjProp = new TestClass {Prop = "prop2"};
-            Assert.AreEqual("prop2", ((TestClass)prx.ObjProp).Prop);
-            Assert.AreEqual("prop2", ((TestClass)_svc.ObjProp).Prop);
+
+            var propVal = KeepBinary
+                ? ((IBinaryObject) prx.ObjProp).Deserialize<TestClass>().Prop
+                : ((TestClass) prx.ObjProp).Prop;
+
+            Assert.AreEqual("prop2", propVal);
+            Assert.AreEqual("prop2", ((TestClass) _svc.ObjProp).Prop);
         }
 
         /// <summary>
@@ -191,10 +196,19 @@ namespace Apache.Ignite.Core.Tests.Services
             var prx = GetProxy();
 
             var err = Assert.Throws<ServiceInvocationException>(prx.ExceptionMethod);
-            Assert.AreEqual("Expected exception", err.InnerException.Message);
 
-            var ex = Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionMethod());
-            Assert.IsTrue(ex.ToString().Contains("+CustomException"));
+            if (KeepBinary)
+            {
+                Assert.IsNotNull(err.BinaryCause);
+                Assert.AreEqual("Expected exception", err.BinaryCause.Deserialize<Exception>().Message);
+            }
+            else
+            {
+                Assert.IsNotNull(err.InnerException);
+                Assert.AreEqual("Expected exception", err.InnerException.Message);
+            }
+
+            Assert.Throws<ServiceInvocationException>(() => prx.CustomExceptionMethod());
         }
 
         [Test]
@@ -243,7 +257,7 @@ namespace Apache.Ignite.Core.Tests.Services
         /// <summary>
         /// Creates the proxy.
         /// </summary>
-        protected T GetProxy<T>()
+        private T GetProxy<T>()
         {
             _svc = new TestIgniteService(Binary);
 
@@ -591,9 +605,19 @@ namespace Apache.Ignite.Core.Tests.Services
         /// <summary>
         /// Custom non-serializable exception.
         /// </summary>
-        private class CustomException : Exception
+        private class CustomException : Exception, IBinarizable
         {
-            
+            /** <inheritDoc /> */
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                throw new BinaryObjectException("Expected");
+            }
+
+            /** <inheritDoc /> */
+            public void ReadBinary(IBinaryReader reader)
+            {
+                throw new BinaryObjectException("Expected");
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 8360bf1..0bb3b7f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Discovery.Tcp;
     using Apache.Ignite.Core.Discovery.Tcp.Static;
     using Apache.Ignite.Core.Impl;
+    using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Tests.Process;
     using NUnit.Framework;
@@ -370,5 +371,15 @@ namespace Apache.Ignite.Core.Tests
             Assert.IsTrue(proc.WaitForExit(15000));
             Assert.AreEqual(0, proc.ExitCode);
         }
+
+        /// <summary>
+        /// Serializes and deserializes back an object.
+        /// </summary>
+        public static T SerializeDeserialize<T>(T obj)
+        {
+            var marsh = new Marshaller(null) {CompactFooter = false};
+
+            return marsh.Unmarshal<T>(marsh.Marshal(obj));
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 333b9bc..2a174eb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -186,11 +186,12 @@
     <Compile Include="Common\IgniteFutureCancelledException.cs" />
     <Compile Include="Common\IgniteGuid.cs" />
     <Compile Include="Common\Package-Info.cs" />
-    <Compile Include="Impl\Binary\DateTimeSerializer.cs" />
     <Compile Include="Impl\Binary\IO\IBinaryStreamProcessor.cs" />
     <Compile Include="Impl\Binary\Metadata\BinaryField.cs" />
     <Compile Include="Impl\Binary\SerializableSerializer.cs" />
     <Compile Include="Impl\Binary\BinaryWriterExtensions.cs" />
+    <Compile Include="Impl\Binary\DeserializationCallbackProcessor.cs" />
+    <Compile Include="Impl\Binary\ReflectionUtils.cs" />
     <Compile Include="Cache\Affinity\AffinityFunctionBase.cs" />
     <Compile Include="Impl\Cache\Store\CacheStore.cs" />
     <Compile Include="Impl\Cache\Store\ICacheStoreInternal.cs" />
@@ -319,6 +320,7 @@
     <Compile Include="Impl\Common\CopyOnWriteConcurrentDictionary.cs" />
     <Compile Include="Impl\Common\DelegateConverter.cs" />
     <Compile Include="Impl\Common\DelegateTypeDescriptor.cs" />
+    <Compile Include="Impl\Common\SerializableTypeDescriptor.cs" />
     <Compile Include="Impl\Events\EventTypeConverter.cs" />
     <Compile Include="Impl\Common\Fnv1Hash.cs" />
     <Compile Include="Impl\Common\Future.cs" />
@@ -385,11 +387,9 @@
     <Compile Include="Impl\Messaging\MessageListenerHolder.cs" />
     <Compile Include="Impl\Messaging\Messaging.cs" />
     <Compile Include="Impl\NativeMethods.cs" />
-    <Compile Include="Impl\Binary\DateTimeHolder.cs" />
     <Compile Include="Impl\Binary\IO\IBinaryStream.cs" />
     <Compile Include="Impl\Binary\IO\BinaryStreamBase.cs" />
     <Compile Include="Impl\Binary\IO\BinaryHeapStream.cs" />
-    <Compile Include="Impl\Binary\IO\BinaryStreamAdapter.cs" />
     <Compile Include="Impl\Binary\IBinaryTypeDescriptor.cs" />
     <Compile Include="Impl\Binary\IBinaryWriteAware.cs" />
     <Compile Include="Impl\Binary\Metadata\IBinaryTypeHandler.cs" />
@@ -419,7 +419,6 @@
     <Compile Include="Impl\Binary\BinaryObject.cs" />
     <Compile Include="Impl\Binary\BinaryUtils.cs" />
     <Compile Include="Impl\Binary\BinaryWriter.cs" />
-    <Compile Include="Impl\Binary\SerializableObjectHolder.cs" />
     <Compile Include="Impl\Binary\Structure\BinaryStructure.cs" />
     <Compile Include="Impl\Binary\Structure\BinaryStructureEntry.cs" />
     <Compile Include="Impl\Binary\Structure\BinaryStructureJumpTable.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 29d2ee3..4f48ea5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -235,6 +235,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
         /// <param name="reader">The reader.</param>
         internal CacheConfiguration(IBinaryRawReader reader)
         {
+            // Make sure system marshaller is used.
+            Debug.Assert(((BinaryReader) reader).Marshaller == BinaryUtils.Marshaller);
+
             AtomicityMode = (CacheAtomicityMode) reader.ReadInt();
             AtomicWriteOrderMode = (CacheAtomicWriteOrderMode) reader.ReadInt();
             Backups = reader.ReadInt();
@@ -297,6 +300,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
         /// <param name="writer">The writer.</param>
         internal void Write(IBinaryRawWriter writer)
         {
+            // Make sure system marshaller is used.
+            Debug.Assert(((BinaryWriter) writer).Marshaller == BinaryUtils.Marshaller);
+
             writer.WriteInt((int) AtomicityMode);
             writer.WriteInt((int) AtomicWriteOrderMode);
             writer.WriteInt(Backups);
@@ -740,7 +746,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
         public IAffinityFunction AffinityFunction { get; set; }
 
         /// <summary>
-        /// Gets or sets the factory for <see cref="IExpiryPolicy"/> to be used for all cache operations, 
+        /// Gets or sets the factory for <see cref="IExpiryPolicy"/> to be used for all cache operations,
         /// unless <see cref="ICache{TK,TV}.WithExpiryPolicy"/> is called.
         /// <para />
         /// Default is null, which means no expiration.

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index d3bd50c..28842e9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -159,7 +159,7 @@
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
             {
-                var marsh = new Marshaller(configuration.BinaryConfiguration);
+                var marsh = BinaryUtils.Marshaller;
 
                 configuration.Write(marsh.StartMarshal(stream));
 
@@ -276,15 +276,26 @@
 
                 // Send only descriptors with non-null EqualityComparer to preserve old behavior where
                 // remote nodes can have no BinaryConfiguration.
-                var types = writer.Marshaller.GetUserTypeDescriptors().Where(x => x.EqualityComparer != null).ToList();
 
-                writer.WriteInt(types.Count);
+                if (BinaryConfiguration.TypeConfigurations != null &&
+                    BinaryConfiguration.TypeConfigurations.Any(x => x.EqualityComparer != null))
+                {
+                    // Create a new marshaller to reuse type name resolver mechanism.
+                    var types = new Marshaller(BinaryConfiguration).GetUserTypeDescriptors()
+                        .Where(x => x.EqualityComparer != null).ToList();
+
+                    writer.WriteInt(types.Count);
 
-                foreach (var type in types)
+                    foreach (var type in types)
+                    {
+                        writer.WriteString(BinaryUtils.SimpleTypeName(type.TypeName));
+                        writer.WriteBoolean(type.IsEnum);
+                        BinaryEqualityComparerSerializer.Write(writer, type.EqualityComparer);
+                    }
+                }
+                else
                 {
-                    writer.WriteString(BinaryUtils.SimpleTypeName(type.TypeName));
-                    writer.WriteBoolean(type.IsEnum);
-                    BinaryEqualityComparerSerializer.Write(writer, type.EqualityComparer);
+                    writer.WriteInt(0);
                 }
             }
             else

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
index 1190c14..f590794 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -359,11 +359,11 @@ namespace Apache.Ignite.Core
             if (cfg.BinaryConfiguration == null)
                 cfg.BinaryConfiguration = binaryCfg;
 
-            _startup.Marshaller = new Marshaller(cfg.BinaryConfiguration);
+            _startup.Marshaller = new Marshaller(cfg.BinaryConfiguration, log);
 
             // 3. Send configuration details to Java
             cfg.Validate(log);
-            cfg.Write(_startup.Marshaller.StartMarshal(outStream));
+            cfg.Write(BinaryUtils.Marshaller.StartMarshal(outStream));  // Use system marshaller.
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarizableSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarizableSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarizableSerializer.cs
index dcb261f..2273a93 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarizableSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarizableSerializer.cs
@@ -17,7 +17,6 @@
 
 namespace Apache.Ignite.Core.Impl.Binary
 {
-    using System;
     using System.Runtime.Serialization;
     using Apache.Ignite.Core.Binary;
 
@@ -39,9 +38,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /** <inheritdoc /> */
-        public T ReadBinary<T>(BinaryReader reader, Type type, int pos)
+        public T ReadBinary<T>(BinaryReader reader, IBinaryTypeDescriptor desc, int pos)
         {
-            var obj = (T) FormatterServices.GetUninitializedObject(type);
+            var obj = (T) FormatterServices.GetUninitializedObject(desc.Type);
 
             reader.AddHandle(pos, obj);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
index d88e7a9..6a911ad 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
@@ -62,7 +62,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         private volatile BinaryStructure _readerTypeStructure = BinaryStructure.CreateEmpty();
         
         /** Type schema. */
-        private readonly BinaryObjectSchema _schema = new BinaryObjectSchema();
+        private readonly BinaryObjectSchema _schema;
 
         /** Enum flag. */
         private readonly bool _isEnum;
@@ -70,6 +70,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Comparer. */
         private readonly IBinaryEqualityComparer _equalityComparer;
 
+        /** Register flag. */
+        private readonly bool _isRegistered;
+
         /// <summary>
         /// Constructor.
         /// </summary>
@@ -84,6 +87,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="affKeyFieldName">Affinity field key name.</param>
         /// <param name="isEnum">Enum flag.</param>
         /// <param name="comparer">Equality comparer.</param>
+        /// <param name="isRegistered">Registered flag.</param>
         public BinaryFullTypeDescriptor(
             Type type, 
             int typeId, 
@@ -94,8 +98,9 @@ namespace Apache.Ignite.Core.Impl.Binary
             IBinarySerializerInternal serializer, 
             bool keepDeserialized, 
             string affKeyFieldName,
-            bool isEnum, 
-            IEqualityComparer<IBinaryObject> comparer)
+            bool isEnum,
+            IEqualityComparer<IBinaryObject> comparer,
+            bool isRegistered = true)
         {
             _type = type;
             _typeId = typeId;
@@ -114,6 +119,38 @@ namespace Apache.Ignite.Core.Impl.Binary
                 throw new IgniteException(string.Format("Unsupported IEqualityComparer<IBinaryObject> " +
                                                         "implementation: {0}. Only predefined implementations " +
                                                         "are supported.", comparer.GetType()));
+
+            _isRegistered = isRegistered;
+            _schema = new BinaryObjectSchema();
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BinaryFullTypeDescriptor"/> class,
+        /// copying values from specified descriptor.
+        /// </summary>
+        /// <param name="desc">The descriptor to copy from.</param>
+        /// <param name="type">Type.</param>
+        /// <param name="serializer">Serializer.</param>
+        /// <param name="isRegistered">Registered flag.</param>
+        public BinaryFullTypeDescriptor(BinaryFullTypeDescriptor desc, Type type,
+            IBinarySerializerInternal serializer, bool isRegistered)
+        {
+            _type = type;
+            _typeId = desc._typeId;
+            _typeName = desc._typeName;
+            _userType = desc._userType;
+            _nameMapper = desc._nameMapper;
+            _idMapper = desc._idMapper;
+            _serializer = serializer;
+            _keepDeserialized = desc._keepDeserialized;
+            _affKeyFieldName = desc._affKeyFieldName;
+            _isEnum = desc._isEnum;
+            _equalityComparer = desc._equalityComparer;
+            _isRegistered = isRegistered;
+
+            _schema = desc._schema;
+            _writerTypeStruct = desc._writerTypeStruct;
+            _readerTypeStructure = desc._readerTypeStructure;
         }
 
         /// <summary>
@@ -237,5 +274,11 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             get { return _schema; }
         }
+
+        /** <inheritDoc /> */
+        public bool IsRegistered
+        {
+            get { return _isRegistered; }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index e77cbae..e4fb10a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -676,6 +676,9 @@ namespace Apache.Ignite.Core.Impl.Binary
                                 ? BinaryObjectHeader.Flag.UserType
                                 : BinaryObjectHeader.Flag.None;
 
+                            if (inHeader.IsCustomDotNetType)
+                                flags |= BinaryObjectHeader.Flag.CustomDotNetType;
+
                             // Write raw data.
                             int outRawOff = outStream.Position - outStartPos;
 
@@ -936,8 +939,6 @@ namespace Apache.Ignite.Core.Impl.Binary
                 case BinaryUtils.TypeArrayString:
                 case BinaryUtils.TypeArrayGuid:
                 case BinaryUtils.TypeArrayTimestamp:
-                case BinaryUtils.TypeArrayEnum:
-                case BinaryUtils.TypeArray:
                     int arrLen = inStream.ReadInt();
 
                     outStream.WriteInt(arrLen);
@@ -947,6 +948,28 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     break;
 
+                case BinaryUtils.TypeArrayEnum:
+                case BinaryUtils.TypeArray:
+                    int type = inStream.ReadInt();
+
+                    outStream.WriteInt(type);
+
+                    if (type == BinaryUtils.TypeUnregistered)
+                    {
+                        outStream.WriteByte(inStream.ReadByte());  // String header.
+
+                        BinaryUtils.WriteString(BinaryUtils.ReadString(inStream), outStream);  // String data.
+                    }
+
+                    arrLen = inStream.ReadInt();
+
+                    outStream.WriteInt(arrLen);
+
+                    for (int i = 0; i < arrLen; i++)
+                        Mutate0(ctx, inStream, outStream, false, EmptyVals);
+
+                    break;
+
                 case BinaryUtils.TypeCollection:
                     int colLen = inStream.ReadInt();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
index 636b177..0f0fafe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
@@ -58,7 +58,10 @@ namespace Apache.Ignite.Core.Impl.Binary
             OffsetTwoBytes  = 0x10,
 
             /** Flag: compact footer, no field IDs. */
-            CompactFooter   = 0x20
+            CompactFooter   = 0x20,
+
+            /** Flag: raw data contains .NET type information. */
+            CustomDotNetType   = 0x40
         }
 
         /** Actual header layout */
@@ -164,6 +167,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /// <summary>
+        /// Gets the custom .NET type flag.
+        /// </summary>
+        public bool IsCustomDotNetType
+        {
+            get { return (Flags & Flag.CustomDotNetType) == Flag.CustomDotNetType; }
+        }
+
+        /// <summary>
         /// Gets the size of the schema field offset (1, 2 or 4 bytes).
         /// </summary>
         public int SchemaFieldOffsetSize

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
index f1d2f6a..e2f9ea7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
@@ -249,6 +249,8 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             if (fieldIds == null)
             {
+                Debug.Assert(hdr.TypeId != BinaryUtils.TypeUnregistered);
+
                 if (marsh.Ignite != null)
                     fieldIds = marsh.Ignite.BinaryProcessor.GetSchema(hdr.TypeId, hdr.SchemaId);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
index f5bc370..555a042 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
@@ -17,6 +17,7 @@
 
 namespace Apache.Ignite.Core.Impl.Binary
 {
+    using System;
     using System.Collections.Generic;
     using System.Diagnostics;
     using Apache.Ignite.Core.Binary;
@@ -36,7 +37,9 @@ namespace Apache.Ignite.Core.Impl.Binary
             GetMeta = 1,
             GetAllMeta = 2,
             PutMeta = 3,
-            GetSchema = 4
+            GetSchema = 4,
+            RegisterType = 5,
+            GetType = 6
         }
 
         /// <summary>
@@ -101,7 +104,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Put binary types to Grid.
         /// </summary>
         /// <param name="types">Binary types.</param>
-        internal void PutBinaryTypes(ICollection<BinaryType> types)
+        public void PutBinaryTypes(ICollection<BinaryType> types)
         {
             DoOutOp((int) Op.PutMeta, w =>
             {
@@ -153,5 +156,36 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             Marshaller.OnBinaryTypesSent(types);
         }
+
+        /// <summary>
+        /// Registers the type.
+        /// </summary>
+        /// <param name="id">The identifier.</param>
+        /// <param name="type">The type.</param>
+        /// <returns>True if registration succeeded; otherwise, false.</returns>
+        public bool RegisterType(int id, Type type)
+        {
+            Debug.Assert(type != null);
+            Debug.Assert(id != BinaryUtils.TypeUnregistered);
+
+            return DoOutOp((int) Op.RegisterType, w =>
+            {
+                w.WriteInt(id);
+                w.WriteString(type.AssemblyQualifiedName);
+            }) == True;
+        }
+
+        /// <summary>
+        /// Gets the type by id.
+        /// </summary>
+        /// <param name="id">The identifier.</param>
+        /// <returns>Type or null.</returns>
+        public Type GetType(int id)
+        {
+            var typeName = DoOutInOp((int) Op.GetType, w => w.WriteInt(id),
+                r => Marshaller.StartUnmarshal(r).ReadString());
+
+            return new TypeResolver().ResolveType(typeName);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 092eb72..49bab77 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System;
     using System.Collections;
     using System.Collections.Generic;
+    using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
     using System.IO;
     using Apache.Ignite.Core.Binary;
@@ -79,6 +80,14 @@ namespace Apache.Ignite.Core.Impl.Binary
             get { return _marsh; }
         }
 
+        /// <summary>
+        /// Gets the mode.
+        /// </summary>
+        public BinaryMode Mode
+        {
+            get { return _mode; }
+        }
+
         /** <inheritdoc /> */
         public IBinaryRawReader GetRawReader()
         {
@@ -572,6 +581,14 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             throw new BinaryObjectException("Invalid header on deserialization [pos=" + pos + ", hdr=" + hdr + ']');
         }
+                
+        /// <summary>
+        /// Gets the flag indicating that there is custom type information in raw region.
+        /// </summary>
+        public bool GetCustomTypeDataFlag()
+        {
+            return _frame.Hdr.IsCustomDotNetType;
+        }
 
         /// <summary>
         /// Reads the binary object.
@@ -676,7 +693,9 @@ namespace Apache.Ignite.Core.Impl.Binary
                 else
                 {
                     // Find descriptor.
-                    var desc = _marsh.GetDescriptor(hdr.IsUserType, hdr.TypeId);
+                    var desc = hdr.TypeId == BinaryUtils.TypeUnregistered
+                        ? _marsh.GetDescriptor(Type.GetType(ReadString(), true))
+                        : _marsh.GetDescriptor(hdr.IsUserType, hdr.TypeId, true);
 
                     // Instantiate object. 
                     if (desc.Type == null)
@@ -707,7 +726,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                     _frame.Raw = false;
 
                     // Read object.
-                    var obj = desc.Serializer.ReadBinary<T>(this, desc.Type, pos);
+                    var obj = desc.Serializer.ReadBinary<T>(this, desc, pos);
 
                     _frame.Struct.UpdateReaderStructure();
 
@@ -758,8 +777,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                 // Get schema from Java
                 var ignite = Marshaller.Ignite;
 
-                var schema = ignite == null 
-                    ? null 
+                Debug.Assert(typeId != BinaryUtils.TypeUnregistered);
+
+                var schema = ignite == null
+                    ? null
                     : ignite.BinaryProcessor.GetSchema(_frame.Hdr.TypeId, _frame.Hdr.SchemaId);
 
                 if (schema == null)
@@ -850,6 +871,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /// <summary>
+        /// Seeks to raw data.
+        /// </summary>
+        internal void SeekToRaw()
+        {
+            Stream.Seek(_frame.Pos + _frame.Hdr.GetRawOffset(Stream, _frame.Pos), SeekOrigin.Begin);
+        }
+
+        /// <summary>
         /// Mark current output as raw. 
         /// </summary>
         private void MarkRaw()
@@ -858,7 +887,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 _frame.Raw = true;
 
-                Stream.Seek(_frame.Pos + _frame.Hdr.GetRawOffset(Stream, _frame.Pos), SeekOrigin.Begin);
+                SeekToRaw();
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
index 795f8ac..907b465 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
@@ -722,7 +722,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             // Assign field value
             var targetParam = Expression.Parameter(typeof(object));
-            var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
+            var targetParamConverted = Expression.Convert(targetParam, typeof(object));
             var assignExpr = Expression.Call(DelegateConverter.GetWriteFieldMethod(field), targetParamConverted, 
                 readExpr);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
index c9fd3cc..e160559 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveSerializerInternal.cs
@@ -20,19 +20,17 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System;
     using System.Collections.Generic;
     using System.Diagnostics;
+    using System.Linq;
     using System.Reflection;
     using System.Runtime.Serialization;
     using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Internal reflective serializer.
     /// </summary>
     internal sealed class BinaryReflectiveSerializerInternal : IBinarySerializerInternal
     {
-        /** Cached binding flags. */
-        private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public |
-                                           BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
-
         /** Raw mode flag. */
         private readonly bool _rawMode;
 
@@ -42,6 +40,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Read actions to be performed. */
         private readonly BinaryReflectiveReadAction[] _rActions;
 
+        /** Callback type descriptor. */
+        private readonly SerializableTypeDescriptor _serializableDescriptor;
+
         /// <summary>
         /// Initializes a new instance of the <see cref="BinaryReflectiveSerializer"/> class.
         /// </summary>
@@ -53,36 +54,64 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Initializes a new instance of the <see cref="BinaryReflectiveSerializer"/> class.
         /// </summary>
-        private BinaryReflectiveSerializerInternal(BinaryReflectiveWriteAction[] wActions, BinaryReflectiveReadAction[] rActions, bool raw)
+        private BinaryReflectiveSerializerInternal(BinaryReflectiveWriteAction[] wActions, 
+            BinaryReflectiveReadAction[] rActions, bool raw, SerializableTypeDescriptor serializableDescriptor)
         {
             Debug.Assert(wActions != null);
             Debug.Assert(rActions != null);
+            Debug.Assert(serializableDescriptor != null);
 
             _wActions = wActions;
             _rActions = rActions;
             _rawMode = raw;
+            _serializableDescriptor = serializableDescriptor;
         }
 
         /** <inheritdoc /> */
         void IBinarySerializerInternal.WriteBinary<T>(T obj, BinaryWriter writer)
         {
             Debug.Assert(_wActions != null);
+            Debug.Assert(writer != null);
+
+            var ctx = GetStreamingContext(writer);
+
+            _serializableDescriptor.OnSerializing(obj, ctx);
 
             foreach (var action in _wActions)
                 action(obj, writer);
+
+            _serializableDescriptor.OnSerialized(obj, ctx);
         }
 
         /** <inheritdoc /> */
-        T IBinarySerializerInternal.ReadBinary<T>(BinaryReader reader, Type type, int pos)
+        T IBinarySerializerInternal.ReadBinary<T>(BinaryReader reader, IBinaryTypeDescriptor desc, int pos)
         {
             Debug.Assert(_rActions != null);
+            Debug.Assert(reader != null);
+            Debug.Assert(desc != null);
+
+            var obj = FormatterServices.GetUninitializedObject(desc.Type);
+
+            var ctx = GetStreamingContext(reader);
+
+            _serializableDescriptor.OnDeserializing(obj, ctx);
 
-            var obj = FormatterServices.GetUninitializedObject(type);
+            DeserializationCallbackProcessor.Push(obj);
 
-            reader.AddHandle(pos, obj);
+            try
+            {
+                reader.AddHandle(pos, obj);
+
+                foreach (var action in _rActions)
+                    action(obj, reader);
 
-            foreach (var action in _rActions)
-                action(obj, reader);
+                _serializableDescriptor.OnDeserialized(obj, ctx);
+
+            }
+            finally
+            {
+                DeserializationCallbackProcessor.Pop();
+            }
 
             return (T) obj;
         }
@@ -103,20 +132,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             Debug.Assert(_wActions == null && _rActions == null);
 
-            List<FieldInfo> fields = new List<FieldInfo>();
-
-            Type curType = type;
-
-            while (curType != null)
-            {
-                foreach (FieldInfo field in curType.GetFields(Flags))
-                {
-                    if (!field.IsNotSerialized)
-                        fields.Add(field);
-                }
-
-                curType = curType.BaseType;
-            }
+            var fields = ReflectionUtils.GetAllFields(type).Where(x => !x.IsNotSerialized).ToList();
 
             IDictionary<int, string> idMap = new Dictionary<int, string>();
 
@@ -152,7 +168,9 @@ namespace Apache.Ignite.Core.Impl.Binary
                 rActions[i] = readAction;
             }
 
-            return new BinaryReflectiveSerializerInternal(wActions, rActions, _rawMode);
+            var serDesc = SerializableTypeDescriptor.Get(type);
+
+            return new BinaryReflectiveSerializerInternal(wActions, rActions, _rawMode, serDesc);
         }
 
         /// <summary>
@@ -165,5 +183,21 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             return string.Compare(name1, name2, StringComparison.OrdinalIgnoreCase);
         }
+                
+        /// <summary>
+        /// Gets the streaming context.
+        /// </summary>
+        private static StreamingContext GetStreamingContext(IBinaryReader reader)
+        {
+            return new StreamingContext(StreamingContextStates.All, reader);
+        }
+
+        /// <summary>
+        /// Gets the streaming context.
+        /// </summary>
+        private static StreamingContext GetStreamingContext(IBinaryWriter writer)
+        {
+            return new StreamingContext(StreamingContextStates.All, writer);
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index adba577..8c7e5e9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 {
     using System;
     using System.Collections.Generic;
+    using System.Diagnostics;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.Structure;
 
@@ -51,10 +52,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         /// <param name="cfg">Configuration.</param>
         /// <param name="id">Type ID.</param>
-        public BinarySurrogateTypeDescriptor(BinaryConfiguration cfg, int id)
+        /// <param name="typeName">Name of the type.</param>
+        public BinarySurrogateTypeDescriptor(BinaryConfiguration cfg, int id, string typeName)
         {
+            Debug.Assert(cfg != null);
+
             _cfg = cfg;
             _id = id;
+            _name = typeName;
         }
 
         /// <summary>
@@ -170,5 +175,11 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             get { return _schema; }
         }
+
+        /** <inheritDoc /> */
+        public bool IsRegistered
+        {
+            get { return false; }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index beb2668..60bbb46 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -22,7 +22,6 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
-    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Common;
 
@@ -169,8 +168,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                 var handler = FindWriteHandler(t, out supportsHandles);
 
-                return handler == null ? null : new BinarySystemWriteHandler(handler, supportsHandles, 
-                    handler == WriteSerializable);
+                return handler == null ? null : new BinarySystemWriteHandler(handler, supportsHandles);
             });
         }
 
@@ -191,8 +189,6 @@ namespace Apache.Ignite.Core.Impl.Binary
                 return WriteString;
             if (type == typeof(decimal))
                 return WriteDecimal;
-            if (type == typeof(DateTime))
-                return WriteDate;
             if (type == typeof(Guid))
                 return WriteGuid;
             if (type == typeof (BinaryObject))
@@ -251,16 +247,11 @@ namespace Apache.Ignite.Core.Impl.Binary
                 // Enums.
                 if (elemType.IsEnum || elemType == typeof(BinaryEnum))
                     return WriteEnumArray;
-                
+
                 // Object array.
-                if (elemType == typeof (object) || elemType == typeof (IBinaryObject) ||
-                    elemType == typeof (BinaryObject))
-                    return WriteArray;
+                return WriteArray;
             }
 
-            if (type.IsSerializable)
-                return WriteSerializable;
-
             return null;
         }
 
@@ -315,16 +306,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
         
         /// <summary>
-        /// Write date.
-        /// </summary>
-        /// <param name="ctx">Context.</param>
-        /// <param name="obj">Value.</param>
-        private static void WriteDate(BinaryWriter ctx, object obj)
-        {
-            ctx.Write(new DateTimeHolder((DateTime) obj));
-        }
-        
-        /// <summary>
         /// Write string.
         /// </summary>
         /// <param name="ctx">Context.</param>
@@ -535,21 +516,17 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             ctx.Stream.WriteByte(BinaryUtils.TypeArrayEnum);
 
-            var desc = ctx.Marshaller.GetDescriptor(obj.GetType());
-
-            int typeId = desc == null ? BinaryUtils.ObjTypeId : desc.TypeId;
-
-            BinaryUtils.WriteArray((Array)obj, ctx, typeId);
+            BinaryUtils.WriteArray((Array) obj, ctx);
         }
 
-        /**
-         * <summary>Write array.</summary>
-         */
+        /// <summary>
+        /// Writes the array.
+        /// </summary>
         private static void WriteArray(BinaryWriter ctx, object obj)
         {
             ctx.Stream.WriteByte(BinaryUtils.TypeArray);
 
-            BinaryUtils.WriteArray((Array)obj, ctx);
+            BinaryUtils.WriteArray((Array) obj, ctx);
         }
 
         /**
@@ -603,16 +580,6 @@ namespace Apache.Ignite.Core.Impl.Binary
             ctx.WriteInt(binEnum.EnumValue);
         }
 
-        /// <summary>
-        /// Writes serializable.
-        /// </summary>
-        /// <param name="writer">The writer.</param>
-        /// <param name="o">The object.</param>
-        private static void WriteSerializable(BinaryWriter writer, object o)
-        {
-            writer.Write(new SerializableObjectHolder(o));
-        }
-
         /**
          * <summary>Read enum array.</summary>
          */
@@ -623,13 +590,36 @@ namespace Apache.Ignite.Core.Impl.Binary
             return BinaryUtils.ReadTypedArray(ctx, true, elemType);
         }
 
-        /**
-         * <summary>Read array.</summary>
-         */
+        /// <summary>
+        /// Reads the array.
+        /// </summary>
         private static object ReadArray(BinaryReader ctx, Type type)
         {
-            var elemType = type.GetElementType() ?? typeof(object);
+            var elemType = type.GetElementType();
+
+            if (elemType == null)
+            {
+                if (ctx.Mode == BinaryMode.ForceBinary)
+                {
+                    // Forced binary mode: use object because primitives are not represented as IBinaryObject.
+                    elemType = typeof(object);
+                }
+                else
+                {
+                    // Infer element type from typeId.
+                    var typeId = ctx.ReadInt();
+
+                    if (typeId != BinaryUtils.ObjTypeId)
+                    {
+                        elemType = ctx.Marshaller.GetDescriptor(true, typeId, true).Type;
+                    }
+
+                    return BinaryUtils.ReadTypedArray(ctx, false, elemType ?? typeof(object));
+                }
+            }
 
+            // Element type is known, no need to check typeId.
+            // In case of incompatible types we'll get exception either way.
             return BinaryUtils.ReadTypedArray(ctx, true, elemType);
         }
 
@@ -798,23 +788,17 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** */
         private readonly bool _supportsHandles;
 
-        /** */
-        private readonly bool _isSerializable;
-
         /// <summary>
         /// Initializes a new instance of the <see cref="BinarySystemWriteHandler" /> class.
         /// </summary>
         /// <param name="writeAction">The write action.</param>
         /// <param name="supportsHandles">Handles flag.</param>
-        /// <param name="isSerializable">Determines whether this handler writes objects as serializable.</param>
-        public BinarySystemWriteHandler(Action<BinaryWriter, object> writeAction, bool supportsHandles, 
-            bool isSerializable)
+        public BinarySystemWriteHandler(Action<BinaryWriter, object> writeAction, bool supportsHandles)
         {
             Debug.Assert(writeAction != null);
 
             _writeAction = writeAction;
             _supportsHandles = supportsHandles;
-            _isSerializable = isSerializable;
         }
 
         /// <summary>
@@ -834,13 +818,5 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             get { return _supportsHandles; }
         }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether this handler writes objects as serializable
-        /// </summary>
-        public bool IsSerializable
-        {
-            get { return _isSerializable; }
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemTypeSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemTypeSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemTypeSerializer.cs
index b416848..1ea1f0b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemTypeSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemTypeSerializer.cs
@@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /** <inheritDoc /> */
-        public T1 ReadBinary<T1>(BinaryReader reader, Type type, int pos)
+        public T1 ReadBinary<T1>(BinaryReader reader, IBinaryTypeDescriptor desc, int pos)
         {
             return TypeCaster<T1>.Cast(_ctor(reader));
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 2050f67..bb58ea5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -52,6 +52,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Type: object. */
         public const byte TypeObject = HdrFull;
 
+        /** Type: unregistered. */
+        public const byte TypeUnregistered = 0;
+
         /** Type: unsigned byte. */
         public const byte TypeByte = 1;
 
@@ -166,12 +169,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Type: Compute job wrapper. */
         public const byte TypeComputeJobWrapper = 86;
 
-        /** Type: Serializable wrapper. */
-        public const byte TypeSerializableHolder = 87;
-
-        /** Type: DateTime wrapper. */
-        public const byte TypeDateTimeHolder = 93;
-
         /** Type: action wrapper. */
         public const byte TypeComputeActionJob = 88;
 
@@ -235,8 +232,12 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Bindig flags for static search. */
         private const BindingFlags BindFlagsStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
 
-        /** Default poratble marshaller. */
-        private static readonly Marshaller Marsh = new Marshaller(null);
+        /** System marshaller. */
+        private static readonly Marshaller Marsh = new Marshaller(
+            new BinaryConfiguration {CompactFooter = false})
+        {
+            RegistrationDisabled = true
+        };
 
         /** Method: ReadArray. */
         public static readonly MethodInfo MtdhReadArray =
@@ -1265,14 +1266,31 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         /// <param name="val">Array.</param>
         /// <param name="ctx">Write context.</param>
-        /// <param name="elementType">Type of the array element.</param>
-        public static void WriteArray(Array val, BinaryWriter ctx, int elementType = ObjTypeId)
+        /// <param name="elemTypeId">The element type id.</param>
+        public static void WriteArray(Array val, BinaryWriter ctx, int? elemTypeId = null)
         {
             Debug.Assert(val != null && ctx != null);
 
             IBinaryStream stream = ctx.Stream;
 
-            stream.WriteInt(elementType);
+            if (elemTypeId != null && elemTypeId != TypeUnregistered)
+            {
+                stream.WriteInt(elemTypeId.Value);
+            }
+            else
+            {
+                var elemType = val.GetType().GetElementType();
+
+                var typeId = ObjTypeId;
+
+                if (elemType != typeof(object))
+                    typeId = ctx.Marshaller.GetDescriptor(elemType).TypeId;
+
+                stream.WriteInt(typeId);
+
+                if (typeId == TypeUnregistered)
+                    ctx.WriteString(elemType.FullName);
+            }
 
             stream.WriteInt(val.Length);
 
@@ -1313,7 +1331,12 @@ namespace Apache.Ignite.Core.Impl.Binary
             var pos = stream.Position;
 
             if (typed)
-                stream.ReadInt();
+            {
+                int typeId = stream.ReadInt();
+
+                if (typeId == TypeUnregistered)
+                    ctx.ReadString();
+            }
 
             int len = stream.ReadInt();
 
@@ -1538,7 +1561,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 var desc = marshaller.GetDescriptor(enumType);
 
-                return desc == null ? ObjTypeId : desc.TypeId;
+                return desc.TypeId;
             }
 
             throw new BinaryObjectException("Only Int32 underlying type is supported for enums: " +
@@ -1559,10 +1582,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                 return TypeCaster<T>.Cast(value);
 
             // All enums are user types
-            var desc = marsh.GetDescriptor(true, typeId);
+            var desc = marsh.GetDescriptor(true, typeId, true);
 
             if (desc == null || desc.Type == null)
-                throw new BinaryObjectException("Unknown enum type id: " + typeId);
+                return TypeCaster<T>.Cast(value);
 
             return (T)Enum.ToObject(desc.Type, value);
         }
@@ -1743,7 +1766,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         public static int FieldId(int typeId, string fieldName, IBinaryNameMapper nameMapper,
             IBinaryIdMapper idMapper)
         {
-            Debug.Assert(typeId != 0);
             Debug.Assert(fieldName != null);
 
             fieldName = ConvertFieldName(fieldName, nameMapper);

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index 0490ec8..1388d16 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -48,27 +48,12 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Metadatas collected during this write session. */
         private IDictionary<int, BinaryType> _metas;
 
-        /** Current type ID. */
-        private int _curTypeId;
-
-        /** Current name converter */
-        private IBinaryNameMapper _curConverter;
-
-        /** Current mapper. */
-        private IBinaryIdMapper _curMapper;
-        
-        /** Current object start position. */
-        private int _curPos;
-
-        /** Current raw position. */
-        private int _curRawPos;
+        /** Current stack frame. */
+        private Frame _frame;
 
         /** Whether we are currently detaching an object. */
         private bool _detaching;
 
-        /** Current type structure tracker, */
-        private BinaryStructureTracker _curStruct;
-
         /** Schema holder. */
         private readonly BinaryObjectSchemaHolder _schema = BinaryObjectSchemaHolder.Current;
 
@@ -150,7 +135,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="val">Byte value.</param>
         public void WriteByte(string fieldName, byte val)
         {
-            WriteFieldId(fieldName, BinaryUtils.TypeBool);
+            WriteFieldId(fieldName, BinaryUtils.TypeByte);
             WriteByteField(val);
         }
 
@@ -875,23 +860,13 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 var desc = _marsh.GetDescriptor(val.GetType());
 
-                if (desc != null)
-                {
-                    var metaHnd = _marsh.GetBinaryTypeHandler(desc);
+                var metaHnd = _marsh.GetBinaryTypeHandler(desc);
 
-                    _stream.WriteByte(BinaryUtils.TypeEnum);
+                _stream.WriteByte(BinaryUtils.TypeEnum);
 
-                    BinaryUtils.WriteEnum(this, val);
+                BinaryUtils.WriteEnum(this, val);
 
-                    SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
-                }
-                else
-                {
-                    // Unregistered enum, write with object type id.
-                    _stream.WriteByte(BinaryUtils.TypeEnum);
-                    _stream.WriteInt(BinaryUtils.ObjTypeId);
-                    _stream.WriteInt(TypeCaster<int>.Cast(val));
-                }
+                SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
             }
         }
 
@@ -931,9 +906,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 _stream.WriteByte(BinaryUtils.TypeArrayEnum);
 
-                var elTypeId = elementTypeId ?? BinaryUtils.GetEnumTypeId(val.GetType().GetElementType(), Marshaller);
-
-                BinaryUtils.WriteArray(val, this, elTypeId);
+                BinaryUtils.WriteArray(val, this, elementTypeId);
             }
         }
 
@@ -1089,8 +1062,8 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </returns>
         public IBinaryRawWriter GetRawWriter()
         {
-            if (_curRawPos == 0)
-                _curRawPos = _stream.Position;
+            if (_frame.RawPos == 0)
+                _frame.RawPos = _stream.Position;
 
             return this;
         }
@@ -1159,121 +1132,122 @@ namespace Apache.Ignite.Core.Impl.Binary
             if (WriteBuilderSpecials(obj))
                 return;
 
-            // Suppose that we faced normal object and perform descriptor lookup.
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
+            // Are we dealing with a well-known type?
+            var handler = BinarySystemHandlers.GetWriteHandler(type);
 
-            if (desc != null)
+            if (handler != null)
             {
-                // Writing normal object.
-                var pos = _stream.Position;
-
-                // Dealing with handles.
-                if (desc.Serializer.SupportsHandles && WriteHandle(pos, obj))
+                if (handler.SupportsHandles && WriteHandle(_stream.Position, obj))
                     return;
 
-                // Skip header length as not everything is known now
-                _stream.Seek(BinaryObjectHeader.Size, SeekOrigin.Current);
-
-                // Preserve old frame.
-                int oldTypeId = _curTypeId;
-                IBinaryNameMapper oldConverter = _curConverter;
-                IBinaryIdMapper oldMapper = _curMapper;
-                int oldRawPos = _curRawPos;
-                var oldPos = _curPos;
-                
-                var oldStruct = _curStruct;
+                handler.Write(this, obj);
 
-                // Push new frame.
-                _curTypeId = desc.TypeId;
-                _curConverter = desc.NameMapper;
-                _curMapper = desc.IdMapper;
-                _curRawPos = 0;
-                _curPos = pos;
+                return;
+            }
 
-                _curStruct = new BinaryStructureTracker(desc, desc.WriterTypeStructure);
-                var schemaIdx = _schema.PushSchema();
+            // Suppose that we faced normal object and perform descriptor lookup.
+            var desc = _marsh.GetDescriptor(type);
 
-                try
-                {
-                    // Write object fields.
-                    desc.Serializer.WriteBinary(obj, this);
-                    var dataEnd = _stream.Position;
+            // Writing normal object.
+            var pos = _stream.Position;
 
-                    // Write schema
-                    var schemaOffset = dataEnd - pos;
+            // Dealing with handles.
+            if (desc.Serializer.SupportsHandles && WriteHandle(pos, obj))
+                return;
 
-                    int schemaId;
-                    
-                    var flags = desc.UserType
-                        ? BinaryObjectHeader.Flag.UserType
-                        : BinaryObjectHeader.Flag.None;
+            // Skip header length as not everything is known now
+            _stream.Seek(BinaryObjectHeader.Size, SeekOrigin.Current);
 
-                    if (Marshaller.CompactFooter && desc.UserType)
-                        flags |= BinaryObjectHeader.Flag.CompactFooter;
+            // Write type name for unregistered types
+            if (!desc.IsRegistered)
+                WriteString(type.AssemblyQualifiedName);
 
-                    var hasSchema = _schema.WriteSchema(_stream, schemaIdx, out schemaId, ref flags);
+            var headerSize = _stream.Position - pos;
 
-                    if (hasSchema)
-                    {
-                        flags |= BinaryObjectHeader.Flag.HasSchema;
+            // Preserve old frame.
+            var oldFrame = _frame;
 
-                        // Calculate and write header.
-                        if (_curRawPos > 0)
-                            _stream.WriteInt(_curRawPos - pos); // raw offset is in the last 4 bytes
+            // Push new frame.
+            _frame.RawPos = 0;
+            _frame.Pos = pos;
+            _frame.Struct = new BinaryStructureTracker(desc, desc.WriterTypeStructure);
+            _frame.HasCustomTypeData = false;
 
-                        // Update schema in type descriptor
-                        if (desc.Schema.Get(schemaId) == null)
-                            desc.Schema.Add(schemaId, _schema.GetSchema(schemaIdx));
-                    }
-                    else
-                        schemaOffset = BinaryObjectHeader.Size;
+            var schemaIdx = _schema.PushSchema();
 
-                    if (_curRawPos > 0)
-                        flags |= BinaryObjectHeader.Flag.HasRaw;
+            try
+            {
+                // Write object fields.
+                desc.Serializer.WriteBinary(obj, this);
+                var dataEnd = _stream.Position;
 
-                    var len = _stream.Position - pos;
+                // Write schema
+                var schemaOffset = dataEnd - pos;
 
-                    var comparer = BinaryUtils.GetEqualityComparer(desc);
+                int schemaId;
+                    
+                var flags = desc.UserType
+                    ? BinaryObjectHeader.Flag.UserType
+                    : BinaryObjectHeader.Flag.None;
 
-                    var hashCode = comparer.GetHashCode(Stream, pos + BinaryObjectHeader.Size,
-                            dataEnd - pos - BinaryObjectHeader.Size, _schema, schemaIdx, _marsh, desc);
+                if (_frame.HasCustomTypeData)
+                    flags |= BinaryObjectHeader.Flag.CustomDotNetType;
 
-                    var header = new BinaryObjectHeader(desc.TypeId, hashCode, len, schemaId, schemaOffset, flags);
+                if (Marshaller.CompactFooter && desc.UserType)
+                    flags |= BinaryObjectHeader.Flag.CompactFooter;
 
-                    BinaryObjectHeader.Write(header, _stream, pos);
+                var hasSchema = _schema.WriteSchema(_stream, schemaIdx, out schemaId, ref flags);
 
-                    Stream.Seek(pos + len, SeekOrigin.Begin); // Seek to the end
-                }
-                finally
+                if (hasSchema)
                 {
-                    _schema.PopSchema(schemaIdx);
+                    flags |= BinaryObjectHeader.Flag.HasSchema;
+
+                    // Calculate and write header.
+                    if (_frame.RawPos > 0)
+                        _stream.WriteInt(_frame.RawPos - pos); // raw offset is in the last 4 bytes
+
+                    // Update schema in type descriptor
+                    if (desc.Schema.Get(schemaId) == null)
+                        desc.Schema.Add(schemaId, _schema.GetSchema(schemaIdx));
                 }
+                else
+                    schemaOffset = headerSize;
+
+                if (_frame.RawPos > 0)
+                    flags |= BinaryObjectHeader.Flag.HasRaw;
+
+                var len = _stream.Position - pos;
+
+                    var comparer = BinaryUtils.GetEqualityComparer(desc);
+
+                    var hashCode = comparer.GetHashCode(Stream, pos + BinaryObjectHeader.Size,
+                            dataEnd - pos - BinaryObjectHeader.Size, _schema, schemaIdx, _marsh, desc);
 
-                // Apply structure updates if any.
-                _curStruct.UpdateWriterStructure(this);
+                    var header = new BinaryObjectHeader(desc.IsRegistered ? desc.TypeId : BinaryUtils.TypeUnregistered,
+                        hashCode, len, schemaId, schemaOffset, flags);
 
-                // Restore old frame.
-                _curTypeId = oldTypeId;
-                _curConverter = oldConverter;
-                _curMapper = oldMapper;
-                _curRawPos = oldRawPos;
-                _curPos = oldPos;
+                BinaryObjectHeader.Write(header, _stream, pos);
 
-                _curStruct = oldStruct;
+                Stream.Seek(pos + len, SeekOrigin.Begin); // Seek to the end
             }
-            else
+            finally
             {
-                // Are we dealing with a well-known type?
-                var handler = BinarySystemHandlers.GetWriteHandler(type);
+                _schema.PopSchema(schemaIdx);
+            }
 
-                if (handler == null) // We did our best, object cannot be marshalled.
-                    throw BinaryUtils.GetUnsupportedTypeException(type, obj);
-                
-                if (handler.SupportsHandles && WriteHandle(_stream.Position, obj))
-                    return;
+            // Apply structure updates if any.
+            _frame.Struct.UpdateWriterStructure(this);
 
-                handler.Write(this, obj);
-            }
+            // Restore old frame.
+            _frame = oldFrame;
+        }
+
+        /// <summary>
+        /// Marks current object with a custom type data flag.
+        /// </summary>
+        public void SetCustomTypeDataFlag(bool hasCustomTypeData)
+        {
+            _frame.HasCustomTypeData = hasCustomTypeData;
         }
 
         /// <summary>
@@ -1455,12 +1429,12 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="fieldTypeId">Field type ID.</param>
         private void WriteFieldId(string fieldName, byte fieldTypeId)
         {
-            if (_curRawPos != 0)
+            if (_frame.RawPos != 0)
                 throw new BinaryObjectException("Cannot write named fields after raw data is written.");
 
-            var fieldId = _curStruct.GetFieldId(fieldName, fieldTypeId);
+            var fieldId = _frame.Struct.GetFieldId(fieldName, fieldTypeId);
 
-            _schema.PushField(fieldId, _stream.Position - _curPos);
+            _schema.PushField(fieldId, _stream.Position - _frame.Pos);
         }
 
         /// <summary>
@@ -1489,5 +1463,23 @@ namespace Apache.Ignite.Core.Impl.Binary
                     _metas[desc.TypeId] = new BinaryType(desc, fields);
             }
         }
+
+        /// <summary>
+        /// Stores current writer stack frame.
+        /// </summary>
+        private struct Frame
+        {
+            /** Current object start position. */
+            public int Pos;
+
+            /** Current raw position. */
+            public int RawPos;
+
+            /** Current type structure tracker. */
+            public BinaryStructureTracker Struct;
+
+            /** Custom type data. */
+            public bool HasCustomTypeData;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeHolder.cs
deleted file mode 100644
index 21c56a9..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeHolder.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Impl.Binary
-{
-    using System;
-    using System.Diagnostics;
-    using Apache.Ignite.Core.Binary;
-
-    /// <summary>
-    /// Wraps DateTime item in a binarizable.
-    /// </summary>
-    internal struct DateTimeHolder : IBinaryWriteAware
-    {
-        /** */
-        private readonly DateTime _item;
-
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="item">The item to wrap.</param>
-        public DateTimeHolder(DateTime item)
-        {
-            _item = item;
-        }
-
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="reader">The reader.</param>
-        public DateTimeHolder(IBinaryRawReader reader)
-        {
-            Debug.Assert(reader != null);
-
-            _item = DateTime.FromBinary(reader.ReadLong());
-        }
-
-        /// <summary>
-        /// Gets the item to wrap.
-        /// </summary>
-        public DateTime Item
-        {
-            get { return _item; }
-        }
-
-        /** <inheritDoc /> */
-        public void WriteBinary(IBinaryWriter writer)
-        {
-            Debug.Assert(writer != null);
-
-            writer.GetRawWriter().WriteLong(_item.ToBinary());
-        }
-
-        /** <inheritDoc /> */
-        public override bool Equals(object obj)
-        {
-            if (ReferenceEquals(null, obj)) return false;
-            return obj is DateTimeHolder && Equals((DateTimeHolder) obj);
-        }
-
-        /** <inheritDoc /> */
-        public override int GetHashCode()
-        {
-            return _item.GetHashCode();
-        }
-
-        /** <inheritDoc /> */
-        public static bool operator ==(DateTimeHolder left, DateTimeHolder right)
-        {
-            return left.Equals(right);
-        }
-
-        /** <inheritDoc /> */
-        public static bool operator !=(DateTimeHolder left, DateTimeHolder right)
-        {
-            return !left.Equals(right);
-        }
-
-        /// <summary>
-        /// Checks equality.
-        /// </summary>
-        private bool Equals(DateTimeHolder other)
-        {
-            return _item.Equals(other._item);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeSerializer.cs
deleted file mode 100644
index bea7d58..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DateTimeSerializer.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-\ufeff/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Impl.Binary
-{
-    using System;
-    using Apache.Ignite.Core.Impl.Common;
-
-    /// <summary>
-    /// DateTime serializer.
-    /// </summary>
-    internal class DateTimeSerializer : IBinarySerializerInternal
-    {
-        /** <inheritdoc /> */
-        public void WriteBinary<T>(T obj, BinaryWriter writer)
-        {
-            TypeCaster<DateTimeHolder>.Cast(obj).WriteBinary(writer);
-        }
-
-        /** <inheritdoc /> */
-        public T ReadBinary<T>(BinaryReader reader, Type type, int pos)
-        {
-            var holder = new DateTimeHolder(reader);
-
-            return TypeCaster<T>.Cast(holder.Item);
-        }
-
-        /** <inheritdoc /> */
-        public bool SupportsHandles
-        {
-            get { return false; }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
new file mode 100644
index 0000000..3b21946
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/DeserializationCallbackProcessor.cs
@@ -0,0 +1,102 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+    using System.Collections.Generic;
+    using System.Runtime.Serialization;
+    using System.Threading;
+
+    /// <summary>
+    /// Tracks object graph and invokes <see cref="IDeserializationCallback" />.
+    /// <para />
+    /// <see cref="IDeserializationCallback.OnDeserialization" /> must be called after entire object graph has been
+    /// deserialized. We preserve all objects in a thread-local list and invoke callbacks once all objects
+    /// are fully deserialized.
+    /// </summary>
+    internal static class DeserializationCallbackProcessor
+    {
+        /// <summary>
+        /// Object graph for current thread.
+        /// </summary>
+        private static readonly ThreadLocal<ObjectGraph> Graph 
+            = new ThreadLocal<ObjectGraph>(() => new ObjectGraph());
+
+        /// <summary>
+        /// Register an object for deserialization callback.
+        /// </summary>
+        /// <param name="obj">The object.</param>
+        /// <returns>Id of the object.</returns>
+        public static void Push(object obj)
+        {
+            var graph = Graph.Value;
+
+            graph.Depth++;
+
+            var cb = obj as IDeserializationCallback;
+
+            if (cb != null)
+            {
+                graph.Objects.Add(cb);
+            }
+        }
+
+        /// <summary>
+        /// Called when deserialization of an object has completed.
+        /// When Pop() has been called for all registered objects, all callbacks are invoked.
+        /// </summary>
+        public static void Pop()
+        {
+            var graph = Graph.Value;
+
+            graph.Depth--;
+
+            if (graph.Depth == 0)
+            {
+                // Entire graph has been deserialized: invoke callbacks in direct order (like BinaryFormatter does).
+                foreach (var obj in graph.Objects)
+                {
+                    obj.OnDeserialization(null);
+                }
+
+                graph.Objects.Clear();
+            }
+        }
+
+        /// <summary>
+        /// Object graph.
+        /// </summary>
+        private class ObjectGraph
+        {
+            /** */
+            private readonly List<IDeserializationCallback> _objects = new List<IDeserializationCallback>();
+
+            /// <summary>
+            /// Gets or sets the depth.
+            /// </summary>
+            public int Depth { get; set; }
+
+            /// <summary>
+            /// Gets the objects.
+            /// </summary>
+            public List<IDeserializationCallback> Objects
+            {
+                get { return _objects; }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinarySerializerInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinarySerializerInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinarySerializerInternal.cs
index 58844d6..b775999 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinarySerializerInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinarySerializerInternal.cs
@@ -17,8 +17,6 @@
 
 namespace Apache.Ignite.Core.Impl.Binary
 {
-    using System;
-
     /// <summary>
     /// Internal generic serializer interface.
     /// </summary>
@@ -32,7 +30,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Read binary object.
         /// </summary>
-        T ReadBinary<T>(BinaryReader reader, Type type, int pos);
+        T ReadBinary<T>(BinaryReader reader, IBinaryTypeDescriptor desc, int pos);
 
         /// <summary>
         /// Gets a value indicating whether this serializer supports handles.

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
index 6c7e360..6bec70f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
@@ -112,5 +112,13 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Gets the schema.
         /// </summary>
         BinaryObjectSchema Schema { get; }
+
+        /// <summary>
+        /// Gets a value indicating whether this descriptor is registered in the cluster.
+        /// </summary>
+        /// <value>
+        /// <c>true</c> if this instance is registered; otherwise, <c>false</c>.
+        /// </value>
+        bool IsRegistered { get; }
     }
 }


[02/18] ignite git commit: IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 42879b7..f13f1f2 100755
--- 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
@@ -106,7 +106,6 @@ import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
@@ -122,6 +121,7 @@ import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutException;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
@@ -241,8 +241,7 @@ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.SSL_META
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false)
-public class TcpCommunicationSpi extends IgniteSpiAdapter
-    implements CommunicationSpi<Message>, TcpCommunicationSpiMBean {
+public class TcpCommunicationSpi extends IgniteSpiAdapter implements CommunicationSpi<Message> {
     /** IPC error message. */
     public static final String OUT_OF_RESOURCES_TCP_MSG = "Failed to allocate shared memory segment " +
         "(switching to TCP, may be slower).";
@@ -1100,12 +1099,15 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * Sets address resolver.
      *
      * @param addrRslvr Address resolver.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setAddressResolver(AddressResolver addrRslvr) {
+    public TcpCommunicationSpi setAddressResolver(AddressResolver addrRslvr) {
         // Injection should not override value already set by Spring or user.
         if (this.addrRslvr == null)
             this.addrRslvr = addrRslvr;
+
+        return this;
     }
 
     /**
@@ -1130,16 +1132,23 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      *
      * @param locAddr IP address. Default value is any available local
      *      IP address.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setLocalAddress(String locAddr) {
+    public TcpCommunicationSpi setLocalAddress(String locAddr) {
         // Injection should not override value already set by Spring or user.
         if (this.locAddr == null)
             this.locAddr = locAddr;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getLocalAddress() {
+    /**
+     * See {@link #setLocalAddress(String)}.
+     *
+     * @return Grid node IP address.
+     */
+    public String getLocalAddress() {
         return locAddr;
     }
 
@@ -1149,14 +1158,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@link #DFLT_PORT}.
      *
      * @param locPort Port number.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setLocalPort(int locPort) {
+    public TcpCommunicationSpi setLocalPort(int locPort) {
         this.locPort = locPort;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getLocalPort() {
+    /**
+     * See {@link #setLocalPort(int)}.
+     *
+     * @return Port number.
+     */
+    public int getLocalPort() {
         return locPort;
     }
 
@@ -1175,19 +1191,30 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@link #DFLT_PORT_RANGE}.
      *
      * @param locPortRange New local port range.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setLocalPortRange(int locPortRange) {
+    public TcpCommunicationSpi setLocalPortRange(int locPortRange) {
         this.locPortRange = locPortRange;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getLocalPortRange() {
+    /**
+     * See {@link #setLocalPortRange(int)}.
+     *
+     * @return Local Port range.
+     */
+    public int getLocalPortRange() {
         return locPortRange;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isUsePairedConnections() {
+    /**
+     * See {@link #setUsePairedConnections(boolean)}.
+     *
+     * @return {@code true} to use paired connections and {@code false} otherwise.
+     */
+    public boolean isUsePairedConnections() {
         return usePairedConnections;
     }
 
@@ -1205,9 +1232,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      *
      * @param usePairedConnections {@code true} to use paired connections and {@code false} otherwise.
      * @see #getConnectionsPerNode()
+     * @return {@code this} for chaining.
      */
-    public void setUsePairedConnections(boolean usePairedConnections) {
+    public TcpCommunicationSpi setUsePairedConnections(boolean usePairedConnections) {
         this.usePairedConnections = usePairedConnections;
+
+        return this;
     }
 
     /**
@@ -1217,13 +1247,20 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      *
      * @param maxConnectionsPerNode Number of connections per node.
      * @see #isUsePairedConnections()
+     * @return {@code this} for chaining.
      */
-    public void setConnectionsPerNode(int maxConnectionsPerNode) {
+    public TcpCommunicationSpi setConnectionsPerNode(int maxConnectionsPerNode) {
         this.connectionsPerNode = maxConnectionsPerNode;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getConnectionsPerNode() {
+    /**
+     * See {@link #setConnectionsPerNode(int)}.
+     *
+     *  @return Number of connections per node.
+     */
+    public int getConnectionsPerNode() {
         return connectionsPerNode;
     }
 
@@ -1235,14 +1272,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@link #DFLT_SHMEM_PORT}.
      *
      * @param shmemPort Port number.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setSharedMemoryPort(int shmemPort) {
+    public TcpCommunicationSpi setSharedMemoryPort(int shmemPort) {
         this.shmemPort = shmemPort;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getSharedMemoryPort() {
+    /**
+     * See {@link #setSharedMemoryPort(int)}.
+     *
+     * @return Port number.
+     */
+    public int getSharedMemoryPort() {
         return shmemPort;
     }
 
@@ -1253,19 +1297,30 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@link #DFLT_IDLE_CONN_TIMEOUT}.
      *
      * @param idleConnTimeout Maximum idle connection time.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setIdleConnectionTimeout(long idleConnTimeout) {
+    public TcpCommunicationSpi setIdleConnectionTimeout(long idleConnTimeout) {
         this.idleConnTimeout = idleConnTimeout;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getIdleConnectionTimeout() {
+    /**
+     * See {@link #setIdleConnectionTimeout(long)}.
+     *
+     * @return Maximum idle connection time.
+     */
+    public long getIdleConnectionTimeout() {
         return idleConnTimeout;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getSocketWriteTimeout() {
+    /**
+     * See {@link #setSocketWriteTimeout(long)}.
+     *
+     * @return Socket write timeout for TCP connections.
+     */
+    public long getSocketWriteTimeout() {
         return sockWriteTimeout;
     }
 
@@ -1276,14 +1331,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * Default to {@link #DFLT_SOCK_WRITE_TIMEOUT}.
      *
      * @param sockWriteTimeout Socket write timeout for TCP connection.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setSocketWriteTimeout(long sockWriteTimeout) {
+    public TcpCommunicationSpi setSocketWriteTimeout(long sockWriteTimeout) {
         this.sockWriteTimeout = sockWriteTimeout;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getAckSendThreshold() {
+    /**
+     * See {@link #setAckSendThreshold(int)}.
+     *
+     * @return Number of received messages after which acknowledgment is sent.
+     */
+    public int getAckSendThreshold() {
         return ackSndThreshold;
     }
 
@@ -1293,14 +1355,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * Default to {@link #DFLT_ACK_SND_THRESHOLD}.
      *
      * @param ackSndThreshold Number of received messages after which acknowledgment is sent.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setAckSendThreshold(int ackSndThreshold) {
+    public TcpCommunicationSpi setAckSendThreshold(int ackSndThreshold) {
         this.ackSndThreshold = ackSndThreshold;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getUnacknowledgedMessagesBufferSize() {
+    /**
+     * See {@link #setUnacknowledgedMessagesBufferSize(int)}.
+     *
+     * @return Maximum number of unacknowledged messages.
+     */
+    public int getUnacknowledgedMessagesBufferSize() {
         return unackedMsgsBufSize;
     }
 
@@ -1310,17 +1379,19 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * closed and reconnect is attempted.
      *
      * @param unackedMsgsBufSize Maximum number of unacknowledged messages.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setUnacknowledgedMessagesBufferSize(int unackedMsgsBufSize) {
+    public TcpCommunicationSpi setUnacknowledgedMessagesBufferSize(int unackedMsgsBufSize) {
         this.unackedMsgsBufSize = unackedMsgsBufSize;
+
+        return this;
     }
 
     /**
      * Sets connection buffer size. If set to {@code 0} connection buffer is disabled.
      *
      * @param connBufSize Connection buffer size.
-     * @see #setConnectionBufferFlushFrequency(long)
      * @deprecated Not used any more.
      */
     @Deprecated
@@ -1329,22 +1400,48 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         // No-op.
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Gets connection buffer size.
+     * <p>
+     * If set to {@code 0} connection buffer is disabled.
+     *
+     * @return Connection buffer size.
+     * @deprecated Not used anymore.
+     */
     @Deprecated
-    @Override public int getConnectionBufferSize() {
+    public int getConnectionBufferSize() {
         return 0;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets connection buffer flush frequency.
+     * <p>
+     * Client connections to other nodes in topology use buffered output.
+     * This frequency defines how often system will advice to flush
+     * connection buffer.
+     * <p>
+     * This property is used only if {@link #getConnectionBufferSize()} is greater than {@code 0}.
+     *
+     * @param connBufFlushFreq Flush frequency.
+     * @see #getConnectionBufferSize()
+     * @deprecated Not used anymore.
+     */
     @Deprecated
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setConnectionBufferFlushFrequency(long connBufFlushFreq) {
+    public void setConnectionBufferFlushFrequency(long connBufFlushFreq) {
         // No-op.
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Gets connection buffer size.
+     * <p>
+     * If set to {@code 0} connection buffer is disabled.
+     *
+     * @return Connection buffer size.
+     * @deprecated Not used anymore.
+     */
     @Deprecated
-    @Override public long getConnectionBufferFlushFrequency() {
+    public long getConnectionBufferFlushFrequency() {
         return 0;
     }
 
@@ -1359,16 +1456,22 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param connTimeout Connect timeout.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setConnectTimeout(long connTimeout) {
+    public TcpCommunicationSpi setConnectTimeout(long connTimeout) {
         this.connTimeout = connTimeout;
 
         failureDetectionTimeoutEnabled(false);
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getConnectTimeout() {
+    /**
+     * See {@link #setConnectTimeout(long)}.
+     *
+     * @return Connect timeout.
+     */public long getConnectTimeout() {
         return connTimeout;
     }
 
@@ -1385,16 +1488,23 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param maxConnTimeout Maximum connect timeout.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setMaxConnectTimeout(long maxConnTimeout) {
+    public TcpCommunicationSpi setMaxConnectTimeout(long maxConnTimeout) {
         this.maxConnTimeout = maxConnTimeout;
 
         failureDetectionTimeoutEnabled(false);
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getMaxConnectTimeout() {
+    /**
+     * Gets maximum connect timeout.
+     *
+     * @return Maximum connect timeout.
+     */
+    public long getMaxConnectTimeout() {
         return maxConnTimeout;
     }
 
@@ -1407,16 +1517,24 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param reconCnt Maximum number of reconnection attempts.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setReconnectCount(int reconCnt) {
+    public TcpCommunicationSpi setReconnectCount(int reconCnt) {
         this.reconCnt = reconCnt;
 
         failureDetectionTimeoutEnabled(false);
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getReconnectCount() {
+    /**
+     * Gets maximum number of reconnect attempts used when establishing connection
+     * with remote nodes.
+     *
+     * @return Reconnects count.
+     */
+    public int getReconnectCount() {
         return reconCnt;
     }
 
@@ -1428,32 +1546,46 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@code true}.
      *
      * @param directBuf Flag indicates to allocate direct or heap buffer in SPI.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setDirectBuffer(boolean directBuf) {
+    public TcpCommunicationSpi setDirectBuffer(boolean directBuf) {
         this.directBuf = directBuf;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isDirectBuffer() {
+    /**
+     * Gets flag that indicates whether direct or heap allocated buffer is used.
+     *
+     * @return Flag that indicates whether direct or heap allocated buffer is used.
+     */
+    public boolean isDirectBuffer() {
         return directBuf;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isDirectSendBuffer() {
+    /**
+     * Gets flag defining whether direct send buffer should be used.
+     *
+     * @return {@code True} if direct buffers should be used.
+     */
+    public boolean isDirectSendBuffer() {
         return directSndBuf;
     }
 
     /**
      * Sets whether to use direct buffer for sending.
-     * <p>
+     *
      * If not provided default is {@code false}.
      *
      * @param directSndBuf {@code True} to use direct buffers for send.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setDirectSendBuffer(boolean directSndBuf) {
+    public TcpCommunicationSpi setDirectSendBuffer(boolean directSndBuf) {
         this.directSndBuf = directSndBuf;
+
+        return this;
     }
 
     /**
@@ -1462,19 +1594,30 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@link #DFLT_SELECTORS_CNT}.
      *
      * @param selectorsCnt Selectors count.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setSelectorsCount(int selectorsCnt) {
+    public TcpCommunicationSpi setSelectorsCount(int selectorsCnt) {
         this.selectorsCnt = selectorsCnt;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getSelectorsCount() {
+    /**
+     * See {@link #setSelectorsCount(int)}.
+     *
+     * @return Count of selectors in TCP server.
+     */
+    public int getSelectorsCount() {
         return selectorsCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getSelectorSpins() {
+    /**
+     * See {@link #setSelectorSpins(long)}.
+     *
+     * @return Selector thread busy-loop iterations.
+     */
+    public long getSelectorSpins() {
         return selectorSpins;
     }
 
@@ -1484,9 +1627,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * Can be set to {@code Long.MAX_VALUE} so selector threads will never block.
      *
      * @param selectorSpins Selector thread busy-loop iterations.
+     * @return {@code this} for chaining.
      */
-    public void setSelectorSpins(long selectorSpins) {
+    public TcpCommunicationSpi setSelectorSpins(long selectorSpins) {
         this.selectorSpins = selectorSpins;
+
+        return this;
     }
 
     /**
@@ -1502,14 +1648,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default value is {@link #DFLT_TCP_NODELAY}.
      *
      * @param tcpNoDelay {@code True} to disable TCP delay.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setTcpNoDelay(boolean tcpNoDelay) {
+    public TcpCommunicationSpi setTcpNoDelay(boolean tcpNoDelay) {
         this.tcpNoDelay = tcpNoDelay;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isTcpNoDelay() {
+    /**
+     * Gets value for {@code TCP_NODELAY} socket option.
+     *
+     * @return {@code True} if TCP delay is disabled.
+     */
+    public boolean isTcpNoDelay() {
         return tcpNoDelay;
     }
 
@@ -1519,14 +1672,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default is {@link #DFLT_SOCK_BUF_SIZE}.
      *
      * @param sockRcvBuf Socket receive buffer size.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setSocketReceiveBuffer(int sockRcvBuf) {
+    public TcpCommunicationSpi setSocketReceiveBuffer(int sockRcvBuf) {
         this.sockRcvBuf = sockRcvBuf;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getSocketReceiveBuffer() {
+    /**
+     * See {@link #setSocketReceiveBuffer(int)}.
+     *
+     * @return Socket receive buffer size.
+     */
+    public int getSocketReceiveBuffer() {
         return sockRcvBuf;
     }
 
@@ -1536,14 +1696,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default is {@link #DFLT_SOCK_BUF_SIZE}.
      *
      * @param sockSndBuf Socket send buffer size.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setSocketSendBuffer(int sockSndBuf) {
+    public TcpCommunicationSpi setSocketSendBuffer(int sockSndBuf) {
         this.sockSndBuf = sockSndBuf;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getSocketSendBuffer() {
+    /**
+     * See {@link #setSocketSendBuffer(int)}.
+     *
+     * @return Socket send buffer size.
+     */
+    public int getSocketSendBuffer() {
         return sockSndBuf;
     }
 
@@ -1556,19 +1723,30 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * If not provided, default is {@link #DFLT_MSG_QUEUE_LIMIT}.
      *
      * @param msgQueueLimit Send queue size limit.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setMessageQueueLimit(int msgQueueLimit) {
+    public TcpCommunicationSpi setMessageQueueLimit(int msgQueueLimit) {
         this.msgQueueLimit = msgQueueLimit;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMessageQueueLimit() {
+    /**
+     * Gets message queue limit for incoming and outgoing messages.
+     *
+     * @return Send queue size limit.
+     */
+    public int getMessageQueueLimit() {
         return msgQueueLimit;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getSlowClientQueueLimit() {
+    /**
+     * See {@link #setSlowClientQueueLimit(int)}.
+     *
+     * @return Slow client queue limit.
+     */
+    public int getSlowClientQueueLimit() {
         return slowClientQueueLimit;
     }
 
@@ -1583,9 +1761,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * which means {@code unlimited}.
      *
      * @param slowClientQueueLimit Slow client queue limit.
+     * @return {@code this} for chaining.
      */
-    public void setSlowClientQueueLimit(int slowClientQueueLimit) {
+    public TcpCommunicationSpi setSlowClientQueueLimit(int slowClientQueueLimit) {
         this.slowClientQueueLimit = slowClientQueueLimit;
+
+        return this;
     }
 
     /**
@@ -1601,9 +1782,15 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         // No-op.
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Gets the minimum number of messages for this SPI, that are buffered
+     * prior to sending.
+     *
+     * @return Minimum buffered message count.
+     * @deprecated Not used anymore.
+     */
     @Deprecated
-    @Override public int getMinimumBufferedMessageCount() {
+    public int getMinimumBufferedMessageCount() {
         return 0;
     }
 
@@ -1656,8 +1843,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         rcvdBytesCnt.add(-rcvdBytesCnt.sum());
     }
 
-    /** {@inheritDoc} */
-    @Override public void dumpStats() {
+    /**
+     * Dumps SPI per-connection stats to logs.
+     */
+    public void dumpStats() {
         IgniteLogger log = this.log;
 
         if (log != null) {
@@ -1879,7 +2068,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 "potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes " +
                 "due to message queues growth on sender and receiver sides.");
 
-        registerMBean(igniteInstanceName, this, TcpCommunicationSpiMBean.class);
+        registerMBean(igniteInstanceName, new TcpCommunicationSpiMBeanImpl(this), TcpCommunicationSpiMBean.class);
 
         connectGate = new ConnectGateway();
 
@@ -3424,6 +3613,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     }
 
     /** {@inheritDoc} */
+    @Override public TcpCommunicationSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpCommunicationSpi.class, this);
     }
@@ -4562,4 +4758,178 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
          */
         int connectionIndex();
     }
+
+    /**
+     * MBean implementation for TcpCommunicationSpi.
+     */
+    private class TcpCommunicationSpiMBeanImpl extends IgniteSpiMBeanAdapter implements TcpCommunicationSpiMBean {
+        /** {@inheritDoc} */
+        TcpCommunicationSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getLocalAddress() {
+            return TcpCommunicationSpi.this.getLocalAddress();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getLocalPort() {
+            return TcpCommunicationSpi.this.getLocalPort();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getLocalPortRange() {
+            return TcpCommunicationSpi.this.getLocalPortRange();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isUsePairedConnections() {
+            return TcpCommunicationSpi.this.isUsePairedConnections();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getConnectionsPerNode() {
+            return TcpCommunicationSpi.this.getConnectionsPerNode();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getSharedMemoryPort() {
+            return TcpCommunicationSpi.this.getSharedMemoryPort();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getIdleConnectionTimeout() {
+            return TcpCommunicationSpi.this.getIdleConnectionTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSocketWriteTimeout() {
+            return TcpCommunicationSpi.this.getSocketWriteTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getAckSendThreshold() {
+            return TcpCommunicationSpi.this.getAckSendThreshold();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getUnacknowledgedMessagesBufferSize() {
+            return TcpCommunicationSpi.this.getUnacknowledgedMessagesBufferSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getConnectTimeout() {
+            return TcpCommunicationSpi.this.getConnectTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMaxConnectTimeout() {
+            return TcpCommunicationSpi.this.getMaxConnectTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getReconnectCount() {
+            return TcpCommunicationSpi.this.getReconnectCount();
+        }
+
+        /** {@inheritDoc} */
+        @Deprecated
+        @Override public int getConnectionBufferSize() {
+            return TcpCommunicationSpi.this.getConnectionBufferSize();
+        }
+
+        /** {@inheritDoc} */
+        @Deprecated
+        @Override public void setConnectionBufferFlushFrequency(long connBufFlushFreq) {
+            TcpCommunicationSpi.this.setConnectionBufferFlushFrequency(connBufFlushFreq);
+        }
+
+        /** {@inheritDoc} */
+        @Deprecated
+        @Override public long getConnectionBufferFlushFrequency() {
+            return TcpCommunicationSpi.this.getConnectionBufferFlushFrequency();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isDirectBuffer() {
+            return TcpCommunicationSpi.this.isDirectBuffer();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isDirectSendBuffer() {
+            return TcpCommunicationSpi.this.isDirectSendBuffer();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getSelectorsCount() {
+            return TcpCommunicationSpi.this.getSelectorsCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSelectorSpins() {
+            return TcpCommunicationSpi.this.getSelectorSpins();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isTcpNoDelay() {
+            return TcpCommunicationSpi.this.isTcpNoDelay();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getSocketReceiveBuffer() {
+            return TcpCommunicationSpi.this.getSocketReceiveBuffer();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getSocketSendBuffer() {
+            return TcpCommunicationSpi.this.getSocketSendBuffer();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMessageQueueLimit() {
+            return TcpCommunicationSpi.this.getMessageQueueLimit();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getSlowClientQueueLimit() {
+            return TcpCommunicationSpi.this.getSlowClientQueueLimit();
+        }
+
+        /** {@inheritDoc} */
+        @Deprecated
+        @Override public int getMinimumBufferedMessageCount() {
+            return TcpCommunicationSpi.this.getMinimumBufferedMessageCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void dumpStats() {
+            TcpCommunicationSpi.this.dumpStats();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getSentMessagesCount() {
+            return TcpCommunicationSpi.this.getSentMessagesCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSentBytesCount() {
+            return TcpCommunicationSpi.this.getSentBytesCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getReceivedMessagesCount() {
+            return TcpCommunicationSpi.this.getReceivedMessagesCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getReceivedBytesCount() {
+            return TcpCommunicationSpi.this.getReceivedBytesCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getOutboundMessagesQueueSize() {
+            return TcpCommunicationSpi.this.getOutboundMessagesQueueSize();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
index 66b715a..9d46737 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
@@ -35,6 +35,7 @@ import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.deployment.DeploymentListener;
 import org.apache.ignite.spi.deployment.DeploymentResource;
@@ -66,7 +67,7 @@ import org.jsr166.ConcurrentLinkedHashMap;
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false)
 @IgnoreIfPeerClassLoadingDisabled
-public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi, LocalDeploymentSpiMBean {
+public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSpi {
     /** */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     @LoggerResource
@@ -76,7 +77,7 @@ public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSp
     private ConcurrentLinkedHashMap<ClassLoader, ConcurrentMap<String, String>> ldrRsrcs =
         new ConcurrentLinkedHashMap<>(16, 0.75f, 64);
 
-    /** Deployment SPI listener.    */
+    /** Deployment SPI listener. */
     private volatile DeploymentListener lsnr;
 
     /** {@inheritDoc} */
@@ -84,7 +85,7 @@ public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSp
         // Start SPI start stopwatch.
         startStopwatch();
 
-        registerMBean(igniteInstanceName, this, LocalDeploymentSpiMBean.class);
+        registerMBean(igniteInstanceName, new LocalDeploymentSpiMBeanImpl(this), LocalDeploymentSpiMBean.class);
 
         if (log.isDebugEnabled())
             log.debug(startInfo());
@@ -395,7 +396,24 @@ public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSp
     }
 
     /** {@inheritDoc} */
+    @Override public LocalDeploymentSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(LocalDeploymentSpi.class, this);
     }
+
+    /**
+     * MBean implementation for LocalDeploymentSpi.
+     */
+    private class LocalDeploymentSpiMBeanImpl extends IgniteSpiMBeanAdapter implements LocalDeploymentSpiMBean {
+        /** {@inheritDoc} */
+        LocalDeploymentSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 e8b937a..19244dd 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
@@ -70,6 +70,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutException;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
@@ -217,7 +218,7 @@ import org.jetbrains.annotations.Nullable;
 @IgniteSpiMultipleInstancesSupport(true)
 @DiscoverySpiOrderSupport(true)
 @DiscoverySpiHistorySupport(true)
-public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, TcpDiscoverySpiMBean {
+public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     /** Node attribute that is mapped to node's external addresses (value is <tt>disc.tcp.ext-addrs</tt>). */
     public static final String ATTR_EXT_ADDRS = "disc.tcp.ext-addrs";
 
@@ -403,18 +404,30 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     /** */
     protected IgniteSpiContext spiCtx;
 
-    /** {@inheritDoc} */
-    @Override public String getSpiState() {
+    /**
+     * Gets current SPI state.
+     *
+     * @return Current SPI state.
+     */
+    public String getSpiState() {
         return impl.getSpiState();
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMessageWorkerQueueSize() {
+    /**
+     * Gets message worker queue current size.
+     *
+     * @return Message worker queue current size.
+     */
+    public int getMessageWorkerQueueSize() {
         return impl.getMessageWorkerQueueSize();
     }
 
-    /** {@inheritDoc} */
-    @Nullable @Override public UUID getCoordinator() {
+    /**
+     * Gets current coordinator.
+     *
+     * @return Gets current coordinator.
+     */
+    public UUID getCoordinator() {
         return impl.getCoordinator();
     }
 
@@ -453,8 +466,10 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         impl.failNode(nodeId, warning);
     }
 
-    /** {@inheritDoc} */
-    @Override public void dumpDebugInfo() {
+    /**
+     * Dumps debug info using configured logger.
+     */
+    public void dumpDebugInfo() {
         impl.dumpDebugInfo(log);
     }
 
@@ -580,8 +595,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return addrRslvr;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getReconnectCount() {
+    /**
+     * Gets number of connection attempts.
+     *
+     * @return Number of connection attempts.
+     */
+    public int getReconnectCount() {
         return reconCnt;
     }
 
@@ -608,8 +627,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getMaxAckTimeout() {
+    /**
+     * Gets maximum message acknowledgement timeout.
+     *
+     * @return Maximum message acknowledgement timeout.
+     */
+    public long getMaxAckTimeout() {
         return maxAckTimeout;
     }
 
@@ -639,8 +662,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getLocalPort() {
+    /**
+     * Gets local TCP port SPI listens to.
+     *
+     * @return Local port range.
+     */
+    public int getLocalPort() {
         TcpDiscoveryNode locNode0 = locNode;
 
         return locNode0 != null ? locNode0.discoveryPort() : 0;
@@ -663,8 +690,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getLocalPortRange() {
+    /**
+     * Gets local TCP port range.
+     *
+     * @return Local port range.
+     */
+    public int getLocalPortRange() {
         return locPortRange;
     }
 
@@ -689,8 +720,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMaxMissedHeartbeats() {
+    /**
+     * Gets max heartbeats count node can miss without initiating status check.
+     *
+     * @return Max missed heartbeats.
+     */
+    public int getMaxMissedHeartbeats() {
         return maxMissedHbs;
     }
 
@@ -711,8 +746,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMaxMissedClientHeartbeats() {
+    /**
+     * Gets max heartbeats count node can miss without failing client node.
+     *
+     * @return Max missed client heartbeats.
+     */
+    public int getMaxMissedClientHeartbeats() {
         return maxMissedClientHbs;
     }
 
@@ -731,8 +770,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getStatisticsPrintFrequency() {
+    /**
+     * Gets statistics print frequency.
+     *
+     * @return Statistics print frequency in milliseconds.
+     */
+    public long getStatisticsPrintFrequency() {
         return statsPrintFreq;
     }
 
@@ -755,8 +798,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getIpFinderCleanFrequency() {
+    /**
+     * Gets IP finder clean frequency.
+     *
+     * @return IP finder clean frequency.
+     */
+    public long getIpFinderCleanFrequency() {
         return ipFinderCleanFreq;
     }
 
@@ -862,8 +909,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getJoinTimeout() {
+    /**
+     * Gets join timeout.
+     *
+     * @return Join timeout.
+     */
+    public long getJoinTimeout() {
         return joinTimeout;
     }
 
@@ -964,6 +1015,15 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     }
 
     /**
+     * Gets ID of the local node.
+     *
+     * @return ID of the local node.
+     */
+    public UUID getLocalNodeId() {
+        return ignite.cluster().localNode().id();
+    }
+
+    /**
      * @param srvPort Server port.
      * @param addExtAddrAttr If {@code true} adds {@link #ATTR_EXT_ADDRS} attribute.
      */
@@ -1061,93 +1121,164 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         return F.<Object>asList(ipFinder);
     }
 
-    /** {@inheritDoc} */
-    @Override public long getSocketTimeout() {
+    /**
+     * Gets socket timeout.
+     *
+     * @return Socket timeout.
+     */
+    public long getSocketTimeout() {
         return sockTimeout;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getAckTimeout() {
+    /**
+     * Gets message acknowledgement timeout.
+     *
+     * @return Message acknowledgement timeout.
+     */
+    public long getAckTimeout() {
         return ackTimeout;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getNetworkTimeout() {
+    /**
+     * Gets network timeout.
+     *
+     * @return Network timeout.
+     */
+    public long getNetworkTimeout() {
         return netTimeout;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getThreadPriority() {
+    /**
+     * Gets thread priority. All threads within SPI will be started with it.
+     *
+     * @return Thread priority.
+     */
+    public int getThreadPriority() {
         return threadPri;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getHeartbeatFrequency() {
+    /**
+     * Gets delay between heartbeat messages sent by coordinator.
+     *
+     * @return Time period in milliseconds.
+     */
+    public long getHeartbeatFrequency() {
         return hbFreq;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getIpFinderFormatted() {
+    /**
+     * Gets {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} (string representation).
+     *
+     * @return IPFinder (string representation).
+     */public String getIpFinderFormatted() {
         return ipFinder.toString();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getNodesJoined() {
+    /**
+     * Gets joined nodes count.
+     *
+     * @return Nodes joined count.
+     */
+    public long getNodesJoined() {
         return stats.joinedNodesCount();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getNodesLeft() {
+    /**
+     * Gets left nodes count.
+     *
+     * @return Left nodes count.
+     */
+    public long getNodesLeft() {
         return stats.leftNodesCount();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getNodesFailed() {
+    /**
+     * Gets failed nodes count.
+     *
+     * @return Failed nodes count.
+     */
+    public long getNodesFailed() {
         return stats.failedNodesCount();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getPendingMessagesRegistered() {
+    /**
+     * Gets pending messages registered count.
+     *
+     * @return Pending messages registered count.
+     */
+    public long getPendingMessagesRegistered() {
         return stats.pendingMessagesRegistered();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getPendingMessagesDiscarded() {
+    /**
+     * Gets pending messages discarded count.
+     *
+     * @return Pending messages registered count.
+     */
+    public long getPendingMessagesDiscarded() {
         return stats.pendingMessagesDiscarded();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getAvgMessageProcessingTime() {
+    /**
+     * Gets avg message processing time.
+     *
+     * @return Avg message processing time.
+     */
+    public long getAvgMessageProcessingTime() {
         return stats.avgMessageProcessingTime();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getMaxMessageProcessingTime() {
+    /**
+     * Gets max message processing time.
+     *
+     * @return Max message processing time.
+     */
+    public long getMaxMessageProcessingTime() {
         return stats.maxMessageProcessingTime();
     }
 
-    /** {@inheritDoc} */
-    @Override public int getTotalReceivedMessages() {
+    /**
+     * Gets total received messages count.
+     *
+     * @return Total received messages count.
+     */
+    public int getTotalReceivedMessages() {
         return stats.totalReceivedMessages();
     }
 
-    /** {@inheritDoc} */
-    @Override public Map<String, Integer> getReceivedMessages() {
+    /**
+     * Gets received messages counts (grouped by type).
+     *
+     * @return Map containing message types and respective counts.
+     */
+    public Map<String, Integer> getReceivedMessages() {
         return stats.receivedMessages();
     }
 
-    /** {@inheritDoc} */
-    @Override public int getTotalProcessedMessages() {
+    /**
+     * Gets total processed messages count.
+     *
+     * @return Total processed messages count.
+     */
+    public int getTotalProcessedMessages() {
         return stats.totalProcessedMessages();
     }
 
-    /** {@inheritDoc} */
-    @Override public Map<String, Integer> getProcessedMessages() {
+    /**
+     * Gets processed messages counts (grouped by type).
+     *
+     * @return Map containing message types and respective counts.
+     */
+    public Map<String, Integer> getProcessedMessages() {
         return stats.processedMessages();
     }
 
-    /** {@inheritDoc} */
-    @Override public long getCoordinatorSinceTimestamp() {
+    /**
+     * Gets time local node has been coordinator since.
+     *
+     * @return Time local node is coordinator since.
+     */
+    public long getCoordinatorSinceTimestamp() {
         return stats.coordinatorSinceTimestamp();
     }
 
@@ -1815,7 +1946,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         if (netTimeout < 3000)
             U.warn(log, "Network timeout is too low (at least 3000 ms recommended): " + netTimeout);
 
-        registerMBean(igniteInstanceName, this, TcpDiscoverySpiMBean.class);
+        registerMBean(igniteInstanceName, new TcpDiscoverySpiMBeanImpl(this), TcpDiscoverySpiMBean.class);
 
         if (ipFinder instanceof TcpDiscoveryMulticastIpFinder) {
             TcpDiscoveryMulticastIpFinder mcastIpFinder = ((TcpDiscoveryMulticastIpFinder)ipFinder);
@@ -2000,6 +2131,13 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     }
 
     /** {@inheritDoc} */
+    @Override public TcpDiscoverySpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpDiscoverySpi.class, this);
     }
@@ -2070,4 +2208,175 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
             return S.toString(SocketTimeoutObject.class, this);
         }
     }
+
+    /**
+     * MBean implementation for TcpDiscoverySpiMBean.
+     */
+    private class TcpDiscoverySpiMBeanImpl extends IgniteSpiMBeanAdapter implements TcpDiscoverySpiMBean {
+        /** {@inheritDoc} */
+        TcpDiscoverySpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getSpiState() {
+            return impl.getSpiState();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMessageWorkerQueueSize() {
+            return impl.getMessageWorkerQueueSize();
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public UUID getCoordinator() {
+            return impl.getCoordinator();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void dumpDebugInfo() {
+            impl.dumpDebugInfo(log);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getSocketTimeout() {
+            return TcpDiscoverySpi.this.getSocketTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMaxAckTimeout() {
+            return TcpDiscoverySpi.this.getMaxAckTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getAckTimeout() {
+            return TcpDiscoverySpi.this.getAckTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getNetworkTimeout() {
+            return TcpDiscoverySpi.this.getNetworkTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getJoinTimeout() {
+            return TcpDiscoverySpi.this.getJoinTimeout();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getLocalPort() {
+            return TcpDiscoverySpi.this.getLocalPort();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getLocalPortRange() {
+            return TcpDiscoverySpi.this.getLocalPortRange();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getIpFinderCleanFrequency() {
+            return TcpDiscoverySpi.this.getIpFinderCleanFrequency();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getThreadPriority() {
+            return TcpDiscoverySpi.this.getThreadPriority();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getHeartbeatFrequency() {
+            return TcpDiscoverySpi.this.getHeartbeatFrequency();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxMissedHeartbeats() {
+            return TcpDiscoverySpi.this.getMaxMissedHeartbeats();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxMissedClientHeartbeats() {
+            return TcpDiscoverySpi.this.getMaxMissedClientHeartbeats();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getStatisticsPrintFrequency() {
+            return TcpDiscoverySpi.this.getStatisticsPrintFrequency();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getIpFinderFormatted() {
+            return TcpDiscoverySpi.this.getIpFinderFormatted();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getReconnectCount() {
+            return TcpDiscoverySpi.this.getReconnectCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isClientMode() {
+            return TcpDiscoverySpi.this.isClientMode();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getNodesJoined() {
+            return TcpDiscoverySpi.this.getNodesJoined();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getNodesLeft() {
+            return TcpDiscoverySpi.this.getNodesLeft();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getNodesFailed() {
+            return TcpDiscoverySpi.this.getNodesFailed();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getPendingMessagesRegistered() {
+            return TcpDiscoverySpi.this.getPendingMessagesRegistered();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getPendingMessagesDiscarded() {
+            return stats.pendingMessagesDiscarded();
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getAvgMessageProcessingTime() {
+            return TcpDiscoverySpi.this.getAvgMessageProcessingTime();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMaxMessageProcessingTime() {
+            return TcpDiscoverySpi.this.getMaxMessageProcessingTime();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getTotalReceivedMessages() {
+            return TcpDiscoverySpi.this.getTotalReceivedMessages();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, Integer> getReceivedMessages() {
+            return TcpDiscoverySpi.this.getReceivedMessages();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getTotalProcessedMessages() {
+            return TcpDiscoverySpi.this.getTotalProcessedMessages();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, Integer> getProcessedMessages() {
+            return TcpDiscoverySpi.this.getProcessedMessages();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getCoordinatorSinceTimestamp() {
+            return TcpDiscoverySpi.this.getCoordinatorSinceTimestamp();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAdapter.java
index 0e0aed5..1cd91f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAdapter.java
@@ -71,10 +71,13 @@ public abstract class TcpDiscoveryIpFinderAdapter implements TcpDiscoveryIpFinde
      * with IP finder will be seen by IP finders on all other nodes.
      *
      * @param shared {@code true} if this IP finder is shared.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setShared(boolean shared) {
+    public TcpDiscoveryIpFinderAdapter setShared(boolean shared) {
         this.shared = shared;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java
index a16f238..fbbda07 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java
@@ -263,10 +263,13 @@ public class TcpDiscoveryJdbcIpFinder extends TcpDiscoveryIpFinderAdapter {
      * Data source should be fully configured and ready-to-use.
      *
      * @param dataSrc Data source.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setDataSource(DataSource dataSrc) {
+    public TcpDiscoveryJdbcIpFinder setDataSource(DataSource dataSrc) {
         this.dataSrc = dataSrc;
+
+        return this;
     }
 
     /**
@@ -275,10 +278,13 @@ public class TcpDiscoveryJdbcIpFinder extends TcpDiscoveryIpFinderAdapter {
      *
      * @param initSchema {@code True} if DB schema should be initialized by Ignite (default behaviour),
      *      {code @false} if schema was explicitly created by user.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setInitSchema(boolean initSchema) {
+    public TcpDiscoveryJdbcIpFinder setInitSchema(boolean initSchema) {
         this.initSchema = initSchema;
+
+        return this;
     }
 
     /**
@@ -404,6 +410,13 @@ public class TcpDiscoveryJdbcIpFinder extends TcpDiscoveryIpFinderAdapter {
     }
 
     /** {@inheritDoc} */
+    @Override public TcpDiscoveryJdbcIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpDiscoveryJdbcIpFinder.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 8fe8a65..6c47014 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
@@ -153,10 +153,13 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      * If not provided, default value is {@link #DFLT_MCAST_GROUP}.
      *
      * @param mcastGrp Multicast IP address.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setMulticastGroup(String mcastGrp) {
+    public TcpDiscoveryMulticastIpFinder setMulticastGroup(String mcastGrp) {
         this.mcastGrp = mcastGrp;
+
+        return this;
     }
 
     /**
@@ -174,10 +177,13 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      * If not provided, default value is {@link #DFLT_MCAST_PORT}.
      *
      * @param mcastPort Multicast port number.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setMulticastPort(int mcastPort) {
+    public TcpDiscoveryMulticastIpFinder setMulticastPort(int mcastPort) {
         this.mcastPort = mcastPort;
+
+        return this;
     }
 
     /**
@@ -196,10 +202,13 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      * If not provided, default value is {@link #DFLT_RES_WAIT_TIME}.
      *
      * @param resWaitTime Time IP finder waits for reply to multicast address request.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setResponseWaitTime(int resWaitTime) {
+    public TcpDiscoveryMulticastIpFinder setResponseWaitTime(int resWaitTime) {
         this.resWaitTime = resWaitTime;
+
+        return this;
     }
 
     /**
@@ -219,10 +228,13 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      * If not provided, default value is {@link #DFLT_ADDR_REQ_ATTEMPTS}.
      *
      * @param addrReqAttempts Number of attempts to send multicast address request.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setAddressRequestAttempts(int addrReqAttempts) {
+    public TcpDiscoveryMulticastIpFinder setAddressRequestAttempts(int addrReqAttempts) {
         this.addrReqAttempts = addrReqAttempts;
+
+        return this;
     }
 
     /**
@@ -245,10 +257,13 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      *
      * @param locAddr Local host address.
      * @see org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi#setLocalAddress(String)
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setLocalAddress(String locAddr) {
+    public TcpDiscoveryMulticastIpFinder setLocalAddress(String locAddr) {
         this.locAddr = locAddr;
+
+        return this;
     }
 
     /**
@@ -272,10 +287,13 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      * Default value is {@code -1} which corresponds to system default value.
      *
      * @param ttl Time to live.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setTimeToLive(int ttl) {
+    public TcpDiscoveryMulticastIpFinder setTimeToLive(int ttl) {
         this.ttl = ttl;
+
+        return this;
     }
 
     /**
@@ -650,11 +668,6 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
         }
     }
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(TcpDiscoveryMulticastIpFinder.class, this, "super", super.toString());
-    }
-
     /**
      * @param e Network error to handle.
      * @return {@code True} if this error is recoverable and the operation can be retried.
@@ -670,6 +683,18 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
         return true;
     }
 
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryMulticastIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryMulticastIpFinder.class, this, "super", super.toString());
+    }
+
     /**
      * Response to multicast address request.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/sharedfs/TcpDiscoverySharedFsIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/sharedfs/TcpDiscoverySharedFsIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/sharedfs/TcpDiscoverySharedFsIpFinder.java
index d4e93d2..a30309c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/sharedfs/TcpDiscoverySharedFsIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/sharedfs/TcpDiscoverySharedFsIpFinder.java
@@ -112,10 +112,13 @@ public class TcpDiscoverySharedFsIpFinder extends TcpDiscoveryIpFinderAdapter {
      * Sets path.
      *
      * @param path Shared path.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setPath(String path) {
+    public TcpDiscoverySharedFsIpFinder setPath(String path) {
         this.path = path;
+
+        return this;
     }
 
     /**
@@ -302,6 +305,13 @@ public class TcpDiscoverySharedFsIpFinder extends TcpDiscoveryIpFinderAdapter {
     }
 
     /** {@inheritDoc} */
+    @Override public TcpDiscoverySharedFsIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpDiscoverySharedFsIpFinder.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java
index 94c237f..e2239b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java
@@ -129,11 +129,12 @@ public class TcpDiscoveryVmIpFinder extends TcpDiscoveryIpFinderAdapter {
      *
      * @param addrs Known nodes addresses.
      * @throws IgniteSpiException If any error occurs.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public synchronized void setAddresses(Collection<String> addrs) throws IgniteSpiException {
+    public synchronized TcpDiscoveryVmIpFinder setAddresses(Collection<String> addrs) throws IgniteSpiException {
         if (F.isEmpty(addrs))
-            return;
+            return this;
 
         Collection<InetSocketAddress> newAddrs = new LinkedHashSet<>();
 
@@ -141,6 +142,8 @@ public class TcpDiscoveryVmIpFinder extends TcpDiscoveryIpFinderAdapter {
             newAddrs.addAll(address(ipStr));
 
         this.addrs = newAddrs;
+
+        return this;
     }
 
     /**
@@ -261,6 +264,13 @@ public class TcpDiscoveryVmIpFinder extends TcpDiscoveryIpFinderAdapter {
     }
 
     /** {@inheritDoc} */
+    @Override public TcpDiscoveryVmIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpDiscoveryVmIpFinder.class, this, "super", super.toString());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
index dcfbde1..a61c236 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
@@ -29,6 +29,7 @@ import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.eventstorage.EventStorageSpi;
 import org.jsr166.ConcurrentLinkedDeque8;
@@ -94,8 +95,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_METRICS_UPDATED;
  * @see org.apache.ignite.spi.eventstorage.EventStorageSpi
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStorageSpi,
-    MemoryEventStorageSpiMBean {
+public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStorageSpi {
     /** Default event time to live value in milliseconds (value is {@link Long#MAX_VALUE}). */
     public static final long DFLT_EXPIRE_AGE_MS = Long.MAX_VALUE;
 
@@ -131,10 +131,13 @@ public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStor
      * Sets filter for events to be recorded.
      *
      * @param filter Filter to use.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setFilter(IgnitePredicate<Event> filter) {
+    public MemoryEventStorageSpi setFilter(IgnitePredicate<Event> filter) {
         this.filter = filter;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -151,7 +154,7 @@ public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStor
             log.debug(configInfo("expireCnt", expireCnt));
         }
 
-        registerMBean(igniteInstanceName, this, MemoryEventStorageSpiMBean.class);
+        registerMBean(igniteInstanceName, new MemoryEventStorageSpiMBeanImpl(this), MemoryEventStorageSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -171,16 +174,37 @@ public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStor
     }
 
     /**
+     * See {@link #setExpireAgeMs(long)}
+     *
+     * @return Event time-to-live.
+     */
+    public long getExpireAgeMs() {
+        return expireAgeMs;
+    }
+
+    /**
      * Sets events expiration time. All events that exceed this value
      * will be removed from the queue when next event comes.
      * <p>
      * If not provided, default value is {@link #DFLT_EXPIRE_AGE_MS}.
      *
      * @param expireAgeMs Expiration time in milliseconds.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setExpireAgeMs(long expireAgeMs) {
+    public MemoryEventStorageSpi setExpireAgeMs(long expireAgeMs) {
         this.expireAgeMs = expireAgeMs;
+
+        return this;
+    }
+
+    /**
+     * See {@link #setExpireCount(long)}
+     *
+     * @return Maximum event queue size.
+     */
+    public long getExpireCount() {
+        return expireCnt;
     }
 
     /**
@@ -189,29 +213,28 @@ public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStor
      * If not provided, default value {@link #DFLT_EXPIRE_COUNT} will be used.
      *
      * @param expireCnt Maximum queue size.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setExpireCount(long expireCnt) {
+    public MemoryEventStorageSpi setExpireCount(long expireCnt) {
         this.expireCnt = expireCnt;
-    }
 
-    /** {@inheritDoc} */
-    @Override public long getExpireAgeMs() {
-        return expireAgeMs;
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getExpireCount() {
-        return expireCnt;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getQueueSize() {
+    /**
+     * Gets current queue size of the event queue.
+     *
+     * @return Current queue size of the event queue.
+     */
+    public long getQueueSize() {
         return evts.sizex();
     }
 
-    /** {@inheritDoc} */
-    @Override public void clearAll() {
+    /**
+     * Removes all events from the event queue.
+     */
+    public void clearAll() {
         evts.clear();
     }
 
@@ -278,7 +301,44 @@ public class MemoryEventStorageSpi extends IgniteSpiAdapter implements EventStor
     }
 
     /** {@inheritDoc} */
+    @Override public MemoryEventStorageSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(MemoryEventStorageSpi.class, this);
     }
+
+    /**
+     * MBean implementation for MemoryEventStorageSpi.
+     */
+    private class MemoryEventStorageSpiMBeanImpl extends IgniteSpiMBeanAdapter implements MemoryEventStorageSpiMBean {
+        /** {@inheritDoc} */
+        MemoryEventStorageSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getExpireAgeMs() {
+            return MemoryEventStorageSpi.this.getExpireAgeMs();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getExpireCount() {
+            return MemoryEventStorageSpi.this.getExpireCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getQueueSize() {
+            return MemoryEventStorageSpi.this.getQueueSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void clearAll() {
+            MemoryEventStorageSpi.this.clearAll();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
index 4b916e7..468a627 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
@@ -37,6 +37,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.failover.FailoverContext;
 import org.apache.ignite.spi.failover.FailoverSpi;
@@ -95,7 +96,7 @@ import org.apache.ignite.spi.failover.FailoverSpi;
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = true)
-public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi, AlwaysFailoverSpiMBean {
+public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi {
     /** Maximum number of attempts to execute a failed job on another node (default is {@code 5}). */
     public static final int DFLT_MAX_FAILOVER_ATTEMPTS = 5;
 
@@ -124,8 +125,12 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
     /** Number of jobs that were failed over. */
     private int totalFailoverJobs;
 
-    /** {@inheritDoc} */
-    @Override public int getMaximumFailoverAttempts() {
+    /**
+     * See {@link #setMaximumFailoverAttempts(int)}.
+     *
+     * @return Maximum number of attempts to execute a failed job on another node.
+     */
+    public int getMaximumFailoverAttempts() {
         return maxFailoverAttempts;
     }
 
@@ -134,14 +139,21 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
      * If not specified, {@link #DFLT_MAX_FAILOVER_ATTEMPTS} value will be used.
      *
      * @param maxFailoverAttempts Maximum number of attempts to execute a failed job on another node.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setMaximumFailoverAttempts(int maxFailoverAttempts) {
+    public AlwaysFailoverSpi setMaximumFailoverAttempts(int maxFailoverAttempts) {
         this.maxFailoverAttempts = maxFailoverAttempts;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getTotalFailoverJobsCount() {
+    /**
+     * Get total number of jobs that were failed over.
+     *
+     * @return Total number of failed over jobs.
+     */
+    public int getTotalFailoverJobsCount() {
         return totalFailoverJobs;
     }
 
@@ -160,7 +172,7 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
         if (log.isDebugEnabled())
             log.debug(configInfo("maximumFailoverAttempts", maxFailoverAttempts));
 
-        registerMBean(igniteInstanceName, this, AlwaysFailoverSpiMBean.class);
+        registerMBean(igniteInstanceName, new AlwaysFailoverSpiMBeanImpl(this), AlwaysFailoverSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -286,7 +298,34 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
     }
 
     /** {@inheritDoc} */
+    @Override public AlwaysFailoverSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(AlwaysFailoverSpi.class, this);
     }
+
+    /**
+     * MBean implementation for AlwaysFailoverSpi.
+     */
+    private class AlwaysFailoverSpiMBeanImpl extends IgniteSpiMBeanAdapter implements AlwaysFailoverSpiMBean {
+        /** {@inheritDoc} */
+        AlwaysFailoverSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaximumFailoverAttempts() {
+            return AlwaysFailoverSpi.this.getMaximumFailoverAttempts();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getTotalFailoverJobsCount() {
+            return AlwaysFailoverSpi.this.getTotalFailoverJobsCount();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpi.java
index 05c681d..3ef32ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/jobstealing/JobStealingFailoverSpi.java
@@ -34,6 +34,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.failover.FailoverContext;
 import org.apache.ignite.spi.failover.FailoverSpi;
@@ -98,8 +99,7 @@ import static org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSp
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = true)
-public class JobStealingFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
-    JobStealingFailoverSpiMBean {
+public class JobStealingFailoverSpi extends IgniteSpiAdapter implements FailoverSpi {
     /** Maximum number of attempts to execute a failed job on another node (default is {@code 5}). */
     public static final int DFLT_MAX_FAILOVER_ATTEMPTS = 5;
 
@@ -136,8 +136,12 @@ public class JobStealingFailoverSpi extends IgniteSpiAdapter implements Failover
     /** Number of jobs that were stolen. */
     private int totalStolenJobs;
 
-    /** {@inheritDoc} */
-    @Override public int getMaximumFailoverAttempts() {
+    /**
+     * See {@link #setMaximumFailoverAttempts(int)}.
+     *
+     * @return Maximum number of attempts to execute a failed job on another node.
+     */
+    public int getMaximumFailoverAttempts() {
         return maxFailoverAttempts;
     }
 
@@ -151,19 +155,30 @@ public class JobStealingFailoverSpi extends IgniteSpiAdapter implements Failover
      *
      * @param maxFailoverAttempts Maximum number of attempts to execute a failed
      *      job on another node.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setMaximumFailoverAttempts(int maxFailoverAttempts) {
+    public JobStealingFailoverSpi setMaximumFailoverAttempts(int maxFailoverAttempts) {
         this.maxFailoverAttempts = maxFailoverAttempts;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getTotalFailedOverJobsCount() {
+    /**
+     * Get total number of jobs that were failed over including stolen ones.
+     *
+     * @return Total number of failed over jobs.
+     */
+    public int getTotalFailedOverJobsCount() {
         return totalFailedOverJobs;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getTotalStolenJobsCount() {
+    /**
+     * Get total number of jobs that were stolen.
+     *
+     * @return Total number of stolen jobs.
+     */
+    public int getTotalStolenJobsCount() {
         return totalStolenJobs;
     }
 
@@ -182,7 +197,7 @@ public class JobStealingFailoverSpi extends IgniteSpiAdapter implements Failover
         if (log.isDebugEnabled())
             log.debug(configInfo("maxFailoverAttempts", maxFailoverAttempts));
 
-        registerMBean(igniteInstanceName, this, JobStealingFailoverSpiMBean.class);
+        registerMBean(igniteInstanceName, new JobStealingFailoverSpiMBeanImpl(this), JobStealingFailoverSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -355,7 +370,40 @@ public class JobStealingFailoverSpi extends IgniteSpiAdapter implements Failover
     }
 
     /** {@inheritDoc} */
+    @Override public JobStealingFailoverSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(JobStealingFailoverSpi.class, this);
     }
+
+    /**
+     * MBean implementation for JobStealingFailoverSpi.
+     */
+    private class JobStealingFailoverSpiMBeanImpl extends IgniteSpiMBeanAdapter implements JobStealingFailoverSpiMBean {
+        /** {@inheritDoc} */
+        public JobStealingFailoverSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaximumFailoverAttempts() {
+            return JobStealingFailoverSpi.this.getMaximumFailoverAttempts();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getTotalFailedOverJobsCount() {
+            return JobStealingFailoverSpi.this.getTotalFailedOverJobsCount();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getTotalStolenJobsCount() {
+            return JobStealingFailoverSpi.this.getTotalStolenJobsCount();
+        }
+
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpi.java
index 1056d2e..ffd695e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/never/NeverFailoverSpi.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.failover.FailoverContext;
 import org.apache.ignite.spi.failover.FailoverSpi;
@@ -32,7 +33,8 @@ import org.apache.ignite.spi.failover.FailoverSpi;
 /**
  * This class provides failover SPI implementation that never fails over. This implementation
  * never fails over a failed job by always returning {@code null} out of
- * {@link org.apache.ignite.spi.failover.FailoverSpi#failover(org.apache.ignite.spi.failover.FailoverContext, List)} method.
+ * {@link org.apache.ignite.spi.failover.FailoverSpi#failover(org.apache.ignite.spi.failover.FailoverContext, List)}
+ * method.
  * <h1 class="header">Configuration</h1>
  * <h2 class="header">Mandatory</h2>
  * This SPI has no mandatory configuration parameters.
@@ -54,17 +56,18 @@ import org.apache.ignite.spi.failover.FailoverSpi;
  * Here is an example on how to configure grid with {@link NeverFailoverSpi} from Spring XML configuration file:
  * <pre name="code" class="xml">
  * &lt;property name="failoverSpi"&gt;
- *     &lt;bean class="org.apache.ignite.spi.failover.never.NeverFailoverSpi"/&gt;
+ * &lt;bean class="org.apache.ignite.spi.failover.never.NeverFailoverSpi"/&gt;
  * &lt;/property&gt;
  * </pre>
  * <p>
  * <img src="http://ignite.apache.org/images/spring-small.png">
  * <br>
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ *
  * @see org.apache.ignite.spi.failover.FailoverSpi
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class NeverFailoverSpi extends IgniteSpiAdapter implements FailoverSpi, NeverFailoverSpiMBean {
+public class NeverFailoverSpi extends IgniteSpiAdapter implements FailoverSpi {
     /** Injected grid logger. */
     @LoggerResource
     private IgniteLogger log;
@@ -74,7 +77,7 @@ public class NeverFailoverSpi extends IgniteSpiAdapter implements FailoverSpi, N
         // Start SPI start stopwatch.
         startStopwatch();
 
-        registerMBean(igniteInstanceName, this, NeverFailoverSpiMBean.class);
+        registerMBean(igniteInstanceName, new NeverFailoverSpiMBeanImpl(this), NeverFailoverSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -93,14 +96,31 @@ public class NeverFailoverSpi extends IgniteSpiAdapter implements FailoverSpi, N
     /** {@inheritDoc} */
     @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
         U.warn(log, "Returning 'null' node for failed job (failover will not happen) [job=" +
-            ctx.getJobResult().getJob() + ", task=" +  ctx.getTaskSession().getTaskName() +
+            ctx.getJobResult().getJob() + ", task=" + ctx.getTaskSession().getTaskName() +
             ", sessionId=" + ctx.getTaskSession().getId() + ']');
 
         return null;
     }
 
     /** {@inheritDoc} */
+    @Override public NeverFailoverSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(NeverFailoverSpi.class, this);
     }
+
+    /**
+     * MBean implementation for NeverFailoverSpi.
+     */
+    private class NeverFailoverSpiMBeanImpl extends IgniteSpiMBeanAdapter implements NeverFailoverSpiMBean {
+        /** {@inheritDoc} */
+        NeverFailoverSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java
index 5c8bfd2..a8683a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/noop/NoopIndexingSpi.java
@@ -68,4 +68,11 @@ public class NoopIndexingSpi extends IgniteSpiAdapter implements IndexingSpi {
     @Override public void spiStop() throws IgniteSpiException {
         // No-op.
     }
+
+    /** {@inheritDoc} */
+    @Override public NoopIndexingSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
 }
\ No newline at end of file


[03/18] ignite git commit: IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpi.java
index 619c468..35cb62a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpi.java
@@ -30,6 +30,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.checkpoint.CheckpointListener;
 import org.apache.ignite.spi.checkpoint.CheckpointSpi;
@@ -101,7 +102,7 @@ import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED;
  * @see org.apache.ignite.spi.checkpoint.CheckpointSpi
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class CacheCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi, CacheCheckpointSpiMBean {
+public class CacheCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     /** Default cache name (value is <tt>checkpoints</tt>). */
     public static final String DFLT_CACHE_NAME = "checkpoints";
 
@@ -124,14 +125,21 @@ public class CacheCheckpointSpi extends IgniteSpiAdapter implements CheckpointSp
      * If cache name is not provided {@link #DFLT_CACHE_NAME} is used.
      *
      * @param cacheName Cache name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setCacheName(String cacheName) {
+    public CacheCheckpointSpi setCacheName(String cacheName) {
         this.cacheName = cacheName;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getCacheName() {
+    /**
+     * Gets cache name to be used by this SPI..
+     *
+     * @return Cache name to be used by this SPI.
+     */
+    public String getCacheName() {
         return cacheName;
     }
 
@@ -146,7 +154,7 @@ public class CacheCheckpointSpi extends IgniteSpiAdapter implements CheckpointSp
         if (log.isDebugEnabled())
             log.debug(configInfo("cacheName", cacheName));
 
-        registerMBean(igniteInstanceName, this, CacheCheckpointSpiMBean.class);
+        registerMBean(igniteInstanceName, new CacheCheckpointSpiMBeanImpl(this), CacheCheckpointSpiMBean.class);
 
         if (log.isDebugEnabled())
             log.debug(startInfo());
@@ -247,7 +255,29 @@ public class CacheCheckpointSpi extends IgniteSpiAdapter implements CheckpointSp
     }
 
     /** {@inheritDoc} */
+    @Override public CacheCheckpointSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheCheckpointSpi.class, this);
     }
+
+    /**
+     * MBean implementation for CacheCheckpointSpi.
+     */
+    private class CacheCheckpointSpiMBeanImpl extends IgniteSpiMBeanAdapter implements CacheCheckpointSpiMBean {
+        /** {@inheritDoc} */
+        CacheCheckpointSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getCacheName() {
+            return CacheCheckpointSpi.this.getCacheName();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java
index a052704..744ce59 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java
@@ -32,6 +32,7 @@ import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.checkpoint.CheckpointListener;
 import org.apache.ignite.spi.checkpoint.CheckpointSpi;
@@ -111,7 +112,7 @@ import org.apache.ignite.spi.checkpoint.CheckpointSpi;
  */
 @SuppressWarnings({"JDBCResourceOpenedButNotSafelyClosed", "JDBCExecuteWithNonConstantString"})
 @IgniteSpiMultipleInstancesSupport(true)
-public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi, JdbcCheckpointSpiMBean {
+public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     /** Default number of retries in case of errors (value is {@code 2}). */
     public static final int DFLT_NUMBER_OF_RETRIES = 2;
 
@@ -242,58 +243,102 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
     /** Listener. */
     private CheckpointListener lsnr;
 
-    /** {@inheritDoc} */
-    @Override public int getNumberOfRetries() {
+    /**
+     * Gets number of retries in case of DB failure.
+     *
+     * @return Number of retries.
+     */
+    public int getNumberOfRetries() {
         return retryNum;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getDataSourceInfo() {
+    /**
+     * Gets data source description.
+     *
+     * @return Description for data source.
+     */
+    public String getDataSourceInfo() {
         return dataSrc.toString();
     }
 
-    /** {@inheritDoc} */
-    @Override public String getUser() {
+    /**
+     * Gets checkpoint jdbc user name.
+     *
+     * @return User name for checkpoint jdbc.
+     */
+    public String getUser() {
         return user;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getPwd() {
+    /**
+     * Gets checkpoint jdbc password.
+     *
+     * @return Password for checkpoint jdbc.
+     */
+    public String getPwd() {
         return pwd;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getCheckpointTableName() {
+    /**
+     * Gets checkpoint table name.
+     *
+     * @return Checkpoint table name.
+     */
+    public String getCheckpointTableName() {
         return tblName;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getKeyFieldName() {
+    /**
+     * Gets key field name for checkpoint table.
+     *
+     * @return Key field name for checkpoint table.
+     */
+    public String getKeyFieldName() {
         return keyName;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getKeyFieldType() {
+    /**
+     * Gets key field type for checkpoint table.
+     *
+     * @return Key field type for checkpoint table.
+     */
+    public String getKeyFieldType() {
         return keyType;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getValueFieldName() {
+    /**
+     * Gets value field name for checkpoint table.
+     *
+     * @return Value field name for checkpoint table.
+     */
+    public String getValueFieldName() {
         return valName;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getValueFieldType() {
+    /**
+     * Gets value field type for checkpoint table.
+     *
+     * @return Value field type for checkpoint table.
+     */
+    public String getValueFieldType() {
         return valType;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getExpireDateFieldName() {
+    /**
+     * Gets expiration date field name for checkpoint table.
+     *
+     * @return Create date field name for checkpoint table.
+     */
+    public String getExpireDateFieldName() {
         return expDateName;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getExpireDateFieldType() {
+    /**
+     * Gets expiration date field type for checkpoint table.
+     *
+     * @return Expiration date field type for checkpoint table.
+     */
+    public String getExpireDateFieldType() {
         return expDateType;
     }
 
@@ -306,10 +351,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * this SPI from Spring configuration file. Refer to {@code Apache DBCP} project for more information.
      *
      * @param dataSrc DataSource object to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setDataSource(DataSource dataSrc) {
+    public JdbcCheckpointSpi setDataSource(DataSource dataSrc) {
         this.dataSrc = dataSrc;
+
+        return this;
     }
 
     /**
@@ -317,10 +365,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * the value is {@link #DFLT_NUMBER_OF_RETRIES}.
      *
      * @param retryNum Number of retries in case of any database errors.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setNumberOfRetries(int retryNum) {
+    public JdbcCheckpointSpi setNumberOfRetries(int retryNum) {
         this.retryNum = retryNum;
+
+        return this;
     }
 
     /**
@@ -329,10 +380,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      *
      * @param user Checkpoint database user name to set.
      * @see #setPwd(String)
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setUser(String user) {
+    public JdbcCheckpointSpi setUser(String user) {
         this.user = user;
+
+        return this;
     }
 
     /**
@@ -341,20 +395,26 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      *
      * @param pwd Checkpoint database password to set.
      * @see #setUser(String)
+     ** @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setPwd(String pwd) {
+    public JdbcCheckpointSpi setPwd(String pwd) {
         this.pwd = pwd;
+
+        return this;
     }
 
     /**
      * Sets checkpoint table name. By default {@link #DFLT_CHECKPOINT_TABLE_NAME} is used.
      *
      * @param tblName Checkpoint table name to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setCheckpointTableName(String tblName) {
+    public JdbcCheckpointSpi setCheckpointTableName(String tblName) {
         this.tblName = tblName;
+
+        return this;
     }
 
     /**
@@ -363,10 +423,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * change key field type (see {@link #setKeyFieldType(String)}).
      *
      * @param keyName Checkpoint key field name to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setKeyFieldName(String keyName) {
+    public JdbcCheckpointSpi setKeyFieldName(String keyName) {
         this.keyName = keyName;
+
+        return this;
     }
 
     /**
@@ -375,10 +438,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * By default {@link #DFLT_EXPIRE_DATE_FIELD_TYPE} is used.
      *
      * @param keyType Checkpoint key field type to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setKeyFieldType(String keyType) {
+    public JdbcCheckpointSpi setKeyFieldType(String keyType) {
         this.keyType = keyType;
+
+        return this;
     }
 
     /**
@@ -387,10 +453,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * (see {@link #setValueFieldType(String)}).
      *
      * @param valName Checkpoint value field name to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setValueFieldName(String valName) {
+    public JdbcCheckpointSpi setValueFieldName(String valName) {
         this.valName = valName;
+
+        return this;
     }
 
     /**
@@ -400,10 +469,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * then the type should be {@code longvarbinary}.
      *
      * @param valType Checkpoint value field type to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setValueFieldType(String valType) {
+    public JdbcCheckpointSpi setValueFieldType(String valType) {
         this.valType = valType;
+
+        return this;
     }
 
     /**
@@ -413,10 +485,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * (see {@link #setExpireDateFieldType(String)}).
      *
      * @param expDateName Checkpoint expiration date field name to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setExpireDateFieldName(String expDateName) {
+    public JdbcCheckpointSpi setExpireDateFieldName(String expDateName) {
         this.expDateName = expDateName;
+
+        return this;
     }
 
     /**
@@ -425,10 +500,13 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
      * corresponding SQL {@code DATETIME} type.
      *
      * @param expDateType Checkpoint expiration date field type to set.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setExpireDateFieldType(String expDateType) {
+    public JdbcCheckpointSpi setExpireDateFieldType(String expDateType) {
         this.expDateType = expDateType;
+
+        return this;
     }
 
     /**
@@ -880,4 +958,77 @@ public class JdbcCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
     @Override public void setCheckpointListener(CheckpointListener lsnr) {
         this.lsnr = lsnr;
     }
+
+    /** {@inheritDoc} */
+    @Override
+    public JdbcCheckpointSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /**
+     * MBean implementation for JdbcCheckpointSpi.
+     */
+    private class JdbcCheckpointSpiMBeanImpl extends IgniteSpiMBeanAdapter implements JdbcCheckpointSpiMBean {
+        /** {@inheritDoc} */
+        JdbcCheckpointSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getNumberOfRetries() {
+            return JdbcCheckpointSpi.this.getNumberOfRetries();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getDataSourceInfo() {
+            return JdbcCheckpointSpi.this.getDataSourceInfo();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getUser() {
+            return JdbcCheckpointSpi.this.getUser();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getPwd() {
+            return JdbcCheckpointSpi.this.getPwd();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getCheckpointTableName() {
+            return JdbcCheckpointSpi.this.getCheckpointTableName();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getKeyFieldName() {
+            return JdbcCheckpointSpi.this.getKeyFieldName();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getKeyFieldType() {
+            return JdbcCheckpointSpi.this.getKeyFieldType();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getValueFieldName() {
+            return JdbcCheckpointSpi.this.getValueFieldName();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getValueFieldType() {
+            return JdbcCheckpointSpi.this.getValueFieldType();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getExpireDateFieldName() {
+            return JdbcCheckpointSpi.this.getExpireDateFieldName();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getExpireDateFieldType() {
+            return JdbcCheckpointSpi.this.getExpireDateFieldType();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/noop/NoopCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/noop/NoopCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/noop/NoopCheckpointSpi.java
index c3ac202..d0bf2d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/noop/NoopCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/noop/NoopCheckpointSpi.java
@@ -71,6 +71,13 @@ public class NoopCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi
     }
 
     /** {@inheritDoc} */
+    @Override public NoopCheckpointSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(NoopCheckpointSpi.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 1917d38..29a7ec1 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
@@ -42,6 +42,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.checkpoint.CheckpointListener;
 import org.apache.ignite.spi.checkpoint.CheckpointSpi;
@@ -118,8 +119,7 @@ import org.jetbrains.annotations.Nullable;
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = false)
-public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
-    SharedFsCheckpointSpiMBean {
+public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     /**
      * Default checkpoint directory. Note that this path is relative to {@code IGNITE_HOME/work} folder
      * if {@code IGNITE_HOME} system or environment variable specified, otherwise it is relative to
@@ -177,13 +177,21 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
         dirPaths.offer(DFLT_DIR_PATH);
     }
 
-     /** {@inheritDoc} */
-    @Override public Collection<String> getDirectoryPaths() {
+    /**
+     * Gets collection of all configured paths where checkpoints can be saved.
+     *
+     * @return Collection of all configured paths.
+     */
+    public Collection<String> getDirectoryPaths() {
         return dirPaths;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getCurrentDirectoryPath() {
+    /**
+     * Gets path to the directory where all checkpoints are saved.
+     *
+     * @return Path to the checkpoints directory.
+     */
+    public String getCurrentDirectoryPath() {
         return curDirPath;
     }
 
@@ -196,13 +204,16 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
      *
      * @param dirPaths Absolute or Ignite installation home folder relative path where checkpoints
      * will be stored.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setDirectoryPaths(Collection<String> dirPaths) {
+    public SharedFsCheckpointSpi setDirectoryPaths(Collection<String> dirPaths) {
         A.ensure(!F.isEmpty(dirPaths), "!F.isEmpty(dirPaths)");
 
         this.dirPaths.clear();
         this.dirPaths.addAll(dirPaths);
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -227,7 +238,7 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
         if (!folder.isDirectory())
             throw new IgniteSpiException("Checkpoint directory path is not a valid directory: " + curDirPath);
 
-        registerMBean(igniteInstanceName, this, SharedFsCheckpointSpiMBean.class);
+        registerMBean(igniteInstanceName, new SharedFsCheckpointSpiMBeanImpl(this), SharedFsCheckpointSpiMBean.class);
 
         // Ack parameters.
         if (log.isDebugEnabled()) {
@@ -506,7 +517,34 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
     }
 
     /** {@inheritDoc} */
+    @Override public SharedFsCheckpointSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(SharedFsCheckpointSpi.class, this);
     }
+
+    /**
+     * MBean implementation for SharedFsCheckpointSpi.
+     */
+    private class SharedFsCheckpointSpiMBeanImpl extends IgniteSpiMBeanAdapter implements SharedFsCheckpointSpiMBean {
+        /** {@inheritDoc} */
+        SharedFsCheckpointSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Collection<String> getDirectoryPaths() {
+            return SharedFsCheckpointSpi.this.getDirectoryPaths();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getCurrentDirectoryPath() {
+            return SharedFsCheckpointSpi.this.getCurrentDirectoryPath();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpi.java
index d94b453..703e90e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpi.java
@@ -26,6 +26,7 @@ import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.collision.CollisionContext;
 import org.apache.ignite.spi.collision.CollisionExternalListener;
@@ -78,8 +79,7 @@ import org.apache.ignite.spi.collision.CollisionSpi;
  * </pre>
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class FifoQueueCollisionSpi extends IgniteSpiAdapter implements CollisionSpi,
-    FifoQueueCollisionSpiMBean {
+public class FifoQueueCollisionSpi extends IgniteSpiAdapter implements CollisionSpi {
     /**
      * Default number of parallel jobs allowed (set to number of cores times 2).
      */
@@ -110,49 +110,88 @@ public class FifoQueueCollisionSpi extends IgniteSpiAdapter implements Collision
     /** Number of jobs that are held. */
     private volatile int heldCnt;
 
-    /** {@inheritDoc} */
-    @Override public int getParallelJobsNumber() {
+    /**
+     * See {@link #setParallelJobsNumber(int)}
+     *
+     * @return Number of jobs that can be executed in parallel.
+     */
+    public int getParallelJobsNumber() {
         return parallelJobsNum;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets number of jobs that can be executed in parallel.
+     *
+     * @param parallelJobsNum Parallel jobs number.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setParallelJobsNumber(int parallelJobsNum) {
+    public FifoQueueCollisionSpi setParallelJobsNumber(int parallelJobsNum) {
         A.ensure(parallelJobsNum > 0, "parallelJobsNum > 0");
 
         this.parallelJobsNum = parallelJobsNum;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getWaitingJobsNumber() {
+    /**
+     * See {@link #setWaitingJobsNumber(int)}
+     *
+     * @return Maximum allowed number of waiting jobs.
+     */
+    public int getWaitingJobsNumber() {
         return waitJobsNum;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets maximum number of jobs that are allowed to wait in waiting queue. If number
+     * of waiting jobs ever exceeds this number, excessive jobs will be rejected.
+     *
+     * @param waitJobsNum Waiting jobs number.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setWaitingJobsNumber(int waitJobsNum) {
+    public FifoQueueCollisionSpi setWaitingJobsNumber(int waitJobsNum) {
         A.ensure(waitJobsNum >= 0, "waitingJobsNum >= 0");
 
         this.waitJobsNum = waitJobsNum;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentWaitJobsNumber() {
+    /**
+     * Gets current number of jobs that wait for the execution.
+     *
+     * @return Number of jobs that wait for execution.
+     */
+    public int getCurrentWaitJobsNumber() {
         return waitingCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentActiveJobsNumber() {
+    /**
+     * Gets current number of jobs that are active, i.e. {@code 'running + held'} jobs.
+     *
+     * @return Number of active jobs.
+     */
+    public int getCurrentActiveJobsNumber() {
         return runningCnt + heldCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentRunningJobsNumber() {
+    /**
+     * Gets number of currently running (not {@code 'held}) jobs.
+     *
+     * @return Number of currently running (not {@code 'held}) jobs.
+     */
+    public int getCurrentRunningJobsNumber() {
         return runningCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentHeldJobsNumber() {
+    /**
+     * Gets number of currently {@code 'held'} jobs.
+     *
+     * @return Number of currently {@code 'held'} jobs.
+     */
+    public int getCurrentHeldJobsNumber() {
         return heldCnt;
     }
 
@@ -168,7 +207,7 @@ public class FifoQueueCollisionSpi extends IgniteSpiAdapter implements Collision
         if (log.isDebugEnabled())
             log.debug(configInfo("parallelJobsNum", parallelJobsNum));
 
-        registerMBean(igniteInstanceName, this, FifoQueueCollisionSpiMBean.class);
+        registerMBean(igniteInstanceName, new FifoQueueCollisionSpiMBeanImpl(this), FifoQueueCollisionSpiMBean.class);
 
         // Ack start.
         if (log.isDebugEnabled())
@@ -252,7 +291,64 @@ public class FifoQueueCollisionSpi extends IgniteSpiAdapter implements Collision
     }
 
     /** {@inheritDoc} */
+    @Override public FifoQueueCollisionSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(FifoQueueCollisionSpi.class, this);
     }
+
+    /**
+     * MBean implementation for FifoQueueCollisionSpi.
+     */
+    private class FifoQueueCollisionSpiMBeanImpl extends IgniteSpiMBeanAdapter implements FifoQueueCollisionSpiMBean {
+        /** {@inheritDoc} */
+        FifoQueueCollisionSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getParallelJobsNumber() {
+            return FifoQueueCollisionSpi.this.getParallelJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentWaitJobsNumber() {
+            return FifoQueueCollisionSpi.this.getCurrentWaitJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentActiveJobsNumber() {
+            return FifoQueueCollisionSpi.this.getCurrentActiveJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentRunningJobsNumber() {
+            return FifoQueueCollisionSpi.this.getCurrentRunningJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentHeldJobsNumber() {
+            return FifoQueueCollisionSpi.this.getCurrentHeldJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getWaitingJobsNumber() {
+            return FifoQueueCollisionSpi.this.getWaitingJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setWaitingJobsNumber(int waitJobsNum) {
+            FifoQueueCollisionSpi.this.setWaitingJobsNumber(waitJobsNum);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setParallelJobsNumber(int parallelJobsNum) {
+            FifoQueueCollisionSpi.this.setParallelJobsNumber(parallelJobsNum);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpiMBean.java
index 40d47a2..59283e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/fifoqueue/FifoQueueCollisionSpiMBean.java
@@ -75,7 +75,7 @@ public interface FifoQueueCollisionSpiMBean extends IgniteSpiManagementMBean {
     @MXBeanDescription("Number of active jobs.")
     public int getCurrentActiveJobsNumber();
 
-    /*
+    /**
      * Gets number of currently running (not {@code 'held}) jobs.
      *
      * @return Number of currently running (not {@code 'held}) jobs.

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
index 37db103..8a02225 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
@@ -49,6 +49,7 @@ import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.collision.CollisionContext;
 import org.apache.ignite.spi.collision.CollisionExternalListener;
@@ -185,8 +186,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = true)
-public class JobStealingCollisionSpi extends IgniteSpiAdapter implements CollisionSpi,
-    JobStealingCollisionSpiMBean {
+public class JobStealingCollisionSpi extends IgniteSpiAdapter implements CollisionSpi {
     /** Maximum number of attempts to steal job by another node (default is {@code 5}). */
     public static final int DFLT_MAX_STEALING_ATTEMPTS = 5;
 
@@ -305,66 +305,133 @@ public class JobStealingCollisionSpi extends IgniteSpiAdapter implements Collisi
     /** */
     private Comparator<CollisionJobContext> cmp;
 
-    /** {@inheritDoc} */
+    /**
+     * Sets number of jobs that can be executed in parallel.
+     *
+     * @param activeJobsThreshold Number of jobs that can be executed in parallel.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setActiveJobsThreshold(int activeJobsThreshold) {
+    public JobStealingCollisionSpi setActiveJobsThreshold(int activeJobsThreshold) {
         A.ensure(activeJobsThreshold >= 0, "activeJobsThreshold >= 0");
 
         this.activeJobsThreshold = activeJobsThreshold;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getActiveJobsThreshold() {
+    /**
+     * See {@link #setActiveJobsThreshold(int)}.
+     *
+     * @return Number of jobs that can be executed in parallel.
+     */
+    public int getActiveJobsThreshold() {
         return activeJobsThreshold;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets job count threshold at which this node will
+     * start stealing jobs from other nodes.
+     *
+     * @param waitJobsThreshold Job count threshold.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setWaitJobsThreshold(int waitJobsThreshold) {
+    public JobStealingCollisionSpi setWaitJobsThreshold(int waitJobsThreshold) {
         A.ensure(waitJobsThreshold >= 0, "waitJobsThreshold >= 0");
 
         this.waitJobsThreshold = waitJobsThreshold;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getWaitJobsThreshold() {
+    /**
+     * See {@link #setWaitJobsThreshold(int)}.
+     *
+     * @return Job count threshold.
+     */
+    public int getWaitJobsThreshold() {
         return waitJobsThreshold;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Message expire time configuration parameter. If no response is received
+     * from a busy node to a job stealing message, then implementation will
+     * assume that message never got there, or that remote node does not have
+     * this node included into topology of any of the jobs it has.
+     *
+     * @param msgExpireTime Message expire time.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setMessageExpireTime(long msgExpireTime) {
+    public JobStealingCollisionSpi setMessageExpireTime(long msgExpireTime) {
         A.ensure(msgExpireTime > 0, "messageExpireTime > 0");
 
         this.msgExpireTime = msgExpireTime;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getMessageExpireTime() {
+    /**
+     * See {@link #setMessageExpireTime(long)}.
+     *
+     * @return Message expire time.
+     */
+    public long getMessageExpireTime() {
         return msgExpireTime;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Gets flag indicating whether this node should attempt to steal jobs
+     * from other nodes. If {@code false}, then this node will steal allow
+     * jobs to be stolen from it, but won't attempt to steal any jobs from
+     * other nodes.
+     * <p>
+     * Default value is {@code true}.
+     *
+     * @param isStealingEnabled Flag indicating whether this node should attempt to steal jobs
+     *      from other nodes.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setStealingEnabled(boolean isStealingEnabled) {
+    public JobStealingCollisionSpi setStealingEnabled(boolean isStealingEnabled) {
         this.isStealingEnabled = isStealingEnabled;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isStealingEnabled() {
+    /**
+     * See {@link #setStealingEnabled(boolean)}.
+     *
+     * @return Flag indicating whether this node should attempt to steal jobs
+     *      from other nodes.
+     */
+    public boolean isStealingEnabled() {
         return isStealingEnabled;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Gets maximum number of attempts to steal job by another node.
+     * If not specified, {@link JobStealingCollisionSpi#DFLT_MAX_STEALING_ATTEMPTS}
+     * value will be used.
+     *
+     * @param maxStealingAttempts Maximum number of attempts to steal job by another node.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setMaximumStealingAttempts(int maxStealingAttempts) {
+    public JobStealingCollisionSpi setMaximumStealingAttempts(int maxStealingAttempts) {
         A.ensure(maxStealingAttempts > 0, "maxStealingAttempts > 0");
 
         this.maxStealingAttempts = maxStealingAttempts;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMaximumStealingAttempts() {
+    /**
+     * See {@link #setMaximumStealingAttempts(int)}.
+     *
+     * @return Maximum number of attempts to steal job by another node.
+     */
+    public int getMaximumStealingAttempts() {
         return maxStealingAttempts;
     }
 
@@ -374,47 +441,80 @@ public class JobStealingCollisionSpi extends IgniteSpiAdapter implements Collisi
      * {@link org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} methods).
      *
      * @param stealAttrs Node attributes to enable job stealing for.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setStealingAttributes(Map<String, ? extends Serializable> stealAttrs) {
+    public JobStealingCollisionSpi setStealingAttributes(Map<String, ? extends Serializable> stealAttrs) {
         this.stealAttrs = stealAttrs;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public Map<String, ? extends Serializable> getStealingAttributes() {
+    /**
+     * {@link #setStealingAttributes(Map)}.
+     *
+     * @return Node attributes to enable job stealing for.
+     */
+     public Map<String, ? extends Serializable> getStealingAttributes() {
         return stealAttrs;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentRunningJobsNumber() {
+    /**
+     * Gets number of currently running (not {@code 'held}) jobs.
+     *
+     * @return Number of currently running (not {@code 'held}) jobs.
+     */
+    public int getCurrentRunningJobsNumber() {
         return runningNum;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentHeldJobsNumber() {
+    /**
+     * Gets number of currently {@code 'held'} jobs.
+     *
+     * @return Number of currently {@code 'held'} jobs.
+     */
+    public int getCurrentHeldJobsNumber() {
         return heldNum;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentWaitJobsNumber() {
+    /**
+     * Gets current number of jobs that wait for the execution.
+     *
+     * @return Number of jobs that wait for execution.
+     */
+    public int getCurrentWaitJobsNumber() {
         return waitingNum;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentActiveJobsNumber() {
+    /**
+     * Gets current number of jobs that are being executed.
+     *
+     * @return Number of active jobs.
+     */
+    public int getCurrentActiveJobsNumber() {
         return runningNum + heldNum;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getTotalStolenJobsNumber() {
+    /**
+     * Gets total number of stolen jobs.
+     *
+     * @return Number of stolen jobs.
+     */
+    public int getTotalStolenJobsNumber() {
         return totalStolenJobsNum.get();
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentJobsToStealNumber() {
+    /**
+     * Gets current number of jobs to be stolen. This is outstanding
+     * requests number.
+     *
+     * @return Number of jobs to be stolen.
+     */
+    public int getCurrentJobsToStealNumber() {
         return stealReqs.get();
     }
 
+
     /** {@inheritDoc} */
     @Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
         HashMap<String, Object> res = new HashMap<>(4);
@@ -445,7 +545,8 @@ public class JobStealingCollisionSpi extends IgniteSpiAdapter implements Collisi
             log.debug(configInfo("maxStealingAttempts", maxStealingAttempts));
         }
 
-        registerMBean(igniteInstanceName, this, JobStealingCollisionSpiMBean.class);
+        registerMBean(igniteInstanceName, new JobStealingCollisionSpiMBeanImpl(this),
+            JobStealingCollisionSpiMBean.class);
 
         // Ack start.
         if (log.isDebugEnabled())
@@ -698,7 +799,7 @@ public class JobStealingCollisionSpi extends IgniteSpiAdapter implements Collisi
                 // requested to be stolen. Note, that we use lose total steal request
                 // counter to prevent excessive iteration over nodes under load.
                 for (Iterator<Entry<UUID, MessageInfo>> iter = rcvMsgMap.entrySet().iterator();
-                     iter.hasNext() && stealReqs.get() > 0;) {
+                    iter.hasNext() && stealReqs.get() > 0;) {
                     Entry<UUID, MessageInfo> entry = iter.next();
 
                     UUID nodeId = entry.getKey();
@@ -998,6 +1099,13 @@ public class JobStealingCollisionSpi extends IgniteSpiAdapter implements Collisi
     }
 
     /** {@inheritDoc} */
+    @Override public JobStealingCollisionSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(JobStealingCollisionSpi.class, this);
     }
@@ -1047,4 +1155,99 @@ public class JobStealingCollisionSpi extends IgniteSpiAdapter implements Collisi
         }
     }
 
+    /**
+     * MBean implementation for JobStealingCollisionSpi.
+     */
+    private class JobStealingCollisionSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements JobStealingCollisionSpiMBean {
+        /** {@inheritDoc} */
+        JobStealingCollisionSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, ? extends Serializable> getStealingAttributes() {
+            return JobStealingCollisionSpi.this.getStealingAttributes();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentRunningJobsNumber() {
+            return JobStealingCollisionSpi.this.getCurrentRunningJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentHeldJobsNumber() {
+            return JobStealingCollisionSpi.this.getCurrentHeldJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentWaitJobsNumber() {
+            return JobStealingCollisionSpi.this.getCurrentWaitJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentActiveJobsNumber() {
+            return JobStealingCollisionSpi.this.getCurrentActiveJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getTotalStolenJobsNumber() {
+            return JobStealingCollisionSpi.this.getTotalStolenJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentJobsToStealNumber() {
+            return JobStealingCollisionSpi.this.getCurrentJobsToStealNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setActiveJobsThreshold(int activeJobsThreshold) {
+            JobStealingCollisionSpi.this.setActiveJobsThreshold(activeJobsThreshold);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getActiveJobsThreshold() {
+            return JobStealingCollisionSpi.this.getActiveJobsThreshold();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setWaitJobsThreshold(int waitJobsThreshold) {
+            JobStealingCollisionSpi.this.setWaitJobsThreshold(waitJobsThreshold);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getWaitJobsThreshold() {
+            return JobStealingCollisionSpi.this.getWaitJobsThreshold();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMessageExpireTime(long msgExpireTime) {
+            JobStealingCollisionSpi.this.setMessageExpireTime(msgExpireTime);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMessageExpireTime() {
+            return JobStealingCollisionSpi.this.getMessageExpireTime();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setStealingEnabled(boolean isStealingEnabled) {
+            JobStealingCollisionSpi.this.setStealingEnabled(isStealingEnabled);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isStealingEnabled() {
+            return JobStealingCollisionSpi.this.isStealingEnabled();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaximumStealingAttempts(int maxStealingAttempts) {
+            JobStealingCollisionSpi.this.setMaximumStealingAttempts(maxStealingAttempts);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaximumStealingAttempts() {
+            return JobStealingCollisionSpi.this.getMaximumStealingAttempts();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpiMBean.java
index 9c49f70..8052936 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpiMBean.java
@@ -52,7 +52,7 @@ public interface JobStealingCollisionSpiMBean extends IgniteSpiManagementMBean {
     @MXBeanDescription("Number of active jobs.")
     public int getCurrentActiveJobsNumber();
 
-    /*
+    /**
      * Gets number of currently running (not {@code 'held}) jobs.
      *
      * @return Number of currently running (not {@code 'held}) jobs.
@@ -87,10 +87,10 @@ public interface JobStealingCollisionSpiMBean extends IgniteSpiManagementMBean {
     /**
      * Sets number of jobs that can be executed in parallel.
      *
-     * @param activeJobsTreshold Number of jobs that can be executed in parallel.
+     * @param activeJobsThreshold Number of jobs that can be executed in parallel.
      */
     @MXBeanDescription("Number of jobs that can be executed in parallel.")
-    public void setActiveJobsThreshold(int activeJobsTreshold);
+    public void setActiveJobsThreshold(int activeJobsThreshold);
 
     /**
      * Gets job count threshold at which this node will

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/noop/NoopCollisionSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/noop/NoopCollisionSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/noop/NoopCollisionSpi.java
index 8b75220..67a47a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/noop/NoopCollisionSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/noop/NoopCollisionSpi.java
@@ -59,6 +59,13 @@ public class NoopCollisionSpi extends IgniteSpiAdapter implements CollisionSpi {
     }
 
     /** {@inheritDoc} */
+    @Override public NoopCollisionSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(NoopCollisionSpi.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpi.java
index 9a6eb0e..47e81dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpi.java
@@ -37,6 +37,7 @@ import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiConsistencyChecked;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.collision.CollisionContext;
 import org.apache.ignite.spi.collision.CollisionExternalListener;
@@ -174,8 +175,7 @@ import org.apache.ignite.spi.collision.CollisionSpi;
  */
 @IgniteSpiMultipleInstancesSupport(true)
 @IgniteSpiConsistencyChecked(optional = true)
-public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements CollisionSpi,
-    PriorityQueueCollisionSpiMBean {
+public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements CollisionSpi {
     /**
      * Default number of parallel jobs allowed (set to number of cores times 2).
      */
@@ -245,49 +245,89 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
     @LoggerResource
     private IgniteLogger log;
 
-    /** {@inheritDoc} */
-    @Override public int getParallelJobsNumber() {
+    /**
+     * Gets number of jobs that can be executed in parallel.
+     *
+     * @return Number of jobs that can be executed in parallel.
+     */
+    public int getParallelJobsNumber() {
         return parallelJobsNum;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets number of jobs that can be executed in parallel.
+     *
+     * @param parallelJobsNum Parallel jobs number.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setParallelJobsNumber(int parallelJobsNum) {
+    public PriorityQueueCollisionSpi setParallelJobsNumber(int parallelJobsNum) {
         A.ensure(parallelJobsNum > 0,  "parallelJobsNum > 0");
 
         this.parallelJobsNum = parallelJobsNum;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getWaitingJobsNumber() {
+    /**
+     * Maximum number of jobs that are allowed to wait in waiting queue. If number
+     * of waiting jobs ever exceeds this number, excessive jobs will be rejected.
+     *
+     * @return Maximum allowed number of waiting jobs.
+     */
+    public int getWaitingJobsNumber() {
         return waitJobsNum;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Maximum number of jobs that are allowed to wait in waiting queue. If number
+     * of waiting jobs ever exceeds this number, excessive jobs will be rejected.
+     *
+     * @param waitJobsNum Maximium jobs number.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setWaitingJobsNumber(int waitJobsNum) {
+    public PriorityQueueCollisionSpi setWaitingJobsNumber(int waitJobsNum) {
         A.ensure(waitJobsNum >= 0, "waitJobsNum >= 0");
 
         this.waitJobsNum = waitJobsNum;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentWaitJobsNumber() {
+    /**
+     * Gets current number of jobs that wait for the execution.
+     *
+     * @return Number of jobs that wait for execution.
+     */
+    public int getCurrentWaitJobsNumber() {
         return waitingCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentActiveJobsNumber() {
+    /**
+     * Gets current number of jobs that are active, i.e. {@code 'running + held'} jobs.
+     *
+     * @return Number of active jobs.
+     */
+    public int getCurrentActiveJobsNumber() {
         return runningCnt + heldCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentRunningJobsNumber() {
+    /*
+     * Gets number of currently running (not {@code 'held}) jobs.
+     *
+     * @return Number of currently running (not {@code 'held}) jobs.
+     */
+    public int getCurrentRunningJobsNumber() {
         return runningCnt;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentHeldJobsNumber() {
+    /**
+     * Gets number of currently {@code 'held'} jobs.
+     *
+     * @return Number of currently {@code 'held'} jobs.
+     */
+    public int getCurrentHeldJobsNumber() {
         return heldCnt;
     }
 
@@ -298,10 +338,13 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
      * If not provided, default value is {@code {@link #DFLT_PRIORITY_ATTRIBUTE_KEY}}.
      *
      * @param taskPriAttrKey Priority session attribute key.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setPriorityAttributeKey(String taskPriAttrKey) {
+    public PriorityQueueCollisionSpi setPriorityAttributeKey(String taskPriAttrKey) {
         this.taskPriAttrKey = taskPriAttrKey;
+
+        return this;
     }
 
     /**
@@ -311,53 +354,102 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
      * If not provided, default value is {@code {@link #DFLT_JOB_PRIORITY_ATTRIBUTE_KEY}}.
      *
      * @param jobPriAttrKey Job priority attribute key.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setJobPriorityAttributeKey(String jobPriAttrKey) {
+    public PriorityQueueCollisionSpi setJobPriorityAttributeKey(String jobPriAttrKey) {
         this.jobPriAttrKey = jobPriAttrKey;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getPriorityAttributeKey() {
+    /**
+     * Gets key name of task priority attribute.
+     *
+     * @return Key name of task priority attribute.
+     */
+    public String getPriorityAttributeKey() {
         return taskPriAttrKey;
     }
 
-    /** {@inheritDoc} */
-    @Override public String getJobPriorityAttributeKey() {
+    /**
+     * Gets key name of job priority attribute.
+     *
+     * @return Key name of job priority attribute.
+     */
+    public String getJobPriorityAttributeKey() {
         return jobPriAttrKey;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getDefaultPriority() {
+    /**
+     * Gets default priority to use if a job does not have priority attribute
+     * set.
+     *
+     * @return Default priority to use if a task does not have priority
+     *      attribute set.
+     */
+    public int getDefaultPriority() {
         return dfltPri;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets default priority to use if a job does not have priority attribute set.
+     *
+     * @param priority default priority.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setDefaultPriority(int dfltPri) {
-        this.dfltPri = dfltPri;
+    public PriorityQueueCollisionSpi setDefaultPriority(int priority) {
+        this.dfltPri = priority;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getStarvationIncrement() {
+    /**
+     * Gets value to increment job priority by every time a lower priority job gets
+     * behind a higher priority job.
+     *
+     * @return Value to increment job priority by every time a lower priority job gets
+     *      behind a higher priority job.
+     */
+    public int getStarvationIncrement() {
         return starvationInc;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets value to increment job priority by every time a lower priority job gets
+     * behind a higher priority job.
+     *
+     * @param starvationInc Increment value.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setStarvationIncrement(int starvationInc) {
+    public PriorityQueueCollisionSpi setStarvationIncrement(int starvationInc) {
         this.starvationInc = starvationInc;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean isStarvationPreventionEnabled() {
+    /**
+     * Gets flag indicating whether job starvation prevention is enabled.
+     *
+     * @return Flag indicating whether job starvation prevention is enabled.
+     */
+    public boolean isStarvationPreventionEnabled() {
         return preventStarvation;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Sets flag indicating whether job starvation prevention is enabled.
+     *
+     * @param preventStarvation Flag indicating whether job starvation prevention is enabled.
+     * @return {@code this} for chaining.
+     */
     @IgniteSpiConfiguration(optional = true)
-    @Override public void setStarvationPreventionEnabled(boolean preventStarvation) {
+    public PriorityQueueCollisionSpi setStarvationPreventionEnabled(boolean preventStarvation) {
         this.preventStarvation = preventStarvation;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -386,7 +478,8 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
             log.debug(configInfo("preventStarvation", preventStarvation));
         }
 
-        registerMBean(igniteInstanceName, this, PriorityQueueCollisionSpiMBean.class);
+        registerMBean(igniteInstanceName, new PriorityQueueCollisionSpiMBeanImpl(this),
+            PriorityQueueCollisionSpiMBean.class);
 
         // Ack start.
         if (log.isDebugEnabled())
@@ -563,11 +656,6 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
         return Collections.singletonList(createSpiAttributeName(PRIORITY_ATTRIBUTE_KEY));
     }
 
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(PriorityQueueCollisionSpi.class, this);
-    }
-
     /**
      * Returns (possibly shared) comparator fo sorting GridCollisionJobContextWrapper
      * by priority.
@@ -581,6 +669,18 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
         return priComp;
     }
 
+    /** {@inheritDoc} */
+    @Override public PriorityQueueCollisionSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(PriorityQueueCollisionSpi.class, this);
+    }
+
     /**
      * Comparator for by priority comparison of collision contexts.
      */
@@ -630,4 +730,96 @@ public class PriorityQueueCollisionSpi extends IgniteSpiAdapter implements Colli
             return originalIdx;
         }
     }
+
+    /**
+     * MBean implementation for PriorityQueueCollisionSpi.
+     */
+    private class PriorityQueueCollisionSpiMBeanImpl extends IgniteSpiMBeanAdapter
+        implements PriorityQueueCollisionSpiMBean {
+        /** {@inheritDoc} */
+        PriorityQueueCollisionSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getParallelJobsNumber() {
+            return PriorityQueueCollisionSpi.this.getParallelJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @IgniteSpiConfiguration(optional = true)
+        @Override public void setParallelJobsNumber(int parallelJobsNum) {
+            PriorityQueueCollisionSpi.this.setParallelJobsNumber(parallelJobsNum);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getWaitingJobsNumber() {
+            return PriorityQueueCollisionSpi.this.getWaitingJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setWaitingJobsNumber(int waitJobsNum) {
+            PriorityQueueCollisionSpi.this.setWaitingJobsNumber(waitJobsNum);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getPriorityAttributeKey() {
+            return PriorityQueueCollisionSpi.this.getPriorityAttributeKey();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getJobPriorityAttributeKey() {
+            return PriorityQueueCollisionSpi.this.getJobPriorityAttributeKey();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getDefaultPriority() {
+            return PriorityQueueCollisionSpi.this.getDefaultPriority();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setDefaultPriority(int dfltPri) {
+            PriorityQueueCollisionSpi.this.setDefaultPriority(dfltPri);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getStarvationIncrement() {
+            return PriorityQueueCollisionSpi.this.getStarvationIncrement();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setStarvationIncrement(int starvationInc) {
+            PriorityQueueCollisionSpi.this.setStarvationIncrement(starvationInc);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isStarvationPreventionEnabled() {
+            return PriorityQueueCollisionSpi.this.isStarvationPreventionEnabled();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setStarvationPreventionEnabled(boolean preventStarvation) {
+            PriorityQueueCollisionSpi.this.setStarvationPreventionEnabled(preventStarvation);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentWaitJobsNumber() {
+            return PriorityQueueCollisionSpi.this.getCurrentWaitJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentActiveJobsNumber() {
+            return PriorityQueueCollisionSpi.this.getCurrentActiveJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentRunningJobsNumber() {
+            return PriorityQueueCollisionSpi.this.getCurrentRunningJobsNumber();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentHeldJobsNumber() {
+            return PriorityQueueCollisionSpi.this.getCurrentHeldJobsNumber();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpiMBean.java
index b7f8ba1..e6a8412 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/priorityqueue/PriorityQueueCollisionSpiMBean.java
@@ -41,7 +41,7 @@ public interface PriorityQueueCollisionSpiMBean extends IgniteSpiManagementMBean
     @MXBeanDescription("Number of active jobs.")
     public int getCurrentActiveJobsNumber();
 
-    /*
+    /**
      * Gets number of currently running (not {@code 'held}) jobs.
      *
      * @return Number of currently running (not {@code 'held}) jobs.


[09/18] ignite git commit: IGNITE-3506 .NET: Fix ContinuousQuery, QueryBase, and SqlFieldsQuery class constants

Posted by ag...@apache.org.
IGNITE-3506 .NET: Fix ContinuousQuery, QueryBase, and SqlFieldsQuery class constants

This closes #1695


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

Branch: refs/heads/ignite-3477-master
Commit: 2ad2365a03686530ab10993966e7153105380fa9
Parents: b44432d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Mar 31 14:51:57 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Mar 31 14:51:57 2017 +0300

----------------------------------------------------------------------
 .../Cache/Query/CacheLinqTest.cs                |  2 +-
 .../Cache/Query/CacheQueriesTest.cs             |  2 +
 .../Continuous/ContinuousQueryAbstractTest.cs   | 14 +++++
 .../Cache/Query/Continuous/ContinuousQuery.cs   | 59 +++++++++++---------
 .../Apache.Ignite.Core/Cache/Query/QueryBase.cs |  4 +-
 .../Cache/Query/SqlFieldsQuery.cs               |  6 +-
 .../dotnet/Apache.Ignite.Linq/QueryOptions.cs   |  2 +-
 7 files changed, 57 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index 8acf89c..856fb49 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -1250,7 +1250,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             fq = fieldsQuery.GetFieldsQuery();
             Assert.AreEqual("select _T0.Name from \"\".Person as _T0", fq.Sql);
             Assert.IsFalse(fq.Local);
-            Assert.AreEqual(SqlFieldsQuery.DfltPageSize, fq.PageSize);
+            Assert.AreEqual(SqlFieldsQuery.DefaultPageSize, fq.PageSize);
             Assert.IsFalse(fq.EnableDistributedJoins);
             Assert.IsFalse(fq.EnforceJoinOrder);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index 4061ac2..fc47f52 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -245,6 +245,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
 
             SqlQuery qry = new SqlQuery(typeof (QueryPerson), "age < 60");
 
+            Assert.AreEqual(QueryBase.DefaultPageSize, qry.PageSize);
+
             // 2. Page size is bigger than result set.
             qry.PageSize = 4;
             CheckEnumeratorQuery(qry);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index 40d8525..e890198 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -290,6 +290,20 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
         }
 
         /// <summary>
+        /// Tests the defaults.
+        /// </summary>
+        [Test]
+        public void TestDefaults()
+        {
+            var qry = new ContinuousQuery<int, int>(null);
+
+            Assert.AreEqual(ContinuousQuery.DefaultAutoUnsubscribe, qry.AutoUnsubscribe);
+            Assert.AreEqual(ContinuousQuery.DefaultBufferSize, qry.BufferSize);
+            Assert.AreEqual(ContinuousQuery.DefaultTimeInterval, qry.TimeInterval);
+            Assert.IsFalse(qry.Local);
+        }
+
+        /// <summary>
         /// Check filter.
         /// </summary>
         /// <param name="binarizable">Binarizable.</param>

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
index 3bb136e..81913c8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
@@ -18,10 +18,38 @@
 namespace Apache.Ignite.Core.Cache.Query.Continuous
 {
     using System;
-    using System.Diagnostics.CodeAnalysis;
     using Apache.Ignite.Core.Cache.Event;
 
     /// <summary>
+    /// Continuous query base class, see <see cref="ContinuousQuery{K, V}"/>.
+    /// </summary>
+    public abstract class ContinuousQuery
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ContinuousQuery"/> class.
+        /// </summary>
+        protected internal ContinuousQuery()
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Default buffer size.
+        /// </summary>
+        public const int DefaultBufferSize = 1;
+
+        /// <summary>
+        /// Default time interval.
+        /// </summary>
+        public static readonly TimeSpan DefaultTimeInterval = new TimeSpan(0);
+
+        /// <summary>
+        /// Default auto-unsubscribe flag value.
+        /// </summary>
+        public const bool DefaultAutoUnsubscribe = true;
+    }
+
+    /// <summary>
     /// API for configuring continuous cache queries.
     /// <para />
     /// Continuous queries allow to register a remote and a listener for cache update events. 
@@ -36,28 +64,9 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
     /// To execute the query use method 
     /// <see cref="ICache{K,V}.QueryContinuous(ContinuousQuery{K,V})"/>.
     /// </summary>
-    public class ContinuousQuery<TK, TV>
+    public class ContinuousQuery<TK, TV> : ContinuousQuery
     {
         /// <summary>
-        /// Default buffer size.
-        /// </summary>
-        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
-        public const int DfltBufSize = 1;
-
-        /// <summary>
-        /// Default time interval.
-        /// </summary>
-        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
-        [SuppressMessage("ReSharper", "StaticMemberInGenericType")]
-        public static readonly TimeSpan DfltTimeInterval = new TimeSpan(0);
-
-        /// <summary>
-        /// Default auto-unsubscribe flag value.
-        /// </summary>
-        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
-        public const bool DfltAutoUnsubscribe = true;
-
-        /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="lsnr">Listener.</param>
@@ -99,9 +108,9 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
             Filter = filter;
             Local = loc;
 
-            BufferSize = DfltBufSize;
-            TimeInterval = DfltTimeInterval;
-            AutoUnsubscribe = DfltAutoUnsubscribe;
+            BufferSize = DefaultBufferSize;
+            TimeInterval = DefaultTimeInterval;
+            AutoUnsubscribe = DefaultAutoUnsubscribe;
         }
 
         /// <summary>
@@ -124,7 +133,7 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
         /// Entries from buffer will be sent to the master node only if the buffer is 
         /// full or time provided via <see cref="TimeInterval"/> is exceeded.
         /// <para />
-        /// Defaults to <see cref="DfltBufSize"/>
+        /// Defaults to <see cref="ContinuousQuery.DefaultBufferSize"/>
         /// </summary>
         public int BufferSize { get; set; }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
index d992845..e4ab6e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
@@ -28,14 +28,14 @@ namespace Apache.Ignite.Core.Cache.Query
     public abstract class QueryBase
     {
         /// <summary> Default page size. </summary>
-        public const int DfltPageSize = 1024;
+        public const int DefaultPageSize = 1024;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="QueryBase"/> class.
         /// </summary>
         protected internal QueryBase()
         {
-            PageSize = DfltPageSize;
+            PageSize = DefaultPageSize;
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
index 1d896b8..aab2bfe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
@@ -26,7 +26,7 @@ namespace Apache.Ignite.Core.Cache.Query
     public class SqlFieldsQuery
     {
         /// <summary> Default page size. </summary>
-        public const int DfltPageSize = 1024;
+        public const int DefaultPageSize = 1024;
 
         /// <summary>
         /// Constructor.
@@ -50,7 +50,7 @@ namespace Apache.Ignite.Core.Cache.Query
             Local = loc;
             Arguments = args;
 
-            PageSize = DfltPageSize;
+            PageSize = DefaultPageSize;
         }
 
         /// <summary>
@@ -75,7 +75,7 @@ namespace Apache.Ignite.Core.Cache.Query
         /// <summary>
         /// Optional page size.
         /// <para />
-        /// Defaults to <see cref="DfltPageSize"/>.
+        /// Defaults to <see cref="DefaultPageSize"/>.
         /// </summary>
         public int PageSize { get; set; }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
index 4fe3ee5..c70152e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
@@ -27,7 +27,7 @@ namespace Apache.Ignite.Linq
     public class QueryOptions
     {
         /// <summary> Default page size. </summary>
-        public const int DefaultPageSize = SqlFieldsQuery.DfltPageSize;
+        public const int DefaultPageSize = SqlFieldsQuery.DefaultPageSize;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="QueryOptions"/> class.


[14/18] ignite git commit: IGNITE-2703 .NET: Dynamic type registration

Posted by ag...@apache.org.
IGNITE-2703 .NET: Dynamic type registration

* BinaryTypeConfiguration is not required anymore
* Serializable types are written in Ignite binary format


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

Branch: refs/heads/ignite-3477-master
Commit: 79bac4f87b15081d44e096d5bfc2c22854aad20e
Parents: 2ad2365
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Mar 31 16:31:56 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Mar 31 16:31:56 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/MarshallerPlatformIds.java  |   3 +
 .../ignite/internal/binary/BinaryUtils.java     |   4 +
 .../platform/PlatformContextImpl.java           |  10 +-
 .../binary/PlatformBinaryProcessor.java         |  40 +-
 .../Apache.Ignite.Core.Tests.csproj             |  11 +-
 .../Binary/BinaryBuilderSelfTest.cs             | 112 +--
 .../BinaryBuilderSelfTestDynamicRegistration.cs |  40 +
 .../Binary/BinaryCompactFooterInteropTest.cs    |   2 +-
 .../Binary/BinaryDynamicRegistrationTest.cs     | 441 +++++++++++
 .../Binary/BinarySelfTest.cs                    | 197 +++--
 .../Binary/BinarySelfTestFullFooter.cs          |   5 +-
 .../Binary/JavaBinaryInteropTest.cs             | 182 +++++
 .../Serializable/AdvancedSerializationTest.cs   | 228 ++++++
 .../BasicSerializableObjectsTest.cs             | 124 +++
 .../Binary/Serializable/CallbacksTest.cs        | 369 +++++++++
 .../Binary/Serializable/DelegatesTest.cs        | 161 ++++
 .../Binary/Serializable/ObjectReferenceTests.cs | 131 ++++
 .../Binary/Serializable/PrimitivesTest.cs       | 754 +++++++++++++++++++
 .../Binary/Serializable/SqlDmlTest.cs           | 277 +++++++
 .../Cache/Affinity/AffinityFunctionTest.cs      |  21 -
 .../Cache/CacheAbstractTest.cs                  |  56 +-
 .../Cache/Query/CacheQueriesTest.cs             |  13 +-
 .../Continuous/ContinuousQueryAbstractTest.cs   |  15 +-
 .../Cache/Store/CacheStoreTest.cs               |   5 +-
 .../Compute/ComputeApiTest.cs                   |  28 +-
 .../Compute/IgniteExceptionTaskSelfTest.cs      |  40 +-
 .../Compute/ResourceTaskTest.cs                 |  13 +-
 .../Apache.Ignite.Core.Tests/DeploymentTest.cs  |  16 +-
 .../Examples/ExamplesTest.cs                    |   2 +-
 .../Apache.Ignite.Core.Tests/ExecutableTest.cs  |  28 +-
 .../SerializationTest.cs                        | 240 ------
 .../Services/ServiceProxyTest.cs                |  40 +-
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |  11 +
 .../Apache.Ignite.Core.csproj                   |   7 +-
 .../Cache/Configuration/CacheConfiguration.cs   |   8 +-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  25 +-
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |   4 +-
 .../Impl/Binary/BinarizableSerializer.cs        |   5 +-
 .../Impl/Binary/BinaryFullTypeDescriptor.cs     |  49 +-
 .../Impl/Binary/BinaryObjectBuilder.cs          |  27 +-
 .../Impl/Binary/BinaryObjectHeader.cs           |  13 +-
 .../Impl/Binary/BinaryObjectSchemaSerializer.cs |   2 +
 .../Impl/Binary/BinaryProcessor.cs              |  38 +-
 .../Impl/Binary/BinaryReader.cs                 |  39 +-
 .../Impl/Binary/BinaryReflectiveActions.cs      |   2 +-
 .../BinaryReflectiveSerializerInternal.cs       |  84 ++-
 .../Binary/BinarySurrogateTypeDescriptor.cs     |  13 +-
 .../Impl/Binary/BinarySystemHandlers.cs         |  96 +--
 .../Impl/Binary/BinarySystemTypeSerializer.cs   |   2 +-
 .../Impl/Binary/BinaryUtils.cs                  |  54 +-
 .../Impl/Binary/BinaryWriter.cs                 | 242 +++---
 .../Impl/Binary/DateTimeHolder.cs               | 101 ---
 .../Impl/Binary/DateTimeSerializer.cs           |  48 --
 .../Binary/DeserializationCallbackProcessor.cs  | 102 +++
 .../Impl/Binary/IBinarySerializerInternal.cs    |   4 +-
 .../Impl/Binary/IBinaryTypeDescriptor.cs        |   8 +
 .../Impl/Binary/Io/BinaryStreamAdapter.cs       | 119 ---
 .../Impl/Binary/Marshaller.cs                   | 248 ++++--
 .../Impl/Binary/ReflectionUtils.cs              |  50 ++
 .../Impl/Binary/SerializableObjectHolder.cs     |  96 ---
 .../Impl/Binary/SerializableSerializer.cs       | 656 +++++++++++++++-
 .../Impl/Binary/TypeResolver.cs                 |   7 +
 .../Impl/Binary/UserSerializerProxy.cs          |   5 +-
 .../Affinity/AffinityFunctionSerializer.cs      |   3 -
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |   3 +-
 .../Common/CopyOnWriteConcurrentDictionary.cs   |  35 +
 .../Impl/Common/DelegateConverter.cs            |  90 ++-
 .../Impl/Common/DelegateTypeDescriptor.cs       |   3 +-
 .../Impl/Common/SerializableTypeDescriptor.cs   | 222 ++++++
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  13 +-
 .../Impl/Services/ServiceProxySerializer.cs     |   4 +-
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |   8 +-
 .../NuGet/LINQPad/ComputeExample.linq           |   1 -
 .../NuGet/LINQPad/PutGetExample.linq            |   5 +-
 .../NuGet/LINQPad/QueryExample.linq             |   5 +-
 .../NuGet/LINQPad/QueryExample.linq             |   5 +-
 .../examples/Apache.Ignite.Examples/App.config  |  16 +-
 .../Apache.Ignite.ExamplesDll/Binary/Address.cs |   2 -
 .../Compute/CharacterCountClosure.cs            |   1 -
 .../Datagrid/ContinuousQueryFilter.cs           |   2 -
 .../Datagrid/EmployeeStorePredicate.cs          |   2 -
 .../Messaging/RemoteOrderedListener.cs          |   1 -
 .../Messaging/RemoteUnorderedListener.cs        |   1 -
 .../Services/MapService.cs                      |   1 -
 84 files changed, 4956 insertions(+), 1240 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/core/src/main/java/org/apache/ignite/internal/MarshallerPlatformIds.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerPlatformIds.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerPlatformIds.java
index 458ae49..4167f41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerPlatformIds.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerPlatformIds.java
@@ -25,6 +25,9 @@ public final class MarshallerPlatformIds {
     public static final byte JAVA_ID = 0;
 
     /** */
+    public static final byte DOTNET_ID = 1;
+
+    /** */
     private MarshallerPlatformIds() {
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index c59b8b7..e4011a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -110,6 +110,10 @@ public class BinaryUtils {
     /** Flag: compact footer, no field IDs. */
     public static final short FLAG_COMPACT_FOOTER = 0x0020;
 
+    /** Flag: raw data contains .NET type information. Always 0 in Java. Keep it here for information only. */
+    @SuppressWarnings("unused")
+    public static final short FLAG_CUSTOM_DOTNET_TYPE = 0x0040;
+
     /** Offset which fits into 1 byte. */
     public static final int OFFSET_1 = 1;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 10a8f74..bdcb88c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -430,10 +430,12 @@ public class PlatformContextImpl implements PlatformContext {
         if (schema == null) {
             BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId);
 
-            for (BinarySchema typeSchema : meta.metadata().schemas()) {
-                if (schemaId == typeSchema.schemaId()) {
-                    schema = typeSchema;
-                    break;
+            if (meta != null) {
+                for (BinarySchema typeSchema : meta.metadata().schemas()) {
+                    if (schemaId == typeSchema.schemaId()) {
+                        schema = typeSchema;
+                        break;
+                    }
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/binary/PlatformBinaryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/binary/PlatformBinaryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/binary/PlatformBinaryProcessor.java
index 3c00abc..8d95ac8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/binary/PlatformBinaryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/binary/PlatformBinaryProcessor.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.internal.processors.platform.binary;
 
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.internal.MarshallerPlatformIds;
 import org.apache.ignite.internal.binary.BinaryRawReaderEx;
 import org.apache.ignite.internal.binary.BinaryRawWriterEx;
 import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
@@ -39,6 +41,12 @@ public class PlatformBinaryProcessor extends PlatformAbstractTarget {
     /** */
     private static final int OP_GET_SCHEMA = 4;
 
+    /** */
+    private static final int OP_REGISTER_TYPE = 5;
+
+    /** */
+    private static final int OP_GET_TYPE = 6;
+
     /**
      * Constructor.
      *
@@ -50,10 +58,20 @@ public class PlatformBinaryProcessor extends PlatformAbstractTarget {
 
     /** {@inheritDoc} */
     @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
-        if (type == OP_PUT_META) {
-            platformCtx.processMetadata(reader);
+        switch (type) {
+            case OP_PUT_META:
+                platformCtx.processMetadata(reader);
+
+                return TRUE;
+
+            case OP_REGISTER_TYPE: {
+                int typeId = reader.readInt();
+                String typeName = reader.readString();
 
-            return TRUE;
+                return platformContext().kernalContext().marshallerContext()
+                    .registerClassName(MarshallerPlatformIds.DOTNET_ID, typeId, typeName)
+                    ? TRUE : FALSE;
+            }
         }
 
         return super.processInStreamOutLong(type, reader);
@@ -88,6 +106,22 @@ public class PlatformBinaryProcessor extends PlatformAbstractTarget {
                 break;
             }
 
+            case OP_GET_TYPE: {
+                int typeId = reader.readInt();
+
+                try {
+                    String typeName = platformContext().kernalContext().marshallerContext()
+                        .getClassName(MarshallerPlatformIds.DOTNET_ID, typeId);
+
+                    writer.writeString(typeName);
+                }
+                catch (ClassNotFoundException e) {
+                    throw new BinaryObjectException(e);
+                }
+
+                break;
+            }
+
             default:
                 super.processInStreamOutStream(type, reader, writer);
                 break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 1540243..27aec9c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -69,9 +69,17 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Binary\BinaryEqualityComparerTest.cs" />
+    <Compile Include="Binary\BinaryBuilderSelfTestDynamicRegistration.cs" />
     <Compile Include="Binary\BinaryReaderWriterTest.cs" />
     <Compile Include="Binary\IO\BinaryStreamsTest.cs" />
+    <Compile Include="Binary\JavaBinaryInteropTest.cs" />
     <Compile Include="Binary\JavaTypeMappingTest.cs" />
+    <Compile Include="Binary\Serializable\CallbacksTest.cs" />
+    <Compile Include="Binary\Serializable\DelegatesTest.cs" />
+    <Compile Include="Binary\Serializable\BasicSerializableObjectsTest.cs" />
+    <Compile Include="Binary\Serializable\ObjectReferenceTests.cs" />
+    <Compile Include="Binary\Serializable\PrimitivesTest.cs" />
+    <Compile Include="Binary\Serializable\SqlDmlTest.cs" />
     <Compile Include="Binary\TypeResolverTest.cs" />
     <Compile Include="Cache\Affinity\AffinityKeyTest.cs" />
     <Compile Include="Cache\Affinity\AffinityTopologyVersionTest.cs" />
@@ -103,6 +111,7 @@
     <Compile Include="TestAppConfig.cs" />
     <Compile Include="Binary\BinaryBuilderSelfTestFullFooter.cs" />
     <Compile Include="Binary\BinaryCompactFooterInteropTest.cs" />
+    <Compile Include="Binary\BinaryDynamicRegistrationTest.cs" />
     <Compile Include="Binary\BinarySelfTestFullFooter.cs" />
     <Compile Include="Binary\BinaryStringTest.cs" />
     <Compile Include="Cache\Affinity\AffinityFieldTest.cs" />
@@ -190,7 +199,7 @@
     <Compile Include="ProcessExtensions.cs" />
     <Compile Include="ProjectFilesTest.cs" />
     <Compile Include="ReconnectTest.cs" />
-    <Compile Include="SerializationTest.cs" />
+    <Compile Include="Binary\Serializable\AdvancedSerializationTest.cs" />
     <Compile Include="IgniteStartStopTest.cs" />
     <Compile Include="Services\ServicesTestFullFooter.cs" />
     <Compile Include="TestUtils.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
index e59611b..35c7e47 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -56,36 +56,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             {
                 BinaryConfiguration = new BinaryConfiguration
                 {
-                    TypeConfigurations = new List<BinaryTypeConfiguration>
-                    {
-                        new BinaryTypeConfiguration(typeof(Empty)),
-                        new BinaryTypeConfiguration(typeof(Primitives)),
-                        new BinaryTypeConfiguration(typeof(PrimitiveArrays)),
-                        new BinaryTypeConfiguration(typeof(StringDateGuidEnum)),
-                        new BinaryTypeConfiguration(typeof(WithRaw)),
-                        new BinaryTypeConfiguration(typeof(MetaOverwrite)),
-                        new BinaryTypeConfiguration(typeof(NestedOuter)),
-                        new BinaryTypeConfiguration(typeof(NestedInner)),
-                        new BinaryTypeConfiguration(typeof(MigrationOuter)),
-                        new BinaryTypeConfiguration(typeof(MigrationInner)),
-                        new BinaryTypeConfiguration(typeof(InversionOuter)),
-                        new BinaryTypeConfiguration(typeof(InversionInner)),
-                        new BinaryTypeConfiguration(typeof(CompositeOuter)),
-                        new BinaryTypeConfiguration(typeof(CompositeInner)),
-                        new BinaryTypeConfiguration(typeof(CompositeArray)),
-                        new BinaryTypeConfiguration(typeof(CompositeContainer)),
-                        new BinaryTypeConfiguration(typeof(ToBinary)),
-                        new BinaryTypeConfiguration(typeof(Remove)),
-                        new BinaryTypeConfiguration(typeof(RemoveInner)),
-                        new BinaryTypeConfiguration(typeof(BuilderInBuilderOuter)),
-                        new BinaryTypeConfiguration(typeof(BuilderInBuilderInner)),
-                        new BinaryTypeConfiguration(typeof(BuilderCollection)),
-                        new BinaryTypeConfiguration(typeof(BuilderCollectionItem)),
-                        new BinaryTypeConfiguration(typeof(DecimalHolder)),
-                        new BinaryTypeConfiguration(TypeEmpty),
-                        new BinaryTypeConfiguration(typeof(TestEnumRegistered)),
-                        new BinaryTypeConfiguration(typeof(NameMapperTestType))
-                    },
+                    TypeConfigurations = GetTypeConfigurations(),
                     DefaultIdMapper = new IdMapper(),
                     DefaultNameMapper = new NameMapper(),
                     CompactFooter = GetCompactFooter()
@@ -98,6 +69,43 @@ namespace Apache.Ignite.Core.Tests.Binary
         }
 
         /// <summary>
+        /// Gets the type configurations.
+        /// </summary>
+        protected virtual ICollection<BinaryTypeConfiguration> GetTypeConfigurations()
+        {
+            return new[]
+            {
+                new BinaryTypeConfiguration(typeof(Empty)),
+                new BinaryTypeConfiguration(typeof(Primitives)),
+                new BinaryTypeConfiguration(typeof(PrimitiveArrays)),
+                new BinaryTypeConfiguration(typeof(StringDateGuidEnum)),
+                new BinaryTypeConfiguration(typeof(WithRaw)),
+                new BinaryTypeConfiguration(typeof(MetaOverwrite)),
+                new BinaryTypeConfiguration(typeof(NestedOuter)),
+                new BinaryTypeConfiguration(typeof(NestedInner)),
+                new BinaryTypeConfiguration(typeof(MigrationOuter)),
+                new BinaryTypeConfiguration(typeof(MigrationInner)),
+                new BinaryTypeConfiguration(typeof(InversionOuter)),
+                new BinaryTypeConfiguration(typeof(InversionInner)),
+                new BinaryTypeConfiguration(typeof(CompositeOuter)),
+                new BinaryTypeConfiguration(typeof(CompositeInner)),
+                new BinaryTypeConfiguration(typeof(CompositeArray)),
+                new BinaryTypeConfiguration(typeof(CompositeContainer)),
+                new BinaryTypeConfiguration(typeof(ToBinary)),
+                new BinaryTypeConfiguration(typeof(Remove)),
+                new BinaryTypeConfiguration(typeof(RemoveInner)),
+                new BinaryTypeConfiguration(typeof(BuilderInBuilderOuter)),
+                new BinaryTypeConfiguration(typeof(BuilderInBuilderInner)),
+                new BinaryTypeConfiguration(typeof(BuilderCollection)),
+                new BinaryTypeConfiguration(typeof(BuilderCollectionItem)),
+                new BinaryTypeConfiguration(typeof(DecimalHolder)),
+                new BinaryTypeConfiguration(TypeEmpty),
+                new BinaryTypeConfiguration(typeof(TestEnumRegistered)),
+                new BinaryTypeConfiguration(typeof(NameMapperTestType))
+            };
+        }
+
+        /// <summary>
         /// Gets the compact footer setting.
         /// </summary>
         protected virtual bool GetCompactFooter()
@@ -213,7 +221,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             // 2. Special types.
             Assert.AreEqual("a", api.ToBinary<string>("a"));
-            Assert.AreEqual(date, api.ToBinary<DateTime>(date));
+            Assert.AreEqual(date, api.ToBinary<IBinaryObject>(date).Deserialize<DateTime>());
             Assert.AreEqual(guid, api.ToBinary<Guid>(guid));
             Assert.AreEqual(TestEnumRegistered.One, api.ToBinary<IBinaryObject>(TestEnumRegistered.One)
                 .Deserialize<TestEnumRegistered>());
@@ -231,7 +239,8 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] { 'a' }, api.ToBinary<char[]>(new[] { 'a' }));
 
             Assert.AreEqual(new[] { "a" }, api.ToBinary<string[]>(new[] { "a" }));
-            Assert.AreEqual(new[] { date }, api.ToBinary<DateTime[]>(new[] { date }));
+            Assert.AreEqual(new[] {date}, api.ToBinary<IBinaryObject[]>(new[] {date})
+                .Select(x => x.Deserialize<DateTime>()));
             Assert.AreEqual(new[] { guid }, api.ToBinary<Guid[]>(new[] { guid }));
             Assert.AreEqual(new[] { TestEnumRegistered.One},
                 api.ToBinary<IBinaryObject[]>(new[] { TestEnumRegistered.One})
@@ -619,6 +628,11 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             CheckPrimitiveFields1(binObj);
 
+            // Rebuild unchanged.
+            binObj = binObj.ToBuilder().Build();
+
+            CheckPrimitiveFields1(binObj);
+
             // Specific setter methods.
             var binObj2 = _grid.GetBinary().GetBuilder(typeof(Primitives))
                 .SetByteField("fByte", 1)
@@ -766,6 +780,11 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             CheckPrimitiveArrayFields1(binObj);
 
+            // Rebuild unchanged.
+            binObj = binObj.ToBuilder().Build();
+
+            CheckPrimitiveArrayFields1(binObj);
+
             // Specific setters.
             var binObj2 = _grid.GetBinary().GetBuilder(typeof(PrimitiveArrays))
                 .SetByteArrayField("fByte", new byte[] {1})
@@ -814,7 +833,7 @@ namespace Apache.Ignite.Core.Tests.Binary
                 .Build();
 
             CheckPrimitiveArrayFields2(binObj);
-            
+
             // Check equality.
             Assert.AreEqual(binObj, binObj2);
             Assert.AreEqual(binObj.GetHashCode(), binObj2.GetHashCode());
@@ -918,6 +937,11 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             CheckStringDateGuidEnum1(binObj, nDate, nGuid);
 
+            // Rebuild with no changes.
+            binObj = binObj.ToBuilder().Build();
+
+            CheckStringDateGuidEnum1(binObj, nDate, nGuid);
+
             // Specific setters.
             var binObj2 = _grid.GetBinary().GetBuilder(typeof(StringDateGuidEnum))
                 .SetStringField("fStr", "str")
@@ -1001,12 +1025,13 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(BinaryTypeNames.TypeNameArrayEnum, meta.GetFieldTypeName("fEnumArr"));
 
             Assert.AreEqual("str", binObj.GetField<string>("fStr"));
-            Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNDate"));
+            Assert.AreEqual(nDate, binObj.GetField<IBinaryObject>("fNDate").Deserialize<DateTime?>());
             Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNTimestamp"));
             Assert.AreEqual(nGuid, binObj.GetField<Guid?>("fNGuid"));
             Assert.AreEqual(TestEnum.One, binObj.GetField<IBinaryObject>("fEnum").Deserialize<TestEnum>());
             Assert.AreEqual(new[] {"str"}, binObj.GetField<string[]>("fStrArr"));
-            Assert.AreEqual(new[] {nDate}, binObj.GetField<DateTime?[]>("fDateArr"));
+            Assert.AreEqual(new[] {nDate}, binObj.GetField<IBinaryObject[]>("fDateArr")
+                .Select(x => x.Deserialize<DateTime?>()));
             Assert.AreEqual(new[] {nDate}, binObj.GetField<DateTime?[]>("fTimestampArr"));
             Assert.AreEqual(new[] {nGuid}, binObj.GetField<Guid?[]>("fGuidArr"));
             Assert.AreEqual(new[] {TestEnum.One},
@@ -1028,12 +1053,13 @@ namespace Apache.Ignite.Core.Tests.Binary
             var builder = _grid.GetBinary().GetBuilder(binObj);
 
             Assert.AreEqual("str", builder.GetField<string>("fStr"));
-            Assert.AreEqual(nDate, builder.GetField<DateTime?>("fNDate"));
+            Assert.AreEqual(nDate, builder.GetField<IBinaryObjectBuilder>("fNDate").Build().Deserialize<DateTime?>());
             Assert.AreEqual(nDate, builder.GetField<DateTime?>("fNTimestamp"));
             Assert.AreEqual(nGuid, builder.GetField<Guid?>("fNGuid"));
             Assert.AreEqual(TestEnum.One, builder.GetField<IBinaryObject>("fEnum").Deserialize<TestEnum>());
             Assert.AreEqual(new[] {"str"}, builder.GetField<string[]>("fStrArr"));
-            Assert.AreEqual(new[] {nDate}, builder.GetField<DateTime?[]>("fDateArr"));
+            Assert.AreEqual(new[] {nDate}, builder.GetField<IBinaryObjectBuilder[]>("fDateArr")
+                .Select(x => x.Build().Deserialize<DateTime?>()));
             Assert.AreEqual(new[] {nDate}, builder.GetField<DateTime?[]>("fTimestampArr"));
             Assert.AreEqual(new[] {nGuid}, builder.GetField<Guid?[]>("fGuidArr"));
             Assert.AreEqual(new[] {TestEnum.One},
@@ -1043,12 +1069,13 @@ namespace Apache.Ignite.Core.Tests.Binary
             binObj = builder.Build();
 
             Assert.AreEqual("str", binObj.GetField<string>("fStr"));
-            Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNDate"));
+            Assert.AreEqual(nDate, binObj.GetField<IBinaryObject>("fNDate").Deserialize<DateTime?>());
             Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNTimestamp"));
             Assert.AreEqual(nGuid, binObj.GetField<Guid?>("fNGuid"));
             Assert.AreEqual(TestEnum.One, binObj.GetField<IBinaryObject>("fEnum").Deserialize<TestEnum>());
             Assert.AreEqual(new[] {"str"}, binObj.GetField<string[]>("fStrArr"));
-            Assert.AreEqual(new[] {nDate}, binObj.GetField<DateTime?[]>("fDateArr"));
+            Assert.AreEqual(new[] {nDate}, binObj.GetField<IBinaryObject[]>("fDateArr")
+                .Select(x => x.Deserialize<DateTime?>()));
             Assert.AreEqual(new[] {nDate}, binObj.GetField<DateTime?[]>("fTimestampArr"));
             Assert.AreEqual(new[] {nGuid}, binObj.GetField<Guid?[]>("fGuidArr"));
             Assert.AreEqual(new[] { TestEnum.One },
@@ -1073,12 +1100,13 @@ namespace Apache.Ignite.Core.Tests.Binary
         private static void CheckStringDateGuidEnum2(IBinaryObject binObj, DateTime? nDate, Guid? nGuid)
         {
             Assert.AreEqual("str2", binObj.GetField<string>("fStr"));
-            Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNDate"));
+            Assert.AreEqual(nDate, binObj.GetField<IBinaryObject>("fNDate").Deserialize<DateTime?>());
             Assert.AreEqual(nDate, binObj.GetField<DateTime?>("fNTimestamp"));
             Assert.AreEqual(nGuid, binObj.GetField<Guid?>("fNGuid"));
             Assert.AreEqual(TestEnum.Two, binObj.GetField<IBinaryObject>("fEnum").Deserialize<TestEnum>());
             Assert.AreEqual(new[] { "str2" }, binObj.GetField<string[]>("fStrArr"));
-            Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
+            Assert.AreEqual(new[] {nDate}, binObj.GetField<IBinaryObject[]>("fDateArr")
+                .Select(x => x.Deserialize<DateTime?>()));
             Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fTimestampArr"));
             Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
             Assert.AreEqual(new[] {TestEnum.Two},
@@ -1659,7 +1687,7 @@ namespace Apache.Ignite.Core.Tests.Binary
                 cache1[1] = new Primitives {FByte = 3};
                 var obj = cache2[1];
 
-                // Rebuild with no changes
+                // Rebuild with no changes.
                 cache2[2] = obj.ToBuilder().Build();
                 Assert.AreEqual(3, cache1[2].FByte);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs
new file mode 100644
index 0000000..3f37833
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using System.Collections.Generic;
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Binary builder self test with dynamic type registration.
+    /// </summary>
+    public class BinaryBuilderSelfTestDynamicRegistration : BinaryBuilderSelfTest
+    {
+        /** <inheritdoc /> */
+        protected override ICollection<BinaryTypeConfiguration> GetTypeConfigurations()
+        {
+            // The only type to be registered is TestEnumRegistered,
+            // because unregistered enums are handled differently.
+
+            return new []
+            {
+                new BinaryTypeConfiguration(typeof(TestEnumRegistered))
+            };
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
index 830e7f4..76ef999 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
@@ -30,7 +30,7 @@ namespace Apache.Ignite.Core.Tests.Binary
     public class BinaryCompactFooterInteropTest
     {
         /** */
-        private const string PlatformSqlQueryTask = "org.apache.ignite.platform.PlatformSqlQueryTask";
+        public const string PlatformSqlQueryTask = "org.apache.ignite.platform.PlatformSqlQueryTask";
 
         /** */
         private IIgnite _grid;

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
new file mode 100644
index 0000000..10e6e0b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -0,0 +1,441 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ReSharper disable UnusedAutoPropertyAccessor.Local
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.IO;
+    using System.Linq;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Cache.Configuration;
+    using Apache.Ignite.Core.Cache.Store;
+    using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Compute;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Common;
+    using Apache.Ignite.Core.Tests.Compute;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests the dynamic type registration.
+    /// </summary>
+    public class BinaryDynamicRegistrationTest
+    {
+        /// <summary>
+        /// Executes before each test.
+        /// </summary>
+        [SetUp]
+        public void SetUp()
+        {
+            ClearMarshallerWorkDir();
+        }
+
+        /// <summary>
+        /// Tests the failed registration.
+        /// </summary>
+        [Test]
+        public void TestFailedRegistration()
+        {
+            TestFailedRegistration<Foo>(false, false);
+            TestFailedRegistration<Bin>(true, false);
+            TestFailedRegistration<BinRaw>(true, true);
+        }
+
+        /// <summary>
+        /// Tests the failed registration, when we write type name after the header.
+        /// </summary>
+        private static void TestFailedRegistration<T>(bool rawStr, bool rawInt) where T : ITest, new()
+        {
+            // Disable compact footers for local mode
+            var cfg = new BinaryConfiguration {CompactFooter = false};
+
+            // Test in local mode so that MarshallerContext can't propagate type registration.
+            var bytes = new Marshaller(cfg).Marshal(new T {Int = 1, Str = "2"});
+
+            var res = new Marshaller(cfg).Unmarshal<T>(bytes);
+
+            Assert.AreEqual(1, res.Int);
+            Assert.AreEqual("2", res.Str);
+
+            // Check binary mode
+            var bin = new Marshaller(cfg).Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+            if (!rawStr)
+                Assert.AreEqual("2", bin.GetField<string>("Str"));
+
+            if (!rawInt)
+                Assert.AreEqual(1, bin.GetField<int>("Int"));
+
+            res = bin.Deserialize<T>();
+
+            Assert.AreEqual(1, res.Int);
+            Assert.AreEqual("2", res.Str);
+        }
+
+        /// <summary>
+        /// Tests the store with node restart to make sure type names are persisted to disk properly.
+        /// </summary>
+        [Test]
+        public void TestStore()
+        {
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                // Disable compact footers to test grid restart with persistent store
+                // (Because store operates on raw binary objects).
+                BinaryConfiguration = new BinaryConfiguration {CompactFooter = false},
+                CacheConfiguration = new[]
+                {
+                    new CacheConfiguration
+                    {
+                        CacheStoreFactory = new StoreFactory(),
+                        ReadThrough = true,
+                        WriteThrough = true
+                    }
+                }
+            };
+
+            using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+            {
+                // Put through dynamically started cache
+                var dynCache = ignite.CreateCache<int, Foo>(new CacheConfiguration("dynCache")
+                {
+                    CacheStoreFactory = new StoreFactory(),
+                    ReadThrough = true,
+                    WriteThrough = true
+                });
+                dynCache[2] = new Foo { Str = "test2", Int = 3 };
+
+                // Start another server node so that store is initialized there
+                using (var ignite2 = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+                {
+                    IgniteInstanceName = "grid2"
+                }))
+                {
+                    var dynCache2 = ignite2.GetCache<int, Foo>(dynCache.Name);
+
+                    Assert.AreEqual("test2", dynCache2[2].Str);
+                    Assert.AreEqual(3, dynCache2[2].Int);
+                }
+            }
+
+            using (var ignite = Ignition.Start(cfg))
+            {
+                // Put through statically started cache
+                var staticCache = ignite.GetCache<int, Foo>(null);
+                staticCache[1] = new Foo {Str = "test", Int = 2};
+            }
+
+            using (var ignite = Ignition.Start(cfg))
+            {
+                var foo = ignite.GetCache<int, Foo>(null)[1];
+                var foo2 = ignite.GetCache<int, Foo>(null)[2];
+
+                Assert.AreEqual("test", foo.Str);
+                Assert.AreEqual(2, foo.Int);
+
+                Assert.AreEqual("test2", foo2.Str);
+                Assert.AreEqual(3, foo2.Int);
+
+                // Client node
+                using (var igniteClient = Ignition.Start(new IgniteConfiguration(cfg)
+                {
+                    ClientMode = true,
+                    IgniteInstanceName = "grid2"
+                }))
+                {
+                    var fooClient = igniteClient.GetCache<int, Foo>(null)[1];
+                    var fooClient2 = igniteClient.GetCache<int, Foo>(null)[2];
+
+                    Assert.AreEqual("test", fooClient.Str);
+                    Assert.AreEqual(2, fooClient.Int);
+
+                    Assert.AreEqual("test2", fooClient2.Str);
+                    Assert.AreEqual(3, fooClient2.Int);
+                }
+            }
+
+            // Delete directory and check that store no longer works
+            ClearMarshallerWorkDir();
+
+            using (var ignite = Ignition.Start(cfg))
+            {
+                var ex = Assert.Throws<BinaryObjectException>(() => ignite.GetCache<int, Foo>(null).Get(1));
+
+                Assert.IsTrue(ex.Message.Contains("Unknown pair"));
+            }
+        }
+
+        /// <summary>
+        /// Tests the store factory property propagation.
+        /// </summary>
+        [Test]
+        public void TestStoreFactory()
+        {
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                CacheConfiguration = new[]
+                {
+                    new CacheConfiguration
+                    {
+                        CacheStoreFactory = new StoreFactory {StringProp = "test", IntProp = 9},
+                        ReadThrough = true,
+                        WriteThrough = true
+                    }
+                }
+            };
+
+            using (Ignition.Start(cfg))
+            {
+                var storeFactory = StoreFactory.LastInstance;
+
+                Assert.AreEqual("test", storeFactory.StringProp);
+                Assert.AreEqual(9, storeFactory.IntProp);
+            }
+        }
+
+        /// <summary>
+        /// Tests the single grid scenario.
+        /// </summary>
+        [Test]
+        public void TestSingleGrid()
+        {
+            using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+            {
+                Test(ignite, ignite);
+            }
+        }
+
+        /// <summary>
+        /// Tests the two grid scenario.
+        /// </summary>
+        [Test]
+        public void TestTwoGrids([Values(false, true)] bool clientMode)
+        {
+            using (var ignite1 = Ignition.Start(TestUtils.GetTestConfiguration()))
+            {
+                using (var ignite2 = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+                {
+                    IgniteInstanceName = "grid2",
+                    ClientMode = clientMode
+                }))
+                {
+                    Test(ignite1, ignite2);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Tests interop scenario: Java and .NET exchange an object with the same type id, 
+        /// but marshaller cache contains different entries for different platforms for the same id.
+        /// </summary>
+        [Test]
+        public void TestJavaInterop()
+        {
+            using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+            {
+                var cacheCfg = new CacheConfiguration(null, new QueryEntity(typeof(PlatformComputeBinarizable))
+                {
+                    Fields = new[] {new QueryField("Field", typeof(int))}
+                });
+
+                var cache = ignite.CreateCache<int, object>(cacheCfg);
+
+                // Force dynamic registration for .NET
+                cache.Put(1, new PlatformComputeBinarizable {Field = 7});
+
+                // Run Java code that will also perform dynamic registration
+                var fromJava = ignite.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(ComputeApiTest.EchoTask,
+                    ComputeApiTest.EchoTypeBinarizable);
+
+                // Check that objects are compatible
+                Assert.AreEqual(1, fromJava.Field);
+
+                // Check that Java can read what .NET has put
+                var qryRes = ignite.GetCompute().ExecuteJavaTask<IList>(
+                    BinaryCompactFooterInteropTest.PlatformSqlQueryTask, "Field < 10");
+
+                Assert.AreEqual(7, qryRes.OfType<PlatformComputeBinarizable>().Single().Field);
+            }
+        }
+
+        /// <summary>
+        /// Tests the type registration.
+        /// </summary>
+        private static void Test(IIgnite ignite1, IIgnite ignite2)
+        {
+            const string cacheName = "cache";
+
+            // Put on one grid.
+            var cache1 = ignite1.CreateCache<int, object>(cacheName);
+            cache1[1] = new Foo {Int = 1, Str = "1"};
+            cache1[2] = ignite1.GetBinary().GetBuilder(typeof (Bar)).SetField("Int", 5).SetField("Str", "s").Build();
+
+            // Get on another grid.
+            var cache2 = ignite2.GetCache<int, Foo>(cacheName);
+            var foo = cache2[1];
+
+            Assert.AreEqual(1, foo.Int);
+            Assert.AreEqual("1", foo.Str);
+
+            var bar = cache2.WithKeepBinary<int, IBinaryObject>()[2];
+
+            Assert.AreEqual("s", bar.GetField<string>("Str"));
+            Assert.AreEqual(5, bar.GetField<int>("Int"));
+
+            var bar0 = bar.Deserialize<Bar>();
+
+            Assert.AreEqual("s", bar0.Str);
+            Assert.AreEqual(5, bar0.Int);
+
+            // Test compute.
+            var serverNodeCount = ignite1.GetCluster().ForServers().GetNodes().Count;
+
+            var res = ignite1.GetCompute().Broadcast(new CompFn<DateTime>(() => DateTime.Now));
+            Assert.AreEqual(serverNodeCount, res.Count);
+
+            // Variable capture.
+            var res2 = ignite1.GetCompute().Broadcast(new CompFn<string>(() => bar0.Str));
+            Assert.AreEqual(Enumerable.Repeat(bar0.Str, serverNodeCount), res2);
+        }
+
+        /// <summary>
+        /// Clears the marshaller work dir.
+        /// </summary>
+        private static void ClearMarshallerWorkDir()
+        {
+            // Delete all *.classname files within IGNITE_HOME
+            var home = IgniteHome.Resolve(null);
+
+            var files = Directory.GetFiles(home, "*.classname*", SearchOption.AllDirectories);
+
+            files.ToList().ForEach(File.Delete);
+        }
+
+        private interface ITest
+        {
+            int Int { get; set; }
+            string Str { get; set; }
+        }
+
+        private class Foo : ITest
+        {
+            public int Int { get; set; }
+            public string Str { get; set; }
+        }
+
+        private class Bar : ITest
+        {
+            public int Int { get; set; }
+            public string Str { get; set; }
+        }
+
+        private class Bin : IBinarizable, ITest
+        {
+            public int Int { get; set; }
+            public string Str { get; set; }
+
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                writer.WriteInt("Int", Int);
+                writer.GetRawWriter().WriteString(Str);
+            }
+
+            public void ReadBinary(IBinaryReader reader)
+            {
+                Int = reader.ReadInt("Int");
+                Str = reader.GetRawReader().ReadString();
+            }
+        }
+
+        private class BinRaw : IBinarizable, ITest
+        {
+            public int Int { get; set; }
+            public string Str { get; set; }
+
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                var w = writer.GetRawWriter();
+
+                w.WriteInt(Int);
+                w.WriteString(Str);
+            }
+
+            public void ReadBinary(IBinaryReader reader)
+            {
+                var r = reader.GetRawReader();
+
+                Int = r.ReadInt();
+                Str = r.ReadString();
+            }
+        }
+
+        [Serializable]
+        private class StoreFactory : IFactory<ICacheStore>
+        {
+            public string StringProp { get; set; }
+
+            public int IntProp { get; set; }
+
+            public static StoreFactory LastInstance { get; set; }
+
+            public ICacheStore CreateInstance()
+            {
+                LastInstance = this;
+                return new CacheStore();
+            }
+        }
+
+        private class CacheStore : CacheStoreAdapter<object, object>
+        {
+            private static readonly Dictionary<object, object>  Dict = new Dictionary<object, object>();
+
+            public override object Load(object key)
+            {
+                object res;
+                return Dict.TryGetValue(key, out res) ? res : null;
+            }
+
+            public override void Write(object key, object val)
+            {
+                Dict[key] = val;
+            }
+
+            public override void Delete(object key)
+            {
+                Dict.Remove(key);
+            }
+        }
+
+        private class CompFn<T> : IComputeFunc<T>
+        {
+            private readonly Func<T> _func;
+
+            public CompFn(Func<T> func)
+            {
+                _func = func;
+            }
+
+            public T Invoke()
+            {
+                return _func();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index 70226e6..eb2751e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -63,16 +63,16 @@ namespace Apache.Ignite.Core.Tests.Binary
         [TestFixtureSetUp]
         public void BeforeTest()
         {
-            _marsh = new Marshaller(GetBinaryConfiguration());
+            _marsh = new Marshaller(new BinaryConfiguration{CompactFooter = GetCompactFooter()});
         }
 
         /// <summary>
         /// Gets the binary configuration.
         /// </summary>
         /// <returns></returns>
-        protected virtual BinaryConfiguration GetBinaryConfiguration()
+        protected virtual bool GetCompactFooter()
         {
-            return new BinaryConfiguration { CompactFooter = true };
+            return true;
         }
         
         /**
@@ -691,7 +691,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                 {
                     new BinaryTypeConfiguration(typeof (PrimitiveFieldType)),
                     new BinaryTypeConfiguration(typeof (GenericCollectionsType<PrimitiveFieldType, SerializableObject>))
-                }
+                },
+                CompactFooter = GetCompactFooter()
             });
 
             var obj = new GenericCollectionsType<PrimitiveFieldType, SerializableObject>
@@ -721,6 +722,52 @@ namespace Apache.Ignite.Core.Tests.Binary
             CollectionAssert.AreEquivalent(obj.Objects, result.Objects);
         }
 
+        /// <summary>
+        /// Tests the circular reference handling with List.
+        /// </summary>
+        [Test]
+        public void TestListCircularReference()
+        {
+            var list1 = new List<object> {1};
+            var list2 = new List<object> {2};
+
+            list1.Add(list2);
+            list2.Add(list1);
+
+            var data = _marsh.Marshal(list1);
+
+            var resList1 = _marsh.Unmarshal<List<object>>(data);
+            Assert.AreEqual(1, resList1[0]);
+
+            var resList2 = (List<object>) resList1[1];
+            Assert.AreEqual(2, resList2[0]);
+            Assert.AreEqual(resList1, resList2[1]);
+        }
+
+        /// <summary>
+        /// Tests the circular reference handling with Dictionary.
+        /// This test checks proper handle support in combination with OnDeserialization callback,
+        /// which has to be called after entire graph is deserialized.
+        /// </summary>
+        [Test]
+        public void TestDictionaryCircularReference()
+        {
+            var dict1 = new Dictionary<object, object> {{0, 1}};
+            var dict2 = new Dictionary<object, object> {{0, 2}};
+
+            dict1[1] = dict2;
+            dict2[1] = dict1;
+
+            var data = _marsh.Marshal(dict1);
+
+            var resDict1 = _marsh.Unmarshal<Dictionary<object, object>>(data);
+            Assert.AreEqual(1, resDict1[0]);
+
+            var resDict2 = (Dictionary<object, object>) resDict1[1];
+            Assert.AreEqual(2, resDict2[0]);
+            Assert.AreEqual(resDict1, resDict2[1]);
+        }
+
         /**
          * <summary>Check property read.</summary>
          */
@@ -778,7 +825,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                     {
                         Serializer = serializer
                     }
-                }
+                },
+                CompactFooter = GetCompactFooter()
             });
 
             // Use utc date fields because reflective serializer writes [QuerySqlField] fields as timestamp
@@ -791,20 +839,17 @@ namespace Apache.Ignite.Core.Tests.Binary
             CheckPrimitiveFields(marsh, obj);
         }
 
-        /**
-         * <summary>Check write of primitive fields through binary interface.</summary>
-         */
+        /// <summary>
+        /// Check write of primitive fields through binary interface.
+        /// </summary>
         [Test]
         public void TestPrimitiveFieldsBinary()
         {
-            ICollection<BinaryTypeConfiguration> typeCfgs = 
-                new List<BinaryTypeConfiguration>();
-
-            typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldBinaryType)));
-
-            BinaryConfiguration cfg = new BinaryConfiguration();
-
-            cfg.TypeConfigurations = typeCfgs;
+            var cfg = new BinaryConfiguration
+            {
+                TypeConfigurations = new[] { new BinaryTypeConfiguration(typeof(PrimitiveFieldBinaryType)) },
+                CompactFooter = GetCompactFooter()
+            };
 
             Marshaller marsh = new Marshaller(cfg);
 
@@ -813,44 +858,41 @@ namespace Apache.Ignite.Core.Tests.Binary
             CheckPrimitiveFields(marsh, obj);
         }
 
-        /**
-         * <summary>Check write of primitive fields through binary interface.</summary>
-         */
+        /// <summary>
+        /// Check write of primitive fields through binary interface.
+        /// </summary>
         [Test]
         public void TestPrimitiveFieldsRawBinary()
         {
-            ICollection<BinaryTypeConfiguration> typeCfgs = 
-                new List<BinaryTypeConfiguration>();
-
-            typeCfgs.Add(new BinaryTypeConfiguration(typeof(PrimitiveFieldRawBinaryType)));
-
-            BinaryConfiguration cfg = new BinaryConfiguration();
-
-            cfg.TypeConfigurations = typeCfgs;
-
-            Marshaller marsh = new Marshaller(cfg);
+            var marsh = new Marshaller(new BinaryConfiguration
+            {
+                TypeConfigurations = new[] { new BinaryTypeConfiguration(typeof(PrimitiveFieldRawBinaryType)) },
+                CompactFooter = GetCompactFooter()
+            });
 
-            PrimitiveFieldRawBinaryType obj = new PrimitiveFieldRawBinaryType();
+            var obj = new PrimitiveFieldRawBinaryType();
 
             CheckPrimitiveFields(marsh, obj);
         }
 
-        /**
-         * <summary>Check write of primitive fields through binary interface.</summary>
-         */
+        /// <summary>
+        /// Check write of primitive fields through binary interface.
+        /// </summary>
         [Test]
         public void TestPrimitiveFieldsSerializer()
         {
-            var typeCfgs = new List<BinaryTypeConfiguration>
+            var cfg = new BinaryConfiguration
             {
-                new BinaryTypeConfiguration(typeof (PrimitiveFieldType))
+                TypeConfigurations = new[]
                 {
-                    Serializer = new PrimitiveFieldsSerializer()
-                }
+                    new BinaryTypeConfiguration(typeof(PrimitiveFieldType))
+                    {
+                        Serializer = new PrimitiveFieldsSerializer(),
+                    }
+                },
+                CompactFooter = GetCompactFooter()
             };
 
-            BinaryConfiguration cfg = new BinaryConfiguration {TypeConfigurations = typeCfgs};
-
             Marshaller marsh = new Marshaller(cfg);
 
             PrimitiveFieldType obj = new PrimitiveFieldType();
@@ -909,31 +951,25 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(obj2.RawValArr, portObj.Deserialize<DecimalMarshalAware>().RawValArr);
         }
 
-        /**
-         * <summary>Check write of primitive fields through raw serializer.</summary>
-         */
+        /// <summary>
+        /// Check write of primitive fields through raw serializer.
+        /// </summary>
         [Test]
         public void TestPrimitiveFieldsRawSerializer()
         {
-            ICollection<BinaryTypeConfiguration> typeCfgs = 
-                new List<BinaryTypeConfiguration>();
-
-            BinaryTypeConfiguration typeCfg =
-                new BinaryTypeConfiguration(typeof(PrimitiveFieldType));
-
-            typeCfg.Serializer = new PrimitiveFieldsRawSerializer();
-
-            typeCfgs.Add(typeCfg);
-
-            BinaryConfiguration cfg = new BinaryConfiguration();
-
-            cfg.TypeConfigurations = typeCfgs;
-
-            Marshaller marsh = new Marshaller(cfg);
-
-            PrimitiveFieldType obj = new PrimitiveFieldType();
+            Marshaller marsh = new Marshaller(new BinaryConfiguration
+            {
+                TypeConfigurations = new[]
+                {
+                    new BinaryTypeConfiguration(typeof(PrimitiveFieldType))
+                    {
+                        Serializer = new PrimitiveFieldsRawSerializer()
+                    }
+                },
+                CompactFooter = GetCompactFooter()
+            });
 
-            CheckPrimitiveFields(marsh, obj);
+            CheckPrimitiveFields(marsh, new PrimitiveFieldType());
         }
 
         private void CheckPrimitiveFields(Marshaller marsh, PrimitiveFieldType obj)
@@ -941,7 +977,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             CheckPrimitiveFieldsSerialization(marsh, obj);
         }
 
-        private void CheckPrimitiveFieldsSerialization(Marshaller marsh, PrimitiveFieldType obj)
+        private static void CheckPrimitiveFieldsSerialization(Marshaller marsh, PrimitiveFieldType obj)
         {
             byte[] bytes = marsh.Marshal(obj);
 
@@ -1029,7 +1065,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                     {
                         Serializer = new BinaryReflectiveSerializer {RawMode = raw}
                     }
-                }
+                },
+                CompactFooter = GetCompactFooter()
             });
             
             var obj = new CollectionsType
@@ -1239,9 +1276,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             {
                 var reader = new BinaryReader(marsh, new BinaryHeapStream(bytes), BinaryMode.ForceBinary, null);
 
-                reader.DetachNext();
-
-                outerObj = reader.Deserialize<IBinaryObject>();
+                outerObj = reader.DetachNext().Deserialize<IBinaryObject>();
             }
             else
                 outerObj = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
@@ -1272,7 +1307,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                 TypeConfigurations = new[]
                 {
                     new BinaryTypeConfiguration(typeof (HandleCollection))
-                }
+                },
+                CompactFooter = GetCompactFooter()
             });
 
             // Collection in collection dependency loop
@@ -1441,8 +1477,10 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("guidArr"));
             Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("nGuidArr"));
-            Assert.AreEqual(dateArr, portObj.GetField<DateTime[]>("dateArr"));
-            Assert.AreEqual(nDateArr, portObj.GetField<DateTime?[]>("nDateArr"));
+            Assert.AreEqual(dateArr, portObj.GetField<IBinaryObject[]>("dateArr")
+                .Select(x => x.Deserialize<DateTime>()));
+            Assert.AreEqual(nDateArr, portObj.GetField<IBinaryObject[]>("nDateArr")
+                .Select(x => x.Deserialize<DateTime?>()));
 
             obj1 = portObj.Deserialize<SpecialArray>();
 
@@ -1452,12 +1490,13 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(nDateArr, obj1.NDateArr);
 
             // Use special with IGridbinaryMarshalAware.
-            SpecialArrayMarshalAware obj2 = new SpecialArrayMarshalAware();
-
-            obj2.GuidArr = guidArr;
-            obj2.NGuidArr = nGuidArr;
-            obj2.DateArr = dateArr;
-            obj2.NDateArr = nDateArr;
+            SpecialArrayMarshalAware obj2 = new SpecialArrayMarshalAware
+            {
+                GuidArr = guidArr,
+                NGuidArr = nGuidArr,
+                DateArr = dateArr,
+                NDateArr = nDateArr
+            };
 
             bytes = marsh.Marshal(obj2);
 
@@ -1465,8 +1504,8 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             Assert.AreEqual(guidArr, portObj.GetField<Guid[]>("a"));
             Assert.AreEqual(nGuidArr, portObj.GetField<Guid?[]>("b"));
-            Assert.AreEqual(dateArr, portObj.GetField<DateTime[]>("c"));
-            Assert.AreEqual(nDateArr, portObj.GetField<DateTime?[]>("d"));
+            Assert.AreEqual(dateArr, portObj.GetField<IBinaryObject[]>("c").Select(x => x.Deserialize<DateTime>()));
+            Assert.AreEqual(nDateArr, portObj.GetField<IBinaryObject[]>("d").Select(x => x.Deserialize<DateTime?>()));
 
             obj2 = portObj.Deserialize<SpecialArrayMarshalAware>();
 
@@ -1523,7 +1562,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         [Test]
         public void TestCompactFooterSetting()
         {
-            Assert.AreEqual(GetBinaryConfiguration().CompactFooter, _marsh.CompactFooter);
+            Assert.AreEqual(GetCompactFooter(), _marsh.CompactFooter);
         }
 
         private static void CheckKeepSerialized(BinaryConfiguration cfg, bool expKeep)
@@ -1842,8 +1881,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                 PString = "abc";
                 PGuid = Guid.NewGuid();
                 PnGuid = Guid.NewGuid();
-                PDate = DateTime.Now;
-                PnDate = DateTime.Now;
+                PDate = DateTime.UtcNow;
+                PnDate = DateTime.UtcNow;
                 IgniteGuid = new IgniteGuid(Guid.NewGuid(), 123);
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestFullFooter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestFullFooter.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestFullFooter.cs
index 06e43e1..72228cf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestFullFooter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestFullFooter.cs
@@ -17,7 +17,6 @@
 
 namespace Apache.Ignite.Core.Tests.Binary
 {
-    using Apache.Ignite.Core.Binary;
     using NUnit.Framework;
 
     /// <summary>
@@ -27,9 +26,9 @@ namespace Apache.Ignite.Core.Tests.Binary
     public class BinarySelfTestFullFooter : BinarySelfTest
     {
         /** <inheritdoc /> */
-        protected override BinaryConfiguration GetBinaryConfiguration()
+        protected override bool GetCompactFooter()
         {
-            return new BinaryConfiguration {CompactFooter = false};
+            return false;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
new file mode 100644
index 0000000..9af5c35
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
@@ -0,0 +1,182 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.Linq;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests binary type interoperability between .NET and Java code.
+    /// </summary>
+    public class JavaBinaryInteropTest
+    {
+        /// <summary>
+        /// Tests that all kinds of values from .NET can be handled properly on Java side.
+        /// </summary>
+        [Test]
+        public void TestValueRoundtrip()
+        {
+            using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+            {
+                ignite.CreateCache<int, object>((string) null);
+
+                // Basic types.
+                // Types which map directly to Java are returned properly when retrieved as object.
+                // Non-directly mapped types are returned as their counterpart.
+                CheckValueCaching((char) 128);
+                CheckValueCaching((byte) 255);
+                CheckValueCaching((sbyte) -10, false);
+                CheckValueCaching((short) -32000);
+                CheckValueCaching((ushort) 65350, false);
+                CheckValueCaching(int.MinValue);
+                CheckValueCaching(uint.MaxValue, false);
+                CheckValueCaching(long.MinValue);
+                CheckValueCaching(ulong.MaxValue, false);
+
+                CheckValueCaching((float) 1.1);
+                CheckValueCaching(2.2);
+
+                CheckValueCaching((decimal) 3.3, asArray: false);
+                CheckValueCaching(Guid.NewGuid(), asArray: false);
+                CheckValueCaching(DateTime.Now, asArray: false);
+
+                CheckValueCaching("foobar");
+
+                // Special arrays.
+                CheckValueCaching(new[] {Guid.Empty, Guid.NewGuid()}, false);
+                CheckValueCaching(new Guid?[] {Guid.Empty, Guid.NewGuid()});
+
+                CheckValueCaching(new[] {1.2m, -3.4m}, false);
+                CheckValueCaching(new decimal?[] {1.2m, -3.4m});
+
+                CheckValueCaching(new[] {DateTime.Now}, false);
+
+                // Custom types.
+                CheckValueCaching(new Foo {X = 10}, asArray: false);
+                CheckValueCaching(new Bar {X = 20}, asArray: false);
+
+                // Collections.
+                CheckValueCaching(new List<Foo>(GetFoo()));
+                CheckValueCaching(new List<Bar>(GetBar()));
+
+                CheckValueCaching(new HashSet<Foo>(GetFoo()));
+                CheckValueCaching(new HashSet<Bar>(GetBar()));
+
+                CheckValueCaching(GetFoo().ToDictionary(x => x.X, x => x));
+                CheckValueCaching(GetBar().ToDictionary(x => x.X, x => x));
+
+                // Custom type arrays.
+                // Array type is lost, because in binary mode on Java side we receive the value as Object[].
+                CheckValueCaching(new[] {new Foo {X = -1}, new Foo {X = 1}}, false);
+                CheckValueCaching(new[] {new Bar {X = -10}, new Bar {X = 10}}, false);
+            }
+        }
+
+        /// <summary>
+        /// Checks caching of a value with generic cache.
+        /// </summary>
+        private static void CheckValueCaching<T>(T val, bool asObject = true, bool asArray = true)
+        {
+            var cache = Ignition.GetIgnite(null).GetCache<int, T>(null);
+
+            cache[1] = val;
+            Assert.AreEqual(val, cache[1]);
+
+            if (asObject)
+            {
+                CheckValueCachingAsObject(val);
+            }
+
+            // Array of T
+            if (asArray && !(val is IEnumerable))
+            {
+                CheckValueCaching(new[] {val}, asObject, false);
+            }
+        }
+
+        /// <summary>
+        /// Checks caching of a value with object cache.
+        /// </summary>
+        private static void CheckValueCachingAsObject<T>(T val)
+        {
+            var cache = Ignition.GetIgnite(null).GetCache<int, object>(null);
+
+            cache[1] = val;
+            Assert.AreEqual(val, (T) cache[1]);
+        }
+
+        /// <summary>
+        /// Gets Foo collection.
+        /// </summary>
+        private static IEnumerable<Foo> GetFoo()
+        {
+            return Enumerable.Range(-50, 100).Select(x => new Foo {X = x});
+        }
+
+        /// <summary>
+        /// Gets Bar collection.
+        /// </summary>
+        private static IEnumerable<Bar> GetBar()
+        {
+            return Enumerable.Range(-50, 100).Select(x => new Bar {X = x});
+        }
+
+        /// <summary>
+        /// Test custom class.
+        /// </summary>
+        private class Foo
+        {
+            public int X { get; set; }
+
+            public override bool Equals(object obj)
+            {
+                if (ReferenceEquals(null, obj)) return false;
+                if (ReferenceEquals(this, obj)) return true;
+                if (obj.GetType() != GetType()) return false;
+                return X == ((Foo) obj).X;
+            }
+
+            public override int GetHashCode()
+            {
+                return X;
+            }
+        }
+
+        /// <summary>
+        /// Test custom struct.
+        /// </summary>
+        private struct Bar
+        {
+            public int X { get; set; }
+
+            public override bool Equals(object obj)
+            {
+                if (ReferenceEquals(null, obj)) return false;
+                return obj is Bar && X == ((Bar) obj).X;
+            }
+
+            public override int GetHashCode()
+            {
+                return X;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/AdvancedSerializationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/AdvancedSerializationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/AdvancedSerializationTest.cs
new file mode 100644
index 0000000..c96d111
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/AdvancedSerializationTest.cs
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Linq;
+    using System.Reflection;
+    using System.Reflection.Emit;
+    using System.Runtime.Serialization;
+    using System.Xml;
+    using Apache.Ignite.Core.Cluster;
+    using Apache.Ignite.Core.Compute;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests additional [Serializable] scenarios.
+    /// </summary>
+    public class AdvancedSerializationTest
+    {
+        /// <summary>
+        /// Set up routine.
+        /// </summary>
+        [TestFixtureSetUp]
+        public void SetUp()
+        {
+            Ignition.Start(TestUtils.GetTestConfiguration());
+        }
+
+        /// <summary>
+        /// Tear down routine.
+        /// </summary>
+        [TestFixtureTearDown]
+        public void TearDown()
+        {
+            Ignition.StopAll(true);
+        }
+
+        /// <summary>
+        /// Test complex file serialization.
+        /// </summary>
+        [Test]
+        public void TestSerializableXmlDoc()
+        {
+            var grid = Ignition.GetIgnite(null);
+            var cache = grid.GetOrCreateCache<int, SerializableXmlDoc>("cache");
+
+            var doc = new SerializableXmlDoc();
+
+            doc.LoadXml("<document><test1>val</test1><test2 attr=\"x\" /></document>");
+
+            for (var i = 0; i < 50; i++)
+            {
+                // Test cache
+                cache.Put(i, doc);
+
+                var resultDoc = cache.Get(i);
+
+                Assert.AreEqual(doc.OuterXml, resultDoc.OuterXml);
+
+                // Test task with document arg
+                CheckTask(grid, doc);
+            }
+        }
+
+        /// <summary>
+        /// Checks task execution.
+        /// </summary>
+        /// <param name="grid">Grid.</param>
+        /// <param name="arg">Task arg.</param>
+        private static void CheckTask(IIgnite grid, object arg)
+        {
+            var jobResult = grid.GetCompute().Execute(new CombineStringsTask(), arg);
+
+            var nodeCount = grid.GetCluster().GetNodes().Count;
+
+            var expectedRes =
+                CombineStringsTask.CombineStrings(Enumerable.Range(0, nodeCount).Select(x => arg.ToString()));
+
+            Assert.AreEqual(expectedRes, jobResult.InnerXml);
+        }
+
+        /// <summary>
+        /// Tests custom serialization binder.
+        /// </summary>
+        [Test]
+        public void TestSerializationBinder()
+        {
+            const int count = 50;
+
+            var cache = Ignition.GetIgnite(null).GetOrCreateCache<int, object>("cache");
+
+            // Put multiple objects from multiple same-named assemblies to cache
+            for (var i = 0; i < count; i++)
+            {
+                dynamic val = Activator.CreateInstance(GenerateDynamicType());
+                
+                val.Id = i;
+                val.Name = "Name_" + i;
+
+                cache.Put(i, val);
+            }
+
+            // Verify correct deserialization
+            for (var i = 0; i < count; i++)
+            {
+                dynamic val = cache.Get(i);
+
+                Assert.AreEqual(val.Id, i);
+                Assert.AreEqual(val.Name, "Name_" + i);
+            }
+        }
+
+        /// <summary>
+        /// Generates a Type in runtime, puts it into a dynamic assembly.
+        /// </summary>
+        /// <returns></returns>
+        private static Type GenerateDynamicType()
+        {
+            var asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
+                new AssemblyName("GridSerializationTestDynamicAssembly"), AssemblyBuilderAccess.Run);
+
+            var moduleBuilder = asmBuilder.DefineDynamicModule("GridSerializationTestDynamicModule");
+
+            var typeBuilder = moduleBuilder.DefineType("GridSerializationTestDynamicType",
+                TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Serializable);
+
+            typeBuilder.DefineField("Id", typeof (int), FieldAttributes.Public);
+            
+            typeBuilder.DefineField("Name", typeof (string), FieldAttributes.Public);
+
+            return typeBuilder.CreateType();
+        }
+    }
+
+    [Serializable]
+    [DataContract]
+    public sealed class SerializableXmlDoc : XmlDocument, ISerializable
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public SerializableXmlDoc()
+        {
+            // No-op
+        }
+
+        /// <summary>
+        /// Serialization ctor.
+        /// </summary>
+        private SerializableXmlDoc(SerializationInfo info, StreamingContext context)
+        {
+            LoadXml(info.GetString("xmlDocument"));
+        }
+
+        /** <inheritdoc /> */
+        public void GetObjectData(SerializationInfo info, StreamingContext context)
+        {
+            info.AddValue("xmlDocument", OuterXml, typeof(string));
+        }
+    }
+
+    [Serializable]
+    public class CombineStringsTask : IComputeTask<object, string, SerializableXmlDoc>
+    {
+        public IDictionary<IComputeJob<string>, IClusterNode> Map(IList<IClusterNode> subgrid, object arg)
+        {
+            return subgrid.ToDictionary(x => (IComputeJob<string>) new ToStringJob {Arg = arg}, x => x);
+        }
+
+        public ComputeJobResultPolicy OnResult(IComputeJobResult<string> res, IList<IComputeJobResult<string>> rcvd)
+        {
+            return ComputeJobResultPolicy.Wait;
+        }
+
+        public SerializableXmlDoc Reduce(IList<IComputeJobResult<string>> results)
+        {
+            var result = new SerializableXmlDoc();
+
+            result.LoadXml(CombineStrings(results.Select(x => x.Data)));
+
+            return result;
+        }
+
+        public static string CombineStrings(IEnumerable<string> strings)
+        {
+            var text = string.Concat(strings.Select(x => string.Format("<val>{0}</val>", x)));
+
+            return string.Format("<document>{0}</document>", text);
+        }
+    }
+
+    [Serializable]
+    public class ToStringJob : IComputeJob<string>
+    {
+        /// <summary>
+        /// Job argument.
+        /// </summary>
+        public object Arg { get; set; }
+
+        /** <inheritdoc /> */
+        public string Execute()
+        {
+            return Arg.ToString();
+        }
+
+        /** <inheritdoc /> */
+        public void Cancel()
+        {
+            // No-op.
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
new file mode 100644
index 0000000..82deb3c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/BasicSerializableObjectsTest.cs
@@ -0,0 +1,124 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.Runtime.Serialization;
+    using Apache.Ignite.Core.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests basic ISerializable scenarios.
+    /// </summary>
+    public class BasicSerializableObjectsTest
+    {
+        /// <summary>
+        /// Tests the object with no fields.
+        /// </summary>
+        [Test]
+        public void TestEmptyObject()
+        {
+            var res = TestUtils.SerializeDeserialize(new EmptyObject());
+
+            Assert.IsNotNull(res);
+        }
+
+        /// <summary>
+        /// Tests the object with no fields.
+        /// </summary>
+        [Test]
+        public void TestEmptyObjectOnline()
+        {
+            using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+            {
+                var cache = ignite.CreateCache<int, EmptyObject>("c");
+
+                cache[1] = new EmptyObject();
+
+                var res = cache[1];
+
+                Assert.IsNotNull(res);
+            }
+        }
+
+        /// <summary>
+        /// Tests ISerializable without serialization ctor.
+        /// </summary>
+        [Test]
+        public void TestMissingCtor()
+        {
+            var ex = Assert.Throws<SerializationException>(() => TestUtils.SerializeDeserialize(new MissingCtor()));
+            Assert.AreEqual(string.Format("The constructor to deserialize an object of type '{0}' was not found.", 
+                typeof(MissingCtor)), ex.Message);
+        }
+
+        /// <summary>
+        /// Tests <see cref="Type"/> serialization.
+        /// </summary>
+        [Test]
+        public void TestTypes()
+        {
+            var type = GetType();
+
+            var res = TestUtils.SerializeDeserialize(type);
+
+            Assert.AreEqual(type, res);
+        }
+
+        /// <summary>
+        /// Missing serialization ctor.
+        /// </summary>
+        private class MissingCtor : ISerializable
+        {
+            /** <inheritdoc /> */
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                // No-op.
+            }
+        }
+
+        /// <summary>
+        /// Object with no fields.
+        /// </summary>
+        [Serializable]
+        private class EmptyObject : ISerializable
+        {
+            /// <summary>
+            /// Initializes a new instance of the <see cref="EmptyObject"/> class.
+            /// </summary>
+            public EmptyObject()
+            {
+                // No-op.
+            }
+
+            /// <summary>
+            /// Initializes a new instance of the <see cref="EmptyObject"/> class.
+            /// </summary>
+            private EmptyObject(SerializationInfo info, StreamingContext context)
+            {
+                Assert.IsInstanceOf<IBinaryReader>(context.Context);
+            }
+
+            /** <inheritdoc /> */
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                Assert.IsInstanceOf<IBinaryWriter>(context.Context);
+            }
+        }
+    }
+}


[04/18] ignite git commit: IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index 1a8d576..75e9f7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -249,9 +249,12 @@ public class FileSystemConfiguration {
      * Sets IGFS instance name.
      *
      * @param name IGFS instance name.
+     * @return {@code this} for chaining.
      */
-    public void setName(String name) {
+    public FileSystemConfiguration setName(String name) {
         this.name = name;
+
+        return this;
     }
 
     /**
@@ -275,9 +278,12 @@ public class FileSystemConfiguration {
      * </ul>
      *
      * @param metaCacheCfg Cache configuration object.
+     * @return {@code this} for chaining.
      */
-    public void setMetaCacheConfiguration(CacheConfiguration metaCacheCfg) {
+    public FileSystemConfiguration setMetaCacheConfiguration(CacheConfiguration metaCacheCfg) {
         this.metaCacheCfg = metaCacheCfg;
+
+        return this;
     }
 
     /**
@@ -301,9 +307,12 @@ public class FileSystemConfiguration {
      * </ul>
      *
      * @param dataCacheCfg Cache configuration object.
+     * @return {@code this} for chaining.
      */
-    public void setDataCacheConfiguration(CacheConfiguration dataCacheCfg) {
+    public FileSystemConfiguration setDataCacheConfiguration(CacheConfiguration dataCacheCfg) {
         this.dataCacheCfg = dataCacheCfg;
+
+        return this;
     }
 
     /**
@@ -319,11 +328,14 @@ public class FileSystemConfiguration {
      * Sets file's data block size.
      *
      * @param blockSize File's data block size (bytes) or {@code 0} to reset default value.
+     * @return {@code this} for chaining.
      */
-    public void setBlockSize(int blockSize) {
+    public FileSystemConfiguration setBlockSize(int blockSize) {
         A.ensure(blockSize >= 0, "blockSize >= 0");
 
         this.blockSize = blockSize == 0 ? DFLT_BLOCK_SIZE : blockSize;
+
+        return this;
     }
 
     /**
@@ -339,11 +351,14 @@ public class FileSystemConfiguration {
      * Sets the number of pre-fetched blocks if specific file's chunk is requested.
      *
      * @param prefetchBlocks New number of pre-fetched blocks.
+     * @return {@code this} for chaining.
      */
-    public void setPrefetchBlocks(int prefetchBlocks) {
+    public FileSystemConfiguration setPrefetchBlocks(int prefetchBlocks) {
         A.ensure(prefetchBlocks >= 0, "prefetchBlocks >= 0");
 
         this.prefetchBlocks = prefetchBlocks;
+
+        return this;
     }
 
     /**
@@ -381,11 +396,14 @@ public class FileSystemConfiguration {
      * <b>NOTE:</b> Integration with Hadoop is available only in {@code In-Memory Accelerator For Hadoop} edition.
      *
      * @param seqReadsBeforePrefetch Amount of sequential block reads before prefetch is triggered.
+     * @return {@code this} for chaining.
      */
-    public void setSequentialReadsBeforePrefetch(int seqReadsBeforePrefetch) {
+    public FileSystemConfiguration setSequentialReadsBeforePrefetch(int seqReadsBeforePrefetch) {
         A.ensure(seqReadsBeforePrefetch >= 0, "seqReadsBeforePrefetch >= 0");
 
         this.seqReadsBeforePrefetch = seqReadsBeforePrefetch;
+
+        return this;
     }
 
     /**
@@ -401,11 +419,14 @@ public class FileSystemConfiguration {
      * Sets read/write buffers size for {@code IGFS} stream operations (bytes).
      *
      * @param bufSize Read/write buffers size for stream operations (bytes) or {@code 0} to reset default value.
+     * @return {@code this} for chaining.
      */
-    public void setStreamBufferSize(int bufSize) {
+    public FileSystemConfiguration setStreamBufferSize(int bufSize) {
         A.ensure(bufSize >= 0, "bufSize >= 0");
 
         this.bufSize = bufSize == 0 ? DFLT_BUF_SIZE : bufSize;
+
+        return this;
     }
 
     /**
@@ -421,9 +442,12 @@ public class FileSystemConfiguration {
      * Sets number of file blocks collected on local node before sending batch to remote node.
      *
      * @param perNodeBatchSize Per node buffer size.
+     * @return {@code this} for chaining.
      */
-    public void setPerNodeBatchSize(int perNodeBatchSize) {
+    public FileSystemConfiguration setPerNodeBatchSize(int perNodeBatchSize) {
         this.perNodeBatchSize = perNodeBatchSize;
+
+        return this;
     }
 
     /**
@@ -439,9 +463,12 @@ public class FileSystemConfiguration {
      * Sets number of file block batches that can be concurrently sent to remote node.
      *
      * @param perNodeParallelBatchCnt Per node parallel load operations.
+     * @return {@code this} for chaining.
      */
-    public void setPerNodeParallelBatchCount(int perNodeParallelBatchCnt) {
+    public FileSystemConfiguration setPerNodeParallelBatchCount(int perNodeParallelBatchCnt) {
         this.perNodeParallelBatchCnt = perNodeParallelBatchCnt;
+
+        return this;
     }
 
     /**
@@ -463,9 +490,12 @@ public class FileSystemConfiguration {
      * Hadoop Accelerator</b>.
      *
      * @param ipcEndpointCfg IPC endpoint configuration.
+     * @return {@code this} for chaining.
      */
-    public void setIpcEndpointConfiguration(@Nullable IgfsIpcEndpointConfiguration ipcEndpointCfg) {
+    public FileSystemConfiguration setIpcEndpointConfiguration(@Nullable IgfsIpcEndpointConfiguration ipcEndpointCfg) {
         this.ipcEndpointCfg = ipcEndpointCfg;
+
+        return this;
     }
 
     /**
@@ -488,9 +518,12 @@ public class FileSystemConfiguration {
      * Hadoop Accelerator</b>.
      *
      * @param ipcEndpointEnabled IPC endpoint enabled flag.
+     * @return {@code this} for chaining.
      */
-    public void setIpcEndpointEnabled(boolean ipcEndpointEnabled) {
+    public FileSystemConfiguration setIpcEndpointEnabled(boolean ipcEndpointEnabled) {
         this.ipcEndpointEnabled = ipcEndpointEnabled;
+
+        return this;
     }
 
     /**
@@ -509,9 +542,12 @@ public class FileSystemConfiguration {
      * Sets management endpoint port.
      *
      * @param mgmtPort port number or {@code -1} to disable management endpoint.
+     * @return {@code this} for chaining.
      */
-    public void setManagementPort(int mgmtPort) {
+    public FileSystemConfiguration setManagementPort(int mgmtPort) {
         this.mgmtPort = mgmtPort;
+
+        return this;
     }
 
     /**
@@ -534,9 +570,12 @@ public class FileSystemConfiguration {
      * for pass-through, write-through, and read-through purposes.
      *
      * @param dfltMode {@code IGFS} mode.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultMode(IgfsMode dfltMode) {
+    public FileSystemConfiguration setDefaultMode(IgfsMode dfltMode) {
         this.dfltMode = dfltMode;
+
+        return this;
     }
 
     /**
@@ -554,9 +593,12 @@ public class FileSystemConfiguration {
      * and read-through purposes.
      *
      * @param fileSystem Secondary file system.
+     * @return {@code this} for chaining.
      */
-    public void setSecondaryFileSystem(IgfsSecondaryFileSystem fileSystem) {
+    public FileSystemConfiguration setSecondaryFileSystem(IgfsSecondaryFileSystem fileSystem) {
         secondaryFs = fileSystem;
+
+        return this;
     }
 
     /**
@@ -587,9 +629,12 @@ public class FileSystemConfiguration {
      * {@link #getDefaultMode()} is used.
      *
      * @param pathModes Map of paths to {@code IGFS} modes.
+     * @return {@code this} for chaining.
      */
-    public void setPathModes(Map<String, IgfsMode> pathModes) {
+    public FileSystemConfiguration setPathModes(Map<String, IgfsMode> pathModes) {
         this.pathModes = pathModes;
+
+        return this;
     }
 
     /**
@@ -605,15 +650,19 @@ public class FileSystemConfiguration {
      * Sets length of file chunk to transmit before throttling is delayed.
      *
      * @param fragmentizerThrottlingBlockLen Block length in bytes.
+     * @return {@code this} for chaining.
      */
-    public void setFragmentizerThrottlingBlockLength(long fragmentizerThrottlingBlockLen) {
+    public FileSystemConfiguration setFragmentizerThrottlingBlockLength(long fragmentizerThrottlingBlockLen) {
         this.fragmentizerThrottlingBlockLen = fragmentizerThrottlingBlockLen;
+
+        return this;
     }
 
     /**
      * Gets throttle delay for fragmentizer.
      *
      * @return Throttle delay in milliseconds.
+     * @return {@code this} for chaining.
      */
     public long getFragmentizerThrottlingDelay() {
         return fragmentizerThrottlingDelay;
@@ -624,14 +673,17 @@ public class FileSystemConfiguration {
      *
      * @param fragmentizerThrottlingDelay Delay in milliseconds.
      */
-    public void setFragmentizerThrottlingDelay(long fragmentizerThrottlingDelay) {
+    public FileSystemConfiguration setFragmentizerThrottlingDelay(long fragmentizerThrottlingDelay) {
         this.fragmentizerThrottlingDelay = fragmentizerThrottlingDelay;
+
+        return this;
     }
 
     /**
      * Gets number of files that can be processed by fragmentizer concurrently.
      *
      * @return Number of files to process concurrently.
+     * @return {@code this} for chaining.
      */
     public int getFragmentizerConcurrentFiles() {
         return fragmentizerConcurrentFiles;
@@ -641,9 +693,12 @@ public class FileSystemConfiguration {
      * Sets number of files to process concurrently by fragmentizer.
      *
      * @param fragmentizerConcurrentFiles Number of files to process concurrently.
+     * @return {@code this} for chaining.
      */
-    public void setFragmentizerConcurrentFiles(int fragmentizerConcurrentFiles) {
+    public FileSystemConfiguration setFragmentizerConcurrentFiles(int fragmentizerConcurrentFiles) {
         this.fragmentizerConcurrentFiles = fragmentizerConcurrentFiles;
+
+        return this;
     }
 
     /**
@@ -672,10 +727,13 @@ public class FileSystemConfiguration {
      * @see #getFragmentizerLocalWritesRatio()
      *
      * @deprecated Parameter is no longer used.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setFragmentizerLocalWritesRatio(float fragmentizerLocWritesRatio) {
+    public FileSystemConfiguration setFragmentizerLocalWritesRatio(float fragmentizerLocWritesRatio) {
         this.fragmentizerLocWritesRatio = fragmentizerLocWritesRatio;
+
+        return this;
     }
 
     /**
@@ -692,9 +750,12 @@ public class FileSystemConfiguration {
      * Sets property indicating whether fragmentizer is enabled.
      *
      * @param fragmentizerEnabled {@code True} if fragmentizer is enabled.
+     * @return {@code this} for chaining.
      */
-    public void setFragmentizerEnabled(boolean fragmentizerEnabled) {
+    public FileSystemConfiguration setFragmentizerEnabled(boolean fragmentizerEnabled) {
         this.fragmentizerEnabled = fragmentizerEnabled;
+
+        return this;
     }
 
     /**
@@ -710,9 +771,12 @@ public class FileSystemConfiguration {
      * Set maximum space in bytes available in data cache.
      *
      * @param maxSpace Maximum space available in data cache.
+     * @return {@code this} for chaining.
      */
-    public void setMaxSpaceSize(long maxSpace) {
+    public FileSystemConfiguration setMaxSpaceSize(long maxSpace) {
         this.maxSpace = maxSpace;
+
+        return this;
     }
 
     /**
@@ -731,10 +795,13 @@ public class FileSystemConfiguration {
      *
      * @param trashPurgeTimeout Maximum timeout awaiting for trash purging in case data cache oversize is detected.
      * @deprecated Not used any more.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setTrashPurgeTimeout(long trashPurgeTimeout) {
+    public FileSystemConfiguration setTrashPurgeTimeout(long trashPurgeTimeout) {
         this.trashPurgeTimeout = trashPurgeTimeout;
+
+        return this;
     }
 
     /**
@@ -756,10 +823,13 @@ public class FileSystemConfiguration {
      *
      * @param dualModePutExec Dual mode put operations executor service.
      * @deprecated Not used any more.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setDualModePutExecutorService(ExecutorService dualModePutExec) {
+    public FileSystemConfiguration setDualModePutExecutorService(ExecutorService dualModePutExec) {
         this.dualModePutExec = dualModePutExec;
+
+        return this;
     }
 
     /**
@@ -778,10 +848,13 @@ public class FileSystemConfiguration {
      *
      * @param dualModePutExecShutdown Dual mode put operations executor service shutdown flag.
      * @deprecated Not used any more.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setDualModePutExecutorServiceShutdown(boolean dualModePutExecShutdown) {
+    public FileSystemConfiguration setDualModePutExecutorServiceShutdown(boolean dualModePutExecShutdown) {
         this.dualModePutExecShutdown = dualModePutExecShutdown;
+
+        return this;
     }
 
     /**
@@ -805,10 +878,13 @@ public class FileSystemConfiguration {
      *
      * @param dualModeMaxPendingPutsSize Maximum amount of data in pending put operations.
      * @deprecated Not used any more.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setDualModeMaxPendingPutsSize(long dualModeMaxPendingPutsSize) {
+    public FileSystemConfiguration setDualModeMaxPendingPutsSize(long dualModeMaxPendingPutsSize) {
         this.dualModeMaxPendingPutsSize = dualModeMaxPendingPutsSize;
+
+        return this;
     }
 
     /**
@@ -846,9 +922,12 @@ public class FileSystemConfiguration {
      * See {@link #getMaximumTaskRangeLength()} for more details.
      *
      * @param maxTaskRangeLen Set maximum default range size of a file being split during IGFS task execution.
+     * @return {@code this} for chaining.
      */
-    public void setMaximumTaskRangeLength(long maxTaskRangeLen) {
+    public FileSystemConfiguration setMaximumTaskRangeLength(long maxTaskRangeLen) {
         this.maxTaskRangeLen = maxTaskRangeLen;
+
+        return this;
     }
 
     /**
@@ -880,9 +959,12 @@ public class FileSystemConfiguration {
      * See {@link #isInitializeDefaultPathModes()} for more information.
      *
      * @param initDfltPathModes Whether to initialize default path modes.
+     * @return {@code this} for chaining.
      */
-    public void setInitializeDefaultPathModes(boolean initDfltPathModes) {
+    public FileSystemConfiguration setInitializeDefaultPathModes(boolean initDfltPathModes) {
         this.initDfltPathModes = initDfltPathModes;
+
+        return this;
     }
 
     /**
@@ -919,9 +1001,12 @@ public class FileSystemConfiguration {
      * See {@link #isColocateMetadata()} for more information.
      *
      * @param colocateMeta Whether metadata co-location is enabled.
+     * @return {@code this} for chaining.
      */
-    public void setColocateMetadata(boolean colocateMeta) {
+    public FileSystemConfiguration setColocateMetadata(boolean colocateMeta) {
         this.colocateMeta = colocateMeta;
+
+        return this;
     }
 
     /**
@@ -956,9 +1041,12 @@ public class FileSystemConfiguration {
      * See {@link #isColocateMetadata()} for more information.
      *
      * @param relaxedConsistency Whether to use relaxed consistency optimization.
+     * @return {@code this} for chaining.
      */
-    public void setRelaxedConsistency(boolean relaxedConsistency) {
+    public FileSystemConfiguration setRelaxedConsistency(boolean relaxedConsistency) {
         this.relaxedConsistency = relaxedConsistency;
+
+        return this;
     }
 
     /**
@@ -982,9 +1070,12 @@ public class FileSystemConfiguration {
      * Set {@link #isUpdateFileLengthOnFlush()} for more information.
      *
      * @param updateFileLenOnFlush Whether to update file length on flush.
+     * @return {@code this} for chaining.
      */
-    public void setUpdateFileLengthOnFlush(boolean updateFileLenOnFlush) {
+    public FileSystemConfiguration setUpdateFileLengthOnFlush(boolean updateFileLenOnFlush) {
         this.updateFileLenOnFlush = updateFileLenOnFlush;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
index 6443a67..8d8e96c 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/HadoopConfiguration.java
@@ -92,9 +92,12 @@ public class HadoopConfiguration {
      * Sets max number of local tasks that may be executed in parallel.
      *
      * @param maxParallelTasks Max number of local tasks that may be executed in parallel.
+     * @return {@code this} for chaining.
      */
-    public void setMaxParallelTasks(int maxParallelTasks) {
+    public HadoopConfiguration setMaxParallelTasks(int maxParallelTasks) {
         this.maxParallelTasks = maxParallelTasks;
+
+        return this;
     }
 
     /**
@@ -110,9 +113,12 @@ public class HadoopConfiguration {
      * Sets max task queue size.
      *
      * @param maxTaskQueueSize Max task queue size.
+     * @return {@code this} for chaining.
      */
-    public void setMaxTaskQueueSize(int maxTaskQueueSize) {
+    public HadoopConfiguration setMaxTaskQueueSize(int maxTaskQueueSize) {
         this.maxTaskQueueSize = maxTaskQueueSize;
+
+        return this;
     }
 
     /**
@@ -128,9 +134,12 @@ public class HadoopConfiguration {
      * Sets finished job info time-to-live.
      *
      * @param finishedJobInfoTtl Finished job info time-to-live.
+     * @return {@code this} for chaining.
      */
-    public void setFinishedJobInfoTtl(long finishedJobInfoTtl) {
+    public HadoopConfiguration setFinishedJobInfoTtl(long finishedJobInfoTtl) {
         this.finishedJobInfoTtl = finishedJobInfoTtl;
+
+        return this;
     }
 
     /**
@@ -149,10 +158,14 @@ public class HadoopConfiguration {
      *
      * @param extExecution {@code True} if tasks should be executed in an external process.
      * @see #isExternalExecution()
+     * @return {@code this} for chaining.
      */
     // TODO: IGNITE-404: Uncomment when fixed.
-//    public void setExternalExecution(boolean extExecution) {
+//
+//    public HadoopConfiguration setExternalExecution(boolean extExecution) {
 //        this.extExecution = extExecution;
+//
+//        return this;
 //    }
 
     /**
@@ -170,9 +183,12 @@ public class HadoopConfiguration {
      * configuration and current grid topology.
      *
      * @param planner Map-reduce planner.
+     * @return {@code this} for chaining.
      */
-    public void setMapReducePlanner(HadoopMapReducePlanner planner) {
+    public HadoopConfiguration setMapReducePlanner(HadoopMapReducePlanner planner) {
         this.planner = planner;
+
+        return this;
     }
 
     /**
@@ -199,9 +215,12 @@ public class HadoopConfiguration {
      * Set native library names. See {@link #getNativeLibraryNames()} for more information.
      *
      * @param libNames Native library names.
+     * @return {@code this} for chaining.
      */
-    public void setNativeLibraryNames(@Nullable String... libNames) {
+    public HadoopConfiguration setNativeLibraryNames(@Nullable String... libNames) {
         this.libNames = libNames;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
index 3c59bd6..7c948dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
@@ -17,7 +17,11 @@
 
 package org.apache.ignite.configuration;
 
+import javax.cache.configuration.Factory;
 import javax.cache.configuration.MutableConfiguration;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.integration.CacheLoader;
+import javax.cache.integration.CacheWriter;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.eviction.EvictionPolicy;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -108,6 +112,52 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setTypes(Class<K> keyType, Class<V> valueType) {
+        return (CacheConfiguration<K, V>)super.setTypes(keyType, valueType);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setCacheLoaderFactory(Factory<? extends CacheLoader<K, V>> factory) {
+        return (CacheConfiguration<K, V>)super.setCacheLoaderFactory(factory);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setCacheWriterFactory(
+        Factory<? extends CacheWriter<? super K, ? super V>> factory) {
+        return (CacheConfiguration<K, V>)super.setCacheWriterFactory(factory);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setExpiryPolicyFactory(Factory<? extends ExpiryPolicy> factory) {
+        return (CacheConfiguration<K, V>)super.setExpiryPolicyFactory(factory);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setReadThrough(boolean isReadThrough) {
+        return (CacheConfiguration<K, V>)super.setReadThrough(isReadThrough);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setWriteThrough(boolean isWriteThrough) {
+        return (CacheConfiguration<K, V>)super.setWriteThrough(isWriteThrough);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setStoreByValue(boolean isStoreByValue) {
+        return (CacheConfiguration<K, V>)super.setStoreByValue(isStoreByValue);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setStatisticsEnabled(boolean enabled) {
+        return (CacheConfiguration<K, V>)super.setStatisticsEnabled(enabled);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setManagementEnabled(boolean enabled) {
+        return (CacheConfiguration<K, V>)super.setManagementEnabled(enabled);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(NearCacheConfiguration.class, this, super.toString());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java
index 440e00a..0063afc 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java
@@ -113,10 +113,13 @@ public class TransactionConfiguration implements Serializable {
      * @param txSerEnabled Flag to enable/disable serializable cache transactions.
 
      * @deprecated This method has no effect, {@link TransactionIsolation#SERIALIZABLE} isolation is always enabled.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setTxSerializableEnabled(boolean txSerEnabled) {
+    public TransactionConfiguration setTxSerializableEnabled(boolean txSerEnabled) {
         this.txSerEnabled = txSerEnabled;
+
+        return this;
     }
 
     /**
@@ -134,9 +137,12 @@ public class TransactionConfiguration implements Serializable {
      * Sets default transaction concurrency.
      *
      * @param dfltConcurrency Default cache transaction concurrency.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultTxConcurrency(TransactionConcurrency dfltConcurrency) {
+    public TransactionConfiguration setDefaultTxConcurrency(TransactionConcurrency dfltConcurrency) {
         this.dfltConcurrency = dfltConcurrency;
+
+        return this;
     }
 
     /**
@@ -154,9 +160,12 @@ public class TransactionConfiguration implements Serializable {
      * Sets default transaction isolation.
      *
      * @param dfltIsolation Default cache transaction isolation.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultTxIsolation(TransactionIsolation dfltIsolation) {
+    public TransactionConfiguration setDefaultTxIsolation(TransactionIsolation dfltIsolation) {
         this.dfltIsolation = dfltIsolation;
+
+        return this;
     }
 
     /**
@@ -174,9 +183,12 @@ public class TransactionConfiguration implements Serializable {
      * #DFLT_TRANSACTION_TIMEOUT}.
      *
      * @param dfltTxTimeout Default transaction timeout.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultTxTimeout(long dfltTxTimeout) {
+    public TransactionConfiguration setDefaultTxTimeout(long dfltTxTimeout) {
         this.dfltTxTimeout = dfltTxTimeout;
+
+        return this;
     }
 
     /**
@@ -196,9 +208,12 @@ public class TransactionConfiguration implements Serializable {
      *
      * @param pessimisticTxLogSize Pessimistic transactions log size.
      * @see #getPessimisticTxLogSize()
+     * @return {@code this} for chaining.
      */
-    public void setPessimisticTxLogSize(int pessimisticTxLogSize) {
+    public TransactionConfiguration setPessimisticTxLogSize(int pessimisticTxLogSize) {
         this.pessimisticTxLogSize = pessimisticTxLogSize;
+
+        return this;
     }
 
     /**
@@ -217,9 +232,12 @@ public class TransactionConfiguration implements Serializable {
      *
      * @param pessimisticTxLogLinger Pessimistic log cleanup delay.
      * @see #getPessimisticTxLogLinger()
+     * @return {@code this} for chaining.
      */
-    public void setPessimisticTxLogLinger(int pessimisticTxLogLinger) {
+    public TransactionConfiguration setPessimisticTxLogLinger(int pessimisticTxLogLinger) {
         this.pessimisticTxLogLinger = pessimisticTxLogLinger;
+
+        return this;
     }
 
     /**
@@ -239,10 +257,13 @@ public class TransactionConfiguration implements Serializable {
      * @param tmLookupClsName Name of class implementing GridCacheTmLookup interface that is used to
      *      receive JTA transaction manager.
      * @deprecated Use {@link #setTxManagerFactory(Factory)} instead.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setTxManagerLookupClassName(String tmLookupClsName) {
+    public TransactionConfiguration setTxManagerLookupClassName(String tmLookupClsName) {
         this.tmLookupClsName = tmLookupClsName;
+
+        return this;
     }
 
     /**
@@ -286,9 +307,12 @@ public class TransactionConfiguration implements Serializable {
      * @param factory Transaction manager factory.
      * @param <T> Instance of {@code javax.transaction.TransactionManager}.
      * @see #setUseJtaSynchronization(boolean)
+     * @return {@code this} for chaining.
      */
-    public <T> void setTxManagerFactory(Factory<T> factory) {
+    public <T> TransactionConfiguration setTxManagerFactory(Factory<T> factory) {
         txManagerFactory = factory;
+
+        return this;
     }
 
     /**
@@ -309,8 +333,11 @@ public class TransactionConfiguration implements Serializable {
      * @param useJtaSync Whether to use JTA {@code javax.transaction.Synchronization}
      *      instead of {@code javax.transaction.xa.XAResource}.
      * @see #setTxManagerFactory(Factory)
+     * @return {@code this} for chaining.
      */
-    public void setUseJtaSynchronization(boolean useJtaSync) {
+    public TransactionConfiguration setUseJtaSynchronization(boolean useJtaSync) {
         this.useJtaSync = useJtaSync;
+
+        return this;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/igfs/IgfsGroupDataBlocksKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsGroupDataBlocksKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsGroupDataBlocksKeyMapper.java
index 09143d4..7019c57 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsGroupDataBlocksKeyMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsGroupDataBlocksKeyMapper.java
@@ -124,9 +124,12 @@ public class IgfsGroupDataBlocksKeyMapper extends GridCacheDefaultAffinityKeyMap
      * Set group size. See {@link #getGroupSize()} for more information.
      *
      * @param grpSize Group size.
+     * @return {@code this} for chaining.
      */
-    public void setGroupSize(int grpSize) {
+    public IgfsGroupDataBlocksKeyMapper setGroupSize(int grpSize) {
         this.grpSize = grpSize;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
index 1c68d0f..b79f68e 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
@@ -113,9 +113,12 @@ public class IgfsIpcEndpointConfiguration {
      * Defaults to {@link #DFLT_TYPE}.
      *
      * @param type Endpoint type.
+     * @return {@code this} for chaining.
      */
-    public void setType(IgfsIpcEndpointType type) {
+    public IgfsIpcEndpointConfiguration setType(IgfsIpcEndpointType type) {
         this.type = type;
+
+        return this;
     }
 
     /**
@@ -147,9 +150,12 @@ public class IgfsIpcEndpointConfiguration {
      * Defaults to {@link #DFLT_HOST}.
      *
      * @param host Host.
+     * @return {@code this} for chaining.
      */
-    public void setHost(String host) {
+    public IgfsIpcEndpointConfiguration setHost(String host) {
         this.host = host;
+
+        return this;
     }
 
     /**
@@ -179,9 +185,12 @@ public class IgfsIpcEndpointConfiguration {
      * Defaults to {@link #DFLT_PORT}.
      *
      * @param port Port.
+     * @return {@code this} for chaining.
      */
-    public void setPort(int port) {
+    public IgfsIpcEndpointConfiguration setPort(int port) {
         this.port = port;
+
+        return this;
     }
 
     /**
@@ -205,9 +214,12 @@ public class IgfsIpcEndpointConfiguration {
      * Defaults to {@link #DFLT_MEM_SIZE}.
      *
      * @param memSize Shared memory size.
+     * @return {@code this} for chaining.
      */
-    public void setMemorySize(int memSize) {
+    public IgfsIpcEndpointConfiguration setMemorySize(int memSize) {
         this.memSize = memSize;
+
+        return this;
     }
 
     /**
@@ -237,9 +249,12 @@ public class IgfsIpcEndpointConfiguration {
      * Defaults to {@link #DFLT_TOKEN_DIR_PATH}.
      *
      * @param tokenDirPath Directory where shared memory tokens are stored.
+     * @return {@code this} for chaining.
      */
-    public void setTokenDirectoryPath(String tokenDirPath) {
+    public IgfsIpcEndpointConfiguration setTokenDirectoryPath(String tokenDirPath) {
         this.tokenDirPath = tokenDirPath;
+
+        return this;
     }
 
     /**
@@ -259,9 +274,12 @@ public class IgfsIpcEndpointConfiguration {
      * See {@link #getThreadCount()} for more information.
      *
      * @param threadCnt Number of threads used by this endpoint to process incoming requests.
+     * @return {@code this} for chaining.
      */
-    public void setThreadCount(int threadCnt) {
+    public IgfsIpcEndpointConfiguration setThreadCount(int threadCnt) {
         this.threadCnt = threadCnt;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
index cac1bb3..a54f882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
@@ -234,18 +234,24 @@ public class GridClientConfiguration {
      * Sets list of servers this client should connect to.
      *
      * @param srvs List of servers.
+     * @return {@code this} for chaining.
      */
-    public void setServers(Collection<String> srvs) {
+    public GridClientConfiguration setServers(Collection<String> srvs) {
         this.srvs = srvs != null ? srvs : Collections.<String>emptySet();
+
+        return this;
     }
 
     /**
      * Sets list of routers this client should connect to.
      *
      * @param routers List of routers.
+     * @return {@code this} for chaining.
      */
-    public void setRouters(Collection<String> routers) {
+    public GridClientConfiguration setRouters(Collection<String> routers) {
         this.routers = routers != null ? routers : Collections.<String>emptySet();
+
+        return this;
     }
 
     /**
@@ -264,9 +270,12 @@ public class GridClientConfiguration {
      *
      * @param proto Protocol type.
      * @see GridClientProtocol
+     * @return {@code this} for chaining.
      */
-    public void setProtocol(GridClientProtocol proto) {
+    public GridClientConfiguration setProtocol(GridClientProtocol proto) {
         this.proto = proto;
+
+        return this;
     }
 
     /**
@@ -296,18 +305,24 @@ public class GridClientConfiguration {
      * Sets whether {@code TCP_NODELAY} flag should be set on underlying socket connections.
      *
      * @param tcpNoDelay {@code True} if flag should be set.
+     * @return {@code this} for chaining.
      */
-    public void setTcpNoDelay(boolean tcpNoDelay) {
+    public GridClientConfiguration setTcpNoDelay(boolean tcpNoDelay) {
         this.tcpNoDelay = tcpNoDelay;
+
+        return this;
     }
 
     /**
      * Sets timeout for socket connect operation.
      *
      * @param connectTimeout Connect timeout in milliseconds.
+     * @return {@code this} for chaining.
      */
-    public void setConnectTimeout(int connectTimeout) {
+    public GridClientConfiguration setConnectTimeout(int connectTimeout) {
         this.connectTimeout = connectTimeout;
+
+        return this;
     }
 
     /**
@@ -325,9 +340,12 @@ public class GridClientConfiguration {
      * Sets SSL context factory that will be used for creation of secure connections.
      *
      * @param sslCtxFactory Context factory.
+     * @return {@code this} for chaining.
      */
-    public void setSslContextFactory(GridSslContextFactory sslCtxFactory) {
+    public GridClientConfiguration setSslContextFactory(GridSslContextFactory sslCtxFactory) {
         this.sslCtxFactory = sslCtxFactory;
+
+        return this;
     }
 
     /**
@@ -345,9 +363,12 @@ public class GridClientConfiguration {
      * Sets default compute balancer.
      *
      * @param balancer Balancer to use.
+     * @return {@code this} for chaining.
      */
-    public void setBalancer(GridClientLoadBalancer balancer) {
+    public GridClientConfiguration setBalancer(GridClientLoadBalancer balancer) {
         this.balancer = balancer;
+
+        return this;
     }
 
     /**
@@ -363,9 +384,12 @@ public class GridClientConfiguration {
      * Sets client credentials provider used in authentication process.
      *
      * @param credProvider Client credentials provider.
+     * @return {@code this} for chaining.
      */
-    public void setSecurityCredentialsProvider(SecurityCredentialsProvider credProvider) {
+    public GridClientConfiguration setSecurityCredentialsProvider(SecurityCredentialsProvider credProvider) {
         this.credProvider = credProvider;
+
+        return this;
     }
 
     /**
@@ -381,12 +405,15 @@ public class GridClientConfiguration {
      * Sets data configurations.
      *
      * @param dataCfgs Data configurations.
+     * @return {@code this} for chaining.
      */
-    public void setDataConfigurations(Collection<? extends GridClientDataConfiguration> dataCfgs) {
+    public GridClientConfiguration setDataConfigurations(Collection<? extends GridClientDataConfiguration> dataCfgs) {
         this.dataCfgs = U.newHashMap(dataCfgs.size());
 
         for (GridClientDataConfiguration dataCfg : dataCfgs)
             this.dataCfgs.put(dataCfg.getName(), new GridClientDataConfiguration(dataCfg));
+
+        return this;
     }
 
     /**
@@ -403,9 +430,12 @@ public class GridClientConfiguration {
      * Sets flag indicating whether node and cache metrics should be cached by client.
      *
      * @param enableMetricsCache {@code True} if cache should be enabled.
+     * @return {@code this} for chaining.
      */
-    public void setEnableMetricsCache(boolean enableMetricsCache) {
+    public GridClientConfiguration setEnableMetricsCache(boolean enableMetricsCache) {
         this.enableMetricsCache = enableMetricsCache;
+
+        return this;
     }
 
     /**
@@ -430,9 +460,12 @@ public class GridClientConfiguration {
      * Sets flag indicating whether node attributes should be cached by client.
      *
      * @param enableAttrsCache {@code True} if cache should be enabled.
+     * @return {@code this} for chaining.
      */
-    public void setEnableAttributesCache(boolean enableAttrsCache) {
+    public GridClientConfiguration setEnableAttributesCache(boolean enableAttrsCache) {
         this.enableAttrsCache = enableAttrsCache;
+
+        return this;
     }
 
     /**
@@ -457,9 +490,12 @@ public class GridClientConfiguration {
      * Sets flag indicating whether node metrics should be fetched by client automatically.
      *
      * @param autoFetchMetrics {@code True} if metrics should be fetched.
+     * @return {@code this} for chaining.
      */
-    public void setAutoFetchMetrics(boolean autoFetchMetrics) {
+    public GridClientConfiguration setAutoFetchMetrics(boolean autoFetchMetrics) {
         this.autoFetchMetrics = autoFetchMetrics;
+
+        return this;
     }
 
     /**
@@ -483,9 +519,12 @@ public class GridClientConfiguration {
      * Sets flag indicating whether node attributes should be fetched by client automatically.
      *
      * @param autoFetchAttrs {@code True} if attributes should be fetched.
+     * @return {@code this} for chaining.
      */
-    public void setAutoFetchAttributes(boolean autoFetchAttrs) {
+    public GridClientConfiguration setAutoFetchAttributes(boolean autoFetchAttrs) {
         this.autoFetchAttrs = autoFetchAttrs;
+
+        return this;
     }
 
     /**
@@ -516,9 +555,12 @@ public class GridClientConfiguration {
      * will be refreshed every {@code topRefreshFreq} milliseconds.
      *
      * @param topRefreshFreq Topology refresh frequency in milliseconds.
+     * @return {@code this} for chaining.
      */
-    public void setTopologyRefreshFrequency(long topRefreshFreq) {
+    public GridClientConfiguration setTopologyRefreshFrequency(long topRefreshFreq) {
         this.topRefreshFreq = topRefreshFreq;
+
+        return this;
     }
 
     /**
@@ -535,9 +577,12 @@ public class GridClientConfiguration {
      * Sets maximum time in milliseconds which connection can be idle before it is closed by client.
      *
      * @param maxConnIdleTime Maximum time of connection idleness in milliseconds.
+     * @return {@code this} for chaining.
      */
-    public void setMaxConnectionIdleTime(long maxConnIdleTime) {
+    public GridClientConfiguration setMaxConnectionIdleTime(long maxConnIdleTime) {
         this.maxConnIdleTime = maxConnIdleTime;
+
+        return this;
     }
 
     /**
@@ -557,9 +602,12 @@ public class GridClientConfiguration {
      * Sets ping interval in milliseconds.
      *
      * @param pingInterval Ping interval in milliseconds.
+     * @return {@code this} for chaining.
      */
-    public void setPingInterval(long pingInterval) {
+    public GridClientConfiguration setPingInterval(long pingInterval) {
         this.pingInterval = pingInterval;
+
+        return this;
     }
 
     /**
@@ -580,9 +628,12 @@ public class GridClientConfiguration {
      * Sets ping timeout in milliseconds.
      *
      * @param pingTimeout Ping interval in milliseconds.
+     * @return {@code this} for chaining.
      */
-    public void setPingTimeout(long pingTimeout) {
+    public GridClientConfiguration setPingTimeout(long pingTimeout) {
         this.pingTimeout = pingTimeout;
+
+        return this;
     }
 
     /**
@@ -603,9 +654,12 @@ public class GridClientConfiguration {
      * Sets executor service.
      *
      * @param executor Executor service to use in client.
+     * @return {@code this} for chaining.
      */
-    public void setExecutorService(ExecutorService executor) {
+    public GridClientConfiguration setExecutorService(ExecutorService executor) {
         this.executor = executor;
+
+        return this;
     }
 
     /**
@@ -628,9 +682,12 @@ public class GridClientConfiguration {
      * Sets the marshaller to use for communication.
      *
      * @param marshaller A marshaller to use.
+     * @return {@code this} for chaining.
      */
-    public void setMarshaller(GridClientMarshaller marshaller) {
+    public GridClientConfiguration setMarshaller(GridClientMarshaller marshaller) {
         this.marshaller = marshaller;
+
+        return this;
     }
 
     /**
@@ -836,9 +893,12 @@ public class GridClientConfiguration {
      * Set the daemon flag value. Communication threads will be created as daemons if this flag is set.
      *
      * @param daemon Daemon flag.
+     * @return {@code this} for chaining.
      */
-    public void setDaemon(boolean daemon) {
+    public GridClientConfiguration setDaemon(boolean daemon) {
         this.daemon = daemon;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientDataConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientDataConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientDataConfiguration.java
index 322bccd..9a52554 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientDataConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientDataConfiguration.java
@@ -65,9 +65,12 @@ public class GridClientDataConfiguration {
      * Sets grid cache name for this configuration.
      *
      * @param name Cache name.
+     * @return {@code this} for chaining.
      */
-    public void setName(String name) {
+    public GridClientDataConfiguration setName(String name) {
         this.name = name;
+
+        return this;
     }
 
     /**
@@ -93,9 +96,12 @@ public class GridClientDataConfiguration {
      * work with remote partitioned caches.
      *
      * @param affinity Client data affinity.
+     * @return {@code this} for chaining.
      */
-    public void setAffinity(GridClientDataAffinity affinity) {
+    public GridClientDataConfiguration setAffinity(GridClientDataAffinity affinity) {
         this.affinity = affinity;
+
+        return this;
     }
 
     /**
@@ -112,8 +118,11 @@ public class GridClientDataConfiguration {
      * Sets balancer for pinned mode for this configuration.
      *
      * @param balancer Balancer that will be used in pinned mode.
+     * @return {@code this} for chaining.
      */
-    public void setBalancer(GridClientLoadBalancer balancer) {
+    public GridClientDataConfiguration setBalancer(GridClientLoadBalancer balancer) {
         this.balancer = balancer;
+
+        return this;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientPartitionAffinity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientPartitionAffinity.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientPartitionAffinity.java
index 53a49c6..21f4abe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientPartitionAffinity.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientPartitionAffinity.java
@@ -143,9 +143,12 @@ public class GridClientPartitionAffinity implements GridClientDataAffinity, Grid
      * Sets total number of partitions.
      *
      * @param parts Total number of partitions.
+     * @return {@code this} for chaining.
      */
-    public void setPartitions(int parts) {
+    public GridClientPartitionAffinity setPartitions(int parts) {
         this.parts = parts;
+
+        return this;
     }
 
     /**
@@ -175,9 +178,12 @@ public class GridClientPartitionAffinity implements GridClientDataAffinity, Grid
      * repartitioning.
      *
      * @param hashIdRslvr Hash ID resolver.
+     * @return {@code this} for chaining.
      */
-    public void setHashIdResolver(HashIdResolver hashIdRslvr) {
+    public GridClientPartitionAffinity setHashIdResolver(HashIdResolver hashIdRslvr) {
         this.hashIdRslvr = hashIdRslvr;
+
+        return this;
     }
 
     /**
@@ -201,9 +207,12 @@ public class GridClientPartitionAffinity implements GridClientDataAffinity, Grid
      * Note that {@code excludeNeighbors} parameter is ignored if {@code backupFilter} is set.
      *
      * @param backupFilter Optional backup filter.
+     * @return {@code this} for chaining.
      */
-    public void setBackupFilter(GridClientPredicate<UUID> backupFilter) {
+    public GridClientPartitionAffinity setBackupFilter(GridClientPredicate<UUID> backupFilter) {
         this.backupFilter = backupFilter;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/client/balancer/GridClientBalancerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/balancer/GridClientBalancerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/client/balancer/GridClientBalancerAdapter.java
index 3eb7e1d..75d4163 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/balancer/GridClientBalancerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/balancer/GridClientBalancerAdapter.java
@@ -58,9 +58,12 @@ public abstract class GridClientBalancerAdapter implements GridClientLoadBalance
      * Sets prefer direct nodes.
      *
      * @param preferDirectNodes Prefer direct nodes.
+     * @return {@code this} for chaining.
      */
-    public void setPreferDirectNodes(boolean preferDirectNodes) {
+    public GridClientBalancerAdapter setPreferDirectNodes(boolean preferDirectNodes) {
         this.preferDirectNodes = preferDirectNodes;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/client/router/GridTcpRouterConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/router/GridTcpRouterConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/client/router/GridTcpRouterConfiguration.java
index 191f4ac..e37ffea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/router/GridTcpRouterConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/router/GridTcpRouterConfiguration.java
@@ -207,18 +207,24 @@ public class GridTcpRouterConfiguration {
      * Sets host for router.
      *
      * @param host Host.
+     * @return {@code this} for chaining.
      */
-    public void setHost(String host) {
+    public GridTcpRouterConfiguration setHost(String host) {
         this.host = host;
+
+        return this;
     }
 
     /**
      * Sets port for router.
      *
      * @param port Port.
+     * @return {@code this} for chaining.
      */
-    public void setPort(int port) {
+    public GridTcpRouterConfiguration setPort(int port) {
         this.port = port;
+
+        return this;
     }
 
     /**
@@ -228,11 +234,14 @@ public class GridTcpRouterConfiguration {
      *
      * @param portRange Port range.
      * @see #DFLT_PORT_RANGE
+     * @return {@code this} for chaining.
      */
-    public void setPortRange(int portRange) {
+    public GridTcpRouterConfiguration setPortRange(int portRange) {
         A.ensure(portRange >= 0, "portRange >= 0");
 
         this.portRange = portRange;
+
+        return this;
     }
 
     /**
@@ -240,18 +249,24 @@ public class GridTcpRouterConfiguration {
      * for accepted client connections.
      *
      * @param noDelay No delay.
+     * @return {@code this} for chaining.
      */
-    public void setNoDelay(boolean noDelay) {
+    public GridTcpRouterConfiguration setNoDelay(boolean noDelay) {
         this.noDelay = noDelay;
+
+        return this;
     }
 
     /**
      * Sets idle timeout.
      *
      * @param idleTimeout Idle timeout in milliseconds.
+     * @return {@code this} for chaining.
      */
-    public void setIdleTimeout(long idleTimeout) {
+    public GridTcpRouterConfiguration setIdleTimeout(long idleTimeout) {
         this.idleTimeout = idleTimeout;
+
+        return this;
     }
 
     /**
@@ -259,9 +274,12 @@ public class GridTcpRouterConfiguration {
      * a valid SSL certificate which validity will be verified with trust manager.
      *
      * @param sslClientAuth Ssl client auth.
+     * @return {@code this} for chaining.
      */
-    public void setSslClientAuth(boolean sslClientAuth) {
+    public GridTcpRouterConfiguration setSslClientAuth(boolean sslClientAuth) {
         this.sslClientAuth = sslClientAuth;
+
+        return this;
     }
 
     /**
@@ -269,36 +287,48 @@ public class GridTcpRouterConfiguration {
      * of both rest binary server and out coming connections.
      *
      * @param sslCtxFactory Ssl context factory.
+     * @return {@code this} for chaining.
      */
-    public void setSslContextFactory(GridSslContextFactory sslCtxFactory) {
+    public GridTcpRouterConfiguration setSslContextFactory(GridSslContextFactory sslCtxFactory) {
         this.sslCtxFactory = sslCtxFactory;
+
+        return this;
     }
 
     /**
      * Sets list of server addresses where router's embedded client should connect.
      *
      * @param srvrs List of servers.
+     * @return {@code this} for chaining.
      */
-    public void setServers(Collection<String> srvrs) {
+    public GridTcpRouterConfiguration setServers(Collection<String> srvrs) {
         this.srvrs = srvrs;
+
+        return this;
     }
 
     /**
      * Sets logger for the router instance.
      *
      * @param log Logger.
+     * @return {@code this} for chaining.
      */
-    public void setLogger(IgniteLogger log) {
+    public GridTcpRouterConfiguration setLogger(IgniteLogger log) {
         this.log = log;
+
+        return this;
     }
 
     /**
      * Sets credentials provider for grid access.
      *
      * @param credsProvider Credentials provider.
+     * @return {@code this} for chaining.
      */
-    public void setSecurityCredentialsProvider(SecurityCredentialsProvider credsProvider) {
+    public GridTcpRouterConfiguration setSecurityCredentialsProvider(SecurityCredentialsProvider credsProvider) {
         this.credsProvider = credsProvider;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcSqlFieldsQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcSqlFieldsQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcSqlFieldsQuery.java
index 19dedf6..3d4eaba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcSqlFieldsQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcSqlFieldsQuery.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.jdbc2;
 
+import java.util.concurrent.TimeUnit;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 
 /**
@@ -45,4 +46,60 @@ public final class JdbcSqlFieldsQuery extends SqlFieldsQuery {
     public boolean isQuery() {
         return isQry;
     }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setSql(String sql) {
+        super.setSql(sql);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setArgs(Object... args) {
+        super.setArgs(args);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setTimeout(int timeout, TimeUnit timeUnit) {
+        super.setTimeout(timeout, timeUnit);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setCollocated(boolean collocated) {
+        super.setCollocated(collocated);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setEnforceJoinOrder(boolean enforceJoinOrder) {
+        super.setEnforceJoinOrder(enforceJoinOrder);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setDistributedJoins(boolean distributedJoins) {
+        super.setDistributedJoins(distributedJoins);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setPageSize(int pageSize) {
+        super.setPageSize(pageSize);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcSqlFieldsQuery setLocal(boolean loc) {
+        super.setLocal(loc);
+
+        return this;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 a7d38a7..966fa8e 100755
--- 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
@@ -120,6 +120,7 @@ import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.lifecycle.LifecycleAware;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.marshaller.MarshallerUtils;
+import org.apache.ignite.mxbean.IgniteMBeanAware;
 import org.apache.ignite.spi.IgniteNodeValidationResult;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag.GridDiscoveryData;
@@ -3560,15 +3561,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /**
      * Registers MBean for cache components.
      *
-     * @param o Cache component.
+     * @param obj Cache component.
      * @param cacheName Cache name.
      * @param near Near flag.
      * @throws IgniteCheckedException If registration failed.
      */
     @SuppressWarnings("unchecked")
-    private void registerMbean(Object o, @Nullable String cacheName, boolean near)
+    private void registerMbean(Object obj, @Nullable String cacheName, boolean near)
         throws IgniteCheckedException {
-        assert o != null;
+        assert obj != null;
 
         MBeanServer srvr = ctx.config().getMBeanServer();
 
@@ -3578,14 +3579,16 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         cacheName = near ? cacheName + "-near" : cacheName;
 
-        for (Class<?> itf : o.getClass().getInterfaces()) {
+        final Object mbeanImpl = (obj instanceof IgniteMBeanAware) ? ((IgniteMBeanAware)obj).getMBean() : obj;
+
+        for (Class<?> itf : mbeanImpl.getClass().getInterfaces()) {
             if (itf.getName().endsWith("MBean") || itf.getName().endsWith("MXBean")) {
                 try {
-                    U.registerCacheMBean(srvr, ctx.igniteInstanceName(), cacheName, o.getClass().getName(), o,
+                    U.registerCacheMBean(srvr, ctx.igniteInstanceName(), cacheName, obj.getClass().getName(), mbeanImpl,
                         (Class<Object>)itf);
                 }
                 catch (JMException e) {
-                    throw new IgniteCheckedException("Failed to register MBean for component: " + o, e);
+                    throw new IgniteCheckedException("Failed to register MBean for component: " + obj, e);
                 }
 
                 break;
@@ -3611,16 +3614,24 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         cacheName = near ? cacheName + "-near" : cacheName;
 
-        for (Class<?> itf : o.getClass().getInterfaces()) {
-            if (itf.getName().endsWith("MBean") || itf.getName().endsWith("MXBean")) {
-                try {
-                    srvr.unregisterMBean(U.makeCacheMBeanName(ctx.igniteInstanceName(), cacheName, o.getClass().getName()));
-                }
-                catch (JMException e) {
-                    U.error(log, "Failed to unregister MBean for component: " + o, e);
+        boolean needToUnregister = o instanceof IgniteMBeanAware;
+
+        if (!needToUnregister) {
+            for (Class<?> itf : o.getClass().getInterfaces()) {
+                if (itf.getName().endsWith("MBean") || itf.getName().endsWith("MXBean")) {
+                    needToUnregister = true;
+
+                    break;
                 }
+            }
+        }
 
-                break;
+        if (needToUnregister) {
+            try {
+                srvr.unregisterMBean(U.makeCacheMBeanName(ctx.igniteInstanceName(), cacheName, o.getClass().getName()));
+            }
+            catch (JMException e) {
+                U.error(log, "Failed to unregister MBean for component: " + o, e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
index 8448733..a5d793d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationEx.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.platform.dotnet;
 
+import java.util.List;
 import org.apache.ignite.internal.logger.platform.PlatformLogger;
 import org.apache.ignite.internal.processors.platform.PlatformConfigurationEx;
 import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtension;
@@ -25,6 +26,7 @@ import org.apache.ignite.internal.processors.platform.entityframework.PlatformDo
 import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
 import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
 import org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionCacheExtension;
+import org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration;
 import org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration;
 import org.jetbrains.annotations.Nullable;
 
@@ -98,11 +100,28 @@ public class PlatformDotNetConfigurationEx extends PlatformDotNetConfiguration i
         return logger;
     }
 
+    /** {@inheritDoc} */
+    @Override public PlatformDotNetConfigurationEx setBinaryConfiguration(PlatformDotNetBinaryConfiguration binaryCfg) {
+        super.setBinaryConfiguration(binaryCfg);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public PlatformDotNetConfigurationEx setAssemblies(List<String> assemblies) {
+        super.setAssemblies(assemblies);
+
+        return this;
+    }
+
     /**
      * @param warnings Warnings.
+     * @return {@code this} for chaining.
      */
-    public void warnings(Collection<String> warnings) {
+    public PlatformDotNetConfigurationEx warnings(Collection<String> warnings) {
         this.warnings = warnings;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index b2926e3..5f73f79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -62,7 +62,6 @@ import org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosure;
 import org.apache.ignite.plugin.platform.PlatformPluginConfigurationClosureFactory;
 import org.apache.ignite.spi.communication.CommunicationSpi;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiMBean;
 import org.apache.ignite.spi.discovery.DiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -1014,7 +1013,7 @@ public class PlatformConfigurationUtils {
 
         if (comm instanceof TcpCommunicationSpi) {
             w.writeBoolean(true);
-            TcpCommunicationSpiMBean tcp = (TcpCommunicationSpiMBean) comm;
+            TcpCommunicationSpi tcp = (TcpCommunicationSpi) comm;
 
             w.writeInt(tcp.getAckSendThreshold());
             w.writeLong(tcp.getConnectTimeout());

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
index 6d57864..e61e8dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
@@ -124,18 +124,24 @@ public class OptimizedMarshaller extends AbstractNodeNameAwareMarshaller {
      * Sets whether marshaller should require {@link Serializable} interface or not.
      *
      * @param requireSer Whether to require {@link Serializable}.
+     * @return {@code this} for chaining.
      */
-    public void setRequireSerializable(boolean requireSer) {
+    public OptimizedMarshaller setRequireSerializable(boolean requireSer) {
         this.requireSer = requireSer;
+
+        return this;
     }
 
     /**
      * Sets ID mapper.
      *
      * @param mapper ID mapper.
+     * @return {@code this} for chaining.
      */
-    public void setIdMapper(OptimizedMarshallerIdMapper mapper) {
+    public OptimizedMarshaller setIdMapper(OptimizedMarshallerIdMapper mapper) {
         this.mapper = mapper;
+
+        return this;
     }
 
     /**
@@ -152,9 +158,12 @@ public class OptimizedMarshaller extends AbstractNodeNameAwareMarshaller {
      * different threads which will lead to more frequent context switching.
      *
      * @param poolSize Streams pool size. If {@code 0}, pool is not used.
+     * @return {@code this} for chaining.
      */
-    public void setPoolSize(int poolSize) {
+    public OptimizedMarshaller setPoolSize(int poolSize) {
         OptimizedObjectStreamRegistry.poolSize(poolSize);
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMBeanAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMBeanAware.java b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMBeanAware.java
new file mode 100644
index 0000000..ef917b5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMBeanAware.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.mxbean;
+
+/**
+ * MBean-aware interface.
+ */
+public interface IgniteMBeanAware {
+    /**
+     * @return MBean for this object.
+     */
+    Object getMBean();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
index f9f457d..f51a41d 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
@@ -64,9 +64,12 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
      * Sets .NET type name.
      *
      * @param typName .NET type name.
+     * @return {@code this} for chaining.
      */
-    public void setTypeName(String typName) {
+    public PlatformDotNetAffinityFunction setTypeName(String typName) {
         this.typName = typName;
+
+        return this;
     }
 
     /**
@@ -82,9 +85,12 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
      * Set properties.
      *
      * @param props Properties.
+     * @return {@code this} for chaining.
      */
-    public void setProperties(Map<String, ?> props) {
+    public PlatformDotNetAffinityFunction setProperties(Map<String, ?> props) {
         this.props = props;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryConfiguration.java
index 7c5da2f..876a58c 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryConfiguration.java
@@ -81,9 +81,13 @@ public class PlatformDotNetBinaryConfiguration {
 
     /**
      * @param typesCfg New type cfgs.
+     * @return {@code this} for chaining.
      */
-    public void setTypesConfiguration(Collection<PlatformDotNetBinaryTypeConfiguration> typesCfg) {
+    public PlatformDotNetBinaryConfiguration setTypesConfiguration(
+        Collection<PlatformDotNetBinaryTypeConfiguration> typesCfg) {
         this.typesCfg = typesCfg;
+
+        return this;
     }
 
     /**
@@ -95,9 +99,12 @@ public class PlatformDotNetBinaryConfiguration {
 
     /**
      * @param types New types.
+     * @return {@code this} for chaining.
      */
-    public void setTypes(Collection<String> types) {
+    public PlatformDotNetBinaryConfiguration setTypes(Collection<String> types) {
         this.types = types;
+
+        return this;
     }
 
     /**
@@ -109,9 +116,12 @@ public class PlatformDotNetBinaryConfiguration {
 
     /**
      * @param dfltNameMapper New default name mapper.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultNameMapper(String dfltNameMapper) {
+    public PlatformDotNetBinaryConfiguration setDefaultNameMapper(String dfltNameMapper) {
         this.dfltNameMapper = dfltNameMapper;
+
+        return this;
     }
 
     /**
@@ -123,9 +133,12 @@ public class PlatformDotNetBinaryConfiguration {
 
     /**
      * @param dfltIdMapper New default id mapper.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultIdMapper(String dfltIdMapper) {
+    public PlatformDotNetBinaryConfiguration setDefaultIdMapper(String dfltIdMapper) {
         this.dfltIdMapper = dfltIdMapper;
+
+        return this;
     }
 
     /**
@@ -137,9 +150,12 @@ public class PlatformDotNetBinaryConfiguration {
 
     /**
      * @param dfltSerializer New default serializer.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultSerializer(String dfltSerializer) {
+    public PlatformDotNetBinaryConfiguration setDefaultSerializer(String dfltSerializer) {
         this.dfltSerializer = dfltSerializer;
+
+        return this;
     }
 
     /**
@@ -158,9 +174,12 @@ public class PlatformDotNetBinaryConfiguration {
      * {@link PlatformDotNetBinaryTypeConfiguration#setKeepDeserialized(Boolean)}.
      *
      * @param keepDeserialized Keep deserialized flag.
+     * @return {@code this} for chaining.
      */
-    public void setDefaultKeepDeserialized(boolean keepDeserialized) {
+    public PlatformDotNetBinaryConfiguration setDefaultKeepDeserialized(boolean keepDeserialized) {
         this.dfltKeepDeserialized = keepDeserialized;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
index cae5760..1949f71 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
@@ -75,9 +75,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
 
     /**
      * @param typeName New type name.
+     * @return {@code this} for chaining.
      */
-    public void setTypeName(String typeName) {
+    public PlatformDotNetBinaryTypeConfiguration setTypeName(String typeName) {
         this.typeName = typeName;
+
+        return this;
     }
 
     /**
@@ -89,9 +92,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
 
     /**
      * @param nameMapper New name mapper.
+     * @return {@code this} for chaining.
      */
-    public void setNameMapper(String nameMapper) {
+    public PlatformDotNetBinaryTypeConfiguration setNameMapper(String nameMapper) {
         this.nameMapper = nameMapper;
+
+        return this;
     }
 
     /**
@@ -103,9 +109,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
 
     /**
      * @param idMapper New id mapper.
+     * @return {@code this} for chaining.
      */
-    public void setIdMapper(String idMapper) {
+    public PlatformDotNetBinaryTypeConfiguration setIdMapper(String idMapper) {
         this.idMapper = idMapper;
+
+        return this;
     }
 
     /**
@@ -117,9 +126,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
 
     /**
      * @param serializer New serializer.
+     * @return {@code this} for chaining.
      */
-    public void setSerializer(String serializer) {
+    public PlatformDotNetBinaryTypeConfiguration setSerializer(String serializer) {
         this.serializer = serializer;
+
+        return this;
     }
 
     /**
@@ -131,9 +143,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
 
     /**
      * @param affinityKeyFieldName Affinity key field name.
+     * @return {@code this} for chaining.
      */
-    public void setAffinityKeyFieldName(String affinityKeyFieldName) {
+    public PlatformDotNetBinaryTypeConfiguration setAffinityKeyFieldName(String affinityKeyFieldName) {
         this.affinityKeyFieldName = affinityKeyFieldName;
+
+        return this;
     }
 
     /**
@@ -163,9 +178,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
      * {@link PlatformDotNetBinaryConfiguration#isDefaultKeepDeserialized()} will be used.
      *
      * @param keepDeserialized Keep deserialized flag.
+     * @return {@code this} for chaining.
      */
-    public void setKeepDeserialized(@Nullable Boolean keepDeserialized) {
+    public PlatformDotNetBinaryTypeConfiguration setKeepDeserialized(@Nullable Boolean keepDeserialized) {
         this.keepDeserialized = keepDeserialized;
+
+        return this;
     }
 
     /**
@@ -181,9 +199,12 @@ public class PlatformDotNetBinaryTypeConfiguration {
      * Sets whether this is enum type.
      *
      * @param isEnum {@code True} if enum.
+     * @return {@code this} for chaining.
      */
-    public void setEnum(boolean isEnum) {
+    public PlatformDotNetBinaryTypeConfiguration setEnum(boolean isEnum) {
         this.isEnum = isEnum;
+
+        return this;
     }
 
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
index d31ab95..1c058c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetConfiguration.java
@@ -62,9 +62,12 @@ public class PlatformDotNetConfiguration implements PlatformConfiguration {
 
     /**
      * @param binaryCfg Configuration.
+     * @return {@code this} for chaining.
      */
-    public void setBinaryConfiguration(PlatformDotNetBinaryConfiguration binaryCfg) {
+    public PlatformDotNetConfiguration setBinaryConfiguration(PlatformDotNetBinaryConfiguration binaryCfg) {
         this.binaryCfg = binaryCfg;
+
+        return this;
     }
 
     /**
@@ -77,9 +80,12 @@ public class PlatformDotNetConfiguration implements PlatformConfiguration {
     /**
      *
      * @param assemblies Assemblies.
+     * @return {@code this} for chaining.
      */
-    public void setAssemblies(List<String> assemblies) {
+    public PlatformDotNetConfiguration setAssemblies(List<String> assemblies) {
         this.assemblies = assemblies;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
index 6698dd4..0589b79 100644
--- a/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/services/ServiceConfiguration.java
@@ -94,9 +94,12 @@ public class ServiceConfiguration implements Serializable {
      * This parameter is mandatory when deploying a service.
      *
      * @param name Service name.
+     * @return {@code this} for chaining.
      */
-    public void setName(String name) {
+    public ServiceConfiguration setName(String name) {
         this.name = name;
+
+        return this;
     }
 
     /**
@@ -116,9 +119,12 @@ public class ServiceConfiguration implements Serializable {
      * This parameter is mandatory when deploying a service.
      *
      * @param svc Service instance.
+     * @return {@code this} for chaining.
      */
-    public void setService(Service svc) {
+    public ServiceConfiguration setService(Service svc) {
         this.svc = svc;
+
+        return this;
     }
 
     /**
@@ -138,9 +144,12 @@ public class ServiceConfiguration implements Serializable {
      * At least one of {@code getTotalCount()} or {@link #getMaxPerNodeCount()} values must be positive.
      *
      * @param totalCnt Total number of deployed service instances in the cluster, {@code 0} for unlimited.
+     * @return {@code this} for chaining.
      */
-    public void setTotalCount(int totalCnt) {
+    public ServiceConfiguration setTotalCount(int totalCnt) {
         this.totalCnt = totalCnt;
+
+        return this;
     }
 
     /**
@@ -160,9 +169,12 @@ public class ServiceConfiguration implements Serializable {
      * At least one of {@code getMaxPerNodeCount()} or {@link #getTotalCount()} values must be positive.
      *
      * @param maxPerNodeCnt Maximum number of deployed service instances on each node, {@code 0} for unlimited.
+     * @return {@code this} for chaining.
      */
-    public void setMaxPerNodeCount(int maxPerNodeCnt) {
+    public ServiceConfiguration setMaxPerNodeCount(int maxPerNodeCnt) {
         this.maxPerNodeCnt = maxPerNodeCnt;
+
+        return this;
     }
 
     /**
@@ -182,9 +194,12 @@ public class ServiceConfiguration implements Serializable {
      * This parameter is optional and is set only when deploying service based on key-affinity.
      *
      * @param cacheName Cache name, possibly {@code null}.
+     * @return {@code this} for chaining.
      */
-    public void setCacheName(String cacheName) {
+    public ServiceConfiguration setCacheName(String cacheName) {
         this.cacheName = cacheName;
+
+        return this;
     }
 
     /**
@@ -204,9 +219,12 @@ public class ServiceConfiguration implements Serializable {
      * This parameter is optional and is set only when deploying service based on key-affinity.
      *
      * @param affKey Affinity key, possibly {@code null}.
+     * @return {@code this} for chaining.
      */
-    public void setAffinityKey(Object affKey) {
+    public ServiceConfiguration setAffinityKey(Object affKey) {
         this.affKey = affKey;
+
+        return this;
     }
 
     /**
@@ -228,9 +246,12 @@ public class ServiceConfiguration implements Serializable {
      * nodes in the grid, based on configuration.
      *
      * @param nodeFilter Node filter used to filter nodes on which the service will be deployed, possibly {@code null}.
+     * @return {@code this} for chaining.
      */
-    public void setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
+    public ServiceConfiguration setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
         this.nodeFilter = nodeFilter;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/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 ab14a57..d1219f7 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
@@ -18,10 +18,8 @@
 package org.apache.ignite.spi;
 
 import java.io.Serializable;
-import java.text.DateFormat;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -43,7 +41,6 @@ import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.timeout.GridSpiTimeoutObject;
 import org.apache.ignite.internal.util.IgniteExceptionRegistry;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -65,7 +62,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
 /**
  * This class provides convenient adapter for SPI implementations.
  */
-public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagementMBean {
+public abstract class IgniteSpiAdapter implements IgniteSpi {
     /** */
     private ObjectName spiMBean;
 
@@ -142,31 +139,6 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
         return startedFlag.get();
     }
 
-    /** {@inheritDoc} */
-    @Override public final String getStartTimestampFormatted() {
-        return DateFormat.getDateTimeInstance().format(new Date(startTstamp));
-    }
-
-    /** {@inheritDoc} */
-    @Override public final String getUpTimeFormatted() {
-        return X.timeSpan2HMSM(getUpTime());
-    }
-
-    /** {@inheritDoc} */
-    @Override public final long getStartTimestamp() {
-        return startTstamp;
-    }
-
-    /** {@inheritDoc} */
-    @Override public final long getUpTime() {
-        return startTstamp == 0 ? 0 : U.currentTimeMillis() - startTstamp;
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID getLocalNodeId() {
-        return ignite.cluster().localNode().id();
-    }
-
     /**
      * @return Local node.
      */
@@ -180,11 +152,6 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
     }
 
     /** {@inheritDoc} */
-    @Override public final String getIgniteHome() {
-        return ignite.configuration().getIgniteHome();
-    }
-
-    /** {@inheritDoc} */
     @Override public String getName() {
         return name;
     }
@@ -193,10 +160,13 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
      * Sets SPI name.
      *
      * @param name SPI name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setName(String name) {
+    public IgniteSpiAdapter setName(String name) {
         this.name = name;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -351,7 +321,15 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
      * @return Uniformly formatted message for SPI start.
      */
     protected final String startInfo() {
-        return "SPI started ok [startMs=" + getUpTime() + ", spiMBean=" + spiMBean + ']';
+        return "SPI started ok [startMs=" + startTstamp + ", spiMBean=" + spiMBean + ']';
+    }
+
+    /**
+     * Gets SPI startup time.
+     * @return Time in millis.
+     */
+    final long getStartTstamp() {
+        return startTstamp;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiMBeanAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiMBeanAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiMBeanAdapter.java
new file mode 100644
index 0000000..8035333
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiMBeanAdapter.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * This class provides convenient adapter for MBean implementations.
+ */
+public class IgniteSpiMBeanAdapter implements IgniteSpiManagementMBean {
+    /** */
+    protected IgniteSpiAdapter spiAdapter;
+
+    /**
+     * Constructor
+     *
+     * @param spiAdapter Spi implementation.
+     */
+    public IgniteSpiMBeanAdapter(IgniteSpiAdapter spiAdapter) {
+        this.spiAdapter = spiAdapter;
+    }
+
+    /** {@inheritDoc} */
+    @Override public final String getStartTimestampFormatted() {
+        return DateFormat.getDateTimeInstance().format(new Date(spiAdapter.getStartTstamp()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public final String getUpTimeFormatted() {
+        return X.timeSpan2HMSM(getUpTime());
+    }
+
+    /** {@inheritDoc} */
+    @Override public final long getStartTimestamp() {
+        return spiAdapter.getStartTstamp();
+    }
+
+    /** {@inheritDoc} */
+    @Override public final long getUpTime() {
+        final long startTstamp = spiAdapter.getStartTstamp();
+
+        return startTstamp == 0 ? 0 : U.currentTimeMillis() - startTstamp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID getLocalNodeId() {
+        return spiAdapter.ignite.cluster().localNode().id();
+    }
+
+    /** {@inheritDoc} */
+    @Override public final String getIgniteHome() {
+        return spiAdapter.ignite.configuration().getIgniteHome();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getName() {
+        return spiAdapter.getName();
+    }
+}


[15/18] ignite git commit: IGNITE-3575 CPP: Added support for continuous queries remote filters.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
index dfef8e4..858ee77 100644
--- a/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
@@ -17,8 +17,11 @@
 
 #include <ignite/common/utils.h>
 
-#include "ignite/impl/cache/cache_impl.h"
-#include "ignite/impl/binary/binary_type_updater_impl.h"
+#include <ignite/impl/cache/cache_impl.h>
+#include <ignite/impl/binary/binary_type_updater_impl.h>
+#include <ignite/impl/cache/query/continuous/continuous_query_handle_impl.h>
+
+#include <ignite/cache/query/continuous/continuous_query_handle.h>
 
 using namespace ignite::common::concurrent;
 using namespace ignite::jni::java;
@@ -381,14 +384,93 @@ namespace ignite
                 IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
             }
 
-            struct DummyQry { void Write(BinaryRawWriter&) const { }};
+            struct Dummy
+            {
+                void Write(BinaryRawWriter&) const
+                {
+                    // No-op.
+                }
+            };
 
             ContinuousQueryHandleImpl* CacheImpl::QueryContinuous(const SharedPointer<ContinuousQueryImplBase> qry,
                 IgniteError& err)
             {
-                DummyQry dummy;
+                Dummy dummy;
                 return QueryContinuous(qry, dummy, -1, OP_QRY_CONTINUOUS, err);
             }
+
+            template <typename T>
+            QueryCursorImpl* CacheImpl::QueryInternal(const T& qry, int32_t typ, IgniteError& err)
+            {
+                JniErrorInfo jniErr;
+
+                SharedPointer<InteropMemory> mem = GetEnvironment().AllocateMemory();
+                InteropMemory* mem0 = mem.Get();
+                InteropOutputStream out(mem0);
+                BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
+                BinaryRawWriter rawWriter(&writer);
+
+                qry.Write(rawWriter);
+
+                out.Synchronize();
+
+                jobject qryJavaRef = GetEnvironment().Context()->CacheOutOpQueryCursor(GetTarget(),
+                    typ, mem.Get()->PointerLong(), &jniErr);
+
+                IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+                    return new QueryCursorImpl(GetEnvironmentPointer(), qryJavaRef);
+
+                return 0;
+            }
+
+            template <typename T>
+            ContinuousQueryHandleImpl* CacheImpl::QueryContinuous(const SharedPointer<ContinuousQueryImplBase> qry,
+                const T& initialQry, int32_t typ, int32_t cmd, IgniteError& err)
+            {
+                JniErrorInfo jniErr;
+
+                SharedPointer<InteropMemory> mem = GetEnvironment().AllocateMemory();
+                InteropMemory* mem0 = mem.Get();
+                InteropOutputStream out(mem0);
+                BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
+                BinaryRawWriter rawWriter(&writer);
+
+                const ContinuousQueryImplBase& qry0 = *qry.Get();
+
+                int64_t handle = GetEnvironment().GetHandleRegistry().Allocate(qry);
+
+                rawWriter.WriteInt64(handle);
+                rawWriter.WriteBool(qry0.GetLocal());
+
+                event::CacheEntryEventFilterHolderBase& filterOp = qry0.GetFilterHolder();
+
+                filterOp.Write(writer);
+
+                rawWriter.WriteInt32(qry0.GetBufferSize());
+                rawWriter.WriteInt64(qry0.GetTimeInterval());
+
+                // Autounsubscribe is a filter feature.
+                rawWriter.WriteBool(false);
+
+                // Writing initial query. When there is not initial query writing -1.
+                rawWriter.WriteInt32(typ);
+                if (typ != -1)
+                    initialQry.Write(rawWriter);
+
+                out.Synchronize();
+
+                jobject qryJavaRef = GetEnvironment().Context()->CacheOutOpContinuousQuery(GetTarget(),
+                    cmd, mem.Get()->PointerLong(), &jniErr);
+
+                IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+                    return new ContinuousQueryHandleImpl(GetEnvironmentPointer(), handle, qryJavaRef);
+
+                return 0;
+            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp
index b2fa1fd..b15183b 100644
--- a/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/query/continuous/continuous_query_handle_impl.cpp
@@ -84,11 +84,6 @@ namespace ignite
 
                         return new QueryCursorImpl(env, res);
                     }
-
-                    void ContinuousQueryHandleImpl::SetQuery(SP_ContinuousQueryImplBase query)
-                    {
-                        qry = query;
-                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/src/impl/ignite_binding_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_binding_impl.cpp b/modules/platforms/cpp/core/src/impl/ignite_binding_impl.cpp
new file mode 100644
index 0000000..2e09de2
--- /dev/null
+++ b/modules/platforms/cpp/core/src/impl/ignite_binding_impl.cpp
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ignite/impl/ignite_environment.h>
+#include <ignite/impl/ignite_binding_impl.h>
+
+using namespace ignite::common::concurrent;
+
+namespace ignite
+{
+    namespace impl
+    {
+        IgniteBindingImpl::IgniteBindingImpl(IgniteEnvironment &env) :
+            env(env),
+            callbacks()
+        {
+            // No-op.
+        }
+
+        int64_t IgniteBindingImpl::InvokeCallback(bool& found, int32_t type, int32_t id,
+            binary::BinaryReaderImpl& reader, binary::BinaryWriterImpl& writer)
+        {
+            int64_t key = makeKey(type, id);
+
+            CsLockGuard guard(lock);
+
+            std::map<int64_t, Callback*>::iterator it = callbacks.find(key);
+
+            found = it != callbacks.end();
+
+            if (found)
+            {
+                Callback* callback = it->second;
+
+                // We have found callback and does not need lock here anymore.
+                guard.Reset();
+
+                return callback(reader, writer, env);
+            }
+
+            return 0;
+        }
+
+        void IgniteBindingImpl::RegisterCallback(int32_t type, int32_t id, Callback* proc, IgniteError& err)
+        {
+            int64_t key = makeKey(type, id);
+
+            CsLockGuard guard(lock);
+
+            bool inserted = callbacks.insert(std::make_pair(key, proc)).second;
+
+            guard.Reset();
+
+            if (!inserted)
+            {
+                std::stringstream builder;
+
+                builder << "Trying to register multiple PRC callbacks with the same ID. [type="
+                        << type << ", id=" << id << ']';
+
+                err = IgniteError(IgniteError::IGNITE_ERR_ENTRY_PROCESSOR, builder.str().c_str());
+            }
+        }
+
+        void IgniteBindingImpl::RegisterCallback(int32_t type, int32_t id, Callback* callback)
+        {
+            IgniteError err;
+
+            RegisterCallback(type, id, callback, err);
+
+            IgniteError::ThrowIfNeeded(err);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
index b37fa8f..4e2a1f2 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
@@ -15,14 +15,18 @@
  * limitations under the License.
  */
 
-#include "ignite/impl/interop/interop_external_memory.h"
-#include "ignite/impl/binary/binary_reader_impl.h"
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/cache/query/continuous/continuous_query.h"
-#include "ignite/binary/binary.h"
-#include "ignite/impl/binary/binary_type_updater_impl.h"
-#include "ignite/impl/module_manager.h"
-#include "ignite/ignite_binding.h"
+#include <ignite/impl/interop/interop_external_memory.h>
+#include <ignite/impl/binary/binary_reader_impl.h>
+#include <ignite/impl/binary/binary_type_updater_impl.h>
+#include <ignite/impl/module_manager.h>
+#include <ignite/impl/ignite_binding_impl.h>
+
+#include <ignite/binary/binary.h>
+#include <ignite/cache/query/continuous/continuous_query.h>
+#include <ignite/ignite_binding.h>
+#include <ignite/ignite_binding_context.h>
+
+#include <ignite/impl/ignite_environment.h>
 
 using namespace ignite::common::concurrent;
 using namespace ignite::jni::java;
@@ -42,6 +46,8 @@ namespace ignite
         {
             CACHE_INVOKE = 8,
             CONTINUOUS_QUERY_LISTENER_APPLY = 18,
+            CONTINUOUS_QUERY_FILTER_CREATE = 19,
+            CONTINUOUS_QUERY_FILTER_APPLY = 20,
             CONTINUOUS_QUERY_FILTER_RELEASE = 21,
             REALLOC = 36,
             ON_START = 49,
@@ -57,6 +63,7 @@ namespace ignite
          */
         long long IGNITE_CALL InLongOutLong(void* target, int type, long long val)
         {
+            int64_t res = 0;
             SharedPointer<IgniteEnvironment>* env = static_cast<SharedPointer<IgniteEnvironment>*>(target);
 
             switch (type)
@@ -77,6 +84,24 @@ namespace ignite
                     break;
                 }
 
+                case CONTINUOUS_QUERY_FILTER_CREATE:
+                {
+                    SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val);
+
+                    res = env->Get()->OnContinuousQueryFilterCreate(mem);
+
+                    break;
+                }
+
+                case CONTINUOUS_QUERY_FILTER_APPLY:
+                {
+                    SharedPointer<InteropMemory> mem = env->Get()->GetMemory(val);
+
+                    res = env->Get()->OnContinuousQueryFilterApply(mem);
+
+                    break;
+                }
+
                 case CONTINUOUS_QUERY_FILTER_RELEASE:
                 {
                     // No-op.
@@ -98,7 +123,7 @@ namespace ignite
                 }
             }
 
-            return 0;
+            return res;
         }
 
         /**
@@ -152,10 +177,14 @@ namespace ignite
             registry(DEFAULT_FAST_PATH_CONTAINERS_CAP, DEFAULT_SLOW_PATH_CONTAINERS_CAP),
             metaMgr(new BinaryTypeManager()),
             metaUpdater(0),
-            binding(new IgniteBindingImpl()),
-            moduleMgr(new ModuleManager(GetBindingContext()))
+            binding(),
+            moduleMgr()
         {
-            // No-op.
+            binding = SharedPointer<IgniteBindingImpl>(new IgniteBindingImpl(*this));
+
+            IgniteBindingContext bindingContext(cfg, GetBinding());
+
+            moduleMgr = SharedPointer<ModuleManager>(new ModuleManager(bindingContext));
         }
 
         IgniteEnvironment::~IgniteEnvironment()
@@ -263,14 +292,9 @@ namespace ignite
             return metaUpdater;
         }
 
-        IgniteBinding IgniteEnvironment::GetBinding() const
-        {
-            return IgniteBinding(binding);
-        }
-
-        IgniteBindingContext IgniteEnvironment::GetBindingContext() const
+        SharedPointer<IgniteBindingImpl> IgniteEnvironment::GetBinding() const
         {
-            return IgniteBindingContext(*cfg, GetBinding());
+            return binding;
         }
 
         void IgniteEnvironment::ProcessorReleaseStart()
@@ -321,6 +345,62 @@ namespace ignite
             }
         }
 
+        int64_t IgniteEnvironment::OnContinuousQueryFilterCreate(SharedPointer<InteropMemory>& mem)
+        {
+            if (!binding.Get())
+                throw IgniteError(IgniteError::IGNITE_ERR_UNKNOWN, "IgniteBinding is not initialized.");
+
+            InteropInputStream inStream(mem.Get());
+            BinaryReaderImpl reader(&inStream);
+
+            InteropOutputStream outStream(mem.Get());
+            BinaryWriterImpl writer(&outStream, GetTypeManager());
+
+            BinaryObjectImpl binFilter = BinaryObjectImpl::FromMemory(*mem.Get(), inStream.Position());
+
+            int32_t filterId = binFilter.GetTypeId();
+
+            bool invoked = false;
+
+            int64_t res = binding.Get()->InvokeCallback(invoked,
+                IgniteBindingImpl::CACHE_ENTRY_FILTER_CREATE, filterId, reader, writer);
+
+            if (!invoked)
+            {
+                IGNITE_ERROR_FORMATTED_1(IgniteError::IGNITE_ERR_COMPUTE_USER_UNDECLARED_EXCEPTION,
+                    "C++ remote filter is not registered on the node (did you compile your program without -rdynamic?).",
+                    "filterId", filterId);
+            }
+
+            outStream.Synchronize();
+
+            return res;
+        }
+
+        int64_t IgniteEnvironment::OnContinuousQueryFilterApply(SharedPointer<InteropMemory>& mem)
+        {
+            InteropInputStream inStream(mem.Get());
+            BinaryReaderImpl reader(&inStream);
+            BinaryRawReader rawReader(&reader);
+
+            int64_t handle = rawReader.ReadInt64();
+
+            SharedPointer<ContinuousQueryImplBase> qry =
+                StaticPointerCast<ContinuousQueryImplBase>(registry.Get(handle));
+
+            if (!qry.Get())
+                IGNITE_ERROR_FORMATTED_1(IgniteError::IGNITE_ERR_GENERIC, "Null query for handle.", "handle", handle);
+
+            cache::event::CacheEntryEventFilterBase* filter = qry.Get()->GetFilterHolder().GetFilter();
+
+            if (!filter)
+                IGNITE_ERROR_FORMATTED_1(IgniteError::IGNITE_ERR_GENERIC, "Null filter for handle.", "handle", handle);
+
+            bool res = filter->ReadAndProcessEvent(rawReader);
+
+            return res ? 1 : 0;
+        }
+
         void IgniteEnvironment::CacheInvokeCallback(SharedPointer<InteropMemory>& mem)
         {
             if (!binding.Get())
@@ -340,9 +420,11 @@ namespace ignite
             BinaryObjectImpl binProcHolder = BinaryObjectImpl::FromMemory(*mem.Get(), inStream.Position(), 0);
             BinaryObjectImpl binProc = binProcHolder.GetField(0);
 
-            int64_t procId = binProc.GetTypeId();
+            int32_t procId = binProc.GetTypeId();
+
+            bool invoked = false;
 
-            bool invoked = binding.Get()->InvokeCallbackById(procId, reader, writer);
+            binding.Get()->InvokeCallback(invoked, IgniteBindingImpl::CACHE_ENTRY_PROCESSOR_APPLY, procId, reader, writer);
 
             if (!invoked)
             {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
index fd9bf45..546cd01 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
@@ -59,7 +59,7 @@ namespace ignite
             return env.Get()->Context();
         }
 
-        IgniteBinding IgniteImpl::GetBinding()
+        SharedPointer<IgniteBindingImpl> IgniteImpl::GetBinding()
         {
             return env.Get()->GetBinding();
         }


[16/18] ignite git commit: IGNITE-3575 CPP: Added support for continuous queries remote filters.

Posted by ag...@apache.org.
IGNITE-3575 CPP: Added support for continuous queries remote filters.


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

Branch: refs/heads/ignite-3477-master
Commit: d4da92b7ab2625c1e09d8ae06bf1eb9393162c8e
Parents: 79bac4f
Author: Igor Sapego <is...@gridgain.com>
Authored: Fri Mar 31 16:40:25 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Fri Mar 31 16:40:25 2017 +0300

----------------------------------------------------------------------
 .../ignite/impl/binary/binary_type_impl.h       |   2 +-
 .../common/include/ignite/common/concurrent.h   |  30 +++
 .../cpp/common/include/ignite/reference.h       |  14 +-
 .../cpp/core-test/config/cache-test.xml         |   2 +-
 .../project/vs/core-test.vcxproj.filters        |   3 +
 .../cpp/core-test/src/cache_invoke_test.cpp     |   6 +-
 .../platforms/cpp/core-test/src/cache_test.cpp  |  23 ++-
 .../cpp/core-test/src/continuous_query_test.cpp | 202 ++++++++++++++++++-
 .../cpp/core-test/src/reference_test.cpp        |  12 +-
 modules/platforms/cpp/core/Makefile.am          |   1 +
 modules/platforms/cpp/core/include/Makefile.am  |  70 ++++---
 .../cpp/core/include/ignite/cache/cache.h       |  22 +-
 .../ignite/cache/cache_entry_processor.h        |  42 +---
 .../cache/event/cache_entry_event_filter.h      | 109 ++++++++++
 .../cache/query/continuous/continuous_query.h   |  35 +++-
 .../cpp/core/include/ignite/ignite_binding.h    |  39 +++-
 .../include/ignite/ignite_binding_context.h     |   2 +-
 .../cpp/core/include/ignite/impl/bindings.h     |  95 +++++++++
 .../impl/cache/cache_entry_processor_holder.h   |  15 --
 .../core/include/ignite/impl/cache/cache_impl.h |  81 +-------
 .../cache/event/cache_entry_event_filter_base.h |  66 ++++++
 .../event/cache_entry_event_filter_holder.h     | 185 +++++++++++++++++
 .../continuous/continuous_query_handle_impl.h   |  10 -
 .../query/continuous/continuous_query_impl.h    |  60 +++++-
 .../include/ignite/impl/ignite_binding_impl.h   | 101 +++++-----
 .../include/ignite/impl/ignite_environment.h    |  37 ++--
 .../cpp/core/include/ignite/impl/ignite_impl.h  |  10 +-
 .../cpp/core/include/ignite/impl/operations.h   |   2 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   5 +
 .../cpp/core/project/vs/core.vcxproj.filters    |  18 ++
 .../cpp/core/src/impl/cache/cache_impl.cpp      |  90 ++++++++-
 .../continuous/continuous_query_handle_impl.cpp |   5 -
 .../cpp/core/src/impl/ignite_binding_impl.cpp   |  88 ++++++++
 .../cpp/core/src/impl/ignite_environment.cpp    | 124 ++++++++++--
 .../platforms/cpp/core/src/impl/ignite_impl.cpp |   2 +-
 35 files changed, 1284 insertions(+), 324 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
index d0cbb86..08c60c0 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
@@ -103,7 +103,7 @@ namespace ignite
                     ignite::binary::BinaryType<T> bt;
                     ignite::Reference<ignite::binary::BinaryIdentityResolver> resolver = bt.GetIdentityResolver();
 
-                    return resolver.Get().GetHashCode(obj);
+                    return resolver.Get()->GetHashCode(obj);
                 }
             };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/common/include/ignite/common/concurrent.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/concurrent.h b/modules/platforms/cpp/common/include/ignite/common/concurrent.h
index 84a1f0e..69b8eda 100644
--- a/modules/platforms/cpp/common/include/ignite/common/concurrent.h
+++ b/modules/platforms/cpp/common/include/ignite/common/concurrent.h
@@ -30,6 +30,11 @@ namespace ignite
         namespace concurrent
         {
             /**
+             * Type tag for static pointer cast.
+             */
+            struct StaticTag {};
+
+            /**
              * Default deleter implementation.
              *
              * @param obj Object to be deleted.
@@ -198,6 +203,20 @@ namespace ignite
                 }
 
                 /**
+                 * Static-cast constructor.
+                 *
+                 * @param other Instance to copy.
+                 */
+                template<typename T2>
+                SharedPointer(const SharedPointer<T2>& other, StaticTag) :
+                    ptr(static_cast<T*>(other.ptr)),
+                    impl(other.impl)
+                {
+                    if (impl)
+                        impl->Increment();
+                }
+
+                /**
                  * Assignment operator.
                  *
                  * @param other Other instance.
@@ -313,6 +332,17 @@ namespace ignite
             };
 
             /**
+             * Enables static-cast semantics for SharedPointer.
+             *
+             * @param val Value to cast.
+             */
+            template<class T1, class T2>
+            SharedPointer<T1> StaticPointerCast(const SharedPointer<T2>& val)
+            {
+                return SharedPointer<T1>(val, StaticTag());
+            }
+
+            /**
              * The class provides functionality that allows objects of derived
              * classes to create instances of shared_ptr pointing to themselves
              * and sharing ownership with existing shared_ptr objects.

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/common/include/ignite/reference.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/reference.h b/modules/platforms/cpp/common/include/ignite/reference.h
index b026ad7..08cccec 100644
--- a/modules/platforms/cpp/common/include/ignite/reference.h
+++ b/modules/platforms/cpp/common/include/ignite/reference.h
@@ -160,9 +160,9 @@ namespace ignite
          *
          * @return Constant reference to underlying value.
          */
-        const T& Get() const
+        const T* Get() const
         {
-            return *reinterpret_cast<const T*>(reinterpret_cast<ptrdiff_t>(ptr.Get()->Get()) + offset);
+            return reinterpret_cast<const T*>(reinterpret_cast<ptrdiff_t>(ptr.Get()->Get()) + offset);
         }
 
         /**
@@ -326,11 +326,11 @@ namespace ignite
          * If the pointer is null then this operation causes undefined
          * behaviour.
          *
-         * @return Constant reference to underlying value.
+         * @return Constant pointer to underlying value.
          */
-        const T& Get() const
+        const T* Get() const
         {
-            return *reinterpret_cast<const T*>(reinterpret_cast<ptrdiff_t>(ptr.Get()->Get()) + offset);
+            return reinterpret_cast<const T*>(reinterpret_cast<ptrdiff_t>(ptr.Get()->Get()) + offset);
         }
 
         /**
@@ -341,9 +341,9 @@ namespace ignite
          *
          * @return Reference to underlying value.
          */
-        T& Get()
+        T* Get()
         {
-            return *reinterpret_cast<T*>(reinterpret_cast<ptrdiff_t>(ptr.Get()->Get()) + offset);
+            return reinterpret_cast<T*>(reinterpret_cast<ptrdiff_t>(ptr.Get()->Get()) + offset);
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core-test/config/cache-test.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-test.xml b/modules/platforms/cpp/core-test/config/cache-test.xml
index 0ea5876..10300ba 100644
--- a/modules/platforms/cpp/core-test/config/cache-test.xml
+++ b/modules/platforms/cpp/core-test/config/cache-test.xml
@@ -55,7 +55,7 @@
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="atomicityMode" value="TRANSACTIONAL"/>
                 </bean>
-				
+
                 <bean parent="cache-template">
                     <property name="name" value="partitioned2"/>
                     <property name="cacheMode" value="PARTITIONED"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
index fb0be1b..5181f96 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
@@ -142,5 +142,8 @@
     <None Include="..\..\config\cache-store.xml">
       <Filter>Configs</Filter>
     </None>
+    <None Include="..\..\config\cache-query-continuous.xml">
+      <Filter>Configs</Filter>
+    </None>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp b/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
index db304e2..4f1f30a 100644
--- a/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_invoke_test.cpp
@@ -44,7 +44,7 @@ using namespace ignite::common;
 /**
  * CacheEntryModifier class for invoke tests.
  */
-class CacheEntryModifier : public CacheEntryProcessor<CacheEntryModifier, int, int, int, int>
+class CacheEntryModifier : public CacheEntryProcessor<int, int, int, int>
 {
 public:
     /**
@@ -151,7 +151,7 @@ namespace ignite
 /**
  * Divisor class for invoke tests.
  */
-class Divisor : public CacheEntryProcessor<Divisor, int, int, double, double>
+class Divisor : public CacheEntryProcessor<int, int, double, double>
 {
 public:
     /**
@@ -262,7 +262,7 @@ namespace ignite
 /**
  * Character remover class for invoke tests.
  */
-class CharRemover : public CacheEntryProcessor<CharRemover, std::string, std::string, int, bool>
+class CharRemover : public CacheEntryProcessor<std::string, std::string, int, bool>
 {
 public:
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_test.cpp b/modules/platforms/cpp/core-test/src/cache_test.cpp
index 437ed234..d57b757 100644
--- a/modules/platforms/cpp/core-test/src/cache_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_test.cpp
@@ -29,16 +29,6 @@
 using namespace ignite;
 using namespace boost::unit_test;
 
-/* Nodes started during the test. */
-Ignite grid0 = Ignite();
-Ignite grid1 = Ignite();
-
-/** Cache accessor. */
-cache::Cache<int, int> Cache()
-{
-    return grid0.GetCache<int, int>("partitioned");
-}
-
 struct Person
 {
     std::string name;
@@ -88,7 +78,18 @@ namespace ignite
 /*
  * Test setup fixture.
  */
-struct CacheTestSuiteFixture {
+struct CacheTestSuiteFixture
+{
+    /* Nodes started during the test. */
+    Ignite grid0;
+    Ignite grid1;
+
+    /** Cache accessor. */
+    cache::Cache<int, int> Cache()
+    {
+        return grid0.GetCache<int, int>("partitioned");
+    }
+
     /*
      * Constructor.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
index 1be21c1..f81eb5d 100644
--- a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
@@ -175,6 +175,61 @@ private:
     ConcurrentQueue< CacheEntryEvent<K, V> > eventQueue;
 };
 
+/**
+ * Only lets through keys from the range.
+ */
+template<typename K, typename V>
+struct RangeFilter : CacheEntryEventFilter<K, V>
+{
+    /**
+     * Default constructor.
+     */
+    RangeFilter() :
+        rangeBegin(0),
+        rangeEnd(0)
+    {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param from Range beginning. Inclusive.
+     * @param to Range end. Not inclusive.
+     */
+    RangeFilter(const K& from, const K& to) :
+        rangeBegin(from),
+        rangeEnd(to)
+    {
+        // No-op.
+    }
+
+    /**
+     * Destructor.
+     */
+    virtual ~RangeFilter()
+    {
+        // No-op.
+    }
+
+    /**
+     * Event callback.
+     *
+     * @param event Event.
+     * @return True if the event passes filter.
+     */
+    virtual bool Process(const CacheEntryEvent<K, V>& event)
+    {
+        return event.GetKey() >= rangeBegin && event.GetKey() < rangeEnd;
+    }
+
+    /** Beginning of the range. */
+    K rangeBegin;
+
+    /** End of the range. */
+    K rangeEnd;
+};
+
 /*
  * Test entry.
  */
@@ -204,10 +259,9 @@ namespace ignite
 {
     namespace binary
     {
-        /**
-        * Binary type definition.
-        */
-        IGNITE_BINARY_TYPE_START(TestEntry)
+        template<>
+        struct BinaryType<TestEntry>
+        {
             IGNITE_BINARY_GET_TYPE_ID_AS_HASH(TestEntry)
             IGNITE_BINARY_GET_TYPE_NAME_AS_IS(TestEntry)
             IGNITE_BINARY_GET_FIELD_ID_AS_HASH
@@ -227,8 +281,52 @@ namespace ignite
 
                 return res;
             }
+        };
 
-        IGNITE_BINARY_TYPE_END
+        template<typename K, typename V>
+        struct BinaryType< RangeFilter<K,V> >
+        {
+            int32_t GetTypeId()
+            {
+                return GetBinaryStringHashCode("RangeFilter");
+            }
+
+            std::string GetTypeName()
+            {
+                return "RangeFilter";
+
+            }
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+
+            int32_t GetHashCode(const RangeFilter<K,V>&)
+            {
+                return 0;
+            }
+
+            bool IsNull(const RangeFilter<K,V>&)
+            {
+                return false;
+            }
+
+            RangeFilter<K,V> GetNull()
+            {
+                return RangeFilter<K,V>();
+            }
+
+            void Write(BinaryWriter& writer, const RangeFilter<K,V>& obj)
+            {
+                writer.WriteObject("rangeBegin", obj.rangeBegin);
+                writer.WriteObject("rangeEnd", obj.rangeEnd);
+            }
+
+            RangeFilter<K,V> Read(BinaryReader& reader)
+            {
+                K begin = reader.ReadObject<K>("rangeBegin");
+                K end = reader.ReadObject<K>("rangeEnd");
+
+                return RangeFilter<K,V>(begin, end);
+            }
+        };
     }
 }
 
@@ -237,7 +335,7 @@ namespace ignite
  */
 struct ContinuousQueryTestSuiteFixture
 {
-    Ignite grid;
+    Ignite node;
 
     Cache<int, TestEntry> cache;
 
@@ -245,8 +343,8 @@ struct ContinuousQueryTestSuiteFixture
      * Constructor.
      */
     ContinuousQueryTestSuiteFixture() :
-        grid(ignite_test::StartNode("cache-query-continuous.xml", "node-01")),
-        cache(grid.GetCache<int, TestEntry>("transactional_no_backup"))
+        node(ignite_test::StartNode("cache-query-continuous.xml", "node-01")),
+        cache(node.GetCache<int, TestEntry>("transactional_no_backup"))
     {
         // No-op.
     }
@@ -258,7 +356,7 @@ struct ContinuousQueryTestSuiteFixture
     {
         Ignition::StopAll(false);
 
-        grid = Ignite();
+        node = Ignite();
     }
 };
 
@@ -581,4 +679,90 @@ BOOST_AUTO_TEST_CASE(TestPublicPrivateConstantsConsistence)
         static_cast<int>(QueryType::DEFAULT_BUFFER_SIZE));
 }
 
+BOOST_AUTO_TEST_CASE(TestFilterSingleNode)
+{
+    node.GetBinding().RegisterCacheEntryEventFilter< RangeFilter<int, TestEntry> >();
+
+    Listener<int, TestEntry> lsnr;
+    RangeFilter<int, TestEntry> filter(100, 150);
+
+    ContinuousQuery<int, TestEntry> qry(MakeReference(lsnr), MakeReference(filter));
+
+    ContinuousQueryHandle<int, TestEntry> handle = cache.QueryContinuous(qry);
+
+    cache.Put(1, TestEntry(10));
+    cache.Put(1, TestEntry(11));
+
+    cache.Put(2, TestEntry(20));
+    cache.Remove(2);
+
+    cache.Put(100, TestEntry(1000));
+    cache.Put(101, TestEntry(1010));
+
+    cache.Put(142, TestEntry(1420));
+    cache.Put(142, TestEntry(1421));
+    cache.Remove(142);
+
+    cache.Put(149, TestEntry(1490));
+    cache.Put(150, TestEntry(1500));
+    cache.Put(150, TestEntry(1502));
+    cache.Remove(150);
+
+    lsnr.CheckNextEvent(100, boost::none, TestEntry(1000));
+    lsnr.CheckNextEvent(101, boost::none, TestEntry(1010));
+
+    lsnr.CheckNextEvent(142, boost::none, TestEntry(1420));
+    lsnr.CheckNextEvent(142, TestEntry(1420), TestEntry(1421));
+    lsnr.CheckNextEvent(142, TestEntry(1421), boost::none);
+
+    lsnr.CheckNextEvent(149, boost::none, TestEntry(1490));
+}
+
+BOOST_AUTO_TEST_CASE(TestFilterMultipleNodes)
+{
+    Ignite node2 = ignite_test::StartNode("cache-query-continuous.xml", "node-02");
+    Ignite node3 = ignite_test::StartNode("cache-query-continuous.xml", "node-03");
+
+    node.GetBinding().RegisterCacheEntryEventFilter< RangeFilter<int, TestEntry> >();
+
+    Listener<int, TestEntry> lsnr;
+    RangeFilter<int, TestEntry> filter(100, 150);
+
+    ContinuousQuery<int, TestEntry> qry(MakeReference(lsnr), MakeReference(filter));
+
+    ContinuousQueryHandle<int, TestEntry> handle = cache.QueryContinuous(qry);
+
+    Cache<int, TestEntry> cache2 = node2.GetCache<int, TestEntry>("transactional_no_backup");
+
+    cache2.Put(1, TestEntry(10));
+    cache2.Put(1, TestEntry(11));
+
+    cache2.Put(2, TestEntry(20));
+    cache2.Remove(2);
+
+    cache2.Put(100, TestEntry(1000));
+    cache2.Put(101, TestEntry(1010));
+
+    cache2.Put(142, TestEntry(1420));
+    cache2.Put(142, TestEntry(1421));
+    cache2.Remove(142);
+
+    cache2.Put(149, TestEntry(1490));
+    cache2.Put(150, TestEntry(1500));
+    cache2.Put(150, TestEntry(1502));
+    cache2.Remove(150);
+
+    for (int i = 200; i < 250; ++i)
+        cache2.Put(i, TestEntry(i * 10));
+
+    lsnr.CheckNextEvent(100, boost::none, TestEntry(1000));
+    lsnr.CheckNextEvent(101, boost::none, TestEntry(1010));
+
+    lsnr.CheckNextEvent(142, boost::none, TestEntry(1420));
+    lsnr.CheckNextEvent(142, TestEntry(1420), TestEntry(1421));
+    lsnr.CheckNextEvent(142, TestEntry(1421), boost::none);
+
+    lsnr.CheckNextEvent(149, boost::none, TestEntry(1490));
+}
+
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core-test/src/reference_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/reference_test.cpp b/modules/platforms/cpp/core-test/src/reference_test.cpp
index a5ac559..ec445c7 100644
--- a/modules/platforms/cpp/core-test/src/reference_test.cpp
+++ b/modules/platforms/cpp/core-test/src/reference_test.cpp
@@ -118,32 +118,32 @@ struct C3 : C1, C2
 
 void TestFunction1(Reference<C1> c1, int expected)
 {
-    BOOST_CHECK_EQUAL(c1.Get().c1, expected);
+    BOOST_CHECK_EQUAL(c1.Get()->c1, expected);
 }
 
 void TestFunction2(Reference<C2> c2, int expected)
 {
-    BOOST_CHECK_EQUAL(c2.Get().c2, expected);
+    BOOST_CHECK_EQUAL(c2.Get()->c2, expected);
 }
 
 void TestFunction3(Reference<C3> c3, int expected)
 {
-    BOOST_CHECK_EQUAL(c3.Get().c3, expected);
+    BOOST_CHECK_EQUAL(c3.Get()->c3, expected);
 }
 
 void TestFunctionConst1(ConstReference<C1> c1, int expected)
 {
-    BOOST_CHECK_EQUAL(c1.Get().c1, expected);
+    BOOST_CHECK_EQUAL(c1.Get()->c1, expected);
 }
 
 void TestFunctionConst2(ConstReference<C2> c2, int expected)
 {
-    BOOST_CHECK_EQUAL(c2.Get().c2, expected);
+    BOOST_CHECK_EQUAL(c2.Get()->c2, expected);
 }
 
 void TestFunctionConst3(ConstReference<C3> c3, int expected)
 {
-    BOOST_CHECK_EQUAL(c3.Get().c3, expected);
+    BOOST_CHECK_EQUAL(c3.Get()->c3, expected);
 }
 
 BOOST_AUTO_TEST_SUITE(ReferenceTestSuite)

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/Makefile.am b/modules/platforms/cpp/core/Makefile.am
index 46d6bc9..4de45d3 100644
--- a/modules/platforms/cpp/core/Makefile.am
+++ b/modules/platforms/cpp/core/Makefile.am
@@ -69,6 +69,7 @@ libignite_la_SOURCES = \
     src/impl/transactions/transactions_impl.cpp \
     src/impl/cluster/cluster_group_impl.cpp \
     src/impl/ignite_impl.cpp \
+    src/impl/ignite_binding_impl.cpp \
     src/transactions/transaction.cpp \
     src/transactions/transactions.cpp
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/Makefile.am b/modules/platforms/cpp/core/include/Makefile.am
index 21d3062..0e9a7ec 100644
--- a/modules/platforms/cpp/core/include/Makefile.am
+++ b/modules/platforms/cpp/core/include/Makefile.am
@@ -18,45 +18,55 @@
 ACLOCAL_AMFLAGS =-I m4
 
 nobase_include_HEADERS = \
-    ignite/ignite_configuration.h \
-    ignite/ignite.h \
-    ignite/impl/binary/binary_type_updater_impl.h \
-    ignite/impl/operations.h \
-    ignite/impl/ignite_environment.h \
-    ignite/impl/ignite_impl.h \
-    ignite/impl/cache/query/query_fields_row_impl.h \
-    ignite/impl/cache/query/query_argument.h \
-    ignite/impl/cache/query/query_impl.h \
-    ignite/impl/cache/cache_impl.h \
-    ignite/impl/cache/cache_entry_processor_holder.h \
-    ignite/impl/cache/query/query_batch.h \
-    ignite/impl/interop/interop_target.h \
-    ignite/impl/interop/interop_external_memory.h \
-    ignite/impl/handle_registry.h \
-    ignite/impl/transactions/transaction_impl.h \
-    ignite/impl/transactions/transactions_impl.h \
-    ignite/impl/cluster/cluster_group_impl.h \
-    ignite/impl/ignite_binding_impl.h \
-    ignite/impl/module_manager.h \
-    ignite/cache/query/query_fields_row.h \
+    ignite/cache/cache.h \
+    ignite/cache/cache_entry.h \
+    ignite/cache/cache_entry_processor.h \
+    ignite/cache/cache_peek_mode.h \
+    ignite/cache/event/cache_entry_event.h \
+    ignite/cache/event/cache_entry_event_filter.h \
+    ignite/cache/event/cache_entry_event_listener.h \
+    ignite/cache/mutable_cache_entry.h \
+    ignite/cache/query/continuous/continuous_query.h \
+    ignite/cache/query/continuous/continuous_query_handle.h \
+    ignite/cache/query/query.h \
+    ignite/cache/query/query_cursor.h \
     ignite/cache/query/query_fields_cursor.h \
+    ignite/cache/query/query_fields_row.h \
     ignite/cache/query/query_scan.h \
-    ignite/cache/query/query_cursor.h \
     ignite/cache/query/query_sql.h \
-    ignite/cache/query/query.h \
     ignite/cache/query/query_sql_fields.h \
     ignite/cache/query/query_text.h \
-    ignite/cache/cache.h \
-    ignite/cache/cache_entry.h \
-    ignite/cache/cache_peek_mode.h \
-    ignite/cache/cache_entry_processor.h \
-    ignite/cache/mutable_cache_entry.h \
-    ignite/ignition.h \
+    ignite/ignite.h \
     ignite/ignite_binding.h \
     ignite/ignite_binding_context.h \
+    ignite/ignite_configuration.h \
+    ignite/ignition.h \
+    ignite/impl/binary/binary_type_updater_impl.h \
+    ignite/impl/bindings.h \
+    ignite/impl/cache/cache_entry_processor_holder.h \
+    ignite/impl/cache/cache_impl.h \
+    ignite/impl/cache/event/cache_entry_event_filter_base.h \
+    ignite/impl/cache/event/cache_entry_event_filter_holder.h \
+    ignite/impl/cache/query/continuous/continuous_query_handle_impl.h \
+    ignite/impl/cache/query/continuous/continuous_query_impl.h \
+    ignite/impl/cache/query/query_argument.h \
+    ignite/impl/cache/query/query_batch.h \
+    ignite/impl/cache/query/query_fields_row_impl.h \
+    ignite/impl/cache/query/query_impl.h \
+    ignite/impl/cluster/cluster_group_impl.h \
+    ignite/impl/handle_registry.h \
+    ignite/impl/ignite_binding_impl.h \
+    ignite/impl/ignite_environment.h \
+    ignite/impl/ignite_impl.h \
+    ignite/impl/interop/interop_external_memory.h \
+    ignite/impl/interop/interop_target.h \
+    ignite/impl/module_manager.h \
+    ignite/impl/operations.h \
+    ignite/impl/transactions/transactions_impl.h \
+    ignite/impl/transactions/transaction_impl.h \
     ignite/transactions/transaction.h \
-    ignite/transactions/transaction_consts.h \
     ignite/transactions/transactions.h \
+    ignite/transactions/transaction_consts.h \
     ignite/transactions/transaction_metrics.h
 
 uninstall-hook:

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/cache/cache.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache.h b/modules/platforms/cpp/core/include/ignite/cache/cache.h
index f9c442c..00d1c81 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/cache.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/cache.h
@@ -1485,8 +1485,11 @@ namespace ignite
                 const query::continuous::ContinuousQuery<K, V>& qry, IgniteError& err)
             {
                 using namespace impl::cache::query::continuous;
+                using namespace common::concurrent;
 
-                if (!qry.impl.IsValid() || !qry.impl.Get()->HasListener())
+                const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
+
+                if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
                 {
                     err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
                         "Event listener is not set for ContinuousQuery instance");
@@ -1494,11 +1497,7 @@ namespace ignite
                     return query::continuous::ContinuousQueryHandle<K, V>();
                 }
 
-                ContinuousQueryHandleImpl* cqImpl;
-                cqImpl = impl.Get()->QueryContinuous(qry.impl, err);
-
-                if (cqImpl)
-                    cqImpl->SetQuery(qry.impl);
+                ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, err);
 
                 return query::continuous::ContinuousQueryHandle<K, V>(cqImpl);
             }
@@ -1538,8 +1537,11 @@ namespace ignite
                 const Q& initialQry, IgniteError& err)
             {
                 using namespace impl::cache::query::continuous;
+                using namespace common::concurrent;
 
-                if (!qry.impl.IsValid() || !qry.impl.Get()->HasListener())
+                const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
+
+                if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
                 {
                     err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
                         "Event listener is not set for ContinuousQuery instance");
@@ -1547,11 +1549,7 @@ namespace ignite
                     return query::continuous::ContinuousQueryHandle<K, V>();
                 }
 
-                ContinuousQueryHandleImpl* cqImpl;
-                cqImpl = impl.Get()->QueryContinuous(qry.impl, initialQry, err);
-
-                if (cqImpl)
-                    cqImpl->SetQuery(qry.impl);
+                ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, initialQry, err);
 
                 return query::continuous::ContinuousQueryHandle<K, V>(cqImpl);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/cache/cache_entry_processor.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache_entry_processor.h b/modules/platforms/cpp/core/include/ignite/cache/cache_entry_processor.h
index 7fa1550..e0bb694 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/cache_entry_processor.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/cache_entry_processor.h
@@ -42,17 +42,21 @@ namespace ignite
          * All templated types should be default-constructable,
          * copy-constructable and assignable.
          *
-         * @tparam P The processor itself which inherits from CacheEntryProcessor.
          * @tparam K Key type.
          * @tparam V Value type.
          * @tparam R Process method return type.
          * @tparam A Process method argument type.
          */
-        template<typename P, typename K, typename V, typename R, typename A>
+        template<typename K, typename V, typename R, typename A>
         class CacheEntryProcessor
         {
             friend class ignite::IgniteBinding;
 
+            typedef A ArgumentType;
+            typedef K KeyType;
+            typedef V ValueType;
+            typedef R ReturnType;
+
         public:
             /**
              * Destructor.
@@ -70,40 +74,6 @@ namespace ignite
              * @return Processing result.
              */
             virtual R Process(MutableCacheEntry<K, V>& entry, const A& arg) = 0;
-
-        private:
-            /**
-             * Process input streaming data to produce output streaming data.
-             *
-             * Deserializes cache entry and processor using provided reader, invokes
-             * cache entry processor, gets result and serializes it using provided
-             * writer.
-             *
-             * @param reader Reader.
-             * @param writer Writer.
-             */
-            static void InternalProcess(impl::binary::BinaryReaderImpl& reader, impl::binary::BinaryWriterImpl& writer)
-            {
-                typedef impl::cache::CacheEntryProcessorHolder<P, A> ProcessorHolder;
-
-                ProcessorHolder procHolder = reader.ReadObject<ProcessorHolder>();
-
-                K key = reader.ReadObject<K>();
-
-                V value;
-                bool exists = reader.TryReadObject<V>(value);
-
-                impl::cache::MutableCacheEntryState entryState;
-
-                R res = procHolder.template Process<R, K, V>(key, value, exists, entryState);
-
-                writer.WriteInt8(static_cast<int8_t>(entryState));
-
-                if (entryState == impl::cache::ENTRY_STATE_VALUE_SET)
-                    writer.WriteTopObject(value);
-
-                writer.WriteTopObject(res);
-            }
         };
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/cache/event/cache_entry_event_filter.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/event/cache_entry_event_filter.h b/modules/platforms/cpp/core/include/ignite/cache/event/cache_entry_event_filter.h
new file mode 100644
index 0000000..3a4fc74
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/cache/event/cache_entry_event_filter.h
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Declares ignite::cache::event::CacheEntryEventFilter class.
+ */
+
+#ifndef _IGNITE_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER
+#define _IGNITE_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER
+
+#include <ignite/cache/event/cache_entry_event.h>
+#include <ignite/impl/cache/event/cache_entry_event_filter_base.h>
+
+namespace ignite
+{
+    class IgniteBinding;
+
+    namespace impl
+    {
+        namespace cache
+        {
+            namespace event
+            {
+                template<typename T>
+                class CacheEntryEventFilterHolder;
+            }
+        }
+    }
+
+    namespace cache
+    {
+        namespace event
+        {
+            /**
+             * Cache entry event filter.
+             *
+             * All templated types should be default-constructable,
+             * copy-constructable and assignable.
+             *
+             * @tparam K Key type.
+             * @tparam V Value type.
+             */
+            template<typename K, typename V>
+            class CacheEntryEventFilter : private impl::cache::event::CacheEntryEventFilterBase
+            {
+                template<typename T>
+                friend class impl::cache::event::CacheEntryEventFilterHolder;
+
+            public:
+                /**
+                 * Default constructor.
+                 */
+                CacheEntryEventFilter()
+                {
+                    // No-op.
+                }
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~CacheEntryEventFilter()
+                {
+                    // No-op.
+                }
+
+                /**
+                 * Event callback.
+                 *
+                 * @param event Event.
+                 * @return True if the event passes filter.
+                 */
+                virtual bool Process(const CacheEntryEvent<K, V>& event) = 0;
+
+            private:
+                /**
+                 * Process serialized events.
+                 *
+                 * @param reader Reader for a serialized event.
+                 * @return Filter evaluation result.
+                 */
+                virtual bool ReadAndProcessEvent(binary::BinaryRawReader& reader)
+                {
+                    CacheEntryEvent<K, V> event;
+
+                    event.Read(reader);
+
+                    return Process(event);
+                }
+            };
+        }
+    }
+}
+
+#endif //_IGNITE_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h b/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
index 82bb125..0c1146b 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
@@ -24,7 +24,9 @@
 #define _IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
 
 #include <ignite/impl/cache/query/continuous/continuous_query_impl.h>
+
 #include <ignite/cache/event/cache_entry_event_listener.h>
+#include <ignite/cache/event/cache_entry_event_filter.h>
 
 namespace ignite
 {
@@ -83,7 +85,7 @@ namespace ignite
                      *     continuous query execution has been started.
                      */
                     ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr) :
-                        impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr))
+                        impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false))
                     {
                         // No-op.
                     }
@@ -102,6 +104,37 @@ namespace ignite
                     }
 
                     /**
+                     * Constructor.
+                     *
+                     * @param lsnr Event listener. Invoked on the node where
+                     *     continuous query execution has been started.
+                     * @param remoteFilter Remote filter.
+                     */
+                    template<typename F>
+                    ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
+                        const Reference<F>& remoteFilter) :
+                        impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false, remoteFilter))
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Constructor.
+                     *
+                     * @param lsnr Event listener Invoked on the node where
+                     *     continuous query execution has been started.
+                     * @param remoteFilter Remote filter.
+                     * @param loc Whether query should be executed locally.
+                     */
+                    template<typename F>
+                    ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
+                        const Reference<F>& remoteFilter, bool loc) :
+                        impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, loc, remoteFilter))
+                    {
+                        // No-op.
+                    }
+
+                    /**
                      * Set local flag.
                      *
                      * @param val Value of the flag. If true, query will be

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/ignite_binding.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/ignite_binding.h b/modules/platforms/cpp/core/include/ignite/ignite_binding.h
index a8decf9..a84a1c1 100644
--- a/modules/platforms/cpp/core/include/ignite/ignite_binding.h
+++ b/modules/platforms/cpp/core/include/ignite/ignite_binding.h
@@ -22,6 +22,7 @@
 #include <ignite/common/concurrent.h>
 
 #include <ignite/impl/ignite_binding_impl.h>
+#include <ignite/impl/bindings.h>
 
 namespace ignite
 {
@@ -53,12 +54,10 @@ namespace ignite
         }
 
         /**
-         * Register Type as Cache Entry Processor.
+         * Register type as Cache Entry Processor.
          *
          * Registred type should be a child of ignite::cache::CacheEntryProcessor
          * class.
-         *
-         * This method should only be used on the valid instance.
          */
         template<typename P>
         void RegisterCacheEntryProcessor()
@@ -76,8 +75,6 @@ namespace ignite
          * Registred type should be a child of ignite::cache::CacheEntryProcessor
          * class.
          *
-         * This method should only be used on the valid instance.
-         *
          * @param err Error.
          */
         template<typename P>
@@ -87,7 +84,11 @@ namespace ignite
             impl::IgniteBindingImpl *im = impl.Get();
 
             if (im)
-                im->RegisterCallback(bt.GetTypeId(), &P::CacheEntryProcessor::InternalProcess, err);
+            {
+                im->RegisterCallback(impl::IgniteBindingImpl::CACHE_ENTRY_PROCESSOR_APPLY,
+                    bt.GetTypeId(), impl::binding::ListenerApply<P, typename P::KeyType,
+                        typename P::ValueType, typename P::ReturnType, typename P::ArgumentType>, err);
+            }
             else
             {
                 err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
@@ -96,6 +97,32 @@ namespace ignite
         }
 
         /**
+         * Register type as Cache Entry Event Filter.
+         *
+         * Registred type should be a child of ignite::cache::event::CacheEntryEventFilter
+         * class.
+         */
+        template<typename F>
+        void RegisterCacheEntryEventFilter()
+        {
+            binary::BinaryType<F> bt;
+            impl::IgniteBindingImpl *im = impl.Get();
+
+            int32_t typeId = bt.GetTypeId();
+
+            if (im)
+            {
+                im->RegisterCallback(impl::IgniteBindingImpl::CACHE_ENTRY_FILTER_CREATE,
+                    typeId, impl::binding::FilterCreate<F>);
+            }
+            else
+            {
+                throw IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+                    "Instance is not usable (did you check for error?).");
+            }
+        }
+
+        /**
          * Check if the instance is valid.
          *
          * Invalid instance can be returned if some of the previous operations

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/ignite_binding_context.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/ignite_binding_context.h b/modules/platforms/cpp/core/include/ignite/ignite_binding_context.h
index 1a6d26d..4d8a7a7 100644
--- a/modules/platforms/cpp/core/include/ignite/ignite_binding_context.h
+++ b/modules/platforms/cpp/core/include/ignite/ignite_binding_context.h
@@ -70,7 +70,7 @@ namespace ignite
          * @param cfg Configuration.
          * @param binding Binding.
          */
-        IgniteBindingContext(const IgniteConfiguration& cfg, IgniteBinding binding) :
+        IgniteBindingContext(const IgniteConfiguration& cfg, const IgniteBinding& binding) :
             cfg(cfg),
             binding(binding)
         {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/bindings.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/bindings.h b/modules/platforms/cpp/core/include/ignite/impl/bindings.h
new file mode 100644
index 0000000..ce77672
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/bindings.h
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_BINDINGS
+#define _IGNITE_IMPL_BINDINGS
+
+#include <stdint.h>
+
+#include <ignite/impl/binary/binary_reader_impl.h>
+#include <ignite/impl/ignite_environment.h>
+#include <ignite/impl/cache/query/continuous/continuous_query_impl.h>
+#include <ignite/impl/cache/cache_entry_processor_holder.h>
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace binding
+        {
+            /**
+             * Binding for filter creation.
+             * 
+             * @tparam F The filter which inherits from CacheEntryEventFilter.
+             *
+             * @param reader Reader.
+             * @param env Environment.
+             * @return Handle for the filter.
+             */
+            template<typename F>
+            int64_t FilterCreate(binary::BinaryReaderImpl& reader, binary::BinaryWriterImpl&, IgniteEnvironment& env)
+            {
+                using namespace common::concurrent;
+                using namespace cache::query::continuous;
+
+                F filter = reader.ReadObject<F>();
+
+                SharedPointer<ContinuousQueryImplBase> qry(new RemoteFilterHolder(MakeReferenceFromCopy(filter)));
+
+                return env.GetHandleRegistry().Allocate(qry);
+            }
+
+            /**
+             * Process input streaming data to produce output streaming data.
+             *
+             * Deserializes cache entry and processor using provided reader, invokes
+             * cache entry processor, gets result and serializes it using provided
+             * writer.
+             *
+             * @param reader Reader.
+             * @param writer Writer.
+             */
+            template<typename P, typename K, typename V, typename R, typename A>
+            int64_t ListenerApply(binary::BinaryReaderImpl& reader, binary::BinaryWriterImpl& writer, IgniteEnvironment&)
+            {
+                typedef cache::CacheEntryProcessorHolder<P, A> ProcessorHolder;
+
+                ProcessorHolder procHolder = reader.ReadObject<ProcessorHolder>();
+
+                K key = reader.ReadObject<K>();
+
+                V value;
+                bool exists = reader.TryReadObject<V>(value);
+
+                cache::MutableCacheEntryState entryState;
+
+                R res = procHolder.template Process<R, K, V>(key, value, exists, entryState);
+
+                writer.WriteInt8(static_cast<int8_t>(entryState));
+
+                if (entryState == cache::ENTRY_STATE_VALUE_SET)
+                    writer.WriteTopObject(value);
+
+                writer.WriteTopObject(res);
+
+                return 0;
+            }
+        }
+    }
+}
+
+#endif //_IGNITE_IMPL_BINDINGS

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h
index 23b57c3..c979b4a 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_entry_processor_holder.h
@@ -75,20 +75,6 @@ namespace ignite
             /**
              * Holder for the Cache Entry Processor and its argument. Used as a convenient way to
              * transmit Cache Entry Processor between nodes.
-             *
-             * Both key and value types should be default-constructable,
-             * copy-constructable and assignable.
-             *
-             * Additionally, for the processor class public methods with the
-             * following signatures should be defined:
-             * @code{.cpp}
-             * // Should return unique ID for every class.
-             * static int64_t GetJobId();
-             *
-             * // Main processing method. Takes cache entry and argument and
-             * // returns processing result.
-             * R Process(ignite::cache::MutableCacheEntry<K, V>&, const A&);
-             * @endcode
              */
             template<typename P, typename A>
             class CacheEntryProcessorHolder
@@ -202,7 +188,6 @@ namespace ignite
             typedef impl::cache::CacheEntryProcessorHolder<P, A> UnderlyingType;
 
             IGNITE_BINARY_GET_FIELD_ID_AS_HASH
-            IGNITE_BINARY_GET_HASH_CODE_ZERO(UnderlyingType)
             IGNITE_BINARY_IS_NULL_FALSE(UnderlyingType)
             IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(UnderlyingType)
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
index e6cfbab..4599522 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
@@ -22,9 +22,7 @@
 #include <ignite/cache/query/query_sql.h>
 #include <ignite/cache/query/query_text.h>
 #include <ignite/cache/query/query_sql_fields.h>
-#include <ignite/cache/query/continuous/continuous_query_handle.h>
 #include <ignite/impl/cache/query/query_impl.h>
-#include <ignite/impl/cache/query/continuous/continuous_query_handle_impl.h>
 #include <ignite/impl/cache/query/continuous/continuous_query_impl.h>
 
 #include <ignite/impl/interop/interop_target.h>
@@ -35,6 +33,15 @@ namespace ignite
     {
         namespace cache
         {
+            namespace query
+            {
+                namespace continuous
+                {
+                    /* Forward declaration. */
+                    class ContinuousQueryHandleImpl;
+                }
+            }
+
             /**
              * Cache implementation.
              */
@@ -402,30 +409,7 @@ namespace ignite
                  * @param err Error.
                  */
                 template<typename T>
-                query::QueryCursorImpl* QueryInternal(const T& qry, int32_t typ, IgniteError& err)
-                {
-                    ignite::jni::java::JniErrorInfo jniErr;
-
-                    ignite::common::concurrent::SharedPointer<interop::InteropMemory> mem = GetEnvironment().AllocateMemory();
-                    interop::InteropMemory* mem0 = mem.Get();
-                    interop::InteropOutputStream out(mem0);
-                    binary::BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
-                    ignite::binary::BinaryRawWriter rawWriter(&writer);
-
-                    qry.Write(rawWriter);
-
-                    out.Synchronize();
-
-                    jobject qryJavaRef = GetEnvironment().Context()->CacheOutOpQueryCursor(GetTarget(),
-                        typ, mem.Get()->PointerLong(), &jniErr);
-
-                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
-                    if (jniErr.code == ignite::java::IGNITE_JNI_ERR_SUCCESS)
-                        return new query::QueryCursorImpl(GetEnvironmentPointer(), qryJavaRef);
-                    else
-                        return 0;
-                }
+                query::QueryCursorImpl* QueryInternal(const T& qry, int32_t typ, IgniteError& err);
 
                 /**
                  * Start continuous query execution with the initial query.
@@ -438,50 +422,7 @@ namespace ignite
                 template<typename T>
                 query::continuous::ContinuousQueryHandleImpl* QueryContinuous(
                     const common::concurrent::SharedPointer<query::continuous::ContinuousQueryImplBase> qry,
-                    const T& initialQry, int32_t typ, int32_t cmd, IgniteError& err)
-                {
-                    jni::java::JniErrorInfo jniErr;
-
-                    common::concurrent::SharedPointer<interop::InteropMemory> mem = GetEnvironment().AllocateMemory();
-                    interop::InteropMemory* mem0 = mem.Get();
-                    interop::InteropOutputStream out(mem0);
-                    binary::BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
-                    ignite::binary::BinaryRawWriter rawWriter(&writer);
-
-                    const query::continuous::ContinuousQueryImplBase& qry0 = *qry.Get();
-
-                    int64_t handle = GetEnvironment().GetHandleRegistry().Allocate(qry);
-
-                    rawWriter.WriteInt64(handle);
-                    rawWriter.WriteBool(qry0.GetLocal());
-
-                    // Filters are not supported for now.
-                    rawWriter.WriteBool(false);
-                    rawWriter.WriteNull();
-
-                    rawWriter.WriteInt32(qry0.GetBufferSize());
-                    rawWriter.WriteInt64(qry0.GetTimeInterval());
-
-                    // Autounsubscribe is a filter feature.
-                    rawWriter.WriteBool(false);
-
-                    // Writing initial query. When there is not initial query writing -1.
-                    rawWriter.WriteInt32(typ);
-                    if (typ != -1)
-                        initialQry.Write(rawWriter);
-
-                    out.Synchronize();
-
-                    jobject qryJavaRef = GetEnvironment().Context()->CacheOutOpContinuousQuery(GetTarget(),
-                        cmd, mem.Get()->PointerLong(), &jniErr);
-
-                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
-                    if (jniErr.code == java::IGNITE_JNI_ERR_SUCCESS)
-                        return new query::continuous::ContinuousQueryHandleImpl(GetEnvironmentPointer(), handle, qryJavaRef);
-
-                    return 0;
-                }
+                    const T& initialQry, int32_t typ, int32_t cmd, IgniteError& err);
             };
         }
     }    

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_base.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_base.h b/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_base.h
new file mode 100644
index 0000000..a0e1cb6
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_base.h
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER_BASE
+#define _IGNITE_IMPL_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER_BASE
+
+#include <ignite/binary/binary_raw_reader.h>
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace cache
+        {
+            namespace event
+            {
+                /**
+                 * Base for the Cache Entry Event Filter.
+                 */
+                class CacheEntryEventFilterBase
+                {
+                public:
+                    /**
+                     * Default constructor.
+                     */
+                    CacheEntryEventFilterBase()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Destructor.
+                     */
+                    virtual ~CacheEntryEventFilterBase()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Process serialized events.
+                     *
+                     * @param reader Reader for a serialized event.
+                     * @return Filter evaluation result.
+                     */
+                    virtual bool ReadAndProcessEvent(ignite::binary::BinaryRawReader& reader) = 0;
+                };
+            }
+        }
+    }
+}
+
+#endif //_IGNITE_IMPL_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER_BASE

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_holder.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_holder.h b/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_holder.h
new file mode 100644
index 0000000..4256f2b
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/event/cache_entry_event_filter_holder.h
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER_HOLDER
+#define _IGNITE_IMPL_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER_HOLDER
+
+#include <ignite/reference.h>
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace cache
+        {
+            namespace event
+            {
+                /* Forward declaration. */
+                class CacheEntryEventFilterBase;
+
+                class CacheEntryEventFilterHolderBase
+                {
+                public:
+                    /**
+                     * Destructor.
+                     */
+                    virtual ~CacheEntryEventFilterHolderBase()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Write.
+                     *
+                     * @param writer Writer.
+                     */
+                    virtual void Write(binary::BinaryWriterImpl& writer) = 0;
+
+                    /**
+                     * Get filter pointer.
+                     *
+                     * @return Filter.
+                     */
+                    virtual CacheEntryEventFilterBase* GetFilter() = 0;
+                };
+
+                /**
+                 * Holder for the Cache Entry Event Filter.
+                 */
+                template<typename F>
+                class CacheEntryEventFilterHolder : public CacheEntryEventFilterHolderBase
+                {
+                public:
+                    typedef F FilterType;
+
+                    /**
+                     * Default constructor.
+                     */
+                    CacheEntryEventFilterHolder() :
+                        filter()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Constructor.
+                     *
+                     * @param filter Filter.
+                     */
+                    CacheEntryEventFilterHolder(const Reference<FilterType>& filter) :
+                        filter(filter)
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Destructor.
+                     */
+                    virtual ~CacheEntryEventFilterHolder()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Process input.
+                     *
+                     * @param writer Writer.
+                     */
+                    virtual void Write(binary::BinaryWriterImpl& writer)
+                    {
+                        if (!filter.IsNull())
+                        {
+                            writer.WriteBool(true);
+                            writer.WriteObject<FilterType>(*filter.Get());
+                        }
+                        else
+                        {
+                            writer.WriteBool(false);
+                            writer.WriteNull();
+                        }
+                    }
+
+                    /**
+                     * Get filter pointer.
+                     *
+                     * @return Filter.
+                     */
+                    virtual CacheEntryEventFilterBase* GetFilter()
+                    {
+                        return filter.Get();
+                    }
+
+                private:
+                    /** Stored filter. */
+                    Reference<FilterType> filter;
+                };
+
+                template<>
+                class CacheEntryEventFilterHolder<void> : public CacheEntryEventFilterHolderBase
+                {
+                public:
+                    /**
+                     * Default constructor.
+                     */
+                    CacheEntryEventFilterHolder()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Constructor.
+                     */
+                    CacheEntryEventFilterHolder(const Reference<void>&)
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Destructor.
+                     */
+                    virtual ~CacheEntryEventFilterHolder()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Process input.
+                     *
+                     * @param writer Writer.
+                     */
+                    virtual void Write(binary::BinaryWriterImpl& writer)
+                    {
+                        writer.WriteBool(false);
+                        writer.WriteNull();
+                    }
+
+                    /**
+                     * Get filter pointer.
+                     *
+                     * @return Filter.
+                     */
+                    virtual CacheEntryEventFilterBase* GetFilter()
+                    {
+                        return 0;
+                    }
+                };
+            }
+        }
+    }
+}
+
+#endif //_IGNITE_IMPL_CACHE_EVENT_CACHE_ENTRY_EVENT_FILTER_HOLDER

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_handle_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_handle_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_handle_impl.h
index 75504b1..07facff 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_handle_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_handle_impl.h
@@ -66,13 +66,6 @@ namespace ignite
                          */
                         QueryCursorImpl* GetInitialQueryCursor(IgniteError& err);
 
-                        /**
-                         * Set query to keep pointer to.
-                         *
-                         * @param query Query.
-                         */
-                        void SetQuery(SP_ContinuousQueryImplBase query);
-
                     private:
                         /** Environment. */
                         SP_IgniteEnvironment env;
@@ -83,9 +76,6 @@ namespace ignite
                         /** Handle to Java object. */
                         jobject javaRef;
 
-                        /** Shared pointer to query. Kept for query to live long enough. */
-                        SP_ContinuousQueryImplBase qry;
-
                         /** Mutex. */
                         common::concurrent::CriticalSection mutex;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_impl.h
index 2a24e5f..d2bf241 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/continuous/continuous_query_impl.h
@@ -24,11 +24,13 @@
 #define _IGNITE_IMPL_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_IMPL
 
 #include <stdint.h>
+#include <memory>
 
 #include <ignite/reference.h>
 
 #include <ignite/cache/event/cache_entry_event_listener.h>
 #include <ignite/binary/binary_raw_reader.h>
+#include <ignite/impl/cache/event/cache_entry_event_filter_holder.h>
 
 namespace ignite
 {
@@ -80,10 +82,11 @@ namespace ignite
                          *
                          * @param loc Whether query should be executed locally.
                          */
-                        explicit ContinuousQueryImplBase(bool loc) :
+                        explicit ContinuousQueryImplBase(bool loc, event::CacheEntryEventFilterHolderBase* filterOp) :
                             local(loc),
                             bufferSize(DEFAULT_BUFFER_SIZE),
-                            timeInterval(DEFAULT_TIME_INTERVAL)
+                            timeInterval(DEFAULT_TIME_INTERVAL),
+                            filterOp(filterOp)
                         {
                             // No-op.
                         }
@@ -183,6 +186,16 @@ namespace ignite
                         }
 
                         /**
+                         * Get remote filter holder.
+                         *
+                         * @return Filter holder.
+                         */
+                        event::CacheEntryEventFilterHolderBase& GetFilterHolder() const
+                        {
+                            return *filterOp;
+                        }
+
+                        /**
                          * Callback that reads and processes cache events.
                          *
                          * @param reader Reader to use.
@@ -221,6 +234,9 @@ namespace ignite
                          * sent only when buffer is full.
                          */
                         int64_t timeInterval;
+
+                        /** Cache entry event filter holder. */
+                        std::auto_ptr<event::CacheEntryEventFilterHolderBase> filterOp;
                     };
 
                     /**
@@ -252,11 +268,13 @@ namespace ignite
                         /**
                          * Constructor.
                          *
-                         * @param lsnr Event listener. Invoked on the node where
+                         * @param lsnr Event listener Invoked on the node where
                          *     continuous query execution has been started.
+                         * @param loc Whether query should be executed locally.
                          */
-                        ContinuousQueryImpl(Reference<ignite::cache::event::CacheEntryEventListener<K, V> >& lsnr) :
-                            ContinuousQueryImplBase(false),
+                        ContinuousQueryImpl(Reference<ignite::cache::event::CacheEntryEventListener<K, V> >& lsnr,
+                            bool loc) :
+                            ContinuousQueryImplBase(loc, new event::CacheEntryEventFilterHolder<void>()),
                             lsnr(lsnr)
                         {
                             // No-op.
@@ -269,8 +287,10 @@ namespace ignite
                          *     continuous query execution has been started.
                          * @param loc Whether query should be executed locally.
                          */
-                        ContinuousQueryImpl(Reference<ignite::cache::event::CacheEntryEventListener<K, V> >& lsnr, bool loc) :
-                            ContinuousQueryImplBase(loc),
+                        template<typename F>
+                        ContinuousQueryImpl(Reference<ignite::cache::event::CacheEntryEventListener<K, V> >& lsnr,
+                            bool loc, const Reference<F>& filter) :
+                            ContinuousQueryImplBase(loc, new event::CacheEntryEventFilterHolder<F>(filter)),
                             lsnr(lsnr)
                         {
                             // No-op.
@@ -335,13 +355,37 @@ namespace ignite
                             for (int32_t i = 0; i < cnt; ++i)
                                 events[i].Read(reader);
 
-                            lsnr.Get().OnEvent(events.data(), cnt);
+                            lsnr.Get()->OnEvent(events.data(), cnt);
                         }
 
                     private:
                         /** Cache entry event listener. */
                         Reference<ignite::cache::event::CacheEntryEventListener<K, V> > lsnr;
                     };
+
+                    /**
+                     * Used to store filter on remote nodes where no
+                     * ContinuousQuery instance were really created.
+                     */
+                    class RemoteFilterHolder : public ContinuousQueryImplBase
+                    {
+                    public:
+                        /**
+                         * Constructor.
+                         */
+                        template<typename F>
+                        RemoteFilterHolder(const Reference<F>& filter):
+                            ContinuousQueryImplBase(false, new event::CacheEntryEventFilterHolder<F>(filter))
+                        {
+                            // No-op.
+                        }
+
+                        virtual void ReadAndProcessEvents(ignite::binary::BinaryRawReader&)
+                        {
+                            throw IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+                                "No listener is registered for the ContinuousQuery instance");
+                        }
+                    };
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h
index 32de2cb..7b20c50 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_binding_impl.h
@@ -18,6 +18,7 @@
 #ifndef _IGNITE_IMPL_IGNITE_BINDING_IMPL
 #define _IGNITE_IMPL_IGNITE_BINDING_IMPL
 
+#include <stdint.h>
 #include <map>
 
 #include <ignite/common/common.h>
@@ -29,6 +30,9 @@ namespace ignite
 {
     namespace impl
     {
+        /* Forward declaration. */
+        class IgniteEnvironment;
+
         /**
          * Ignite binding implementation.
          *
@@ -36,16 +40,24 @@ namespace ignite
          */
         class IgniteBindingImpl
         {
-            typedef void (Callback)(binary::BinaryReaderImpl&, binary::BinaryWriterImpl&);
+            typedef int64_t(Callback)(binary::BinaryReaderImpl&, binary::BinaryWriterImpl&, IgniteEnvironment&);
 
         public:
+            enum CallbackType
+            {
+                CACHE_ENTRY_PROCESSOR_APPLY = 1,
+
+                CACHE_ENTRY_FILTER_CREATE = 2,
+
+                CACHE_ENTRY_FILTER_APPLY = 3,
+            };
+
             /**
-             * Default constructor.
+             * Constructor.
+             *
+             * @param env Environment.
              */
-            IgniteBindingImpl() : callbacks()
-            {
-                // No-op.
-            }
+            IgniteBindingImpl(IgniteEnvironment &env);
 
             /**
              * Invoke callback using provided ID.
@@ -53,31 +65,15 @@ namespace ignite
              * Deserializes data and callback itself, invokes callback and
              * serializes processing result using providede reader and writer.
              *
-             * @param id Processor ID.
+             * @param type Callback Type.
+             * @param id Callback ID.
              * @param reader Reader.
              * @param writer Writer.
-             * @return True if callback is registered and false otherwise.
+             * @param found Output param. True if callback was found and false otherwise.
+             * @return Callback return value.
              */
-            bool InvokeCallbackById(int64_t id, binary::BinaryReaderImpl& reader, binary::BinaryWriterImpl& writer)
-            {
-                common::concurrent::CsLockGuard guard(lock);
-
-                std::map<int64_t, Callback*>::iterator it = callbacks.find(id);
-
-                if (it != callbacks.end())
-                {
-                    Callback* callback = it->second;
-
-                    // We have found callback and does not need lock here anymore.
-                    guard.Reset();
-
-                    callback(reader, writer);
-
-                    return true;
-                }
-
-                return false;
-            }
+            IGNITE_IMPORT_EXPORT int64_t InvokeCallback(bool& found, int32_t type, int32_t id, binary::BinaryReaderImpl& reader,
+                binary::BinaryWriterImpl& writer);
 
             /**
              * Register cache entry processor and associate it with provided ID.
@@ -85,29 +81,42 @@ namespace ignite
              * @throw IgniteError another processor is already associated with
              *     the given ID.
              *
-             * @param id Identifier for processor to be associated with.
-             * @param proc Callback.
+             * @param type Callback type.
+             * @param id Callback identifier.
+             * @param callback Callback.
+             * @param err Error.
              */
-            void RegisterCallback(int64_t id, Callback* proc, IgniteError& err)
-            {
-                common::concurrent::CsLockGuard guard(lock);
-
-                bool inserted = callbacks.insert(std::make_pair(id, proc)).second;
-
-                guard.Reset();
-
-                if (!inserted)
-                {
-                    std::stringstream builder;
+            IGNITE_IMPORT_EXPORT void RegisterCallback(int32_t type, int32_t id, Callback* callback, IgniteError& err);
+            
+            /**
+             * Register cache entry processor and associate it with provided ID.
+             *
+             * @throw IgniteError another processor is already associated with
+             *     the given ID.
+             *
+             * @param type Callback type.
+             * @param id Callback identifier.
+             * @param callback Callback.
+             */
+            IGNITE_IMPORT_EXPORT void RegisterCallback(int32_t type, int32_t id, Callback* callback);
 
-                    builder << "Trying to register multiple PRC callbacks with the same ID. [id=" << id << ']';
+        private:
+            IGNITE_NO_COPY_ASSIGNMENT(IgniteBindingImpl);
 
-                    err = IgniteError(IgniteError::IGNITE_ERR_ENTRY_PROCESSOR, builder.str().c_str());
-                }
+            /**
+             * Make key out of callback's type and ID.
+             *
+             * @param type Callback Type.
+             * @param id Callback ID.
+             * @return Key for callback.
+             */
+            int64_t makeKey(int32_t type, int32_t id)
+            {
+                return (static_cast<int64_t>(type) << 32) | id;
             }
 
-        private:
-            IGNITE_NO_COPY_ASSIGNMENT(IgniteBindingImpl);
+            /** Ignite environment. */
+            IgniteEnvironment& env;
 
             /** Registered callbacks. */
             std::map<int64_t, Callback*> callbacks;

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
index 5fc9a27..e3cb859 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_environment.h
@@ -21,19 +21,20 @@
 #include <ignite/common/concurrent.h>
 #include <ignite/jni/java.h>
 #include <ignite/jni/utils.h>
-#include <ignite/ignite_binding_context.h>
 #include <ignite/ignite_configuration.h>
 
-#include "ignite/impl/interop/interop_memory.h"
-#include "ignite/impl/binary/binary_type_manager.h"
-#include "ignite/impl/handle_registry.h"
-#include "ignite/impl/module_manager.h"
-#include "ignite/impl/ignite_binding_impl.h"
+#include <ignite/impl/interop/interop_memory.h>
+#include <ignite/impl/binary/binary_type_manager.h>
+#include <ignite/impl/handle_registry.h>
 
 namespace ignite
 {
     namespace impl
     {
+        /* Forward declarations. */
+        class IgniteBindingImpl;
+        class ModuleManager;
+
         /**
          * Defines environment in which Ignite operates.
          */
@@ -110,6 +111,21 @@ namespace ignite
             void OnContinuousQueryListenerApply(common::concurrent::SharedPointer<interop::InteropMemory>& mem);
 
             /**
+             * Continuous query filter create callback.
+             *
+             * @param mem Memory with data.
+             * @return Filter handle.
+             */
+            int64_t OnContinuousQueryFilterCreate(common::concurrent::SharedPointer<interop::InteropMemory>& mem);
+
+            /**
+             * Continuous query filter apply callback.
+             *
+             * @param mem Memory with data.
+             */
+            int64_t OnContinuousQueryFilterApply(common::concurrent::SharedPointer<interop::InteropMemory>& mem);
+
+            /**
              * Cache Invoke callback.
              *
              * @param mem Input-output memory.
@@ -191,14 +207,7 @@ namespace ignite
              *
              * @return IgniteBinding instance.
              */
-            IgniteBinding GetBinding() const;
-
-            /**
-             * Get binding context.
-             *
-             * @return Binding context.
-             */
-            IgniteBindingContext GetBindingContext() const;
+            common::concurrent::SharedPointer<IgniteBindingImpl> GetBinding() const;
 
         private:
             /** Node configuration. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
index 24fc989..5b1f527 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
@@ -22,10 +22,10 @@
 #include <ignite/jni/java.h>
 #include <ignite/common/utils.h>
 
-#include "ignite/impl/cache/cache_impl.h"
-#include "ignite/impl/transactions/transactions_impl.h"
-#include "ignite/impl/cluster/cluster_group_impl.h"
-#include "ignite/impl/ignite_environment.h"
+#include <ignite/impl/cache/cache_impl.h>
+#include <ignite/impl/transactions/transactions_impl.h>
+#include <ignite/impl/cluster/cluster_group_impl.h>
+#include <ignite/impl/ignite_environment.h>
 
 namespace ignite 
 {
@@ -154,7 +154,7 @@ namespace ignite
              *
              * @return IgniteBinding class instance.
              */
-            IgniteBinding GetBinding();
+            common::concurrent::SharedPointer<IgniteBindingImpl> GetBinding();
 
             /**
              * Get instance of the implementation from the proxy class.

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/include/ignite/impl/operations.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/operations.h b/modules/platforms/cpp/core/include/ignite/impl/operations.h
index dfaa4e8..fff8a86 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/operations.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/operations.h
@@ -79,7 +79,7 @@ namespace ignite
             }
         private:
             /** Value. */
-            const T val;
+            const T& val;
 
             IGNITE_NO_COPY_ASSIGNMENT(In1Operation)
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/project/vs/core.vcxproj b/modules/platforms/cpp/core/project/vs/core.vcxproj
index b490887..b5a95bd 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj
@@ -195,6 +195,7 @@
     <ClInclude Include="..\..\include\ignite\cache\cache_entry_processor.h" />
     <ClInclude Include="..\..\include\ignite\cache\cache_peek_mode.h" />
     <ClInclude Include="..\..\include\ignite\cache\event\cache_entry_event.h" />
+    <ClInclude Include="..\..\include\ignite\cache\event\cache_entry_event_filter.h" />
     <ClInclude Include="..\..\include\ignite\cache\event\cache_entry_event_listener.h" />
     <ClInclude Include="..\..\include\ignite\cache\query\continuous\continuous_query.h" />
     <ClInclude Include="..\..\include\ignite\cache\query\continuous\continuous_query_handle.h" />
@@ -212,9 +213,12 @@
     <ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
     <ClInclude Include="..\..\include\ignite\ignition.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater_impl.h" />
+    <ClInclude Include="..\..\include\ignite\impl\bindings.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\cache_entry_processor_holder.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\query\query_argument.h" />
+    <ClInclude Include="..\..\include\ignite\impl\cache\event\cache_entry_event_filter_base.h" />
+    <ClInclude Include="..\..\include\ignite\impl\cache\event\cache_entry_event_filter_holder.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\query\query_batch.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\query\continuous\continuous_query_handle_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\query\continuous\continuous_query_impl.h" />
@@ -246,6 +250,7 @@
     <ClCompile Include="..\..\src\impl\cache\query\continuous\continuous_query_handle_impl.cpp" />
     <ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp" />
     <ClCompile Include="..\..\src\impl\cluster\cluster_group_impl.cpp" />
+    <ClCompile Include="..\..\src\impl\ignite_binding_impl.cpp" />
     <ClCompile Include="..\..\src\impl\ignite_environment.cpp" />
     <ClCompile Include="..\..\src\impl\ignite_impl.cpp" />
     <ClCompile Include="..\..\src\impl\handle_registry.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4da92b7/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/project/vs/core.vcxproj.filters b/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
index b75b3b2..3b17d53 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
@@ -52,6 +52,9 @@
     <ClCompile Include="..\..\src\impl\cluster\cluster_group_impl.cpp">
       <Filter>Code\impl\cluster</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\impl\ignite_binding_impl.cpp">
+      <Filter>Code\impl</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h">
@@ -192,6 +195,18 @@
     <ClInclude Include="..\..\include\ignite\impl\cache\query\query_argument.h">
       <Filter>Code\impl\cache\query</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\cache\event\cache_entry_event_filter.h">
+      <Filter>Code\cache\event</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\impl\cache\event\cache_entry_event_filter_base.h">
+      <Filter>Code\impl\cache\event</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\impl\cache\event\cache_entry_event_filter_holder.h">
+      <Filter>Code\impl\cache\event</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\impl\bindings.h">
+      <Filter>Code\impl</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Filter Include="Code">
@@ -236,5 +251,8 @@
     <Filter Include="Code\impl\cluster">
       <UniqueIdentifier>{f5b54635-91a1-447e-923a-1b4608d7e5bc}</UniqueIdentifier>
     </Filter>
+    <Filter Include="Code\impl\cache\event">
+      <UniqueIdentifier>{9c5e9732-755a-4553-8926-b4cf3b6abaf3}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
 </Project>
\ No newline at end of file


[11/18] ignite git commit: IGNITE-2703 .NET: Dynamic type registration

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
deleted file mode 100644
index b062689..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Impl.Binary.IO
-{
-    using System;
-    using System.Diagnostics.CodeAnalysis;
-    using System.IO;
-
-    /// <summary>
-    /// Adapter providing .Net streaming functionality over the binary stream.
-    /// </summary>
-    internal class BinaryStreamAdapter : Stream
-    {
-        /// <summary>
-        /// 
-        /// </summary>
-        private readonly IBinaryStream _stream;
-
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="stream">Stream.</param>
-        public BinaryStreamAdapter(IBinaryStream stream)
-        {
-            _stream = stream;
-        }
-
-        /** <inheritDoc /> */
-        public override void Write(byte[] buffer, int offset, int count)
-        {
-            _stream.Write(buffer, offset, count);
-        }
-
-        /** <inheritDoc /> */
-        public override int Read(byte[] buffer, int offset, int count)
-        {
-            _stream.Read(buffer, offset, count);
-
-            return count;
-        }
-
-        /** <inheritDoc /> */
-        public override void Flush()
-        {
-            // No-op.
-        }
-
-        /** <inheritDoc /> */
-        public override bool CanRead
-        {
-            get { return true; }
-        }
-
-        /** <inheritDoc /> */
-        public override bool CanWrite
-        {
-            get { return true; }
-        }
-
-        /** <inheritDoc /> */
-        public override bool CanSeek
-        {
-            get { return false; }
-        }
-
-        /** <inheritDoc /> */
-        [ExcludeFromCodeCoverage]
-        public override long Seek(long offset, SeekOrigin origin)
-        {
-            throw new NotSupportedException("Stream is not seekable.");
-        }
-
-        /** <inheritDoc /> */
-        [ExcludeFromCodeCoverage]
-        public override long Position
-        {
-            get
-            {
-                throw new NotSupportedException("Stream is not seekable.");
-            }
-            set
-            {
-                throw new NotSupportedException("Stream is not seekable.");
-            }
-        }
-
-        /** <inheritDoc /> */
-        [ExcludeFromCodeCoverage]
-        public override long Length
-        {
-            get 
-            {
-                throw new NotSupportedException("Stream is not seekable.");
-            }
-        }
-
-        /** <inheritDoc /> */
-        [ExcludeFromCodeCoverage]
-        public override void SetLength(long value)
-        {
-            throw new NotSupportedException("Stream is not seekable.");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index b929f3a..5effc5c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Linq;
+    using System.Runtime.Serialization;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache.Affinity;
     using Apache.Ignite.Core.Common;
@@ -33,6 +34,7 @@ namespace Apache.Ignite.Core.Impl.Binary
     using Apache.Ignite.Core.Impl.Compute.Closure;
     using Apache.Ignite.Core.Impl.Datastream;
     using Apache.Ignite.Core.Impl.Messaging;
+    using Apache.Ignite.Core.Log;
 
     /// <summary>
     /// Marshaller implementation.
@@ -43,37 +45,43 @@ namespace Apache.Ignite.Core.Impl.Binary
         private readonly BinaryConfiguration _cfg;
 
         /** Type to descriptor map. */
-        private readonly IDictionary<Type, IBinaryTypeDescriptor> _typeToDesc =
-            new Dictionary<Type, IBinaryTypeDescriptor>();
+        private readonly CopyOnWriteConcurrentDictionary<Type, BinaryFullTypeDescriptor> _typeToDesc =
+            new CopyOnWriteConcurrentDictionary<Type, BinaryFullTypeDescriptor>();
 
         /** Type name to descriptor map. */
-        private readonly IDictionary<string, IBinaryTypeDescriptor> _typeNameToDesc =
-            new Dictionary<string, IBinaryTypeDescriptor>();
+        private readonly CopyOnWriteConcurrentDictionary<string, BinaryFullTypeDescriptor> _typeNameToDesc =
+            new CopyOnWriteConcurrentDictionary<string, BinaryFullTypeDescriptor>();
 
         /** ID to descriptor map. */
-        private readonly CopyOnWriteConcurrentDictionary<long, IBinaryTypeDescriptor> _idToDesc =
-            new CopyOnWriteConcurrentDictionary<long, IBinaryTypeDescriptor>();
+        private readonly CopyOnWriteConcurrentDictionary<long, BinaryFullTypeDescriptor> _idToDesc =
+            new CopyOnWriteConcurrentDictionary<long, BinaryFullTypeDescriptor>();
 
-        /** Cached metadatas. */
-        private volatile IDictionary<int, BinaryTypeHolder> _metas =
-            new Dictionary<int, BinaryTypeHolder>();
+        /** Cached binary types. */
+        private volatile IDictionary<int, BinaryTypeHolder> _metas = new Dictionary<int, BinaryTypeHolder>();
+
+        /** */
+        private volatile Ignite _ignite;
+
+        /** */
+        private readonly ILogger _log;
 
         /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="cfg">Configuration.</param>
-        public Marshaller(BinaryConfiguration cfg)
+        /// <param name="log"></param>
+        public Marshaller(BinaryConfiguration cfg, ILogger log = null)
         {
-            // Validation.
-            if (cfg == null)
-                cfg = new BinaryConfiguration();
+            _cfg = cfg ?? new BinaryConfiguration();
+
+            _log = log;
 
-            CompactFooter = cfg.CompactFooter;
+            CompactFooter = _cfg.CompactFooter;
 
-            if (cfg.TypeConfigurations == null)
-                cfg.TypeConfigurations = new List<BinaryTypeConfiguration>();
+            if (_cfg.TypeConfigurations == null)
+                _cfg.TypeConfigurations = new List<BinaryTypeConfiguration>();
 
-            foreach (BinaryTypeConfiguration typeCfg in cfg.TypeConfigurations)
+            foreach (BinaryTypeConfiguration typeCfg in _cfg.TypeConfigurations)
             {
                 if (string.IsNullOrEmpty(typeCfg.TypeName))
                     throw new BinaryObjectException("Type name cannot be null or empty: " + typeCfg);
@@ -85,25 +93,32 @@ namespace Apache.Ignite.Core.Impl.Binary
             // 2. Define user types.
             var typeResolver = new TypeResolver();
 
-            ICollection<BinaryTypeConfiguration> typeCfgs = cfg.TypeConfigurations;
+            ICollection<BinaryTypeConfiguration> typeCfgs = _cfg.TypeConfigurations;
 
             if (typeCfgs != null)
                 foreach (BinaryTypeConfiguration typeCfg in typeCfgs)
                     AddUserType(cfg, typeCfg, typeResolver);
 
-            var typeNames = cfg.Types;
+            var typeNames = _cfg.Types;
 
             if (typeNames != null)
                 foreach (string typeName in typeNames)
                     AddUserType(cfg, new BinaryTypeConfiguration(typeName), typeResolver);
-
-            _cfg = cfg;
         }
 
         /// <summary>
         /// Gets or sets the backing grid.
         /// </summary>
-        public Ignite Ignite { get; set; }
+        public Ignite Ignite
+        {
+            get { return _ignite; }
+            set
+            {
+                Debug.Assert(value != null);
+
+                _ignite = value;
+            }
+        }
 
         /// <summary>
         /// Gets the compact footer flag.
@@ -111,6 +126,12 @@ namespace Apache.Ignite.Core.Impl.Binary
         public bool CompactFooter { get; set; }
 
         /// <summary>
+        /// Gets or sets a value indicating whether type registration is disabled.
+        /// This may be desirable for static system marshallers where everything is written in unregistered mode.
+        /// </summary>
+        public bool RegistrationDisabled { get; set; }
+
+        /// <summary>
         /// Marshal object.
         /// </summary>
         /// <param name="val">Value.</param>
@@ -126,11 +147,10 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /// <summary>
-        /// Marshal object.
+        /// Marshals an object.
         /// </summary>
         /// <param name="val">Value.</param>
         /// <param name="stream">Output stream.</param>
-        /// <returns>Collection of metadatas (if any).</returns>
         private void Marshal<T>(T val, IBinaryStream stream)
         {
             BinaryWriter writer = StartMarshal(stream);
@@ -358,17 +378,20 @@ namespace Apache.Ignite.Core.Impl.Binary
                 _metas[meta.TypeId].Merge(mergeInfo);
             }
         }
-        
+
         /// <summary>
         /// Gets descriptor for type.
         /// </summary>
         /// <param name="type">Type.</param>
-        /// <returns>Descriptor.</returns>
+        /// <returns>
+        /// Descriptor.
+        /// </returns>
         public IBinaryTypeDescriptor GetDescriptor(Type type)
         {
-            IBinaryTypeDescriptor desc;
+            BinaryFullTypeDescriptor desc;
 
-            _typeToDesc.TryGetValue(type, out desc);
+            if (!_typeToDesc.TryGetValue(type, out desc) || !desc.IsRegistered)
+                desc = RegisterType(type, desc);
 
             return desc;
         }
@@ -380,10 +403,11 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <returns>Descriptor.</returns>
         public IBinaryTypeDescriptor GetDescriptor(string typeName)
         {
-            IBinaryTypeDescriptor desc;
+            BinaryFullTypeDescriptor desc;
 
-            return _typeNameToDesc.TryGetValue(typeName, out desc) ? desc : 
-                new BinarySurrogateTypeDescriptor(_cfg, typeName);
+            return _typeNameToDesc.TryGetValue(typeName, out desc)
+                ? (IBinaryTypeDescriptor) desc
+                : new BinarySurrogateTypeDescriptor(_cfg, typeName);
         }
 
         /// <summary>
@@ -391,24 +415,43 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         /// <param name="userType">User type flag.</param>
         /// <param name="typeId">Type id.</param>
-        /// <returns>Descriptor.</returns>
-        public IBinaryTypeDescriptor GetDescriptor(bool userType, int typeId)
+        /// <param name="requiresType">
+        /// If set to true, resulting descriptor must have Type property populated.
+        /// <para />
+        /// When working in binary mode, we don't need Type. And there is no Type at all in some cases.
+        /// So we should not attempt to call BinaryProcessor right away.
+        /// Only when we really deserialize the value, requiresType is set to true
+        /// and we attempt to resolve the type by all means.
+        /// </param>
+        /// <returns>
+        /// Descriptor.
+        /// </returns>
+        public IBinaryTypeDescriptor GetDescriptor(bool userType, int typeId, bool requiresType = false)
         {
-            IBinaryTypeDescriptor desc;
+            BinaryFullTypeDescriptor desc;
 
             var typeKey = BinaryUtils.TypeKey(userType, typeId);
 
-            if (_idToDesc.TryGetValue(typeKey, out desc))
+            if (_idToDesc.TryGetValue(typeKey, out desc) && (!requiresType || desc.Type != null))
                 return desc;
 
             if (!userType)
                 return null;
 
+            if (requiresType)
+            {
+                // Check marshaller context for dynamically registered type.
+                var type = _ignite == null ? null : _ignite.BinaryProcessor.GetType(typeId);
+
+                if (type != null)
+                    return AddUserType(type, typeId, BinaryUtils.GetTypeName(type), true, desc);
+            }
+
             var meta = GetBinaryType(typeId);
 
             if (meta != BinaryType.Empty)
             {
-                desc = new BinaryFullTypeDescriptor(null, meta.TypeId, meta.TypeName, true, null, null, null, false, 
+                desc = new BinaryFullTypeDescriptor(null, meta.TypeId, meta.TypeName, true, null, null, null, false,
                     meta.AffinityKeyFieldName, meta.IsEnum, null);
 
                 _idToDesc.GetOrAdd(typeKey, _ => desc);
@@ -416,13 +459,30 @@ namespace Apache.Ignite.Core.Impl.Binary
                 return desc;
             }
 
-            return new BinarySurrogateTypeDescriptor(_cfg, typeId);
+            return new BinarySurrogateTypeDescriptor(_cfg, typeId, null);
+        }
+
+        /// <summary>
+        /// Registers the type.
+        /// </summary>
+        /// <param name="type">The type.</param>
+        /// <param name="desc">Existing descriptor.</param>
+        private BinaryFullTypeDescriptor RegisterType(Type type, BinaryFullTypeDescriptor desc)
+        {
+            Debug.Assert(type != null);
+
+            var typeName = BinaryUtils.GetTypeName(type);
+            var typeId = BinaryUtils.TypeId(typeName, _cfg.DefaultNameMapper, _cfg.DefaultIdMapper);
+
+            var registered = _ignite != null && _ignite.BinaryProcessor.RegisterType(typeId, type);
+
+            return AddUserType(type, typeId, typeName, registered, desc);
         }
 
         /// <summary>
         /// Gets the user type descriptors.
         /// </summary>
-        public ICollection<IBinaryTypeDescriptor> GetUserTypeDescriptors()
+        public ICollection<BinaryFullTypeDescriptor> GetUserTypeDescriptors()
         {
             return _typeNameToDesc.Values;
         }
@@ -430,18 +490,67 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Add user type.
         /// </summary>
-        /// <param name="cfg">Configuration.</param>
+        /// <param name="type">The type.</param>
+        /// <param name="typeId">The type id.</param>
+        /// <param name="typeName">Name of the type.</param>
+        /// <param name="registered">Registered flag.</param>
+        /// <param name="desc">Existing descriptor.</param>
+        /// <returns>Descriptor.</returns>
+        private BinaryFullTypeDescriptor AddUserType(Type type, int typeId, string typeName, bool registered,
+            BinaryFullTypeDescriptor desc)
+        {
+            Debug.Assert(type != null);
+            Debug.Assert(typeName != null);
+
+            var ser = GetSerializer(_cfg, null, type, typeId, null, null, _log);
+
+            desc = desc == null
+                ? new BinaryFullTypeDescriptor(type, typeId, typeName, true, _cfg.DefaultNameMapper,
+                    _cfg.DefaultIdMapper, ser, false, null, type.IsEnum, null, registered)
+                : new BinaryFullTypeDescriptor(desc, type, ser, registered);
+
+            if (RegistrationDisabled)
+                return desc;
+
+            var typeKey = BinaryUtils.TypeKey(true, typeId);
+
+            var desc0 = _idToDesc.GetOrAdd(typeKey, x => desc);
+            if (desc0.Type != null && desc0.Type.FullName != type.FullName)
+                ThrowConflictingTypeError(type, desc0.Type, typeId);
+
+            desc0 = _typeNameToDesc.GetOrAdd(typeName, x => desc);
+            if (desc0.Type != null && desc0.Type.FullName != type.FullName)
+                ThrowConflictingTypeError(type, desc0.Type, typeId);
+
+            _typeToDesc.Set(type, desc);
+
+            return desc;
+        }
+
+        /// <summary>
+        /// Throws the conflicting type error.
+        /// </summary>
+        private static void ThrowConflictingTypeError(object type1, object type2, int typeId)
+        {
+            throw new BinaryObjectException(string.Format("Conflicting type IDs [type1='{0}', " +
+                                                          "type2='{1}', typeId={2}]", type1, type2, typeId));
+        }
+
+        /// <summary>
+        /// Add user type.
+        /// </summary>
+        /// <param name="cfg">The binary configuration.</param>
         /// <param name="typeCfg">Type configuration.</param>
         /// <param name="typeResolver">The type resolver.</param>
-        private void AddUserType(BinaryConfiguration cfg, BinaryTypeConfiguration typeCfg, 
-            TypeResolver typeResolver)
+        /// <exception cref="BinaryObjectException"></exception>
+        private void AddUserType(BinaryConfiguration cfg, BinaryTypeConfiguration typeCfg, TypeResolver typeResolver)
         {
             // Get converter/mapper/serializer.
-            IBinaryNameMapper nameMapper = typeCfg.NameMapper ?? cfg.DefaultNameMapper;
+            IBinaryNameMapper nameMapper = typeCfg.NameMapper ?? _cfg.DefaultNameMapper;
 
-            IBinaryIdMapper idMapper = typeCfg.IdMapper ?? cfg.DefaultIdMapper;
+            IBinaryIdMapper idMapper = typeCfg.IdMapper ?? _cfg.DefaultIdMapper;
 
-            bool keepDeserialized = typeCfg.KeepDeserialized ?? cfg.DefaultKeepDeserialized;
+            bool keepDeserialized = typeCfg.KeepDeserialized ?? _cfg.DefaultKeepDeserialized;
 
             // Try resolving type.
             Type type = typeResolver.ResolveType(typeCfg.TypeName);
@@ -459,7 +568,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 var typeName = BinaryUtils.GetTypeName(type);
                 int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
                 var affKeyFld = typeCfg.AffinityKeyFieldName ?? GetAffinityKeyFieldNameFromAttribute(type);
-                var serializer = GetSerializer(cfg, typeCfg, type, typeId, nameMapper, idMapper);
+                var serializer = GetSerializer(cfg, typeCfg, type, typeId, nameMapper, idMapper, _log);
 
                 AddType(type, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, serializer,
                     affKeyFld, type.IsEnum, typeCfg.EqualityComparer);
@@ -479,16 +588,25 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Gets the serializer.
         /// </summary>
-        private static IBinarySerializerInternal GetSerializer(BinaryConfiguration cfg, BinaryTypeConfiguration typeCfg,
-            Type type, int typeId, IBinaryNameMapper nameMapper, IBinaryIdMapper idMapper)
+        private static IBinarySerializerInternal GetSerializer(BinaryConfiguration cfg, 
+            BinaryTypeConfiguration typeCfg, Type type, int typeId, IBinaryNameMapper nameMapper,
+            IBinaryIdMapper idMapper, ILogger log)
         {
-            var serializer = typeCfg.Serializer ?? cfg.DefaultSerializer;
+            var serializer = (typeCfg != null ? typeCfg.Serializer : null) ??
+                             (cfg != null ? cfg.DefaultSerializer : null);
 
             if (serializer == null)
             {
                 if (type.GetInterfaces().Contains(typeof(IBinarizable)))
                     return BinarizableSerializer.Instance;
 
+                if (type.GetInterfaces().Contains(typeof(ISerializable)))
+                {
+                    LogSerializableWarning(type, log);
+
+                    return new SerializableSerializer(type);
+                }
+
                 serializer = new BinaryReflectiveSerializer();
             }
 
@@ -531,14 +649,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="affKeyFieldName">Affinity key field name.</param>
         /// <param name="isEnum">Enum flag.</param>
         /// <param name="comparer">Comparer.</param>
-        private void AddType(Type type, int typeId, string typeName, bool userType, 
+        private void AddType(Type type, int typeId, string typeName, bool userType,
             bool keepDeserialized, IBinaryNameMapper nameMapper, IBinaryIdMapper idMapper,
-            IBinarySerializerInternal serializer, string affKeyFieldName, bool isEnum, 
+            IBinarySerializerInternal serializer, string affKeyFieldName, bool isEnum,
             IEqualityComparer<IBinaryObject> comparer)
         {
             long typeKey = BinaryUtils.TypeKey(userType, typeId);
 
-            IBinaryTypeDescriptor conflictingType;
+            BinaryFullTypeDescriptor conflictingType;
 
             if (_idToDesc.TryGetValue(typeKey, out conflictingType))
             {
@@ -548,8 +666,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                 var type2 = type != null ? type.AssemblyQualifiedName : typeName;
 
-                throw new BinaryObjectException(string.Format("Conflicting type IDs [type1='{0}', " +
-                                                              "type2='{1}', typeId={2}]", type1, type2, typeId));
+                ThrowConflictingTypeError(type1, type2, typeId);
             }
 
             if (userType && _typeNameToDesc.ContainsKey(typeName))
@@ -559,10 +676,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                 serializer, keepDeserialized, affKeyFieldName, isEnum, comparer);
 
             if (type != null)
-                _typeToDesc[type] = descriptor;
+                _typeToDesc.GetOrAdd(type, x => descriptor);
 
             if (userType)
-                _typeNameToDesc[typeName] = descriptor;
+                _typeNameToDesc.GetOrAdd(typeName, x => descriptor);
 
             _idToDesc.GetOrAdd(typeKey, _ => descriptor);
         }
@@ -570,7 +687,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Adds a predefined system type.
         /// </summary>
-        private void AddSystemType<T>(int typeId, Func<BinaryReader, T> ctor, string affKeyFldName = null, 
+        private void AddSystemType<T>(int typeId, Func<BinaryReader, T> ctor, string affKeyFldName = null,
             IBinarySerializerInternal serializer = null)
             where T : IBinaryWriteAware
         {
@@ -599,10 +716,6 @@ namespace Apache.Ignite.Core.Impl.Binary
             AddSystemType(BinaryUtils.TypeComputeFuncJob, r => new ComputeFuncJob(r));
             AddSystemType(BinaryUtils.TypeComputeActionJob, r => new ComputeActionJob(r));
             AddSystemType(BinaryUtils.TypeContinuousQueryRemoteFilterHolder, r => new ContinuousQueryFilterHolder(r));
-            AddSystemType(BinaryUtils.TypeSerializableHolder, r => new SerializableObjectHolder(r),
-                serializer: new SerializableSerializer());
-            AddSystemType(BinaryUtils.TypeDateTimeHolder, r => new DateTimeHolder(r),
-                serializer: new DateTimeSerializer());
             AddSystemType(BinaryUtils.TypeCacheEntryProcessorHolder, r => new CacheEntryProcessorHolder(r));
             AddSystemType(BinaryUtils.TypeCacheEntryPredicateHolder, r => new CacheEntryFilterHolder(r));
             AddSystemType(BinaryUtils.TypeMessageListenerHolder, r => new MessageListenerHolder(r));
@@ -612,5 +725,20 @@ namespace Apache.Ignite.Core.Impl.Binary
             AddSystemType(0, r => new ObjectInfoHolder(r));
             AddSystemType(BinaryUtils.TypeIgniteUuid, r => new IgniteGuid(r));
         }
+
+        /// <summary>
+        /// Logs the warning about ISerializable pitfalls.
+        /// </summary>
+        private static void LogSerializableWarning(Type type, ILogger log)
+        {
+            if (log == null)
+                return;
+
+            log.GetLogger(typeof(Marshaller).Name)
+                .Warn("Type '{0}' implements '{1}'. It will be written in Ignite binary format, however, " +
+                      "the following limitations apply: " +
+                      "DateTime fields would not work in SQL; " +
+                      "sbyte, ushort, uint, ulong fields would not work in DML.", type, typeof(ISerializable));
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReflectionUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReflectionUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReflectionUtils.cs
new file mode 100644
index 0000000..50c51a7
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReflectionUtils.cs
@@ -0,0 +1,50 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Reflection;
+
+    /// <summary>
+    /// Reflection utils.
+    /// </summary>
+    internal static class ReflectionUtils
+    {
+        /// <summary>
+        /// Gets all fields, including base classes.
+        /// </summary>
+        public static IEnumerable<FieldInfo> GetAllFields(Type type)
+        {
+            const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public |
+                                       BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
+
+            var curType = type;
+
+            while (curType != null)
+            {
+                foreach (var field in curType.GetFields(flags))
+                {
+                    yield return field;
+                }
+
+                curType = curType.BaseType;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
deleted file mode 100644
index 26b1d5f..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.Ignite.Core.Impl.Binary
-{
-    using System.Diagnostics;
-    using System.Runtime.Serialization.Formatters.Binary;
-    using Apache.Ignite.Core.Binary;
-    using Apache.Ignite.Core.Impl.Binary.IO;
-
-    /// <summary>
-    /// Wraps Serializable item in a binarizable.
-    /// </summary>
-    internal class SerializableObjectHolder : IBinaryWriteAware
-    {
-        /** */
-        private readonly object _item;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
-        /// </summary>
-        /// <param name="item">The item to wrap.</param>
-        public SerializableObjectHolder(object item)
-        {
-            _item = item;
-        }
-
-        /// <summary>
-        /// Gets the item to wrap.
-        /// </summary>
-        public object Item
-        {
-            get { return _item; }
-        }
-
-        /** <inheritDoc /> */
-        public void WriteBinary(IBinaryWriter writer)
-        {
-            Debug.Assert(writer != null);
-
-            var writer0 = (BinaryWriter)writer.GetRawWriter();
-
-            writer0.WithDetach(w =>
-            {
-                using (var streamAdapter = new BinaryStreamAdapter(w.Stream))
-                {
-                    new BinaryFormatter().Serialize(streamAdapter, Item);
-                }
-            });
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
-        /// </summary>
-        /// <param name="reader">The reader.</param>
-        public SerializableObjectHolder(BinaryReader reader)
-        {
-            Debug.Assert(reader != null);
-
-            using (var streamAdapter = new BinaryStreamAdapter(reader.Stream))
-            {
-                _item = new BinaryFormatter().Deserialize(streamAdapter, null);
-            }
-        }
-
-        /** <inheritdoc /> */
-        public override bool Equals(object obj)
-        {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != GetType()) return false;
-
-            return Equals(_item, ((SerializableObjectHolder) obj)._item);
-        }
-
-        /** <inheritdoc /> */
-        public override int GetHashCode()
-        {
-            return _item != null ? _item.GetHashCode() : 0;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
index 55ac3c0..6c7076a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableSerializer.cs
@@ -1,4 +1,4 @@
-/*
+\ufeff/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -18,31 +18,667 @@
 namespace Apache.Ignite.Core.Impl.Binary
 {
     using System;
+    using System.Collections.Generic;
+    using System.IO;
+    using System.Linq;
+    using System.Runtime.Serialization;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl.Binary.Metadata;
     using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
-    /// Serializable serializer.
+    /// Serializes classes that implement <see cref="ISerializable"/>.
     /// </summary>
     internal class SerializableSerializer : IBinarySerializerInternal
     {
+        /** */
+        private readonly SerializableTypeDescriptor _serializableTypeDesc;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SerializableSerializer"/> class.
+        /// </summary>
+        public SerializableSerializer(Type type)
+        {
+            IgniteArgumentCheck.NotNull(type, "type");
+
+            _serializableTypeDesc = SerializableTypeDescriptor.Get(type);
+        }
+        
         /** <inheritdoc /> */
-        public void WriteBinary<T>(T obj, BinaryWriter writer)
+        public bool SupportsHandles
         {
-            TypeCaster<SerializableObjectHolder>.Cast(obj).WriteBinary(writer);
+            get { return true; }
         }
 
         /** <inheritdoc /> */
-        public T ReadBinary<T>(BinaryReader reader, Type type, int pos)
+        public void WriteBinary<T>(T obj, BinaryWriter writer)
         {
-            var holder = new SerializableObjectHolder(reader);
+            var ctx = GetStreamingContext(writer);
+            _serializableTypeDesc.OnSerializing(obj, ctx);
+
+            var serializable = (ISerializable) obj;
+            var objType = obj.GetType();
+
+            // Get field values and write them.
+            var serInfo = new SerializationInfo(objType, new FormatterConverter());
+            serializable.GetObjectData(serInfo, ctx);
 
-            return TypeCaster<T>.Cast(holder.Item);
+            var dotNetFields = WriteSerializationInfo(writer, serInfo);
+
+            // Check if there is any additional information to be written.
+            var customType = GetCustomType(serInfo, serializable);
+
+            if (dotNetFields != null || writer.Marshaller.Ignite == null || customType != null)
+            {
+                // Set custom type flag in object header.
+                writer.SetCustomTypeDataFlag(true);
+
+                // Write additional information in raw mode.
+                writer.GetRawWriter();
+
+                WriteFieldNames(writer, serInfo);
+
+                WriteCustomTypeInfo(writer, customType);
+
+                WriteDotNetFields(writer, dotNetFields);
+            }
+
+            _serializableTypeDesc.OnSerialized(obj, ctx);
         }
 
         /** <inheritdoc /> */
-        public bool SupportsHandles
+        public T ReadBinary<T>(BinaryReader reader, IBinaryTypeDescriptor desc, int pos)
+        {
+            object res;
+            var ctx = GetStreamingContext(reader);
+            var callbackPushed = false;
+
+            // Read additional information from raw part, if flag is set.
+            IEnumerable<string> fieldNames;
+            Type customType = null;
+            ICollection<int> dotNetFields = null;
+
+            if (reader.GetCustomTypeDataFlag())
+            {
+                var oldPos = reader.Stream.Position;
+                reader.SeekToRaw();
+
+                fieldNames = ReadFieldNames(reader, desc);
+                customType = ReadCustomTypeInfo(reader);
+                dotNetFields = ReadDotNetFields(reader);
+
+                // Restore stream position.
+                reader.Stream.Seek(oldPos, SeekOrigin.Begin);
+            }
+            else
+            {
+                fieldNames = GetBinaryTypeFields(reader, desc);
+            }
+
+            try
+            {
+                if (customType != null)
+                {
+                    // Custom type is present, which returns original type via IObjectReference.
+                    var serInfo = ReadSerializationInfo(reader, fieldNames, desc, dotNetFields);
+
+                    res = ReadAsCustomType(customType, serInfo, ctx);
+
+                    // Handle is added after entire object is deserialized,
+                    // because handles should not point to a custom type wrapper.
+                    reader.AddHandle(pos, res);
+
+                    DeserializationCallbackProcessor.Push(res);
+                    callbackPushed = true;
+                }
+                else
+                {
+                    res = FormatterServices.GetUninitializedObject(desc.Type);
+
+                    _serializableTypeDesc.OnDeserializing(res, ctx);
+
+                    DeserializationCallbackProcessor.Push(res);
+                    callbackPushed = true;
+
+                    reader.AddHandle(pos, res);
+
+                    // Read actual data and call constructor.
+                    var serInfo = ReadSerializationInfo(reader, fieldNames, desc, dotNetFields);
+                    _serializableTypeDesc.SerializationCtorUninitialized(res, serInfo, ctx);
+                }
+
+                _serializableTypeDesc.OnDeserialized(res, ctx);
+            }
+            finally
+            {
+                if (callbackPushed)
+                    DeserializationCallbackProcessor.Pop();
+            }
+
+            return (T) res;
+        }
+
+        /// <summary>
+        /// Writes .NET-specific fields.
+        /// </summary>
+        private static void WriteDotNetFields(IBinaryRawWriter writer, ICollection<string> dotNetFields)
         {
-            get { return false; }
+            if (dotNetFields == null)
+            {
+                writer.WriteInt(0);
+
+                return;
+            }
+
+            writer.WriteInt(dotNetFields.Count);
+
+            foreach (var dotNetField in dotNetFields)
+            {
+                writer.WriteInt(BinaryUtils.GetStringHashCode(dotNetField));
+            }
+        }
+
+        /// <summary>
+        /// Writes .NET-specific fields.
+        /// </summary>
+        private static ICollection<int> ReadDotNetFields(IBinaryRawReader reader)
+        {
+            int count = reader.ReadInt();
+
+            if (count <= 0)
+                return null;
+
+            var res = new HashSet<int>();
+
+            for (int i = 0; i < count; i++)
+            {
+                res.Add(reader.ReadInt());
+            }
+
+            return res;
+        }
+
+        /// <summary>
+        /// Writes the field names.
+        /// </summary>
+        private static void WriteFieldNames(BinaryWriter writer, SerializationInfo serInfo)
+        {
+            if (writer.Marshaller.Ignite != null)
+            {
+                // Online mode: field names are in binary metadata.
+                writer.WriteInt(-1);
+                return;
+            }
+
+            // Offline mode: write all field names.
+            // Even if MemberCount is 0, write empty array to denote offline mode.
+            writer.WriteInt(serInfo.MemberCount);
+
+            foreach (var entry in serInfo)
+            {
+                writer.WriteString(entry.Name);
+            }
+        }
+
+        /// <summary>
+        /// Gets the field names.
+        /// </summary>
+        private static IEnumerable<string> ReadFieldNames(BinaryReader reader, IBinaryTypeDescriptor desc)
+        {
+            var fieldCount = reader.ReadInt();
+
+            if (fieldCount == 0)
+                return Enumerable.Empty<string>();
+
+            if (fieldCount > 0)
+            {
+                var fieldNames = new string[fieldCount];
+
+                for (var i = 0; i < fieldCount; i++)
+                {
+                    fieldNames[i] = reader.ReadString();
+                }
+
+                return fieldNames;
+            }
+
+            // Negative field count: online mode.
+            return GetBinaryTypeFields(reader, desc);
+        }
+
+        /// <summary>
+        /// Gets the binary type fields.
+        /// </summary>
+        private static IEnumerable<string> GetBinaryTypeFields(BinaryReader reader, IBinaryTypeDescriptor desc)
+        {
+            var binaryType = reader.Marshaller.GetBinaryType(desc.TypeId);
+
+            if (binaryType == BinaryType.Empty)
+            {
+                // Object without fields.
+                return Enumerable.Empty<string>();
+            }
+
+            return binaryType.Fields;
+        }
+
+        /// <summary>
+        /// Writes the custom type information.
+        /// </summary>
+        private static void WriteCustomTypeInfo(BinaryWriter writer, Type customType)
+        {
+            var raw = writer.GetRawWriter();
+
+            if (customType != null)
+            {
+                raw.WriteBoolean(true);
+
+                var desc = writer.Marshaller.GetDescriptor(customType);
+
+                if (desc.IsRegistered)
+                {
+                    raw.WriteBoolean(true);
+                    raw.WriteInt(desc.TypeId);
+                }
+                else
+                {
+                    raw.WriteBoolean(false);
+                    raw.WriteString(customType.FullName);
+                }
+            }
+            else
+            {
+                raw.WriteBoolean(false);
+            }
+        }
+
+        /// <summary>
+        /// Gets the custom serialization type.
+        /// </summary>
+        private static Type GetCustomType(SerializationInfo serInfo, ISerializable serializable)
+        {
+            // ISerializable implementor may call SerializationInfo.SetType() or FullTypeName setter.
+            // In that case there is no serialization ctor on objType. 
+            // Instead, we should instantiate specified custom type and then call IObjectReference.GetRealObject().
+            if (serInfo.IsFullTypeNameSetExplicit)
+            {
+                return new TypeResolver().ResolveType(serInfo.FullTypeName, serInfo.AssemblyName);
+            }
+            
+            if (serInfo.ObjectType != serializable.GetType())
+            {
+                return serInfo.ObjectType;
+            }
+
+            return null;
+        }
+
+        /// <summary>
+        /// Reads the custom type information.
+        /// </summary>
+        private static Type ReadCustomTypeInfo(BinaryReader reader)
+        {
+            if (!reader.ReadBoolean())
+                return null;
+
+            Type customType;
+
+            if (reader.ReadBoolean())
+            {
+                // Registered type written as type id.
+                var typeId = reader.ReadInt();
+                customType = reader.Marshaller.GetDescriptor(true, typeId, true).Type;
+
+                if (customType == null)
+                {
+                    throw new BinaryObjectException(string.Format(
+                        "Failed to resolve custom type provided by SerializationInfo: [typeId={0}]", typeId));
+                }
+            }
+            else
+            {
+                // Unregistered type written as type name.
+                var typeName = reader.ReadString();
+                customType = new TypeResolver().ResolveType(typeName);
+
+                if (customType == null)
+                {
+                    throw new BinaryObjectException(string.Format(
+                        "Failed to resolve custom type provided by SerializationInfo: [typeName={0}]", typeName));
+                }
+            }
+
+            return customType;
+        }
+
+        /// <summary>
+        /// Writes the serialization information.
+        /// </summary>
+        private static List<string> WriteSerializationInfo(IBinaryWriter writer, SerializationInfo serInfo)
+        {
+            List<string> dotNetFields = null;
+
+            // Write fields.
+            foreach (var entry in GetEntries(serInfo).OrderBy(x => x.Name))
+            {
+                WriteEntry(writer, entry);
+
+                var type = entry.Value == null ? null : entry.Value.GetType();
+
+                if (type == typeof(sbyte) || type == typeof(ushort) || type == typeof(uint) || type == typeof(ulong)
+                    || type == typeof(sbyte[]) || type == typeof(ushort[])
+                    || type == typeof(uint[]) || type == typeof(ulong[]))
+                {
+                    // Denote .NET-specific type.
+                    dotNetFields = dotNetFields ?? new List<string>();
+
+                    dotNetFields.Add(entry.Name);
+                }
+            }
+
+            return dotNetFields;
+        }
+
+        /// <summary>
+        /// Writes the serialization entry.
+        /// </summary>
+        private static void WriteEntry(IBinaryWriter writer, SerializationEntry entry)
+        {
+            unchecked
+            {
+                var type = entry.ObjectType;
+
+                if (type == typeof(byte))
+                {
+                    writer.WriteByte(entry.Name, (byte) entry.Value);
+                }
+                else if (type == typeof(byte[]))
+                {
+                    writer.WriteByteArray(entry.Name, (byte[]) entry.Value);
+                }
+                if (type == typeof(sbyte))
+                {
+                    writer.WriteByte(entry.Name, (byte) (sbyte) entry.Value);
+                }
+                else if (type == typeof(sbyte[]))
+                {
+                    writer.WriteByteArray(entry.Name, (byte[]) (Array) entry.Value);
+                }
+                else if (type == typeof(bool))
+                {
+                    writer.WriteBoolean(entry.Name, (bool) entry.Value);
+                }
+                else if (type == typeof(bool[]))
+                {
+                    writer.WriteBooleanArray(entry.Name, (bool[]) entry.Value);
+                }
+                else if (type == typeof(char))
+                {
+                    writer.WriteChar(entry.Name, (char) entry.Value);
+                }
+                else if (type == typeof(char[]))
+                {
+                    writer.WriteCharArray(entry.Name, (char[]) entry.Value);
+                }
+                else if (type == typeof(short))
+                {
+                    writer.WriteShort(entry.Name, (short) entry.Value);
+                }
+                else if (type == typeof(short[]))
+                {
+                    writer.WriteShortArray(entry.Name, (short[]) entry.Value);
+                }
+                else if (type == typeof(ushort))
+                {
+                    writer.WriteShort(entry.Name, (short) (ushort) entry.Value);
+                }
+                else if (type == typeof(ushort[]))
+                {
+                    writer.WriteShortArray(entry.Name, (short[]) (Array) entry.Value);
+                }
+                else if (type == typeof(int))
+                {
+                    writer.WriteInt(entry.Name, (int) entry.Value);
+                }
+                else if (type == typeof(int[]))
+                {
+                    writer.WriteIntArray(entry.Name, (int[]) entry.Value);
+                }
+                else if (type == typeof(uint))
+                {
+                    writer.WriteInt(entry.Name, (int) (uint) entry.Value);
+                }
+                else if (type == typeof(uint[]))
+                {
+                    writer.WriteIntArray(entry.Name, (int[]) (Array) entry.Value);
+                }
+                else if (type == typeof(long))
+                {
+                    writer.WriteLong(entry.Name, (long) entry.Value);
+                }
+                else if (type == typeof(long[]))
+                {
+                    writer.WriteLongArray(entry.Name, (long[]) entry.Value);
+                }
+                else if (type == typeof(ulong))
+                {
+                    writer.WriteLong(entry.Name, (long) (ulong) entry.Value);
+                }
+                else if (type == typeof(ulong[]))
+                {
+                    writer.WriteLongArray(entry.Name, (long[]) (Array) entry.Value);
+                }
+                else if (type == typeof(float))
+                {
+                    writer.WriteFloat(entry.Name, (float) entry.Value);
+                }
+                else if (type == typeof(float[]))
+                {
+                    writer.WriteFloatArray(entry.Name, (float[]) entry.Value);
+                }
+                else if (type == typeof(double))
+                {
+                    writer.WriteDouble(entry.Name, (double) entry.Value);
+                }
+                else if (type == typeof(double[]))
+                {
+                    writer.WriteDoubleArray(entry.Name, (double[]) entry.Value);
+                }
+                else if (type == typeof(decimal))
+                {
+                    writer.WriteDecimal(entry.Name, (decimal) entry.Value);
+                }
+                else if (type == typeof(decimal?))
+                {
+                    writer.WriteDecimal(entry.Name, (decimal?) entry.Value);
+                }
+                else if (type == typeof(decimal?[]))
+                {
+                    writer.WriteDecimalArray(entry.Name, (decimal?[]) entry.Value);
+                }
+                else if (type == typeof(string))
+                {
+                    writer.WriteString(entry.Name, (string) entry.Value);
+                }
+                else if (type == typeof(string[]))
+                {
+                    writer.WriteStringArray(entry.Name, (string[]) entry.Value);
+                }
+                else if (type == typeof(Guid))
+                {
+                    writer.WriteGuid(entry.Name, (Guid) entry.Value);
+                }
+                else if (type == typeof(Guid?))
+                {
+                    writer.WriteGuid(entry.Name, (Guid?) entry.Value);
+                }
+                else if (type == typeof(Guid?[]))
+                {
+                    writer.WriteGuidArray(entry.Name, (Guid?[]) entry.Value);
+                }
+                else
+                {
+                    writer.WriteObject(entry.Name, entry.Value);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Gets the entries.
+        /// </summary>
+        private static IEnumerable<SerializationEntry> GetEntries(SerializationInfo serInfo)
+        {
+            foreach (var entry in serInfo)
+            {
+                yield return entry;
+            }
+        }
+
+        /// <summary>
+        /// Reads the serialization information.
+        /// </summary>
+        private static SerializationInfo ReadSerializationInfo(BinaryReader reader, 
+            IEnumerable<string> fieldNames, IBinaryTypeDescriptor desc, ICollection<int> dotNetFields)
+        {
+            var serInfo = new SerializationInfo(desc.Type, new FormatterConverter());
+
+            if (dotNetFields == null)
+            {
+                foreach (var fieldName in fieldNames)
+                {
+                    var fieldVal = reader.ReadObject<object>(fieldName);
+
+                    serInfo.AddValue(fieldName, fieldVal);
+                }
+            }
+            else
+            {
+                foreach (var fieldName in fieldNames)
+                {
+                    var fieldVal = ReadField(reader, fieldName, dotNetFields);
+
+                    serInfo.AddValue(fieldName, fieldVal);
+                }
+            }
+
+            return serInfo;
+        }
+
+        /// <summary>
+        /// Reads the object as a custom type.
+        /// </summary>
+        private static object ReadAsCustomType(Type customType, SerializationInfo serInfo, StreamingContext ctx)
+        {
+            var ctorFunc = SerializableTypeDescriptor.Get(customType).SerializationCtor;
+
+            var customObj = ctorFunc(serInfo, ctx);
+
+            var wrapper = customObj as IObjectReference;
+
+            return wrapper == null
+                ? customObj
+                : wrapper.GetRealObject(ctx);
+        }
+
+        /// <summary>
+        /// Gets the streaming context.
+        /// </summary>
+        private static StreamingContext GetStreamingContext(IBinaryReader reader)
+        {
+            return new StreamingContext(StreamingContextStates.All, reader);
+        }
+
+        /// <summary>
+        /// Gets the streaming context.
+        /// </summary>
+        private static StreamingContext GetStreamingContext(IBinaryWriter writer)
+        {
+            return new StreamingContext(StreamingContextStates.All, writer);
+        }
+
+        /// <summary>
+        /// Reads the field.
+        /// <para />
+        /// Java side does not have counterparts for byte, ushort, uint, ulong.
+        /// For such fields we write a special boolean field indicating the type.
+        /// If special field is present, then the value has to be converted to .NET-specific type.
+        /// </summary>
+        private static object ReadField(IBinaryReader reader, string fieldName, ICollection<int> dotNetFields)
+        {
+            var fieldVal = reader.ReadObject<object>(fieldName);
+
+            if (fieldVal == null)
+                return null;
+
+            var fieldType = fieldVal.GetType();
+
+            unchecked
+            {
+                if (fieldType == typeof(byte))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? (sbyte) (byte) fieldVal : fieldVal;
+                }
+
+                if (fieldType == typeof(short))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? (ushort) (short) fieldVal : fieldVal;
+                }
+
+                if (fieldType == typeof(int))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? (uint) (int) fieldVal : fieldVal;
+                }
+
+                if (fieldType == typeof(long))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? (ulong) (long) fieldVal : fieldVal;
+                }
+
+                if (fieldType == typeof(byte[]))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? ConvertArray<byte, sbyte>((byte[]) fieldVal) : fieldVal;
+                }
+
+                if (fieldType == typeof(short[]))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName))
+                        ? ConvertArray<short, ushort>((short[]) fieldVal) : fieldVal;
+                }
+
+                if (fieldType == typeof(int[]))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? ConvertArray<int, uint>((int[]) fieldVal) : fieldVal;
+                }
+
+                if (fieldType == typeof(long[]))
+                {
+                    return dotNetFields.Contains(BinaryUtils.GetStringHashCode(fieldName)) 
+                        ? ConvertArray<long, ulong>((long[]) fieldVal) : fieldVal;
+                }
+            }
+
+            return fieldVal;
+        }
+
+        /// <summary>
+        /// Converts the array.
+        /// </summary>
+        private static TU[] ConvertArray<T, TU>(T[] arr)
+        {
+            var res = new TU[arr.Length];
+
+            for (var i = 0; i < arr.Length; i++)
+            {
+                res[i] = TypeCaster<TU>.Cast(arr[i]);
+            }
+
+            return res;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
index 340dac4..36dde4b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
@@ -50,6 +50,13 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             Debug.Assert(!string.IsNullOrEmpty(typeName));
 
+            // Fully-qualified name can be resolved with system mechanism.
+            var type = Type.GetType(typeName, false);
+
+            if (type != null)
+                return type;
+
+            // Partial names should be resolved by scanning assemblies.
             return ResolveType(assemblyName, typeName, AppDomain.CurrentDomain.GetAssemblies())
                 ?? ResolveTypeInReferencedAssemblies(assemblyName, typeName);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/UserSerializerProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/UserSerializerProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/UserSerializerProxy.cs
index de25e32..b0d393d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/UserSerializerProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/UserSerializerProxy.cs
@@ -17,7 +17,6 @@
 
 namespace Apache.Ignite.Core.Impl.Binary
 {
-    using System;
     using System.Diagnostics;
     using System.Runtime.Serialization;
     using Apache.Ignite.Core.Binary;
@@ -48,9 +47,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /** <inheritdoc /> */
-        public T ReadBinary<T>(BinaryReader reader, Type type, int pos)
+        public T ReadBinary<T>(BinaryReader reader, IBinaryTypeDescriptor desc, int pos)
         {
-            var obj = FormatterServices.GetUninitializedObject(type);
+            var obj = FormatterServices.GetUninitializedObject(desc.Type);
 
             reader.AddHandle(pos, obj);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
index 5d940c5..73afe38 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionSerializer.cs
@@ -255,9 +255,6 @@ namespace Apache.Ignite.Core.Impl.Cache.Affinity
                 return;
             }
 
-            if (func != null && !func.GetType().IsSerializable)
-                throw new IgniteException("AffinityFunction should be serializable.");
-
             writer.WriteObject(func);
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index a387e1b..2523cf7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -150,7 +150,8 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** <inheritDoc /> */
         public CacheConfiguration GetConfiguration()
         {
-            return DoInOp((int) CacheOp.GetConfig, stream => new CacheConfiguration(Marshaller.StartUnmarshal(stream)));
+            return DoInOp((int) CacheOp.GetConfig, stream => new CacheConfiguration(
+                BinaryUtils.Marshaller.StartUnmarshal(stream)));
         }
 
         /** <inheritDoc /> */

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
index 01fc8a9..78cb8b6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+// ReSharper disable InconsistentlySynchronizedField
 namespace Apache.Ignite.Core.Impl.Common
 {
     using System;
@@ -69,5 +70,39 @@ namespace Apache.Ignite.Core.Impl.Common
                 return res;
             }
         }
+
+        /// <summary>
+        /// Sets a value for the key unconditionally.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <param name="value">The value.</param>
+        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
+        public void Set(TKey key, TValue value)
+        {
+            lock (this)
+            {
+                var dict0 = new Dictionary<TKey, TValue>(_dict);
+
+                dict0[key] = value;
+
+                _dict = dict0;
+            }
+        }
+
+        /// <summary>
+        /// Determines whether the specified key exists in the dictionary.
+        /// </summary>
+        public bool ContainsKey(TKey key)
+        {
+            return _dict.ContainsKey(key);
+        }
+
+        /// <summary>
+        /// Gets the values.
+        /// </summary>
+        public ICollection<TValue> Values
+        {
+            get { return _dict.Values; }
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
index ff61e28..0407b62 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Common
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
+    using System.Linq;
     using System.Linq.Expressions;
     using System.Reflection;
     using System.Reflection.Emit;
@@ -203,13 +204,16 @@ namespace Apache.Ignite.Core.Impl.Common
         /// <typeparam name="T">Result func type.</typeparam>
         /// <param name="ctor">Contructor info.</param>
         /// <param name="argTypes">Argument types.</param>
-        /// <param name="convertResultToObject">if set to <c>true</c> [convert result to object].
+        /// <param name="convertResultToObject">
         /// Flag that indicates whether ctor return value should be converted to object.</param>
+        /// <param name="convertParamsFromObject">
+        /// Flag that indicates whether ctor args are object and should be converted to concrete type.</param>
         /// <returns>
         /// Compiled generic constructor.
         /// </returns>
         [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
-        public static T CompileCtor<T>(ConstructorInfo ctor, Type[] argTypes, bool convertResultToObject = true)
+        public static T CompileCtor<T>(ConstructorInfo ctor, Type[] argTypes, bool convertResultToObject = true,
+            bool convertParamsFromObject = true)
         {
             Debug.Assert(ctor != null);
 
@@ -218,9 +222,16 @@ namespace Apache.Ignite.Core.Impl.Common
 
             for (var i = 0; i < argTypes.Length; i++)
             {
-                var arg = Expression.Parameter(typeof(object));
-                args[i] = arg;
-                argsConverted[i] = Expression.Convert(arg, argTypes[i]);
+                if (convertParamsFromObject)
+                {
+                    var arg = Expression.Parameter(typeof(object));
+                    args[i] = arg;
+                    argsConverted[i] = Expression.Convert(arg, argTypes[i]);
+                }
+                else
+                {
+                    argsConverted[i] = args[i] = Expression.Parameter(argTypes[i]);
+                }
             }
 
             Expression ctorExpr = Expression.New(ctor, argsConverted);  // ctor takes args of specific types
@@ -232,6 +243,50 @@ namespace Apache.Ignite.Core.Impl.Common
         }
 
         /// <summary>
+        /// Compiles a generic ctor with arbitrary number of arguments
+        /// that takes an uninitialized object as a first arguments.
+        /// </summary>
+        /// <typeparam name="T">Result func type.</typeparam>
+        /// <param name="ctor">Contructor info.</param>
+        /// <param name="argTypes">Argument types.</param>
+        /// <returns>
+        /// Compiled generic constructor.
+        /// </returns>
+        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
+        public static T CompileUninitializedObjectCtor<T>(ConstructorInfo ctor, Type[] argTypes)
+        {
+            Debug.Assert(ctor != null);
+            Debug.Assert(ctor.DeclaringType != null);
+            Debug.Assert(argTypes != null);
+
+            argTypes = new[] {typeof(object)}.Concat(argTypes).ToArray();
+
+            var helperMethod = new DynamicMethod(string.Empty, typeof(void), argTypes, ctor.Module, true);
+            var il = helperMethod.GetILGenerator();
+
+            il.Emit(OpCodes.Ldarg_0);
+
+            if (ctor.DeclaringType.IsValueType)
+                il.Emit(OpCodes.Unbox, ctor.DeclaringType);   // modify boxed copy
+
+            if (argTypes.Length > 1)
+                il.Emit(OpCodes.Ldarg_1);
+
+            if (argTypes.Length > 2)
+                il.Emit(OpCodes.Ldarg_2);
+
+            if (argTypes.Length > 3)
+                throw new NotSupportedException("Not supported: too many ctor args.");
+
+            il.Emit(OpCodes.Call, ctor);
+            il.Emit(OpCodes.Ret);
+
+            var constructorInvoker = helperMethod.CreateDelegate(typeof(T));
+
+            return (T) (object) constructorInvoker;
+        }
+
+        /// <summary>
         /// Compiles a generic ctor with arbitrary number of arguments.
         /// </summary>
         /// <typeparam name="T">Result func type.</typeparam>
@@ -440,5 +495,30 @@ namespace Apache.Ignite.Core.Impl.Common
 
             return method;
         }
+
+        /// <summary>
+        /// Gets the constructor with exactly matching signature.
+        /// <para />
+        /// Type.GetConstructor matches compatible ones (i.e. taking object instead of concrete type).
+        /// </summary>
+        /// <param name="type">The type.</param>
+        /// <param name="types">The argument types.</param>
+        /// <returns>Constructor info.</returns>
+        public static ConstructorInfo GetConstructorExact(Type type, Type[] types)
+        {
+            Debug.Assert(type != null);
+            Debug.Assert(types != null);
+
+            foreach (var constructorInfo in type.GetConstructors(
+                BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
+            {
+                var ctorTypes = constructorInfo.GetParameters().Select(x => x.ParameterType);
+
+                if (ctorTypes.SequenceEqual(types))
+                    return constructorInfo;
+            }
+
+            return null;
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
index 2e837c4..4cd0678 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Common
 {
     using System;
     using System.Globalization;
-
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Event;
     using Apache.Ignite.Core.Compute;
@@ -37,7 +36,7 @@ namespace Apache.Ignite.Core.Impl.Common
     /// </summary>
     internal class DelegateTypeDescriptor
     {
-        /** Cached decriptors. */
+        /** Cached descriptors. */
         private static readonly CopyOnWriteConcurrentDictionary<Type, DelegateTypeDescriptor> Descriptors 
             = new CopyOnWriteConcurrentDictionary<Type, DelegateTypeDescriptor>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/SerializableTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/SerializableTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/SerializableTypeDescriptor.cs
new file mode 100644
index 0000000..f16e32a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/SerializableTypeDescriptor.cs
@@ -0,0 +1,222 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Common
+{
+    using System;
+    using System.Diagnostics;
+    using System.Reflection;
+    using System.Runtime.Serialization;
+
+    /// <summary>
+    /// Type descriptor with precompiled delegates to call serialization-related methods.
+    /// </summary>
+    internal class SerializableTypeDescriptor
+    {
+        /** Cached descriptors. */
+        private static readonly CopyOnWriteConcurrentDictionary<Type, SerializableTypeDescriptor> Descriptors 
+            = new CopyOnWriteConcurrentDictionary<Type, SerializableTypeDescriptor>();
+
+        /** */
+        private readonly Type _type;
+
+        /** */
+        private readonly Func<SerializationInfo, StreamingContext, object> _serializationCtor;
+
+        /** */
+        private readonly Action<object, SerializationInfo, StreamingContext> _serializationCtorUninitialized;
+
+        /** */
+        private readonly Action<object, StreamingContext> _onSerializing;
+
+        /** */
+        private readonly Action<object, StreamingContext> _onSerialized;
+
+        /** */
+        private readonly Action<object, StreamingContext> _onDeserializing;
+
+        /** */
+        private readonly Action<object, StreamingContext> _onDeserialized;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SerializableTypeDescriptor"/> class.
+        /// </summary>
+        /// <param name="type">The type.</param>
+        private SerializableTypeDescriptor(Type type)
+        {
+            Debug.Assert(type != null);
+
+            _type = type;
+
+            // Check if there is a serialization ctor.
+            var argTypes = new[] {typeof(SerializationInfo), typeof(StreamingContext)};
+
+            var serializationCtorInfo = DelegateConverter.GetConstructorExact(type, argTypes);
+
+            if (serializationCtorInfo != null)
+            {
+                _serializationCtor = DelegateConverter.CompileCtor<Func<SerializationInfo, StreamingContext, object>>(
+                    serializationCtorInfo, argTypes, convertParamsFromObject: false);
+
+                _serializationCtorUninitialized = DelegateConverter.CompileUninitializedObjectCtor<
+                    Action<object, SerializationInfo, StreamingContext>>(serializationCtorInfo, argTypes);
+            }
+
+            // Scan methods for callback attributes.
+            // Initialize to empty delegates to avoid null checks.
+            _onSerializing = _onSerialized = _onDeserializing = _onDeserialized = (o, c) => { };
+
+            var baseType = type;
+
+            while (baseType != typeof(object) && baseType != null)
+            {
+                var methods = baseType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance
+                                                  | BindingFlags.NonPublic | BindingFlags.Public);
+
+                foreach (var method in methods)
+                {
+                    if (method.IsDefined(typeof(OnSerializingAttribute), false))
+                    {
+                        _onSerializing += CompileCallbackMethod(method);
+                    }
+
+                    if (method.IsDefined(typeof(OnSerializedAttribute), false))
+                    {
+                        _onSerialized += CompileCallbackMethod(method);
+                    }
+
+                    if (method.IsDefined(typeof(OnDeserializingAttribute), false))
+                    {
+                        _onDeserializing += CompileCallbackMethod(method);
+                    }
+
+                    if (method.IsDefined(typeof(OnDeserializedAttribute), false))
+                    {
+                        _onDeserialized += CompileCallbackMethod(method);
+                    }
+                }
+
+                baseType = baseType.BaseType;
+            }
+        }
+
+        /// <summary>
+        /// Gets the serialization ctor.
+        /// </summary>
+        public Func<SerializationInfo, StreamingContext, object> SerializationCtor
+        {
+            get
+            {
+                if (_serializationCtor == null)
+                    throw GetMissingCtorException();
+
+                return _serializationCtor;
+            }
+        }
+
+        /// <summary>
+        /// Gets the serialization ctor to call on an uninitialized instance.
+        /// </summary>
+        public Action<object, SerializationInfo, StreamingContext> SerializationCtorUninitialized
+        {
+            get
+            {
+                if (_serializationCtorUninitialized == null)
+                    throw GetMissingCtorException();
+
+                return _serializationCtorUninitialized;
+            }
+        }
+
+        /// <summary>
+        /// Gets the OnSerializing callback action.
+        /// </summary>
+        public Action<object, StreamingContext> OnSerializing
+        {
+            get { return _onSerializing; }
+        }
+
+        /// <summary>
+        /// Gets the OnSerialized callback action.
+        /// </summary>
+        public Action<object, StreamingContext> OnSerialized
+        {
+            get { return _onSerialized; }
+        }
+
+        /// <summary>
+        /// Gets the OnDeserializing callback action.
+        /// </summary>
+        public Action<object, StreamingContext> OnDeserializing
+        {
+            get { return _onDeserializing; }
+        }
+
+        /// <summary>
+        /// Gets the OnDeserialized callback action.
+        /// </summary>
+        public Action<object, StreamingContext> OnDeserialized
+        {
+            get { return _onDeserialized; }
+        }
+
+        /// <summary>
+        /// Gets the <see cref="DelegateTypeDescriptor" /> by type.
+        /// </summary>
+        public static SerializableTypeDescriptor Get(Type type)
+        {
+            SerializableTypeDescriptor result;
+
+            return Descriptors.TryGetValue(type, out result)
+                ? result
+                : Descriptors.GetOrAdd(type, t => new SerializableTypeDescriptor(t));
+        }
+                
+        /// <summary>
+        /// Gets the missing ctor exception.
+        /// </summary>
+        private SerializationException GetMissingCtorException()
+        {
+            // Same exception as .NET code throws.
+            return new SerializationException(
+                string.Format("The constructor to deserialize an object of type '{0}' was not found.", _type));
+        }
+                
+        /// <summary>
+        /// Checks that callback method has signature "void (StreamingContext)" and compiles it.
+        /// </summary>
+        private static Action<object, StreamingContext> CompileCallbackMethod(MethodInfo method)
+        {
+            Debug.Assert(method != null);
+            Debug.Assert(method.DeclaringType != null);
+
+            var parameters = method.GetParameters();
+
+            if (method.ReturnType != typeof(void) || parameters.Length != 1 ||
+                parameters[0].ParameterType != typeof(StreamingContext))
+            {
+                throw new TypeLoadException(
+                    string.Format("Type '{0}' in assembly '{1}' has method '{2}' with an incorrect " +
+                                  "signature for the serialization attribute that it is decorated with.",
+                        method.DeclaringType, method.DeclaringType.Assembly, method.Name));
+            }
+
+            return DelegateConverter.CompileFunc<Action<object, StreamingContext>>(
+                method.DeclaringType, method, new[] {typeof(StreamingContext)}, new[] {false, false});
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index f79822d..c38cd95 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -157,7 +157,7 @@ namespace Apache.Ignite.Core.Impl
         {
             if (!string.IsNullOrEmpty(_cfg.SpringConfigUrl))
             {
-                // If there is a Spring config, use setting from Spring, 
+                // If there is a Spring config, use setting from Spring,
                 // since we ignore .NET config in legacy mode.
                 var cfg0 = GetConfiguration().BinaryConfiguration;
 
@@ -424,7 +424,7 @@ namespace Apache.Ignite.Core.Impl
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
             {
-                var writer = Marshaller.StartMarshal(stream);
+                var writer = BinaryUtils.Marshaller.StartMarshal(stream);
 
                 configuration.Write(writer);
 
@@ -463,7 +463,8 @@ namespace Apache.Ignite.Core.Impl
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
             {
-                var writer = Marshaller.StartMarshal(stream);
+                // Use system marshaller: full footers, always unregistered mode.
+                var writer = BinaryUtils.Marshaller.StartMarshal(stream);
 
                 configuration.Write(writer);
 
@@ -639,6 +640,8 @@ namespace Apache.Ignite.Core.Impl
 
                 writer.Write(initialValue);
 
+                Marshaller.FinishMarshal(writer);
+
                 var memPtr = stream.SynchronizeOutput();
 
                 return UU.ProcessorAtomicReference(_proc, name, memPtr, true);
@@ -654,7 +657,7 @@ namespace Apache.Ignite.Core.Impl
 
                 stream.SynchronizeInput();
 
-                return new IgniteConfiguration(_marsh.StartUnmarshal(stream), _cfg);
+                return new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(stream), _cfg);
             }
         }
 
@@ -724,7 +727,7 @@ namespace Apache.Ignite.Core.Impl
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
             {
-                var writer = Marshaller.StartMarshal(stream);
+                var writer = BinaryUtils.Marshaller.StartMarshal(stream);
 
                 configuration.Write(writer);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
index 8e44360..2fd020e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
@@ -118,6 +118,8 @@ namespace Apache.Ignite.Core.Impl.Services
             var writer = marsh.StartMarshal(stream);
 
             BinaryUtils.WriteInvocationResult(writer, invocationError == null, invocationError ?? methodResult);
+
+            marsh.FinishMarshal(writer);
         }
 
         /// <summary>
@@ -182,7 +184,7 @@ namespace Apache.Ignite.Core.Impl.Services
 
             var handler = BinarySystemHandlers.GetWriteHandler(type);
 
-            if (handler != null && !handler.IsSerializable)
+            if (handler != null)
                 return null;
 
             if (type.IsArray)

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
index 91ffabb..3028f08 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
@@ -376,7 +376,11 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
                 {
                     stream.Reset();
 
-                    _ignite.Marshaller.StartMarshal(stream).WriteObject(e);
+                    var writer = _ignite.Marshaller.StartMarshal(stream);
+
+                    writer.WriteObject(e);
+
+                    _ignite.Marshaller.FinishMarshal(writer);
 
                     return -1;
                 }
@@ -1164,7 +1168,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
         {
             using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
             {
-                var reader = _ignite.Marshaller.StartUnmarshal(stream);
+                var reader = BinaryUtils.Marshaller.StartUnmarshal(stream);
 
                 var func = reader.ReadObjectEx<IAffinityFunction>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/ComputeExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/ComputeExample.linq b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/ComputeExample.linq
index 2ed0493..6886ddb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/ComputeExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/ComputeExample.linq
@@ -57,7 +57,6 @@ void Main()
 /// <summary>
 /// Closure counting characters in a string.
 /// </summary>
-[Serializable]
 public class CharacterCountClosure : IComputeFunc<string, int>
 {
 	/// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
index 7c77d09..ea396da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/PutGetExample.linq
@@ -35,11 +35,8 @@ void Main()
 	// Force new LINQPad query process to reinit JVM
 	Util.NewProcess = true;
 	
-    // Configure cacheable types
-    var cfg = new IgniteConfiguration {BinaryConfiguration = new BinaryConfiguration(typeof(Organization))};
-
     // Start instance
-    using (var ignite = Ignition.Start(cfg))
+    using (var ignite = Ignition.Start())
     {
         // Create new cache
         var cache = ignite.GetOrCreateCache<int, Organization>("orgs");

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
index 2a2454e..8a7dd10 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/NuGet/LINQPad/QueryExample.linq
@@ -38,11 +38,8 @@ void Main()
 	// Force new LINQPad query process to reinit JVM
 	Util.NewProcess = true;
 	
-	// Configure cacheable types
-    var cfg = new IgniteConfiguration { BinaryConfiguration = new BinaryConfiguration(typeof(Organization), typeof(Person))	};
-
     // Start instance
-    using (var ignite = Ignition.Start(cfg))
+    using (var ignite = Ignition.Start())
     {
         // Create and populate organization cache
         var orgs = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration("orgs-sql", 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq b/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
index 6a28f1f..fb44b12 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/NuGet/LINQPad/QueryExample.linq
@@ -39,11 +39,8 @@ void Main()
 	// Force new LINQPad query process to reinit JVM
 	Util.NewProcess = true;
 	
-	// Configure cacheable types
-    var cfg = new IgniteConfiguration { BinaryConfiguration = new BinaryConfiguration(typeof(Organization), typeof(Person))	};
-
 	// Start instance
-	using (var ignite = Ignition.Start(cfg))
+	using (var ignite = Ignition.Start())
 	{
 		// Create and populate organization cache
 		var orgs = ignite.GetOrCreateCache<int, Organization>(new CacheConfiguration("orgs-linq",

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config
index 13f0d86..e3bc79d 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config
@@ -27,22 +27,8 @@
     </runtime>
 
     <igniteConfiguration xmlns="http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection">
-        <binaryConfiguration>
-            <typeConfigurations>
-                <binaryTypeConfiguration typeName="Apache.Ignite.ExamplesDll.Binary.OrganizationType" isEnum="true" />
-            </typeConfigurations>
-            <types>
-                <string>Apache.Ignite.ExamplesDll.Binary.Account</string>
-                <string>Apache.Ignite.ExamplesDll.Binary.Address</string>
-                <string>Apache.Ignite.ExamplesDll.Binary.Employee</string>
-                <string>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</string>
-                <string>Apache.Ignite.ExamplesDll.Binary.Organization</string>
-                <string>Apache.Ignite.ExamplesDll.Compute.AverageSalaryJob</string>
-            </types>
-        </binaryConfiguration>
-
         <atomicConfiguration atomicSequenceReserveSize="10" />
-        
+
         <discoverySpi type="TcpDiscoverySpi">
             <ipFinder type="TcpDiscoveryMulticastIpFinder">
                 <endpoints>


[18/18] ignite git commit: Merge master into ignite-3477-master

Posted by ag...@apache.org.
Merge master into ignite-3477-master


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

Branch: refs/heads/ignite-3477-master
Commit: db10c451e105dac961cea8a7290feddfc5c100d4
Parents: d0665c1 b43dd2b
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Mar 31 19:22:22 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Mar 31 19:22:22 2017 +0300

----------------------------------------------------------------------
 .../spi/checkpoint/s3/S3CheckpointSpi.java      |  72 +-
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java |  27 +-
 .../cloud/TcpDiscoveryCloudIpFinder.java        |  51 +-
 .../ignite/binary/BinaryBasicIdMapper.java      |   5 +-
 .../ignite/binary/BinaryBasicNameMapper.java    |   5 +-
 .../ignite/binary/BinaryTypeConfiguration.java  |  30 +-
 .../ignite/cache/CacheKeyConfiguration.java     |  10 +-
 .../org/apache/ignite/cache/QueryEntity.java    |  35 +-
 .../affinity/fair/FairAffinityFunction.java     |  21 +-
 .../rendezvous/RendezvousAffinityFunction.java  |  27 +-
 .../cache/eviction/AbstractEvictionPolicy.java  |  15 +-
 .../cache/eviction/fifo/FifoEvictionPolicy.java |  74 +-
 .../eviction/fifo/FifoEvictionPolicyMBean.java  |   2 +
 .../igfs/IgfsPerBlockLruEvictionPolicy.java     | 131 +++-
 .../cache/eviction/lru/LruEvictionPolicy.java   |  74 +-
 .../eviction/sorted/SortedEvictionPolicy.java   |  74 +-
 .../configuration/AtomicConfiguration.java      |  15 +-
 .../configuration/BinaryConfiguration.java      |  30 +-
 .../configuration/CacheConfiguration.java       |  71 +-
 .../configuration/CollectionConfiguration.java  |  35 +-
 .../configuration/ConnectorConfiguration.java   | 100 ++-
 .../configuration/FileSystemConfiguration.java  | 151 +++-
 .../configuration/HadoopConfiguration.java      |  31 +-
 .../configuration/NearCacheConfiguration.java   |  50 ++
 .../configuration/TransactionConfiguration.java |  45 +-
 .../igfs/IgfsGroupDataBlocksKeyMapper.java      |   5 +-
 .../igfs/IgfsIpcEndpointConfiguration.java      |  30 +-
 .../ignite/internal/MarshallerPlatformIds.java  |   3 +
 .../ignite/internal/binary/BinaryUtils.java     |   4 +
 .../client/GridClientConfiguration.java         | 100 ++-
 .../client/GridClientDataConfiguration.java     |  15 +-
 .../client/GridClientPartitionAffinity.java     |  15 +-
 .../balancer/GridClientBalancerAdapter.java     |   5 +-
 .../router/GridTcpRouterConfiguration.java      |  50 +-
 .../internal/jdbc2/JdbcSqlFieldsQuery.java      |  57 ++
 .../processors/cache/GridCacheProcessor.java    |  39 +-
 .../platform/PlatformContextImpl.java           |  10 +-
 .../binary/PlatformBinaryProcessor.java         |  40 +-
 .../dotnet/PlatformDotNetConfigurationEx.java   |  21 +-
 .../utils/PlatformConfigurationUtils.java       |   3 +-
 .../optimized/OptimizedMarshaller.java          |  15 +-
 .../apache/ignite/mxbean/IgniteMBeanAware.java  |  28 +
 .../dotnet/PlatformDotNetAffinityFunction.java  |  10 +-
 .../PlatformDotNetBinaryConfiguration.java      |  31 +-
 .../PlatformDotNetBinaryTypeConfiguration.java  |  35 +-
 .../dotnet/PlatformDotNetConfiguration.java     |  10 +-
 .../ignite/services/ServiceConfiguration.java   |  35 +-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  50 +-
 .../ignite/spi/IgniteSpiMBeanAdapter.java       |  78 ++
 .../checkpoint/cache/CacheCheckpointSpi.java    |  40 +-
 .../spi/checkpoint/jdbc/JdbcCheckpointSpi.java  | 219 +++++-
 .../spi/checkpoint/noop/NoopCheckpointSpi.java  |   7 +
 .../sharedfs/SharedFsCheckpointSpi.java         |  54 +-
 .../fifoqueue/FifoQueueCollisionSpi.java        | 134 +++-
 .../fifoqueue/FifoQueueCollisionSpiMBean.java   |   2 +-
 .../jobstealing/JobStealingCollisionSpi.java    | 281 ++++++-
 .../JobStealingCollisionSpiMBean.java           |   6 +-
 .../spi/collision/noop/NoopCollisionSpi.java    |   7 +
 .../PriorityQueueCollisionSpi.java              | 278 +++++--
 .../PriorityQueueCollisionSpiMBean.java         |   2 +-
 .../communication/tcp/TcpCommunicationSpi.java  | 536 +++++++++++--
 .../deployment/local/LocalDeploymentSpi.java    |  24 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   6 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 438 +++++++++--
 .../ipfinder/TcpDiscoveryIpFinderAdapter.java   |   5 +-
 .../ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java |  17 +-
 .../TcpDiscoveryMulticastIpFinder.java          |  47 +-
 .../sharedfs/TcpDiscoverySharedFsIpFinder.java  |  12 +-
 .../tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java |  14 +-
 .../memory/MemoryEventStorageSpi.java           |  98 ++-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  53 +-
 .../jobstealing/JobStealingFailoverSpi.java     |  68 +-
 .../spi/failover/never/NeverFailoverSpi.java    |  30 +-
 .../spi/indexing/noop/NoopIndexingSpi.java      |   7 +
 .../adaptive/AdaptiveLoadBalancingSpi.java      |  43 +-
 .../roundrobin/RoundRobinLoadBalancingSpi.java  |  44 +-
 .../WeightedRandomLoadBalancingSpi.java         |  61 +-
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  |  33 +-
 .../fs/IgniteHadoopIgfsSecondaryFileSystem.java |  10 +-
 .../IgniteHadoopWeightedMapReducePlanner.java   |  26 +-
 .../ignite/impl/binary/binary_type_impl.h       |   2 +-
 .../common/include/ignite/common/concurrent.h   |  30 +
 .../cpp/common/include/ignite/reference.h       |  14 +-
 .../cpp/core-test/config/cache-test.xml         |   2 +-
 .../project/vs/core-test.vcxproj.filters        |   3 +
 .../cpp/core-test/src/cache_invoke_test.cpp     |   6 +-
 .../platforms/cpp/core-test/src/cache_test.cpp  |  23 +-
 .../cpp/core-test/src/continuous_query_test.cpp | 204 ++++-
 .../cpp/core-test/src/reference_test.cpp        |  12 +-
 modules/platforms/cpp/core/Makefile.am          |   1 +
 modules/platforms/cpp/core/include/Makefile.am  |  70 +-
 .../cpp/core/include/ignite/cache/cache.h       |  22 +-
 .../ignite/cache/cache_entry_processor.h        |  42 +-
 .../cache/event/cache_entry_event_filter.h      | 109 +++
 .../cache/query/continuous/continuous_query.h   |  35 +-
 .../cpp/core/include/ignite/ignite_binding.h    |  39 +-
 .../include/ignite/ignite_binding_context.h     |   2 +-
 .../cpp/core/include/ignite/impl/bindings.h     |  95 +++
 .../impl/cache/cache_entry_processor_holder.h   |  15 -
 .../core/include/ignite/impl/cache/cache_impl.h |  81 +-
 .../cache/event/cache_entry_event_filter_base.h |  66 ++
 .../event/cache_entry_event_filter_holder.h     | 185 +++++
 .../continuous/continuous_query_handle_impl.h   |  10 -
 .../query/continuous/continuous_query_impl.h    |  60 +-
 .../include/ignite/impl/ignite_binding_impl.h   | 101 +--
 .../include/ignite/impl/ignite_environment.h    |  37 +-
 .../cpp/core/include/ignite/impl/ignite_impl.h  |  10 +-
 .../cpp/core/include/ignite/impl/operations.h   |   2 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   5 +
 .../cpp/core/project/vs/core.vcxproj.filters    |  18 +
 .../cpp/core/src/impl/cache/cache_impl.cpp      |  90 ++-
 .../continuous/continuous_query_handle_impl.cpp |   5 -
 .../cpp/core/src/impl/ignite_binding_impl.cpp   |  88 +++
 .../cpp/core/src/impl/ignite_environment.cpp    | 124 ++-
 .../platforms/cpp/core/src/impl/ignite_impl.cpp |   2 +-
 .../Apache.Ignite.Core.Tests.csproj             |  11 +-
 .../Binary/BinaryBuilderSelfTest.cs             | 112 +--
 .../BinaryBuilderSelfTestDynamicRegistration.cs |  40 +
 .../Binary/BinaryCompactFooterInteropTest.cs    |   2 +-
 .../Binary/BinaryDynamicRegistrationTest.cs     | 441 +++++++++++
 .../Binary/BinarySelfTest.cs                    | 197 +++--
 .../Binary/BinarySelfTestFullFooter.cs          |   5 +-
 .../Binary/JavaBinaryInteropTest.cs             | 182 +++++
 .../Serializable/AdvancedSerializationTest.cs   | 228 ++++++
 .../BasicSerializableObjectsTest.cs             | 124 +++
 .../Binary/Serializable/CallbacksTest.cs        | 369 +++++++++
 .../Binary/Serializable/DelegatesTest.cs        | 161 ++++
 .../Binary/Serializable/ObjectReferenceTests.cs | 131 ++++
 .../Binary/Serializable/PrimitivesTest.cs       | 754 +++++++++++++++++++
 .../Binary/Serializable/SqlDmlTest.cs           | 277 +++++++
 .../Cache/Affinity/AffinityFunctionTest.cs      |  21 -
 .../Cache/CacheAbstractTest.cs                  |  56 +-
 .../Cache/Query/CacheLinqTest.cs                |   2 +-
 .../Cache/Query/CacheQueriesTest.cs             |  15 +-
 .../Continuous/ContinuousQueryAbstractTest.cs   |  29 +-
 .../Cache/Store/CacheStoreTest.cs               |   5 +-
 .../Compute/ComputeApiTest.cs                   |  28 +-
 .../Compute/IgniteExceptionTaskSelfTest.cs      |  40 +-
 .../Compute/ResourceTaskTest.cs                 |  13 +-
 .../Apache.Ignite.Core.Tests/DeploymentTest.cs  |  15 +-
 .../Examples/ExamplesTest.cs                    |   2 +-
 .../Apache.Ignite.Core.Tests/ExecutableTest.cs  |  28 +-
 .../SerializationTest.cs                        | 240 ------
 .../Services/ServiceProxyTest.cs                |  40 +-
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |  11 +
 .../Apache.Ignite.Core.csproj                   |   7 +-
 .../Cache/Configuration/CacheConfiguration.cs   |   8 +-
 .../Cache/Query/Continuous/ContinuousQuery.cs   |  59 +-
 .../Apache.Ignite.Core/Cache/Query/QueryBase.cs |   4 +-
 .../Cache/Query/SqlFieldsQuery.cs               |   6 +-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  25 +-
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |   4 +-
 .../Impl/Binary/BinarizableSerializer.cs        |   5 +-
 .../Impl/Binary/BinaryFullTypeDescriptor.cs     |  49 +-
 .../Impl/Binary/BinaryObjectBuilder.cs          |  27 +-
 .../Impl/Binary/BinaryObjectHeader.cs           |  13 +-
 .../Impl/Binary/BinaryObjectSchemaSerializer.cs |   2 +
 .../Impl/Binary/BinaryProcessor.cs              |  38 +-
 .../Impl/Binary/BinaryReader.cs                 |  39 +-
 .../Impl/Binary/BinaryReflectiveActions.cs      |   2 +-
 .../BinaryReflectiveSerializerInternal.cs       |  84 ++-
 .../Binary/BinarySurrogateTypeDescriptor.cs     |  13 +-
 .../Impl/Binary/BinarySystemHandlers.cs         |  96 +--
 .../Impl/Binary/BinarySystemTypeSerializer.cs   |   2 +-
 .../Impl/Binary/BinaryUtils.cs                  |  54 +-
 .../Impl/Binary/BinaryWriter.cs                 | 242 +++---
 .../Impl/Binary/DateTimeHolder.cs               | 101 ---
 .../Impl/Binary/DateTimeSerializer.cs           |  48 --
 .../Binary/DeserializationCallbackProcessor.cs  | 102 +++
 .../Impl/Binary/IBinarySerializerInternal.cs    |   4 +-
 .../Impl/Binary/IBinaryTypeDescriptor.cs        |   8 +
 .../Impl/Binary/Io/BinaryStreamAdapter.cs       | 119 ---
 .../Impl/Binary/Marshaller.cs                   | 248 ++++--
 .../Impl/Binary/ReflectionUtils.cs              |  50 ++
 .../Impl/Binary/SerializableObjectHolder.cs     |  96 ---
 .../Impl/Binary/SerializableSerializer.cs       | 656 +++++++++++++++-
 .../Impl/Binary/TypeResolver.cs                 |   7 +
 .../Impl/Binary/UserSerializerProxy.cs          |   5 +-
 .../Affinity/AffinityFunctionSerializer.cs      |   3 -
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |   3 +-
 .../Common/CopyOnWriteConcurrentDictionary.cs   |  35 +
 .../Impl/Common/DelegateConverter.cs            |  90 ++-
 .../Impl/Common/DelegateTypeDescriptor.cs       |   3 +-
 .../Impl/Common/SerializableTypeDescriptor.cs   | 222 ++++++
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  13 +-
 .../Impl/Services/ServiceProxySerializer.cs     |   4 +-
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |   8 +-
 .../NuGet/LINQPad/ComputeExample.linq           |   1 -
 .../NuGet/LINQPad/PutGetExample.linq            |   5 +-
 .../NuGet/LINQPad/QueryExample.linq             |   5 +-
 .../NuGet/LINQPad/QueryExample.linq             |   5 +-
 .../dotnet/Apache.Ignite.Linq/QueryOptions.cs   |   2 +-
 .../examples/Apache.Ignite.Examples/App.config  |  16 +-
 .../Apache.Ignite.ExamplesDll/Binary/Address.cs |   2 -
 .../Compute/CharacterCountClosure.cs            |   1 -
 .../Datagrid/ContinuousQueryFilter.cs           |   2 -
 .../Datagrid/EmployeeStorePredicate.cs          |   2 -
 .../Messaging/RemoteOrderedListener.cs          |   1 -
 .../Messaging/RemoteUnorderedListener.cs        |   1 -
 .../Services/MapService.cs                      |   1 -
 .../spi/deployment/uri/UriDeploymentSpi.java    |  80 +-
 .../commands/cache/VisorCacheCommand.scala      |   2 +-
 .../helpers/jade/form/form-field-checkbox.pug   |  14 +-
 .../helpers/jade/form/form-field-datalist.pug   |   2 +-
 .../helpers/jade/form/form-field-dropdown.pug   |   3 +-
 .../app/helpers/jade/form/form-field-number.pug |   3 +-
 .../helpers/jade/form/form-field-password.pug   |   2 +-
 .../app/helpers/jade/form/form-field-text.pug   |   3 +-
 .../frontend/app/helpers/jade/mixins.pug        |   1 +
 .../frontend/app/primitives/tooltip/index.pug   |  25 +
 .../views/configuration/domains-import.tpl.pug  |   6 +
 .../zk/TcpDiscoveryZookeeperIpFinder.java       |  37 +-
 212 files changed, 10186 insertions(+), 2301 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
index 4aa60a1,7b79c58..db1eadf
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
@@@ -106,8 -120,12 +116,10 @@@ public class CollectionConfiguration im
  
      /**
       * @param memoryMode Memory mode.
+      * @return {@code this} for chaining.
       */
-     public void setMemoryMode(CacheMemoryMode memoryMode) {
+     public CollectionConfiguration setMemoryMode(CacheMemoryMode memoryMode) {
 -        this.memoryMode = memoryMode;
 -
+         return this;
      }
  
      /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index d4f6d87,966fa8e..3ddd7ac
mode 100644,100755..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

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index e08e29a,19244dd..25804c7
--- 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
@@@ -405,16 -402,14 +406,20 @@@ public class TcpDiscoverySpi extends Ig
      private boolean clientReconnectDisabled;
  
      /** */
 +    private Serializable consistentId;
 +
 +    /** Local node addresses. */
 +    private IgniteBiTuple<Collection<String>, Collection<String>> addrs;
 +
 +    /** */
      protected IgniteSpiContext spiCtx;
  
-     /** {@inheritDoc} */
-     @Override public String getSpiState() {
+     /**
+      * Gets current SPI state.
+      *
+      * @return Current SPI state.
+      */
+     public String getSpiState() {
          return impl.getSpiState();
      }
  
@@@ -973,47 -1014,15 +1024,56 @@@
          locNodeVer = ver;
      }
  
+     /**
+      * Gets ID of the local node.
+      *
+      * @return ID of the local node.
+      */
+     public UUID getLocalNodeId() {
+         return ignite.cluster().localNode().id();
+     }
+ 
 +    /** {@inheritDoc} */
 +    @Nullable @Override public Serializable consistentId() throws IgniteSpiException {
 +        if (consistentId == null) {
 +            initializeImpl();
 +
 +            initAddresses();
 +
 +            Serializable cfgId = ignite.configuration().getConsistentId();
 +
 +            if (cfgId == null) {
 +                List<String> sortedAddrs = new ArrayList<>(addrs.get1());
 +
 +                Collections.sort(sortedAddrs);
 +
 +                if (getBoolean(IGNITE_CONSISTENT_ID_BY_HOST_WITHOUT_PORT))
 +                    consistentId = U.consistentId(sortedAddrs);
 +                else
 +                    consistentId = U.consistentId(sortedAddrs, impl.boundPort());
 +            }
 +            else
 +                consistentId = cfgId;
 +        }
 +
 +        return consistentId;
 +    }
 +
 +    /**
 +     *
 +     */
 +    private void initAddresses() {
 +        if (addrs == null) {
 +            try {
 +                addrs = U.resolveLocalAddresses(locHost);
 +            }
 +            catch (IOException | IgniteCheckedException e) {
 +                throw new IgniteSpiException("Failed to resolve local host to set of external addresses: " + locHost,
 +                    e);
 +            }
 +        }
 +    }
 +
      /**
       * @param srvPort Server port.
       * @param addExtAddrAttr If {@code true} adds {@link #ATTR_EXT_ADDRS} attribute.
@@@ -1771,19 -1853,6 +1902,20 @@@
  
      /** {@inheritDoc} */
      @Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException {
 +        initializeImpl();
 +
-         registerMBean(igniteInstanceName, this, TcpDiscoverySpiMBean.class);
++        registerMBean(igniteInstanceName, new TcpDiscoverySpiMBeanImpl(this), TcpDiscoverySpiMBean.class);
 +
 +        impl.spiStart(igniteInstanceName);
 +    }
 +
 +    /**
 +     *
 +     */
 +    private void initializeImpl() {
 +        if (impl != null)
 +            return;
++
          initFailureDetectionTimeout();
  
          if (!forceSrvMode && (Boolean.TRUE.equals(ignite.configuration().isClientMode()))) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/cpp/core-test/config/cache-test.xml
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/core-test/config/cache-test.xml
index 43ed8d2,10300ba..7fe7ac6
--- a/modules/platforms/cpp/core-test/config/cache-test.xml
+++ b/modules/platforms/cpp/core-test/config/cache-test.xml
@@@ -28,7 -28,109 +28,7 @@@
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/util
          http://www.springframework.org/schema/util/spring-util.xsd">
 -    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
 -        <property name="localHost" value="127.0.0.1"/>
 -        <property name="connectorConfiguration"><null/></property>
 +    <import resource="cache-test-default.xml"/>
  
-     <bean parent="grid.cfg"/>
 -        <property name="includeEventTypes">
 -            <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
 -        </property>
 -
 -        <property name="cacheConfiguration">
 -            <list>
 -                <bean parent="cache-template">
 -                    <property name="name" value="local"/>
 -                    <property name="cacheMode" value="LOCAL"/>
 -                    <property name="atomicityMode" value="TRANSACTIONAL"/>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="local_atomic"/>
 -                    <property name="cacheMode" value="LOCAL"/>
 -                    <property name="atomicityMode" value="ATOMIC"/>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="partitioned"/>
 -                    <property name="cacheMode" value="PARTITIONED"/>
 -                    <property name="atomicityMode" value="TRANSACTIONAL"/>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="partitioned2"/>
 -                    <property name="cacheMode" value="PARTITIONED"/>
 -                    <property name="atomicityMode" value="TRANSACTIONAL"/>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="partitioned_atomic"/>
 -                    <property name="cacheMode" value="PARTITIONED"/>
 -                    <property name="atomicityMode" value="ATOMIC"/>
 -                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="partitioned_near"/>
 -                    <property name="cacheMode" value="PARTITIONED"/>
 -                    <property name="atomicityMode" value="TRANSACTIONAL"/>
 -                    <property name="nearConfiguration">
 -                        <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
 -                    </property>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="partitioned_atomic_near"/>
 -                    <property name="cacheMode" value="PARTITIONED"/>
 -                    <property name="atomicityMode" value="ATOMIC"/>
 -                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
 -                    <property name="nearConfiguration">
 -                        <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
 -                    </property>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="replicated"/>
 -                    <property name="cacheMode" value="REPLICATED"/>
 -                    <property name="atomicityMode" value="TRANSACTIONAL"/>
 -                </bean>
 -
 -                <bean parent="cache-template">
 -                    <property name="name" value="replicated_atomic"/>
 -                    <property name="cacheMode" value="REPLICATED"/>
 -                    <property name="atomicityMode" value="ATOMIC"/>
 -                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
 -                </bean>
 -            </list>
 -        </property>
 -
 -        <property name="discoverySpi">
 -            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
 -                <property name="ipFinder">
 -                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
 -                        <property name="addresses">
 -                            <list>
 -                                <!-- In distributed environment, replace with actual host IP address. -->
 -                                <value>127.0.0.1:47500..47501</value>
 -                            </list>
 -                        </property>
 -                    </bean>
 -                </property>
 -                <property name="socketTimeout" value="300" />
 -            </bean>
 -        </property>
 -
 -        <property name="transactionConfiguration">
 -            <bean class="org.apache.ignite.configuration.TransactionConfiguration">
 -                <property name="txSerializableEnabled" value="true"/>
 -            </bean>
 -        </property>
 -    </bean>
 -
 -    <bean id="cache-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
 -        <property name="rebalanceMode" value="SYNC"/>
 -        <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 -        <property name="swapEnabled" value="true"/>
 -        <property name="backups" value="1"/>
 -        <property name="eagerTtl" value="true"/>
 -    </bean>
++        <bean parent="grid.cfg"/>
  </beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/core-test/src/continuous_query_test.cpp
index d730ae9,f81eb5d..c52baaf
--- a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
@@@ -245,12 -343,8 +343,12 @@@ struct ContinuousQueryTestSuiteFixtur
       * Constructor.
       */
      ContinuousQueryTestSuiteFixture() :
 +#ifdef IGNITE_TESTS_32
-         grid(ignite_test::StartNode("cache-query-continuous-32.xml", "node-01")),
++        node(ignite_test::StartNode("cache-query-continuous-32.xml", "node-01")),
 +#else
-         grid(ignite_test::StartNode("cache-query-continuous.xml", "node-01")),
+         node(ignite_test::StartNode("cache-query-continuous.xml", "node-01")),
 +#endif
-         cache(grid.GetCache<int, TestEntry>("transactional_no_backup"))
+         cache(node.GetCache<int, TestEntry>("transactional_no_backup"))
      {
          // No-op.
      }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/db10c451/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------


[07/18] ignite git commit: IGNITE-4727 modal tooltip fixed

Posted by ag...@apache.org.
IGNITE-4727 modal tooltip fixed


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

Branch: refs/heads/ignite-3477-master
Commit: 4ab870c282ddc7ae11419774a02880907e1c64cd
Parents: f77edc1
Author: Dmitriy Shabalin <ds...@gridgain.com>
Authored: Fri Mar 31 16:06:01 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Mar 31 16:06:01 2017 +0700

----------------------------------------------------------------------
 .../helpers/jade/form/form-field-checkbox.pug   | 14 ++++++++++-
 .../helpers/jade/form/form-field-datalist.pug   |  2 +-
 .../helpers/jade/form/form-field-dropdown.pug   |  3 +--
 .../app/helpers/jade/form/form-field-number.pug |  3 +--
 .../helpers/jade/form/form-field-password.pug   |  2 +-
 .../app/helpers/jade/form/form-field-text.pug   |  3 +--
 .../frontend/app/helpers/jade/mixins.pug        |  1 +
 .../frontend/app/primitives/tooltip/index.pug   | 25 ++++++++++++++++++++
 .../views/configuration/domains-import.tpl.pug  |  6 +++++
 9 files changed, 50 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
index 68a2dd2..fe7f912 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-checkbox.pug
@@ -15,6 +15,17 @@
     limitations under the License.
 
 mixin form-field-checkbox(label, model, name, disabled, required, tip)
+    //- TODO: Need to use common tooltip.
+    mixin tooltip-checkbox(title, options)
+        if title
+            i.tipLabel.icon-help(
+                bs-tooltip=''
+
+                data-title=title
+                data-container=options && options.container || false
+                data-placement=options && options.placement || false
+            )
+
     div.checkbox.col-xs-12.col-sm-12.col-md-12
         label(id=`{{ ${name} }}Label`)
             .input-tip
@@ -35,4 +46,5 @@ mixin form-field-checkbox(label, model, name, disabled, required, tip)
                         data-ignite-form-panel-field=''
                     )
             span #{label}
-            i.tipLabel.icon-help(bs-tooltip='' data-title=tip)
+
+            +tooltip-checkbox(tip, tipOpts)

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/form/form-field-datalist.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-datalist.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-datalist.pug
index e4b71af..6da1255 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-datalist.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-datalist.pug
@@ -40,7 +40,7 @@ mixin form-field-datalist(label, model, name, disabled, required, placeholder, o
     .ignite-form-field
         +ignite-form-field__label(label, name, required)
         .ignite-form-field__control
-            i.tipField.fa.icon-help(bs-tooltip='' data-title=tip)
+            +tooltip(tip, tipOpts)
 
             +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
index d7bd0fd..2f13d69 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-dropdown.pug
@@ -41,8 +41,7 @@ mixin ignite-form-field-dropdown(label, model, name, disabled, required, multipl
     .ignite-form-field
         +ignite-form-field__label(label, name, required)
         .ignite-form-field__control
-            if tip
-                i.tipField.icon-help(bs-tooltip='' data-title=tip)
+            +tooltip(tip, tipOpts)
 
             if block
                 block

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/form/form-field-number.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-number.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-number.pug
index dd41849..0b8bce7 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-number.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-number.pug
@@ -38,8 +38,7 @@ mixin ignite-form-field-number(label, model, name, disabled, required, placehold
     .ignite-form-field
         +ignite-form-field__label(label, name, required)
         .ignite-form-field__control
-            if tip
-                i.tipField.icon-help(bs-tooltip='' data-title=tip)
+            +tooltip(tip, tipOpts)
             
             +form-field-feedback(name, 'required', 'This field could not be empty')
             +form-field-feedback(name, 'min', 'Value is less than allowable minimum: '+ min || 0)

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/form/form-field-password.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-password.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-password.pug
index a12982f..a567e77 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-password.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-password.pug
@@ -36,7 +36,7 @@ mixin ignite-form-field-password(label, model, name, disabled, required, placeho
     .ignite-form-field
         +ignite-form-field__label(label, name, required)
         .ignite-form-field__control
-            i.tipField.icon-help(bs-tooltip='' data-title=tip)
+            +tooltip(tip, tipOpts)
             
             if block
                 block

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
index 76ea6e6..bac455f 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
@@ -52,8 +52,7 @@ mixin ignite-form-field-text(label, model, name, disabled, required, placeholder
     .ignite-form-field
         +ignite-form-field__label(label, name, required)
         .ignite-form-field__control
-            if tip
-                i.tipField.icon-help(bs-tooltip='' data-title=tip)
+            +tooltip(tip, tipOpts)
             
             if block
                 block

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index db175a2..bf49fa9 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -15,6 +15,7 @@
     limitations under the License.
 
 include ./form
+include ../../primitives/tooltip/index
 
 //- Mixin for advanced options toggle.
 mixin advanced-options-toggle(click, cond, showMessage, hideMessage)

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/app/primitives/tooltip/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/tooltip/index.pug b/modules/web-console/frontend/app/primitives/tooltip/index.pug
new file mode 100644
index 0000000..de1b116
--- /dev/null
+++ b/modules/web-console/frontend/app/primitives/tooltip/index.pug
@@ -0,0 +1,25 @@
+//-
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+mixin tooltip(title, options)
+    if title
+        i.tipField.icon-help(
+            bs-tooltip=''
+
+            data-title=title
+            data-container=options && options.container || false
+            data-placement=options && options.placement || false
+        )

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ab870c2/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index baaa2d3..04de07a 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -24,6 +24,9 @@ mixin td-ellipses-lbl(w, lbl)
         label #{lbl}
 
 .modal.modal-domain-import.center(role='dialog')
+    - var tipOpts = {};
+    - tipOpts.container = '.modal-content'
+    - tipOpts.placement = 'top'
     .modal-dialog.domains-import-dialog
         .modal-content(ignite-loading='importDomainFromDb' ignite-loading-text='{{importDomain.loadingOptions.text}}')
             #errors-container.modal-header.header
@@ -75,7 +78,10 @@ mixin td-ellipses-lbl(w, lbl)
                         .settings-row.settings-row_small-label
                             +password('Password:', 'selectedPreset.password', '"jdbcPassword"', false, '', 'Password for connecting to database<br>Note, password would not be saved in preferences for security reasons')(ignite-on-enter='importDomainNext()')
                         .settings-row
+                            - tipOpts.placement = 'auto'
                             +checkbox('Tables only', 'selectedPreset.tablesOnly', '"tablesOnly"', 'If selected, then only tables metadata will be parsed<br>Otherwise table and view metadata will be parsed')
+                            - tipOpts.placement = 'top'
+
                 .import-domain-model-wizard-page(ng-show='importDomain.action == "schemas"')
                     table.table.metadata(st-table='importDomain.displayedSchemas' st-safe-src='importDomain.schemas')
                         thead


[05/18] ignite git commit: IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.

Posted by ag...@apache.org.
IGNITE-4564: All setters on public configuration now return "this" instance to allow convenient chaining. This closes #1449.


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

Branch: refs/heads/ignite-3477-master
Commit: cfc88028fb359d1ccb64ca636eccc86db0f0e61d
Parents: 44cf1d2
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Thu Mar 30 19:01:29 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Mar 30 19:01:29 2017 +0300

----------------------------------------------------------------------
 .../spi/checkpoint/s3/S3CheckpointSpi.java      |  72 ++-
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java |  27 +-
 .../cloud/TcpDiscoveryCloudIpFinder.java        |  51 +-
 .../ignite/binary/BinaryBasicIdMapper.java      |   5 +-
 .../ignite/binary/BinaryBasicNameMapper.java    |   5 +-
 .../ignite/binary/BinaryTypeConfiguration.java  |  30 +-
 .../ignite/cache/CacheKeyConfiguration.java     |  10 +-
 .../org/apache/ignite/cache/QueryEntity.java    |  35 +-
 .../affinity/fair/FairAffinityFunction.java     |  21 +-
 .../rendezvous/RendezvousAffinityFunction.java  |  27 +-
 .../cache/eviction/AbstractEvictionPolicy.java  |  15 +-
 .../cache/eviction/fifo/FifoEvictionPolicy.java |  74 ++-
 .../eviction/fifo/FifoEvictionPolicyMBean.java  |   2 +
 .../igfs/IgfsPerBlockLruEvictionPolicy.java     | 131 ++++-
 .../cache/eviction/lru/LruEvictionPolicy.java   |  74 ++-
 .../eviction/sorted/SortedEvictionPolicy.java   |  74 ++-
 .../configuration/AtomicConfiguration.java      |  15 +-
 .../configuration/BinaryConfiguration.java      |  30 +-
 .../configuration/CacheConfiguration.java       |  71 ++-
 .../configuration/CollectionConfiguration.java  |  36 +-
 .../configuration/ConnectorConfiguration.java   | 100 +++-
 .../configuration/FileSystemConfiguration.java  | 151 ++++--
 .../configuration/HadoopConfiguration.java      |  31 +-
 .../configuration/NearCacheConfiguration.java   |  50 ++
 .../configuration/TransactionConfiguration.java |  45 +-
 .../igfs/IgfsGroupDataBlocksKeyMapper.java      |   5 +-
 .../igfs/IgfsIpcEndpointConfiguration.java      |  30 +-
 .../client/GridClientConfiguration.java         | 100 +++-
 .../client/GridClientDataConfiguration.java     |  15 +-
 .../client/GridClientPartitionAffinity.java     |  15 +-
 .../balancer/GridClientBalancerAdapter.java     |   5 +-
 .../router/GridTcpRouterConfiguration.java      |  50 +-
 .../internal/jdbc2/JdbcSqlFieldsQuery.java      |  57 ++
 .../processors/cache/GridCacheProcessor.java    |  39 +-
 .../dotnet/PlatformDotNetConfigurationEx.java   |  21 +-
 .../utils/PlatformConfigurationUtils.java       |   3 +-
 .../optimized/OptimizedMarshaller.java          |  15 +-
 .../apache/ignite/mxbean/IgniteMBeanAware.java  |  28 +
 .../dotnet/PlatformDotNetAffinityFunction.java  |  10 +-
 .../PlatformDotNetBinaryConfiguration.java      |  31 +-
 .../PlatformDotNetBinaryTypeConfiguration.java  |  35 +-
 .../dotnet/PlatformDotNetConfiguration.java     |  10 +-
 .../ignite/services/ServiceConfiguration.java   |  35 +-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  50 +-
 .../ignite/spi/IgniteSpiMBeanAdapter.java       |  78 +++
 .../checkpoint/cache/CacheCheckpointSpi.java    |  40 +-
 .../spi/checkpoint/jdbc/JdbcCheckpointSpi.java  | 219 ++++++--
 .../spi/checkpoint/noop/NoopCheckpointSpi.java  |   7 +
 .../sharedfs/SharedFsCheckpointSpi.java         |  54 +-
 .../fifoqueue/FifoQueueCollisionSpi.java        | 134 ++++-
 .../fifoqueue/FifoQueueCollisionSpiMBean.java   |   2 +-
 .../jobstealing/JobStealingCollisionSpi.java    | 281 ++++++++--
 .../JobStealingCollisionSpiMBean.java           |   6 +-
 .../spi/collision/noop/NoopCollisionSpi.java    |   7 +
 .../PriorityQueueCollisionSpi.java              | 278 ++++++++--
 .../PriorityQueueCollisionSpiMBean.java         |   2 +-
 .../communication/tcp/TcpCommunicationSpi.java  | 536 ++++++++++++++++---
 .../deployment/local/LocalDeploymentSpi.java    |  24 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 437 ++++++++++++---
 .../ipfinder/TcpDiscoveryIpFinderAdapter.java   |   5 +-
 .../ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java |  17 +-
 .../TcpDiscoveryMulticastIpFinder.java          |  47 +-
 .../sharedfs/TcpDiscoverySharedFsIpFinder.java  |  12 +-
 .../tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java |  14 +-
 .../memory/MemoryEventStorageSpi.java           |  98 +++-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  53 +-
 .../jobstealing/JobStealingFailoverSpi.java     |  68 ++-
 .../spi/failover/never/NeverFailoverSpi.java    |  30 +-
 .../spi/indexing/noop/NoopIndexingSpi.java      |   7 +
 .../adaptive/AdaptiveLoadBalancingSpi.java      |  43 +-
 .../roundrobin/RoundRobinLoadBalancingSpi.java  |  44 +-
 .../WeightedRandomLoadBalancingSpi.java         |  61 ++-
 .../spi/swapspace/file/FileSwapSpaceSpi.java    | 112 +++-
 .../spi/swapspace/noop/NoopSwapSpaceSpi.java    |   7 +
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  |  33 +-
 .../fs/IgniteHadoopIgfsSecondaryFileSystem.java |  10 +-
 .../IgniteHadoopWeightedMapReducePlanner.java   |  26 +-
 .../spi/deployment/uri/UriDeploymentSpi.java    |  80 ++-
 .../zk/TcpDiscoveryZookeeperIpFinder.java       |  37 +-
 79 files changed, 3935 insertions(+), 710 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
index 3d5954f..2330ef3 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
@@ -51,6 +51,7 @@ import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMBeanAdapter;
 import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
 import org.apache.ignite.spi.IgniteSpiThread;
 import org.apache.ignite.spi.checkpoint.CheckpointListener;
@@ -122,7 +123,7 @@ import org.jetbrains.annotations.Nullable;
  * @see org.apache.ignite.spi.checkpoint.CheckpointSpi
  */
 @IgniteSpiMultipleInstancesSupport(true)
-public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi, S3CheckpointSpiMBean {
+public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     /** Logger. */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     @LoggerResource
@@ -169,7 +170,7 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      *
      * @return S3 bucket name to use.
      */
-    @Override public String getBucketName() {
+    public String getBucketName() {
         return bucketName;
     }
 
@@ -178,7 +179,7 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      *
      * @return S3 access key.
      */
-    @Override public String getAccessKey() {
+    public String getAccessKey() {
         return cred.getAWSAccessKeyId();
     }
 
@@ -196,7 +197,7 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      *
      * @return HTTP proxy host.
      */
-    @Override public String getProxyHost() {
+    public String getProxyHost() {
         return cfg.getProxyHost();
     }
 
@@ -205,7 +206,7 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      *
      * @return HTTP proxy port.
      */
-    @Override public int getProxyPort() {
+    public int getProxyPort() {
         return cfg.getProxyPort();
     }
 
@@ -214,7 +215,7 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      *
      * @return HTTP proxy user name.
      */
-    @Override public String getProxyUsername() {
+    public String getProxyUsername() {
         return cfg.getProxyUsername();
     }
 
@@ -231,10 +232,13 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      * Sets bucket name suffix.
      *
      * @param bucketNameSuffix Bucket name suffix.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setBucketNameSuffix(String bucketNameSuffix) {
+    public S3CheckpointSpi setBucketNameSuffix(String bucketNameSuffix) {
         this.bucketNameSuffix = bucketNameSuffix;
+
+        return this;
     }
 
     /**
@@ -243,10 +247,13 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      * For details refer to Amazon S3 API reference.
      *
      * @param cfg Amazon client configuration.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setClientConfiguration(ClientConfiguration cfg) {
+    public S3CheckpointSpi setClientConfiguration(ClientConfiguration cfg) {
         this.cfg = cfg;
+
+        return this;
     }
 
     /**
@@ -255,10 +262,13 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
      * For details refer to Amazon S3 API reference.
      *
      * @param cred AWS credentials.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setAwsCredentials(AWSCredentials cred) {
+    public S3CheckpointSpi setAwsCredentials(AWSCredentials cred) {
         this.cred = cred;
+
+        return this;
     }
 
     /** {@inheritDoc} */
@@ -351,7 +361,7 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
 
         timeoutWrk.start();
 
-        registerMBean(igniteInstanceName, this, S3CheckpointSpiMBean.class);
+        registerMBean(igniteInstanceName, new S3CheckpointSpiMBeanImpl(this), S3CheckpointSpiMBean.class);
 
         // Ack ok start.
         if (log.isDebugEnabled())
@@ -570,6 +580,13 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
     }
 
     /** {@inheritDoc} */
+    @Override public S3CheckpointSpi setName(String name) {
+        super.setName(name);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(S3CheckpointSpi.class, this);
     }
@@ -702,4 +719,39 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
             return S.toString(S3TimeoutWorker.class, this);
         }
     }
+
+    /**
+     * MBean implementation for S3CheckpointSpi.
+     */
+    private class S3CheckpointSpiMBeanImpl extends IgniteSpiMBeanAdapter implements S3CheckpointSpiMBean {
+        /** {@inheritDoc} */
+        S3CheckpointSpiMBeanImpl(IgniteSpiAdapter spiAdapter) {
+            super(spiAdapter);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getBucketName() {
+            return S3CheckpointSpi.this.getBucketName();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getAccessKey() {
+            return S3CheckpointSpi.this.getAccessKey();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getProxyHost() {
+            return S3CheckpointSpi.this.getProxyHost();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getProxyPort() {
+            return S3CheckpointSpi.this.getProxyPort();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getProxyUsername() {
+            return S3CheckpointSpi.this.getProxyUsername();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
index d9f50c2..2307a66 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
@@ -308,10 +308,13 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
      * Sets bucket name for IP finder.
      *
      * @param bucketName Bucket name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setBucketName(String bucketName) {
+    public TcpDiscoveryS3IpFinder setBucketName(String bucketName) {
         this.bucketName = bucketName;
+
+        return this;
     }
 
     /**
@@ -320,10 +323,13 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
      * For details refer to Amazon S3 API reference.
      *
      * @param cfg Amazon client configuration.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setClientConfiguration(ClientConfiguration cfg) {
+    public TcpDiscoveryS3IpFinder setClientConfiguration(ClientConfiguration cfg) {
         this.cfg = cfg;
+
+        return this;
     }
 
     /**
@@ -332,10 +338,13 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
      * For details refer to Amazon S3 API reference.
      *
      * @param cred AWS credentials.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setAwsCredentials(AWSCredentials cred) {
+    public TcpDiscoveryS3IpFinder setAwsCredentials(AWSCredentials cred) {
         this.cred = cred;
+
+        return this;
     }
 
     /**
@@ -344,10 +353,20 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
      * For details refer to Amazon S3 API reference.
      *
      * @param credProvider AWS credentials provider.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setAwsCredentialsProvider(AWSCredentialsProvider credProvider) {
+    public TcpDiscoveryS3IpFinder setAwsCredentialsProvider(AWSCredentialsProvider credProvider) {
         this.credProvider = credProvider;
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryS3IpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
index 2c03557..1aa3790 100644
--- a/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
+++ b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
@@ -36,6 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -230,10 +231,13 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
      * ComputeService section contains names of all supported providers.
      *
      * @param provider Provider name.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setProvider(String provider) {
+    public TcpDiscoveryCloudIpFinder setProvider(String provider) {
         this.provider = provider;
+
+        return this;
     }
 
     /**
@@ -244,10 +248,13 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
      * what is used as an identity for a particular cloud platform.
      *
      * @param identity Identity to use during authentication on the cloud.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = false)
-    public void setIdentity(String identity) {
+    public TcpDiscoveryCloudIpFinder setIdentity(String identity) {
         this.identity = identity;
+
+        return this;
     }
 
     /**
@@ -258,10 +265,13 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
      * what is used as an credential for a particular cloud platform.
      *
      * @param credential Credential to use during authentication on the cloud.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setCredential(String credential) {
+    public TcpDiscoveryCloudIpFinder setCredential(String credential) {
         this.credential = credential;
+
+        return this;
     }
 
     /**
@@ -275,10 +285,13 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
      * what is used as an credential for a particular cloud platform.
      *
      * @param credentialPath Path to the credential to use during authentication on the cloud.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setCredentialPath(String credentialPath) {
+    public TcpDiscoveryCloudIpFinder setCredentialPath(String credentialPath) {
         this.credentialPath = credentialPath;
+
+        return this;
     }
 
     /**
@@ -291,13 +304,14 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
      * providers a call to this method is redundant.
      *
      * @param zones Zones where VMs are located or null if to take every zone into account.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setZones(Collection<String> zones) {
-        if (F.isEmpty(zones))
-            return;
+    public TcpDiscoveryCloudIpFinder setZones(Collection<String> zones) {
+        if (!F.isEmpty(zones))
+            this.zones = new TreeSet<>(zones);
 
-        this.zones = new TreeSet<>(zones);
+        return this;
     }
 
     /**
@@ -310,13 +324,14 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
      * providers a call to this method is redundant.
      *
      * @param regions Regions where VMs are located or null if to check every region a provider has.
+     * @return {@code this} for chaining.
      */
     @IgniteSpiConfiguration(optional = true)
-    public void setRegions(Collection<String> regions) {
-        if (F.isEmpty(regions))
-            return;
+    public TcpDiscoveryCloudIpFinder setRegions(Collection<String> regions) {
+        if (!F.isEmpty(regions))
+            this.regions = new TreeSet<>(regions);
 
-        this.regions = new TreeSet<>(regions);
+        return this;
     }
 
     /**
@@ -452,4 +467,16 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
 
         return builder.toString();
     }
+
+    /** {@inheritDoc} */
+    @Override public TcpDiscoveryCloudIpFinder setShared(boolean shared) {
+        super.setShared(shared);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryCloudIpFinder.class, this);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicIdMapper.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicIdMapper.java
index da31751..53ad9b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicIdMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicIdMapper.java
@@ -114,9 +114,12 @@ public class BinaryBasicIdMapper implements BinaryIdMapper {
      * Sets whether to use strings in lower case or not.
      *
      * @param isLowerCase Whether to use strings in lower case or not.
+     * @return {@code this} for chaining.
      */
-    public void setLowerCase(boolean isLowerCase) {
+    public BinaryBasicIdMapper setLowerCase(boolean isLowerCase) {
         this.isLowerCase = isLowerCase;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
index 42d6b5b..bc338b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
@@ -58,9 +58,12 @@ public class BinaryBasicNameMapper implements BinaryNameMapper {
      * Sets whether to use simple name of class or not.
      *
      * @param isSimpleName Whether to use simple name of class or not.
+     * @return {@code this} for chaining.
      */
-    public void setSimpleName(boolean isSimpleName) {
+    public BinaryBasicNameMapper setSimpleName(boolean isSimpleName) {
         this.isSimpleName = isSimpleName;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
index d95e0ae..1b2d828 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
@@ -91,9 +91,12 @@ public class BinaryTypeConfiguration {
      * Sets type name.
      *
      * @param typeName Type name.
+     * @return {@code this} for chaining.
      */
-    public void setTypeName(String typeName) {
+    public BinaryTypeConfiguration setTypeName(String typeName) {
         this.typeName = typeName;
+
+        return this;
     }
 
     /**
@@ -109,9 +112,12 @@ public class BinaryTypeConfiguration {
      * Sets ID mapper.
      *
      * @param idMapper ID mapper.
+     * @return {@code this} for chaining.
      */
-    public void setIdMapper(BinaryIdMapper idMapper) {
+    public BinaryTypeConfiguration setIdMapper(BinaryIdMapper idMapper) {
         this.idMapper = idMapper;
+
+        return this;
     }
 
     /**
@@ -127,9 +133,12 @@ public class BinaryTypeConfiguration {
      * Sets name mapper.
      *
      * @param nameMapper Name mapper.
+     * @return {@code this} for chaining.
      */
-    public void setNameMapper(BinaryNameMapper nameMapper) {
+    public BinaryTypeConfiguration setNameMapper(BinaryNameMapper nameMapper) {
         this.nameMapper = nameMapper;
+
+        return this;
     }
 
     /**
@@ -145,9 +154,12 @@ public class BinaryTypeConfiguration {
      * Sets serializer.
      *
      * @param serializer Serializer.
+     * @return {@code this} for chaining.
      */
-    public void setSerializer(BinarySerializer serializer) {
+    public BinaryTypeConfiguration setSerializer(BinarySerializer serializer) {
         this.serializer = serializer;
+
+        return this;
     }
 
     /**
@@ -163,9 +175,12 @@ public class BinaryTypeConfiguration {
      * Sets identity resolver.
      *
      * @param identityRslvr Identity resolver.
+     * @return {@code this} for chaining.
      */
-    public void setIdentityResolver(@Nullable BinaryIdentityResolver identityRslvr) {
+    public BinaryTypeConfiguration setIdentityResolver(@Nullable BinaryIdentityResolver identityRslvr) {
         this.identityRslvr = identityRslvr;
+
+        return this;
     }
 
     /**
@@ -181,9 +196,12 @@ public class BinaryTypeConfiguration {
      * Sets whether this is enum type.
      *
      * @param isEnum {@code True} if enum.
+     * @return {@code this} for chaining.
      */
-    public void setEnum(boolean isEnum) {
+    public BinaryTypeConfiguration setEnum(boolean isEnum) {
         this.isEnum = isEnum;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
index f117847..33e5881 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
@@ -81,9 +81,12 @@ public class CacheKeyConfiguration implements Serializable {
 
     /**
      * @param typeName Type name for which affinity field name is being defined.
+     * @return {@code this} for chaining.
      */
-    public void setTypeName(String typeName) {
+    public CacheKeyConfiguration setTypeName(String typeName) {
         this.typeName = typeName;
+
+        return this;
     }
 
     /**
@@ -99,9 +102,12 @@ public class CacheKeyConfiguration implements Serializable {
      * Sets affinity key field name.
      *
      * @param affKeyFieldName Affinity key field name.
+     * @return {@code this} for chaining.
      */
-    public void setAffinityKeyFieldName(String affKeyFieldName) {
+    public CacheKeyConfiguration setAffinityKeyFieldName(String affKeyFieldName) {
         this.affKeyFieldName = affKeyFieldName;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
index 48cdae5..f791c1c 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
@@ -86,9 +86,12 @@ public class QueryEntity implements Serializable {
      * Sets key type for this query pair.
      *
      * @param keyType Key type.
+     * @return {@code this} for chaining.
      */
-    public void setKeyType(String keyType) {
+    public QueryEntity setKeyType(String keyType) {
         this.keyType = keyType;
+
+        return this;
     }
 
     /**
@@ -104,9 +107,12 @@ public class QueryEntity implements Serializable {
      * Sets value type for this query pair.
      *
      * @param valType Value type.
+     * @return {@code this} for chaining.
      */
-    public void setValueType(String valType) {
+    public QueryEntity setValueType(String valType) {
         this.valType = valType;
+
+        return this;
     }
 
     /**
@@ -124,9 +130,12 @@ public class QueryEntity implements Serializable {
      * order of columns returned by the 'select *' queries.
      *
      * @param fields Field-to-type map.
+     * @return {@code this} for chaining.
      */
-    public void setFields(LinkedHashMap<String, String> fields) {
+    public QueryEntity setFields(LinkedHashMap<String, String> fields) {
         this.fields = fields;
+
+        return this;
     }
 
     /**
@@ -146,9 +155,12 @@ public class QueryEntity implements Serializable {
      * Thus, setting this parameter in XML is not mandatory and should be based on particular use case.
      *
      * @param keyFields Set of names of key fields.
+     * @return {@code this} for chaining.
      */
-    public void setKeyFields(Set<String> keyFields) {
+    public QueryEntity setKeyFields(Set<String> keyFields) {
         this.keyFields = keyFields;
+
+        return this;
     }
 
     /**
@@ -174,17 +186,21 @@ public class QueryEntity implements Serializable {
      * Example: {"parent.name" -> "parentName"}.
      *
      * @param aliases Aliases map.
+     * @return {@code this} for chaining.
      */
-    public void setAliases(Map<String, String> aliases) {
+    public QueryEntity setAliases(Map<String, String> aliases) {
         this.aliases = aliases;
+
+        return this;
     }
 
     /**
      * Sets a collection of index entities.
      *
      * @param idxs Collection of index entities.
+     * @return {@code this} for chaining.
      */
-    public void setIndexes(Collection<QueryIndex> idxs) {
+    public QueryEntity setIndexes(Collection<QueryIndex> idxs) {
         for (QueryIndex idx : idxs) {
             if (!F.isEmpty(idx.getFields())) {
                 if (idx.getName() == null)
@@ -199,6 +215,8 @@ public class QueryEntity implements Serializable {
                     throw new IllegalArgumentException("Duplicate index name: " + idx.getName());
             }
         }
+
+        return this;
     }
 
     /**
@@ -220,8 +238,9 @@ public class QueryEntity implements Serializable {
 
     /**
      * Utility method for building query entities programmatically.
+     * @return {@code this} for chaining.
      */
-    public void addQueryField(String fullName, String type, String alias) {
+    public QueryEntity addQueryField(String fullName, String type, String alias) {
         A.notNull(fullName, "fullName");
         A.notNull(type, "type");
 
@@ -229,6 +248,8 @@ public class QueryEntity implements Serializable {
 
         if (alias != null)
             aliases.put(fullName, alias);
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
index 7acb5b4..c406ba6 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
@@ -196,11 +196,14 @@ public class FairAffinityFunction implements AffinityFunction {
      * Sets total number of partitions.
      *
      * @param parts Total number of partitions.
+     * @return {@code this} for chaining.
      */
-    public void setPartitions(int parts) {
+    public FairAffinityFunction setPartitions(int parts) {
         A.ensure(parts <= CacheConfiguration.MAX_PARTITIONS_COUNT, "parts <= " + CacheConfiguration.MAX_PARTITIONS_COUNT);
 
         this.parts = parts;
+
+        return this;
     }
 
 
@@ -226,10 +229,13 @@ public class FairAffinityFunction implements AffinityFunction {
      *
      * @param backupFilter Optional backup filter.
      * @deprecated Use {@code affinityBackupFilter} instead.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setBackupFilter(@Nullable IgniteBiPredicate<ClusterNode, ClusterNode> backupFilter) {
+    public FairAffinityFunction setBackupFilter(@Nullable IgniteBiPredicate<ClusterNode, ClusterNode> backupFilter) {
         this.backupFilter = backupFilter;
+
+        return this;
     }
 
     /**
@@ -253,9 +259,13 @@ public class FairAffinityFunction implements AffinityFunction {
      * Note that {@code affinityBackupFilter} is ignored if {@code excludeNeighbors} is set to {@code true}.
      *
      * @param affinityBackupFilter Optional backup filter.
+     * @return {@code this} for chaining.
      */
-    public void setAffinityBackupFilter(@Nullable IgniteBiPredicate<ClusterNode, List<ClusterNode>> affinityBackupFilter) {
+    public FairAffinityFunction setAffinityBackupFilter(
+        @Nullable IgniteBiPredicate<ClusterNode, List<ClusterNode>> affinityBackupFilter) {
         this.affinityBackupFilter = affinityBackupFilter;
+
+        return this;
     }
 
     /**
@@ -275,9 +285,12 @@ public class FairAffinityFunction implements AffinityFunction {
      * Note that {@code backupFilter} is ignored if {@code excludeNeighbors} is set to {@code true}.
      *
      * @param exclNeighbors {@code True} if nodes residing on the same host may not act as backups of each other.
+     * @return {@code this} for chaining.
      */
-    public void setExcludeNeighbors(boolean exclNeighbors) {
+    public FairAffinityFunction setExcludeNeighbors(boolean exclNeighbors) {
         this.exclNeighbors = exclNeighbors;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
index 3d21dd5..0fee1af 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
@@ -219,11 +219,14 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
      * Sets total number of partitions.
      *
      * @param parts Total number of partitions.
+     * @return {@code this} for chaining.
      */
-    public void setPartitions(int parts) {
+    public RendezvousAffinityFunction setPartitions(int parts) {
         A.ensure(parts <= CacheConfiguration.MAX_PARTITIONS_COUNT, "parts <= " + CacheConfiguration.MAX_PARTITIONS_COUNT);
 
         this.parts = parts;
+
+        return this;
     }
 
     /**
@@ -256,10 +259,13 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
      * @param hashIdRslvr Hash ID resolver.
      *
      * @deprecated Use {@link IgniteConfiguration#setConsistentId(Serializable)} instead.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setHashIdResolver(AffinityNodeHashResolver hashIdRslvr) {
+    public RendezvousAffinityFunction setHashIdResolver(AffinityNodeHashResolver hashIdRslvr) {
         this.hashIdRslvr = hashIdRslvr;
+
+        return this;
     }
 
     /**
@@ -284,10 +290,14 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
      *
      * @param backupFilter Optional backup filter.
      * @deprecated Use {@code affinityBackupFilter} instead.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setBackupFilter(@Nullable IgniteBiPredicate<ClusterNode, ClusterNode> backupFilter) {
+    public RendezvousAffinityFunction setBackupFilter(
+        @Nullable IgniteBiPredicate<ClusterNode, ClusterNode> backupFilter) {
         this.backupFilter = backupFilter;
+
+        return this;
     }
 
     /**
@@ -311,9 +321,13 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
      * Note that {@code affinityBackupFilter} is ignored if {@code excludeNeighbors} is set to {@code true}.
      *
      * @param affinityBackupFilter Optional backup filter.
+     * @return {@code this} for chaining.
      */
-    public void setAffinityBackupFilter(@Nullable IgniteBiPredicate<ClusterNode, List<ClusterNode>> affinityBackupFilter) {
+    public RendezvousAffinityFunction setAffinityBackupFilter(
+        @Nullable IgniteBiPredicate<ClusterNode, List<ClusterNode>> affinityBackupFilter) {
         this.affinityBackupFilter = affinityBackupFilter;
+
+        return this;
     }
 
     /**
@@ -333,9 +347,12 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
      * Note that {@code backupFilter} is ignored if {@code excludeNeighbors} is set to {@code true}.
      *
      * @param exclNeighbors {@code True} if nodes residing on the same host may not act as backups of each other.
+     * @return {@code this} for chaining.
      */
-    public void setExcludeNeighbors(boolean exclNeighbors) {
+    public RendezvousAffinityFunction setExcludeNeighbors(boolean exclNeighbors) {
         this.exclNeighbors = exclNeighbors;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
index cf0aa1f..d282f27 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
@@ -122,11 +122,14 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
 
     /**
      * Sets maximum allowed cache size in bytes.
+     * @return {@code this} for chaining.
      */
-    public void setMaxMemorySize(long maxMemSize) {
+    public AbstractEvictionPolicy<K, V> setMaxMemorySize(long maxMemSize) {
         A.ensure(maxMemSize >= 0, "maxMemSize >= 0");
 
         this.maxMemSize = maxMemSize;
+
+        return this;
     }
 
     /**
@@ -151,11 +154,14 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
      * Sets maximum allowed size of cache before entry will start getting evicted.
      *
      * @param max Maximum allowed size of cache before entry will start getting evicted.
+     * @return {@code this} for chaining.
      */
-    public void setMaxSize(int max) {
+    public AbstractEvictionPolicy<K, V>  setMaxSize(int max) {
         A.ensure(max >= 0, "max >= 0");
 
         this.max = max;
+
+        return this;
     }
 
     /**
@@ -171,11 +177,14 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
      * Sets batch size.
      *
      * @param batchSize Batch size.
+     * @return {@code this} for chaining.
      */
-    public void setBatchSize(int batchSize) {
+    public AbstractEvictionPolicy<K, V>  setBatchSize(int batchSize) {
         A.ensure(batchSize > 0, "batchSize > 0");
 
         this.batchSize = batchSize;
+
+        return this;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
index f95a588..68495db 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
 import org.apache.ignite.cache.eviction.EvictableEntry;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.mxbean.IgniteMBeanAware;
 import org.jsr166.ConcurrentLinkedDeque8;
 import org.jsr166.ConcurrentLinkedDeque8.Node;
 
@@ -43,7 +44,7 @@ import org.jsr166.ConcurrentLinkedDeque8.Node;
  * table-like data structures. The {@code FIFO} ordering information is
  * maintained by attaching ordering metadata to cache entries.
  */
-public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements FifoEvictionPolicyMBean {
+public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements IgniteMBeanAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -83,6 +84,27 @@ public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imple
         return queue.sizex();
     }
 
+    /** {@inheritDoc} */
+    @Override public FifoEvictionPolicy<K, V> setMaxMemorySize(long maxMemSize) {
+        super.setMaxMemorySize(maxMemSize);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public FifoEvictionPolicy<K, V> setMaxSize(int max) {
+        super.setMaxSize(max);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public FifoEvictionPolicy<K, V> setBatchSize(int batchSize) {
+        super.setBatchSize(batchSize);
+
+        return this;
+    }
+
     /**
      * Gets read-only view on internal {@code FIFO} queue in proper order.
      *
@@ -167,7 +189,57 @@ public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imple
     }
 
     /** {@inheritDoc} */
+    @Override public Object getMBean() {
+        return new FifoEvictionPolicyMBeanImpl();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(FifoEvictionPolicy.class, this);
     }
+
+    /**
+     * MBean implementation for FifoEvictionPolicy.
+     */
+    private class FifoEvictionPolicyMBeanImpl implements FifoEvictionPolicyMBean {
+        /** {@inheritDoc} */
+        @Override public long getCurrentMemorySize() {
+            return FifoEvictionPolicy.this.getCurrentMemorySize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentSize() {
+            return FifoEvictionPolicy.this.getCurrentSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxSize() {
+            return FifoEvictionPolicy.this.getMaxSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxSize(int max) {
+            FifoEvictionPolicy.this.setMaxSize(max);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getBatchSize() {
+            return FifoEvictionPolicy.this.getBatchSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setBatchSize(int batchSize) {
+            FifoEvictionPolicy.this.setBatchSize(batchSize);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMaxMemorySize() {
+            return FifoEvictionPolicy.this.getMaxMemorySize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxMemorySize(long maxMemSize) {
+            FifoEvictionPolicy.this.setMaxMemorySize(maxMemSize);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
index 2615bbf..06f281f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicyMBean.java
@@ -74,6 +74,8 @@ public interface FifoEvictionPolicyMBean {
 
     /**
      * Sets maximum allowed cache size in bytes.
+     *
+     * @param maxMemSize Maximum memory size.
      */
     @MXBeanDescription("Set maximum allowed cache size in bytes.")
     public void setMaxMemorySize(long maxMemSize);

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/IgfsPerBlockLruEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/IgfsPerBlockLruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/IgfsPerBlockLruEvictionPolicy.java
index a82d541..df3c73f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/IgfsPerBlockLruEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/igfs/IgfsPerBlockLruEvictionPolicy.java
@@ -33,6 +33,7 @@ import org.apache.ignite.cache.eviction.EvictionPolicy;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.processors.cache.CacheEvictableEntryImpl;
 import org.apache.ignite.internal.processors.igfs.IgfsBlockKey;
+import org.apache.ignite.mxbean.IgniteMBeanAware;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentLinkedDeque8;
 import org.jsr166.ConcurrentLinkedDeque8.Node;
@@ -41,8 +42,8 @@ import org.jsr166.LongAdder8;
 /**
  * IGFS eviction policy which evicts particular blocks.
  */
-public class IgfsPerBlockLruEvictionPolicy implements EvictionPolicy<IgfsBlockKey, byte[]>,
-    IgfsPerBlockLruEvictionPolicyMXBean, Externalizable {
+public class IgfsPerBlockLruEvictionPolicy implements EvictionPolicy<IgfsBlockKey, byte[]>, IgniteMBeanAware,
+    Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -237,49 +238,98 @@ public class IgfsPerBlockLruEvictionPolicy implements EvictionPolicy<IgfsBlockKe
             curSize.add(delta);
     }
 
-    /** {@inheritDoc} */
-    @Override public long getMaxSize() {
+    /**
+     * Gets maximum allowed size of all blocks in bytes.
+     *
+     * @return Maximum allowed size of all blocks in bytes.
+     */
+    public long getMaxSize() {
         return maxSize;
     }
 
-    /** {@inheritDoc} */
-    @Override public void setMaxSize(long maxSize) {
+    /**
+     * Sets maximum allowed size of data in all blocks in bytes.
+     *
+     * @param maxSize Maximum allowed size of data in all blocks in bytes.
+     *
+     * @return {@code this} for chaining.
+     */
+    public IgfsPerBlockLruEvictionPolicy setMaxSize(long maxSize) {
         this.maxSize = maxSize;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public int getMaxBlocks() {
+    /**
+     * Gets maximum allowed amount of blocks.
+     *
+     * @return Maximum allowed amount of blocks.
+     */
+    public int getMaxBlocks() {
         return maxBlocks;
     }
 
-    /** {@inheritDoc} */
-    @Override public void setMaxBlocks(int maxBlocks) {
+    /**
+     * Sets maximum allowed amount of blocks.
+     *
+     * @param maxBlocks Maximum allowed amount of blocks.
+     *
+     * @return {@code this} for chaining.
+     */
+    public IgfsPerBlockLruEvictionPolicy setMaxBlocks(int maxBlocks) {
         this.maxBlocks = maxBlocks;
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public Collection<String> getExcludePaths() {
+    /**
+     * Gets collection of regex for paths whose blocks must not be evicted.
+     *
+     * @return Collection of regex for paths whose blocks must not be evicted.
+     */
+    public Collection<String> getExcludePaths() {
         return Collections.unmodifiableCollection(excludePaths);
     }
 
-    /** {@inheritDoc} */
-    @Override public void setExcludePaths(@Nullable Collection<String> excludePaths) {
+    /**
+     * Sets collection of regex for paths whose blocks must not be evicted.
+     *
+     * @param excludePaths Collection of regex for paths whose blocks must not be evicted.
+     *
+     * @return {@code this} for chaining.
+     */
+    public IgfsPerBlockLruEvictionPolicy setExcludePaths(@Nullable Collection<String> excludePaths) {
         this.excludePaths = excludePaths;
 
         excludeRecompile.set(true);
+
+        return this;
     }
 
-    /** {@inheritDoc} */
-    @Override public long getCurrentSize() {
+    /**
+     * Gets current size of data in all blocks.
+     *
+     * @return Current size of data in all blocks.
+     */
+    public long getCurrentSize() {
         return curSize.longValue();
     }
 
-    /** {@inheritDoc} */
-    @Override public int getCurrentBlocks() {
+    /**
+     * Gets current amount of blocks.
+     *
+     * @return Current amount of blocks.
+     */
+    public int getCurrentBlocks() {
         return queue.size();
     }
 
     /** {@inheritDoc} */
+    @Override public Object getMBean() {
+        return new IgfsPerBlockLruEvictionPolicyMXBeanImpl();
+    }
+
+    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeLong(maxSize);
         out.writeInt(maxBlocks);
@@ -381,4 +431,49 @@ public class IgfsPerBlockLruEvictionPolicy implements EvictionPolicy<IgfsBlockKe
             return size;
         }
     }
+
+    /**
+     * MBean implementation for IgfsPerBlockLruEvictionPolicy.
+     */
+    private class IgfsPerBlockLruEvictionPolicyMXBeanImpl implements IgfsPerBlockLruEvictionPolicyMXBean {
+        /** {@inheritDoc} */
+        @Override public long getMaxSize() {
+            return IgfsPerBlockLruEvictionPolicy.this.getMaxSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxSize(long maxSize) {
+            IgfsPerBlockLruEvictionPolicy.this.setMaxSize(maxSize);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxBlocks() {
+            return IgfsPerBlockLruEvictionPolicy.this.getMaxBlocks();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxBlocks(int maxBlocks) {
+            IgfsPerBlockLruEvictionPolicy.this.setMaxBlocks(maxBlocks);
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Collection<String> getExcludePaths() {
+            return IgfsPerBlockLruEvictionPolicy.this.getExcludePaths();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setExcludePaths(@Nullable Collection<String> excludePaths) {
+            IgfsPerBlockLruEvictionPolicy.this.setExcludePaths(excludePaths);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getCurrentSize() {
+            return IgfsPerBlockLruEvictionPolicy.this.getCurrentSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentBlocks() {
+            return IgfsPerBlockLruEvictionPolicy.this.getCurrentBlocks();
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
index 17835f1..d571e8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
 import org.apache.ignite.cache.eviction.EvictableEntry;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.mxbean.IgniteMBeanAware;
 import org.jsr166.ConcurrentLinkedDeque8;
 import org.jsr166.ConcurrentLinkedDeque8.Node;
 
@@ -42,7 +43,7 @@ import org.jsr166.ConcurrentLinkedDeque8.Node;
  * This implementation is very efficient since it is lock-free and does not create any additional table-like
  * data structures. The {@code LRU} ordering information is maintained by attaching ordering metadata to cache entries.
  */
-public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements LruEvictionPolicyMBean {
+public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements IgniteMBeanAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -71,6 +72,27 @@ public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implem
         return queue.sizex();
     }
 
+    /** {@inheritDoc} */
+    @Override public LruEvictionPolicy<K, V> setMaxMemorySize(long maxMemSize) {
+        super.setMaxMemorySize(maxMemSize);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public LruEvictionPolicy<K, V> setMaxSize(int max) {
+        super.setMaxSize(max);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public LruEvictionPolicy<K, V> setBatchSize(int batchSize) {
+        super.setBatchSize(batchSize);
+
+        return this;
+    }
+
     /**
      * Gets read-only view on internal {@code FIFO} queue in proper order.
      *
@@ -163,7 +185,57 @@ public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implem
     }
 
     /** {@inheritDoc} */
+    @Override public Object getMBean() {
+        return new LruEvictionPolicyMBeanImpl();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(LruEvictionPolicy.class, this, "size", getCurrentSize());
     }
+
+    /**
+     * MBean implementation for LruEvictionPolicy.
+     */
+    private class LruEvictionPolicyMBeanImpl implements LruEvictionPolicyMBean {
+        /** {@inheritDoc} */
+        @Override public long getCurrentMemorySize() {
+            return LruEvictionPolicy.this.getCurrentMemorySize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentSize() {
+            return LruEvictionPolicy.this.getCurrentSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxSize() {
+            return LruEvictionPolicy.this.getMaxSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxSize(int max) {
+            LruEvictionPolicy.this.setMaxSize(max);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getBatchSize() {
+            return LruEvictionPolicy.this.getBatchSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setBatchSize(int batchSize) {
+            LruEvictionPolicy.this.setBatchSize(batchSize);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMaxMemorySize() {
+            return LruEvictionPolicy.this.getMaxMemorySize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxMemorySize(long maxMemSize) {
+            LruEvictionPolicy.this.setMaxMemorySize(maxMemSize);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
index d0cc975..4b8ac2b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
@@ -32,6 +32,7 @@ import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
 import org.apache.ignite.cache.eviction.EvictableEntry;
 import org.apache.ignite.internal.util.GridConcurrentSkipListSet;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.mxbean.IgniteMBeanAware;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.LongAdder8;
 
@@ -58,7 +59,7 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE
  * <p>
  * User defined comparator should implement {@link Serializable} interface.
  */
-public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements SortedEvictionPolicyMBean {
+public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements IgniteMBeanAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -122,6 +123,27 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
         this.set = new GridConcurrentSkipListSetEx<>(this.comp);
     }
 
+    /** {@inheritDoc} */
+    @Override public SortedEvictionPolicy<K, V> setMaxMemorySize(long maxMemSize) {
+        super.setMaxMemorySize(maxMemSize);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public SortedEvictionPolicy<K, V> setMaxSize(int max) {
+        super.setMaxSize(max);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public SortedEvictionPolicy<K, V> setBatchSize(int batchSize) {
+        super.setBatchSize(batchSize);
+
+        return this;
+    }
+
     /**
      * Gets read-only view of backed queue in proper order.
      *
@@ -210,6 +232,11 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
     }
 
     /** {@inheritDoc} */
+    @Override public Object getMBean() {
+        return new SortedEvictionPolicyMBeanImpl();
+    }
+
+    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         super.writeExternal(out);
 
@@ -401,4 +428,49 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
             return e;
         }
     }
+
+    /**
+     * MBean implementation for SortedEvictionPolicy.
+     */
+    private class SortedEvictionPolicyMBeanImpl implements SortedEvictionPolicyMBean {
+        /** {@inheritDoc} */
+        @Override public long getCurrentMemorySize() {
+            return SortedEvictionPolicy.this.getCurrentMemorySize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getCurrentSize() {
+            return SortedEvictionPolicy.this.getCurrentSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getMaxSize() {
+            return SortedEvictionPolicy.this.getMaxSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxSize(int max) {
+            SortedEvictionPolicy.this.setMaxSize(max);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getBatchSize() {
+            return SortedEvictionPolicy.this.getBatchSize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setBatchSize(int batchSize) {
+            SortedEvictionPolicy.this.setBatchSize(batchSize);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long getMaxMemorySize() {
+            return SortedEvictionPolicy.this.getMaxMemorySize();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setMaxMemorySize(long maxMemSize) {
+            SortedEvictionPolicy.this.setMaxMemorySize(maxMemSize);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/AtomicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/AtomicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/AtomicConfiguration.java
index 6649b5e..573e803 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/AtomicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/AtomicConfiguration.java
@@ -54,9 +54,12 @@ public class AtomicConfiguration {
 
     /**
      * @param backups Number of backup nodes.
+     * @return {@code this} for chaining.
      */
-    public void setBackups(int backups) {
+    public AtomicConfiguration setBackups(int backups) {
         this.backups = backups;
+
+        return this;
     }
 
     /**
@@ -68,9 +71,12 @@ public class AtomicConfiguration {
 
     /**
      * @param cacheMode Cache mode.
+     * @return {@code this} for chaining.
      */
-    public void setCacheMode(CacheMode cacheMode) {
+    public AtomicConfiguration setCacheMode(CacheMode cacheMode) {
         this.cacheMode = cacheMode;
+
+        return this;
     }
 
     /**
@@ -93,9 +99,12 @@ public class AtomicConfiguration {
      *
      * @param seqReserveSize Atomic sequence reservation size.
      * @see #getAtomicSequenceReserveSize()
+     * @return {@code this} for chaining.
      */
-    public void setAtomicSequenceReserveSize(int seqReserveSize) {
+    public AtomicConfiguration setAtomicSequenceReserveSize(int seqReserveSize) {
         this.seqReserveSize = seqReserveSize;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
index 30d77de..54bfc40 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/BinaryConfiguration.java
@@ -52,13 +52,16 @@ public class BinaryConfiguration {
      * Sets class names of binary objects explicitly.
      *
      * @param clsNames Class names.
+     * @return {@code this} for chaining.
      */
-    public void setClassNames(Collection<String> clsNames) {
+    public BinaryConfiguration setClassNames(Collection<String> clsNames) {
         if (typeCfgs == null)
             typeCfgs = new ArrayList<>(clsNames.size());
 
         for (String clsName : clsNames)
             typeCfgs.add(new BinaryTypeConfiguration(clsName));
+
+        return this;
     }
 
     /**
@@ -74,9 +77,12 @@ public class BinaryConfiguration {
      * Sets ID mapper.
      *
      * @param idMapper ID mapper.
+     * @return {@code this} for chaining.
      */
-    public void setIdMapper(BinaryIdMapper idMapper) {
+    public BinaryConfiguration setIdMapper(BinaryIdMapper idMapper) {
         this.idMapper = idMapper;
+
+        return this;
     }
 
     /**
@@ -92,9 +98,12 @@ public class BinaryConfiguration {
      * Sets name mapper.
      *
      * @param nameMapper Name mapper.
+     * @return {@code this} for chaining.
      */
-    public void setNameMapper(BinaryNameMapper nameMapper) {
+    public BinaryConfiguration setNameMapper(BinaryNameMapper nameMapper) {
         this.nameMapper = nameMapper;
+
+        return this;
     }
 
     /**
@@ -110,9 +119,12 @@ public class BinaryConfiguration {
      * Sets serializer.
      *
      * @param serializer Serializer.
+     * @return {@code this} for chaining.
      */
-    public void setSerializer(BinarySerializer serializer) {
+    public BinaryConfiguration setSerializer(BinarySerializer serializer) {
         this.serializer = serializer;
+
+        return this;
     }
 
     /**
@@ -128,9 +140,12 @@ public class BinaryConfiguration {
      * Sets type configurations.
      *
      * @param typeCfgs Type configurations.
+     * @return {@code this} for chaining.
      */
-    public void setTypeConfigurations(Collection<BinaryTypeConfiguration> typeCfgs) {
+    public BinaryConfiguration setTypeConfigurations(Collection<BinaryTypeConfiguration> typeCfgs) {
         this.typeCfgs = typeCfgs;
+
+        return this;
     }
 
     /**
@@ -155,9 +170,12 @@ public class BinaryConfiguration {
      * Set whether to write footers in compact form. See {@link #isCompactFooter()} for more info.
      *
      * @param compactFooter Whether to write footers in compact form.
+     * @return {@code this} for chaining.
      */
-    public void setCompactFooter(boolean compactFooter) {
+    public BinaryConfiguration setCompactFooter(boolean compactFooter) {
         this.compactFooter = compactFooter;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index a47f07c..c4fc98b 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -40,6 +40,8 @@ import javax.cache.configuration.CompleteConfiguration;
 import javax.cache.configuration.Factory;
 import javax.cache.configuration.MutableConfiguration;
 import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.integration.CacheLoader;
+import javax.cache.integration.CacheWriter;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
@@ -940,9 +942,12 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
      * Sets keep binary in store flag.
      *
      * @param storeKeepBinary Keep binary in store flag.
+     * @return {@code this} for chaining.
      */
-    public void setStoreKeepBinary(boolean storeKeepBinary) {
+    public CacheConfiguration<K, V> setStoreKeepBinary(boolean storeKeepBinary) {
         this.storeKeepBinary = storeKeepBinary;
+
+        return this;
     }
 
     /**
@@ -2474,6 +2479,70 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setStatisticsEnabled(boolean enabled) {
+        super.setStatisticsEnabled(enabled);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setManagementEnabled(boolean enabled) {
+        super.setManagementEnabled(enabled);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setCacheLoaderFactory(Factory<? extends CacheLoader<K, V>> factory) {
+        super.setCacheLoaderFactory(factory);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setCacheWriterFactory(
+        Factory<? extends CacheWriter<? super K, ? super V>> factory) {
+        super.setCacheWriterFactory(factory);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setExpiryPolicyFactory(Factory<? extends ExpiryPolicy> factory) {
+        super.setExpiryPolicyFactory(factory);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setTypes(Class<K> keyType, Class<V> valueType) {
+        super.setTypes(keyType, valueType);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setReadThrough(boolean isReadThrough) {
+        super.setReadThrough(isReadThrough);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setWriteThrough(boolean isWriteThrough) {
+        super.setWriteThrough(isWriteThrough);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration<K, V> setStoreByValue(boolean isStoreByValue) {
+        super.setStoreByValue(isStoreByValue);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
index 5ea5074..7b79c58 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java
@@ -68,9 +68,13 @@ public class CollectionConfiguration implements Serializable {
      * @param collocated If {@code true} then all items within the same collection will be collocated on the same node.
      *      Otherwise elements of the same set maybe be cached on different nodes. This parameter works only
      *      collections stored in {@link CacheMode#PARTITIONED} cache.
+     *
+     * @return {@code this} for chaining.
      */
-    public void setCollocated(boolean collocated) {
+    public CollectionConfiguration setCollocated(boolean collocated) {
         this.collocated = collocated;
+
+        return this;
     }
 
     /**
@@ -82,9 +86,12 @@ public class CollectionConfiguration implements Serializable {
 
     /**
      * @param atomicityMode Cache atomicity mode.
+     * @return {@code this} for chaining.
      */
-    public void setAtomicityMode(CacheAtomicityMode atomicityMode) {
+    public CollectionConfiguration setAtomicityMode(CacheAtomicityMode atomicityMode) {
         this.atomicityMode = atomicityMode;
+
+        return this;
     }
 
     /**
@@ -96,9 +103,12 @@ public class CollectionConfiguration implements Serializable {
 
     /**
      * @param cacheMode Cache mode.
+     * @return {@code this} for chaining.
      */
-    public void setCacheMode(CacheMode cacheMode) {
+    public CollectionConfiguration setCacheMode(CacheMode cacheMode) {
         this.cacheMode = cacheMode;
+
+        return this;
     }
 
     /**
@@ -110,9 +120,12 @@ public class CollectionConfiguration implements Serializable {
 
     /**
      * @param memoryMode Memory mode.
+     * @return {@code this} for chaining.
      */
-    public void setMemoryMode(CacheMemoryMode memoryMode) {
+    public CollectionConfiguration setMemoryMode(CacheMemoryMode memoryMode) {
         this.memoryMode = memoryMode;
+
+        return this;
     }
 
     /**
@@ -124,9 +137,12 @@ public class CollectionConfiguration implements Serializable {
 
     /**
      * @param nodeFilter Predicate specifying on which nodes the cache should be started.
+     * @return {@code this} for chaining.
      */
-    public void setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
+    public CollectionConfiguration setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
         this.nodeFilter = nodeFilter;
+
+        return this;
     }
 
     /**
@@ -138,9 +154,12 @@ public class CollectionConfiguration implements Serializable {
 
     /**
      * @param backups Cache number of backups.
+     * @return {@code this} for chaining.
      */
-    public void setBackups(int backups) {
+    public CollectionConfiguration setBackups(int backups) {
         this.backups = backups;
+
+        return this;
     }
 
     /**
@@ -152,9 +171,12 @@ public class CollectionConfiguration implements Serializable {
 
     /**
      * @param offHeapMaxMemory Off-heap memory size.
+     * @return {@code this} for chaining.
      */
-    public void setOffHeapMaxMemory(long offHeapMaxMemory) {
+    public CollectionConfiguration setOffHeapMaxMemory(long offHeapMaxMemory) {
         this.offHeapMaxMem = offHeapMaxMemory;
+
+        return this;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc88028/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
index 6e33b9c..0ee1388 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
@@ -169,9 +169,12 @@ public class ConnectorConfiguration {
      * accessing Ignite APIs remotely.
      *
      * @param jettyPath Path to {@code JETTY} XML configuration file.
+     * @return {@code this} for chaining.
      */
-    public void setJettyPath(String jettyPath) {
+    public ConnectorConfiguration setJettyPath(String jettyPath) {
         this.jettyPath = jettyPath;
+
+        return this;
     }
 
     /**
@@ -195,9 +198,12 @@ public class ConnectorConfiguration {
      * Sets secret key to authenticate REST requests. If key is {@code null} or empty authentication is disabled.
      *
      * @param secretKey REST secret key.
+     * @return {@code this} for chaining.
      */
-    public void setSecretKey(@Nullable String secretKey) {
+    public ConnectorConfiguration setSecretKey(@Nullable String secretKey) {
         this.secretKey = secretKey;
+
+        return this;
     }
 
     /**
@@ -231,9 +237,12 @@ public class ConnectorConfiguration {
      * Sets host for TCP binary protocol server.
      *
      * @param host TCP host.
+     * @return {@code this} for chaining.
      */
-    public void setHost(String host) {
+    public ConnectorConfiguration setHost(String host) {
         this.host = host;
+
+        return this;
     }
 
     /**
@@ -251,9 +260,12 @@ public class ConnectorConfiguration {
      * Sets port for TCP binary protocol server.
      *
      * @param port TCP port.
+     * @return {@code this} for chaining.
      */
-    public void setPort(int port) {
+    public ConnectorConfiguration setPort(int port) {
         this.port = port;
+
+        return this;
     }
 
     /**
@@ -274,9 +286,12 @@ public class ConnectorConfiguration {
      *
      * @param noDelay {@code True} if option should be enabled.
      * @see #isNoDelay()
+     * @return {@code this} for chaining.
      */
-    public void setNoDelay(boolean noDelay) {
+    public ConnectorConfiguration setNoDelay(boolean noDelay) {
         this.noDelay = noDelay;
+
+        return this;
     }
 
     /**
@@ -296,9 +311,12 @@ public class ConnectorConfiguration {
      *
      * @param directBuf {@code True} if option should be enabled.
      * @see #isDirectBuffer()
+     * @return {@code this} for chaining.
      */
-    public void setDirectBuffer(boolean directBuf) {
+    public ConnectorConfiguration setDirectBuffer(boolean directBuf) {
         this.directBuf = directBuf;
+
+        return this;
     }
 
     /**
@@ -315,9 +333,12 @@ public class ConnectorConfiguration {
      *
      * @param sndBufSize Send buffer size.
      * @see #getSendBufferSize()
+     * @return {@code this} for chaining.
      */
-    public void setSendBufferSize(int sndBufSize) {
+    public ConnectorConfiguration setSendBufferSize(int sndBufSize) {
         this.sndBufSize = sndBufSize;
+
+        return this;
     }
 
     /**
@@ -334,9 +355,12 @@ public class ConnectorConfiguration {
      *
      * @param rcvBufSize Receive buffer size.
      * @see #getReceiveBufferSize()
+     * @return {@code this} for chaining.
      */
-    public void setReceiveBufferSize(int rcvBufSize) {
+    public ConnectorConfiguration setReceiveBufferSize(int rcvBufSize) {
         this.rcvBufSize = rcvBufSize;
+
+        return this;
     }
 
     /**
@@ -354,9 +378,12 @@ public class ConnectorConfiguration {
      *
      * @param sndQueueLimit REST TCP server send queue limit (0 for unlimited).
      * @see #getSendQueueLimit()
+     * @return {@code this} for chaining.
      */
-    public void setSendQueueLimit(int sndQueueLimit) {
+    public ConnectorConfiguration setSendQueueLimit(int sndQueueLimit) {
         this.sndQueueLimit = sndQueueLimit;
+
+        return this;
     }
 
     /**
@@ -374,9 +401,12 @@ public class ConnectorConfiguration {
      *
      * @param selectorCnt Number of selector threads for REST TCP server.
      * @see #getSelectorCount()
+     * @return {@code this} for chaining.
      */
-    public void setSelectorCount(int selectorCnt) {
+    public ConnectorConfiguration setSelectorCount(int selectorCnt) {
         this.selectorCnt = selectorCnt;
+
+        return this;
     }
 
     /**
@@ -396,9 +426,12 @@ public class ConnectorConfiguration {
      *
      * @param idleTimeout Idle timeout in milliseconds.
      * @see #getIdleTimeout()
+     * @return {@code this} for chaining.
      */
-    public void setIdleTimeout(long idleTimeout) {
+    public ConnectorConfiguration setIdleTimeout(long idleTimeout) {
         this.idleTimeout = idleTimeout;
+
+        return this;
     }
 
     /**
@@ -420,9 +453,12 @@ public class ConnectorConfiguration {
      * should be provided in {@link IgniteConfiguration}. Otherwise, TCP binary protocol will fail to start.
      *
      * @param sslEnabled {@code True} if SSL should be enabled.
+     * @return {@code this} for chaining.
      */
-    public void setSslEnabled(boolean sslEnabled) {
+    public ConnectorConfiguration setSslEnabled(boolean sslEnabled) {
         this.sslEnabled = sslEnabled;
+
+        return this;
     }
 
     /**
@@ -439,9 +475,12 @@ public class ConnectorConfiguration {
      * Sets flag indicating whether or not SSL client authentication is required.
      *
      * @param sslClientAuth Whether or not client authentication is required.
+     * @return {@code this} for chaining.
      */
-    public void setSslClientAuth(boolean sslClientAuth) {
+    public ConnectorConfiguration setSslClientAuth(boolean sslClientAuth) {
         this.sslClientAuth = sslClientAuth;
+
+        return this;
     }
 
     /**
@@ -463,10 +502,13 @@ public class ConnectorConfiguration {
      *
      * @param sslCtxFactory Instance of {@link GridSslContextFactory}
      * @deprecated Use {@link #setSslFactory(Factory)} instead.
+     * @return {@code this} for chaining.
      */
     @Deprecated
-    public void setSslContextFactory(GridSslContextFactory sslCtxFactory) {
+    public ConnectorConfiguration setSslContextFactory(GridSslContextFactory sslCtxFactory) {
         this.sslCtxFactory = sslCtxFactory;
+
+        return this;
     }
 
     /**
@@ -485,9 +527,12 @@ public class ConnectorConfiguration {
      * {@link #setSslEnabled(boolean)} is set to {@code true}.
      *
      * @param sslFactory Instance of {@link Factory}
+     * @return {@code this} for chaining.
      */
-    public void setSslFactory(Factory<SSLContext> sslFactory) {
+    public ConnectorConfiguration setSslFactory(Factory<SSLContext> sslFactory) {
         this.sslFactory = sslFactory;
+
+        return this;
     }
 
     /**
@@ -506,9 +551,12 @@ public class ConnectorConfiguration {
      * Sets number of ports to try if configured one is in use.
      *
      * @param portRange Port range.
+     * @return {@code this} for chaining.
      */
-    public void setPortRange(int portRange) {
+    public ConnectorConfiguration setPortRange(int portRange) {
         this.portRange = portRange;
+
+        return this;
     }
 
     /**
@@ -527,9 +575,12 @@ public class ConnectorConfiguration {
      *
      * @param threadPoolSize Thread pool size to use for processing of client messages.
      * @see #getThreadPoolSize()
+     * @return {@code this} for chaining.
      */
-    public void setThreadPoolSize(int threadPoolSize) {
+    public ConnectorConfiguration setThreadPoolSize(int threadPoolSize) {
         this.threadPoolSize = threadPoolSize;
+
+        return this;
     }
 
     /**
@@ -559,9 +610,12 @@ public class ConnectorConfiguration {
      * access them from java code directly.
      *
      * @param interceptor Interceptor.
+     * @return {@code this} for chaining.
      */
-    public void setMessageInterceptor(ConnectorMessageInterceptor interceptor) {
+    public ConnectorConfiguration setMessageInterceptor(ConnectorMessageInterceptor interceptor) {
         msgInterceptor = interceptor;
+
+        return this;
     }
 
     /**
@@ -569,9 +623,12 @@ public class ConnectorConfiguration {
      *
      * @param idleQryCurTimeout Idle query cursors timeout in milliseconds.
      * @see #getIdleQueryCursorTimeout()
+     * @return {@code this} for chaining.
      */
-    public void setIdleQueryCursorTimeout(long idleQryCurTimeout) {
+    public ConnectorConfiguration setIdleQueryCursorTimeout(long idleQryCurTimeout) {
         this.idleQryCurTimeout = idleQryCurTimeout;
+
+        return this;
     }
 
     /**
@@ -592,9 +649,12 @@ public class ConnectorConfiguration {
      *
      * @param idleQryCurCheckFreq Idle query check frequency in milliseconds.
      * @see #getIdleQueryCursorCheckFrequency()
+     * @return {@code this} for chaining.
      */
-    public void setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq) {
+    public ConnectorConfiguration setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq) {
         this.idleQryCurCheckFreq = idleQryCurCheckFreq;
+
+        return this;
     }
 
     /**


[06/18] ignite git commit: IGNITE-4888 An assertion error in TcpDiscoverySelfTest

Posted by ag...@apache.org.
IGNITE-4888 An assertion error in TcpDiscoverySelfTest


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

Branch: refs/heads/ignite-3477-master
Commit: f77edc1435bb1621ecee9b65f45f11f29ad44925
Parents: cfc8802
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Fri Mar 31 11:18:32 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Mar 31 11:18:32 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f77edc14/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 3e7d815..f9df356 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -451,13 +451,15 @@ class ServerImpl extends TcpDiscoveryImpl {
         U.join(statsPrinter, log);
 
         Collection<TcpDiscoveryNode> rmts = null;
+        Collection<TcpDiscoveryNode> nodes = null;
 
         if (!disconnect)
             spi.printStopInfo();
         else {
             spi.getSpiContext().deregisterPorts();
 
-            rmts = ring.visibleRemoteNodes();
+            nodes = ring.visibleNodes();
+            rmts = F.view(nodes, F.remoteNodes(locNode.id()));
         }
 
         long topVer = ring.topologyVersion();
@@ -477,7 +479,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                     processed.add(n);
 
-                    List<ClusterNode> top = U.arrayList(rmts, F.notIn(processed));
+                    List<ClusterNode> top = U.arrayList(nodes, F.notIn(processed));
 
                     topVer++;
 


[08/18] ignite git commit: IGNITE-4564: Fix .NET IgniteConfigurationTest.TestAllConfigurationProperties

Posted by ag...@apache.org.
IGNITE-4564: Fix .NET IgniteConfigurationTest.TestAllConfigurationProperties


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

Branch: refs/heads/ignite-3477-master
Commit: b44432dd9409591f18d3d34573e32a018a709c4a
Parents: 4ab870c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Mar 31 13:56:36 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Mar 31 13:56:36 2017 +0300

----------------------------------------------------------------------
 .../processors/platform/utils/PlatformConfigurationUtils.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b44432dd/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 5f73f79..7fb25c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -1101,10 +1101,10 @@ public class PlatformConfigurationUtils {
 
         SwapSpaceSpi swap = cfg.getSwapSpaceSpi();
 
-        if (swap instanceof FileSwapSpaceSpiMBean) {
+        if (swap instanceof FileSwapSpaceSpi) {
             w.writeByte(SWAP_TYP_FILE);
 
-            FileSwapSpaceSpiMBean fileSwap = (FileSwapSpaceSpiMBean)swap;
+            FileSwapSpaceSpi fileSwap = (FileSwapSpaceSpi)swap;
 
             w.writeString(fileSwap.getBaseDirectory());
             w.writeFloat(fileSwap.getMaximumSparsity());


[13/18] ignite git commit: IGNITE-2703 .NET: Dynamic type registration

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/CallbacksTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/CallbacksTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/CallbacksTest.cs
new file mode 100644
index 0000000..a014205
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/CallbacksTest.cs
@@ -0,0 +1,369 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Linq;
+    using System.Runtime.Serialization;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that deserialization callbacks are invoked correctly.
+    /// </summary>
+    public class CallbacksTest
+    {
+        /** Deserialization messages. */
+        private static readonly List<string> Messages = new List<string>();
+
+        /// <summary>
+        /// Tests that callbacks are invoked in correct order on class with ISerializable interface.
+        /// </summary>
+        [Test]
+        public void TestSerializable()
+        {
+            CheckCallbacks<SerCallbacks>(true);
+        }
+
+        /// <summary>
+        /// Tests that callbacks are invoked in correct order on class without ISerializable interface.
+        /// </summary>
+        [Test]
+        public void TestNonSerializable()
+        {
+            CheckCallbacks<SerCallbacksNoInterface>(false);
+        }
+
+        /// <summary>
+        /// Tests that callbacks are invoked in correct order on class with ISerializable interface.
+        /// </summary>
+        [Test]
+        public void TestSerializableStruct()
+        {
+            var obj = new SerCallbacksStruct
+            {
+                Name = "Foo",
+                Inner = new SerCallbacksStruct
+                {
+                    Name = "Bar"
+                }
+            };
+
+            Messages.Clear();
+            var res = TestUtils.SerializeDeserialize(obj);
+
+            Assert.AreEqual("Foo", res.Name);
+            Assert.AreEqual("Bar", ((SerCallbacksStruct) res.Inner).Name);
+
+            // OnDeserialization callbacks should be called AFTER entire tree is deserialized.
+            // Other callbacks order is not strictly defined.
+            var expected = new[]
+            {
+                "Foo.OnSerializing",
+                "Bar.OnSerializing",
+                "Bar.OnSerialized",
+                "Foo.OnSerialized",
+                ".OnDeserializing",
+                ".OnDeserializing",
+                "Bar.ctor",
+                "Bar.OnDeserialized",
+                "Foo.ctor",
+                "Foo.OnDeserialized",
+                "Foo.OnDeserialization",
+                "Bar.OnDeserialization",
+            };
+
+            Assert.AreEqual(expected, Messages);
+        }
+
+        /// <summary>
+        /// Tests that callbacks are invoked in correct order on class without ISerializable interface.
+        /// </summary>
+        [Test]
+        public void TestNonSerializableStruct()
+        {
+            var obj = new SerCallbacksStructNoInterface
+            {
+                Name = "Foo",
+                Inner = new SerCallbacksStructNoInterface
+                {
+                    Name = "Bar"
+                }
+            };
+
+            Messages.Clear();
+            var res = TestUtils.SerializeDeserialize(obj);
+
+            Assert.AreEqual("Foo", res.Name);
+            Assert.AreEqual("Bar", ((SerCallbacksStructNoInterface) res.Inner).Name);
+
+            // OnDeserialization callbacks should be called AFTER entire tree is deserialized.
+            // Other callbacks order is not strictly defined.
+            var expected = new[]
+            {
+                "Foo.OnSerializing",
+                "Bar.OnSerializing",
+                "Bar.OnSerialized",
+                "Foo.OnSerialized",
+                ".OnDeserializing",
+                ".OnDeserializing",
+                "Bar.OnDeserialized",
+                "Foo.OnDeserialized",
+                "Foo.OnDeserialization",
+                "Bar.OnDeserialization",
+            };
+
+            Assert.AreEqual(expected, Messages);
+        }
+
+        /// <summary>
+        /// Checks the callbacks.
+        /// </summary>
+        private static void CheckCallbacks<T>(bool ctorCall) where T : SerCallbacksNoInterface, new()
+        {
+            var obj = new T
+            {
+                Name = "Foo",
+                Inner = new T
+                {
+                    Name = "Bar",
+                    Inner = new T
+                    {
+                        Name = "Baz"
+                    }
+                }
+            };
+
+            Messages.Clear();
+            var res = TestUtils.SerializeDeserialize(obj);
+
+            Assert.AreEqual("Foo", res.Name);
+            Assert.AreEqual("Bar", res.Inner.Name);
+            Assert.AreEqual("Baz", res.Inner.Inner.Name);
+
+            // OnDeserialization callbacks should be called AFTER entire tree is deserialized.
+            // Other callbacks order is not strictly defined.
+            var expected = new[]
+            {
+                "Foo.OnSerializing",
+                "Bar.OnSerializing",
+                "Baz.OnSerializing",
+                "Baz.OnSerialized",
+                "Bar.OnSerialized",
+                "Foo.OnSerialized",
+                ".OnDeserializing",
+                ".OnDeserializing",
+                ".OnDeserializing",
+                "Baz.ctor",
+                "Baz.OnDeserialized",
+                "Bar.ctor",
+                "Bar.OnDeserialized",
+                "Foo.ctor",
+                "Foo.OnDeserialized",
+                "Foo.OnDeserialization",
+                "Bar.OnDeserialization",
+                "Baz.OnDeserialization"
+            };
+
+            if (!ctorCall)
+                expected = expected.Where(x => !x.Contains("ctor")).ToArray();
+
+            Assert.AreEqual(expected, Messages);
+        }
+
+        /// <summary>
+        /// Tests that incorrect method signature causes a descriptive exception.
+        /// </summary>
+        [Test]
+        public void TestIncorrectMethodSignature()
+        {
+            var ex = Assert.Throws<TypeLoadException>(
+                    () => TestUtils.SerializeDeserialize(new InvalidCallbackSignature()));
+
+            var t = typeof(InvalidCallbackSignature);
+
+            Assert.AreEqual(string.Format("Type '{0}' in assembly '{1}' has method 'OnDeserializing' " +
+                                          "with an incorrect signature for the serialization attribute that it " +
+                                          "is decorated with.", t, t.Assembly), ex.Message);
+        }
+
+        /// <summary>
+        /// Class with serialization callbacks and <see cref="ISerializable" /> implemented.
+        /// This goes through <see cref="SerializableSerializer"/>.
+        /// </summary>
+        [Serializable]
+        private class SerCallbacks : SerCallbacksNoInterface, ISerializable
+        {
+            public SerCallbacks()
+            {
+            }
+
+            protected SerCallbacks(SerializationInfo info, StreamingContext context)
+            {
+                Name = info.GetString("name");
+                Inner = (SerCallbacks) info.GetValue("inner", typeof(SerCallbacks));
+
+                Messages.Add(string.Format("{0}.ctor", Name));
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.AddValue("name", Name);
+                info.AddValue("inner", Inner);
+            }
+        }
+
+        /// <summary>
+        /// Class with serialization callbacks and without <see cref="ISerializable" /> implemented.
+        /// This goes through <see cref="BinaryReflectiveSerializer"/>.
+        /// </summary>
+        [Serializable]
+        private class SerCallbacksNoInterface : IDeserializationCallback
+        {
+            public string Name { get; set; }
+
+            public SerCallbacksNoInterface Inner { get; set; }
+
+            public void OnDeserialization(object sender)
+            {
+                Messages.Add(string.Format("{0}.OnDeserialization", Name));
+            }
+
+            [OnSerializing]
+            public void OnSerializing(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnSerializing", Name));
+            }
+
+            [OnSerialized]
+            public void OnSerialized(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnSerialized", Name));
+            }
+
+            [OnDeserializing]
+            public void OnDeserializing(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnDeserializing", Name));
+            }
+
+            [OnDeserialized]
+            public void OnDeserialized(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnDeserialized", Name));
+            }
+        }
+
+        private class InvalidCallbackSignature
+        {
+            [OnDeserializing]
+            public void OnDeserializing()
+            {
+                // No-op.
+            }
+        }
+
+        [Serializable]
+        private struct SerCallbacksStruct : IDeserializationCallback, ISerializable
+        {
+            public string Name { get; set; }
+
+            public object Inner { get; set; }
+
+            public SerCallbacksStruct(SerializationInfo info, StreamingContext context) : this()
+            {
+                Name = info.GetString("name");
+                Inner = info.GetValue("inner", typeof(object));
+                Messages.Add(string.Format("{0}.ctor", Name));
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.AddValue("name", Name);
+                info.AddValue("inner", Inner);
+            }
+
+            public void OnDeserialization(object sender)
+            {
+                Messages.Add(string.Format("{0}.OnDeserialization", Name));
+            }
+
+            [OnSerializing]
+            public void OnSerializing(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnSerializing", Name));
+            }
+
+            [OnSerialized]
+            public void OnSerialized(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnSerialized", Name));
+            }
+
+            [OnDeserializing]
+            public void OnDeserializing(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnDeserializing", Name));
+            }
+
+            [OnDeserialized]
+            public void OnDeserialized(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnDeserialized", Name));
+            }
+        }
+
+        private struct SerCallbacksStructNoInterface : IDeserializationCallback
+        {
+            public string Name { get; set; }
+
+            public object Inner { get; set; }
+
+            public void OnDeserialization(object sender)
+            {
+                Messages.Add(string.Format("{0}.OnDeserialization", Name));
+            }
+
+            [OnSerializing]
+            public void OnSerializing(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnSerializing", Name));
+            }
+
+            [OnSerialized]
+            public void OnSerialized(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnSerialized", Name));
+            }
+
+            [OnDeserializing]
+            public void OnDeserializing(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnDeserializing", Name));
+            }
+
+            [OnDeserialized]
+            public void OnDeserialized(StreamingContext context)
+            {
+                Messages.Add(string.Format("{0}.OnDeserialized", Name));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/DelegatesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/DelegatesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/DelegatesTest.cs
new file mode 100644
index 0000000..90720d4
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/DelegatesTest.cs
@@ -0,0 +1,161 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.Reflection;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests delegate serialization.
+    /// </summary>
+    public class DelegatesTest
+    {
+        /** Test int value. */
+        private static int _int;
+
+        /** Test delegate. */
+        private delegate string LowerSubStringDelegate(string s, int startIndex);
+
+        /// <summary>
+        /// Tests that delegates can be serialized.
+        /// </summary>
+        [Test]
+        public void TestAction()
+        {
+            // Action with captured variable.
+            var val = new PrimitivesTest.Primitives {Int = 135};
+
+            Action act = () => {
+                val.Int++;
+                _int = val.Int;
+            };
+
+            var res = TestUtils.SerializeDeserialize(act);
+            Assert.AreEqual(act.Method, res.Method);
+            Assert.AreNotEqual(act.Target, res.Target);
+
+            res();
+            Assert.AreEqual(135, val.Int);   // Captured variable is deserialized to a new instance.
+            Assert.AreEqual(136, _int);
+
+            // Action with arguments.
+            Action<PrimitivesTest.Primitives, int> act1 = (p, i) => { p.Int = i; };
+
+            var res1 = TestUtils.SerializeDeserialize(act1);
+            Assert.AreEqual(act1.Method, res1.Method);
+
+            res1(val, 33);
+            Assert.AreEqual(33, val.Int);
+        }
+
+        /// <summary>
+        /// Tests that anonymous function can be serialized.
+        /// </summary>
+        [Test]
+        public void TestFunc()
+        {
+            int ms = DateTime.Now.Millisecond;
+
+            Func<int, int> func = x => x + ms;
+
+            var resFunc = TestUtils.SerializeDeserialize(func);
+            Assert.AreEqual(func.Method, resFunc.Method);
+            Assert.AreNotEqual(func.Target, resFunc.Target);
+
+            Assert.AreEqual(ms + 20, resFunc(20));
+        }
+
+        /// <summary>
+        /// Tests that old-fashioned delegate can be serialized.
+        /// </summary>
+        [Test]
+        public void TestDelegate()
+        {
+            // Delegate to a static method.
+            LowerSubStringDelegate del1 = LowerSubString;
+
+            var del1Res = TestUtils.SerializeDeserialize(del1);
+
+            Assert.AreEqual(del1.Method, del1Res.Method);
+            Assert.IsNull(del1Res.Target);
+
+            Assert.AreEqual("ooz", del1Res("FOOZ", 1));
+
+            // Delegate to an anonymous method.
+            LowerSubStringDelegate del2 = (s, i) => s.Substring(i).ToLower();
+
+            var del2Res = TestUtils.SerializeDeserialize(del2);
+
+            Assert.AreEqual(del2.Method, del2Res.Method, "Delegate methods are same");
+
+            Assert.AreEqual("ooz", del2Res("FOOZ", 1), "Delegate works as expected");
+        }
+
+        /// <summary>
+        /// Tests that MethodInfo can be serialized.
+        /// </summary>
+        [Test]
+        public void TestMethodInfo()
+        {
+            var methods = typeof(string).GetMethods(BindingFlags.Public | BindingFlags.NonPublic
+                                                    | BindingFlags.Instance | BindingFlags.Static);
+
+            Assert.IsNotEmpty(methods);
+
+            foreach (var methodInfo in methods)
+            {
+                var res = TestUtils.SerializeDeserialize(methodInfo);
+
+                Assert.AreEqual(methodInfo.Name, res.Name);
+                Assert.AreEqual(methodInfo.DeclaringType, res.DeclaringType);
+                Assert.AreEqual(methodInfo.ReturnType, res.ReturnType);
+                Assert.AreEqual(methodInfo.GetParameters(), res.GetParameters());
+            }
+        }
+
+        /// <summary>
+        /// Tests that recursive anonymous function can be serialized.
+        /// </summary>
+        [Test]
+        public void TestRecursiveFunc()
+        {
+            Func<int, int> fib = null;
+            fib = x => x == 0
+                ? 0
+                : x == 1
+                    ? 1
+                    : fib(x - 2) + fib(x - 1);
+
+            Assert.AreEqual(89, fib(11));
+            Assert.AreEqual(144, fib(12));
+
+            var resFib = TestUtils.SerializeDeserialize(fib);
+
+            Assert.AreEqual(fib.Method, resFib.Method);
+
+            Assert.AreEqual(89, resFib(11));
+            Assert.AreEqual(144, resFib(12));
+        }
+
+        private static string LowerSubString(string s, int startIndex)
+        {
+            return s.Substring(startIndex).ToLower();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/ObjectReferenceTests.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/ObjectReferenceTests.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/ObjectReferenceTests.cs
new file mode 100644
index 0000000..71d2f9a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/ObjectReferenceTests.cs
@@ -0,0 +1,131 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.Runtime.Serialization;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests that <see cref="IObjectReference"/> objects are deserialized properly.
+    /// This only applies to <see cref="ISerializable"/> implementers, which can replace underlying object
+    /// with <see cref="SerializationInfo.SetType"/>, <see cref="SerializationInfo.AssemblyName"/>, and
+    /// <see cref="SerializationInfo.FullTypeName"/>.
+    /// </summary>
+    public class ObjectReferenceTests
+    {
+        /// <summary>
+        /// Tests serialization object replacement with <see cref="SerializationInfo.SetType"/> method.
+        /// </summary>
+        [Test]
+        public void TestSetType()
+        {
+            var obj = new SetTypeReplacer(25);
+
+            var res = TestUtils.SerializeDeserialize(obj);
+
+            Assert.AreEqual(obj.Value, res.Value);
+        }
+
+        /// <summary>
+        /// Tests serialization object replacement with <see cref="SerializationInfo.FullTypeName"/> property.
+        /// </summary>
+        [Test]
+        public void TestTypeName()
+        {
+            var obj = new TypeNameReplacer(36);
+
+            var res = TestUtils.SerializeDeserialize(obj);
+
+            Assert.AreEqual(obj.Value, res.Value);
+        }
+
+        [Serializable]
+        private class SetTypeReplacer : ISerializable
+        {
+            private readonly int _value;
+
+            public SetTypeReplacer(int value)
+            {
+                _value = value;
+            }
+
+            public int Value
+            {
+                get { return _value; }
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.SetType(typeof(ObjectInfoHolder));
+
+                info.AddValue("type", GetType());
+                info.AddValue("val", Value);
+            }
+        }
+
+        [Serializable]
+        private class TypeNameReplacer : ISerializable
+        {
+            private readonly int _value;
+
+            public TypeNameReplacer(int value)
+            {
+                _value = value;
+            }
+
+            public int Value
+            {
+                get { return _value; }
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.FullTypeName = typeof(ObjectInfoHolder).FullName;
+                info.AssemblyName = typeof(ObjectInfoHolder).Assembly.FullName;
+
+                info.AddValue("type", GetType());
+                info.AddValue("val", Value);
+            }
+        }
+
+        [Serializable]
+        private class ObjectInfoHolder : IObjectReference, ISerializable
+        {
+            public Type ObjectType { get; set; }
+
+            public int Value { get; set; }
+
+            public object GetRealObject(StreamingContext context)
+            {
+                return Activator.CreateInstance(ObjectType, Value);
+            }
+
+            public ObjectInfoHolder(SerializationInfo info, StreamingContext context)
+            {
+                ObjectType = (Type) info.GetValue("type", typeof(Type));
+                Value = info.GetInt32("val");
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                // No-op.
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/PrimitivesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/PrimitivesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/PrimitivesTest.cs
new file mode 100644
index 0000000..bbbee60
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/PrimitivesTest.cs
@@ -0,0 +1,754 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ReSharper disable StringLiteralTypo
+// ReSharper disable IdentifierTypo
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.Linq;
+    using System.Runtime.Serialization;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl;
+    using Apache.Ignite.Core.Impl.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests [Serializable] mechanism handling primitive types.
+    /// </summary>
+    public class PrimitivesTest
+    {
+        /** */
+        private IIgnite _ignite;
+        
+        /// <summary>
+        /// Sets up the test fixture.
+        /// </summary>
+        [TestFixtureSetUp]
+        public void FixtureSetUp()
+        {
+            _ignite = Ignition.Start(TestUtils.GetTestConfiguration());
+        }
+
+        /// <summary>
+        /// Tears down the test fixture.
+        /// </summary>
+        [TestFixtureTearDown]
+        public void FixtureTearDown()
+        {
+            Ignition.StopAll(true);
+        }
+
+        /// <summary>
+        /// Tests the DateTime which is ISerializable struct.
+        /// </summary>
+        [Test]
+        public void TestDateTime()
+        {
+            var marsh = GetMarshaller();
+
+            var val = DateTime.Now;
+
+            Assert.AreEqual(val, marsh.Unmarshal<DateTime>(marsh.Marshal(val)));
+
+            Assert.AreEqual(new[] {val}, marsh.Unmarshal<DateTime[]>(marsh.Marshal(new[] {val})));
+
+            Assert.AreEqual(new DateTime?[] {val, null},
+                marsh.Unmarshal<DateTime?[]>(marsh.Marshal(new DateTime?[] {val, null})));
+        }
+
+        /// <summary>
+        /// Tests that primitive types can be serialized with ISerializable mechanism.
+        /// </summary>
+        [Test]
+        public void TestPrimitives()
+        {
+            var marsh = GetMarshaller();
+
+            var val1 = new Primitives
+            {
+                Byte = 1,
+                Bytes = new byte[] {2, 3, byte.MinValue, byte.MaxValue},
+                Sbyte = -64,
+                Sbytes = new sbyte[] {sbyte.MinValue, sbyte.MaxValue, 1, 2, -4, -5},
+                Bool = true,
+                Bools = new[] {true, true, false},
+                Char = 'x',
+                Chars = new[] {'a', 'z', char.MinValue, char.MaxValue},
+                Short = -25,
+                Shorts = new short[] {5, -7, 9, short.MinValue, short.MaxValue},
+                Ushort = 99,
+                Ushorts = new ushort[] {10, 20, 12, ushort.MinValue, ushort.MaxValue},
+                Int = -456,
+                Ints = new[] {-100, 200, -300, int.MinValue, int.MaxValue},
+                Uint = 456,
+                Uints = new uint[] {100, 200, 300, uint.MinValue, uint.MaxValue},
+                Long = long.MaxValue,
+                Longs = new[] {long.MinValue, long.MaxValue, 33, -44},
+                Ulong = ulong.MaxValue,
+                Ulongs = new ulong[] {ulong.MinValue, ulong.MaxValue, 33},
+                Float = 1.33f,
+                Floats = new[]
+                {
+                    float.MinValue, float.MaxValue,
+                    float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN,
+                    1.23f, -2.5f
+                },
+                Double = -6.78,
+                Doubles = new[]
+                {
+                    double.MinValue, double.MaxValue, double.Epsilon,
+                    double.NegativeInfinity, double.PositiveInfinity,
+                    3.76, -9.89
+                },
+                Decimal = 1.23456789m,
+                Decimals = new[]
+                {
+                    decimal.MinValue, decimal.MaxValue, decimal.One, decimal.MinusOne, decimal.Zero,
+                    1.35m, -2.46m
+                },
+                DateTime = DateTime.UtcNow,
+                DateTimes = new[] {DateTime.Now, DateTime.MinValue, DateTime.MaxValue, DateTime.UtcNow},
+                Guid = Guid.NewGuid(),
+                Guids = new[] {Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()},
+                String = "hello world",
+                Strings = new[] {"hello", "world"}
+            };
+
+            var vals = new[] {new Primitives(), val1};
+
+            foreach (var val in vals)
+            {
+                Assert.IsFalse(val.GetObjectDataCalled);
+                Assert.IsFalse(val.SerializationCtorCalled);
+
+                // Unmarshal in full and binary form.
+                var bytes = marsh.Marshal(val);
+                var res = marsh.Unmarshal<Primitives>(bytes);
+                var bin = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+                // Verify flags.
+                Assert.IsTrue(val.GetObjectDataCalled);
+                Assert.IsFalse(val.SerializationCtorCalled);
+
+                Assert.IsFalse(res.GetObjectDataCalled);
+                Assert.IsTrue(res.SerializationCtorCalled);
+
+                // Verify values.
+                Assert.AreEqual(val.Byte, res.Byte);
+                Assert.AreEqual(val.Byte, bin.GetField<byte>("byte"));
+
+                Assert.AreEqual(val.Bytes, res.Bytes);
+                Assert.AreEqual(val.Bytes, bin.GetField<byte[]>("bytes"));
+
+                Assert.AreEqual(val.Sbyte, res.Sbyte);
+                Assert.AreEqual(val.Sbyte, bin.GetField<sbyte>("sbyte"));
+
+                Assert.AreEqual(val.Sbytes, res.Sbytes);
+                Assert.AreEqual(val.Sbytes, bin.GetField<sbyte[]>("sbytes"));
+
+                Assert.AreEqual(val.Bool, res.Bool);
+                Assert.AreEqual(val.Bool, bin.GetField<bool>("bool"));
+
+                Assert.AreEqual(val.Bools, res.Bools);
+                Assert.AreEqual(val.Bools, bin.GetField<bool[]>("bools"));
+
+                Assert.AreEqual(val.Char, res.Char);
+                Assert.AreEqual(val.Char, bin.GetField<char>("char"));
+
+                Assert.AreEqual(val.Chars, res.Chars);
+                Assert.AreEqual(val.Chars, bin.GetField<char[]>("chars"));
+
+                Assert.AreEqual(val.Short, res.Short);
+                Assert.AreEqual(val.Short, bin.GetField<short>("short"));
+
+                Assert.AreEqual(val.Shorts, res.Shorts);
+                Assert.AreEqual(val.Shorts, bin.GetField<short[]>("shorts"));
+
+                Assert.AreEqual(val.Ushort, res.Ushort);
+                Assert.AreEqual(val.Ushort, bin.GetField<ushort>("ushort"));
+
+                Assert.AreEqual(val.Ushorts, res.Ushorts);
+                Assert.AreEqual(val.Ushorts, bin.GetField<ushort[]>("ushorts"));
+
+                Assert.AreEqual(val.Int, res.Int);
+                Assert.AreEqual(val.Int, bin.GetField<int>("int"));
+
+                Assert.AreEqual(val.Ints, res.Ints);
+                Assert.AreEqual(val.Ints, bin.GetField<int[]>("ints"));
+
+                Assert.AreEqual(val.Uint, res.Uint);
+                Assert.AreEqual(val.Uint, bin.GetField<uint>("uint"));
+
+                Assert.AreEqual(val.Uints, res.Uints);
+                Assert.AreEqual(val.Uints, bin.GetField<uint[]>("uints"));
+
+                Assert.AreEqual(val.Long, res.Long);
+                Assert.AreEqual(val.Long, bin.GetField<long>("long"));
+
+                Assert.AreEqual(val.Longs, res.Longs);
+                Assert.AreEqual(val.Longs, bin.GetField<long[]>("longs"));
+
+                Assert.AreEqual(val.Ulong, res.Ulong);
+                Assert.AreEqual(val.Ulong, bin.GetField<ulong>("ulong"));
+
+                Assert.AreEqual(val.Ulongs, res.Ulongs);
+                Assert.AreEqual(val.Ulongs, bin.GetField<ulong[]>("ulongs"));
+
+                Assert.AreEqual(val.Float, res.Float);
+                Assert.AreEqual(val.Float, bin.GetField<float>("float"));
+
+                Assert.AreEqual(val.Floats, res.Floats);
+                Assert.AreEqual(val.Floats, bin.GetField<float[]>("floats"));
+
+                Assert.AreEqual(val.Double, res.Double);
+                Assert.AreEqual(val.Double, bin.GetField<double>("double"));
+
+                Assert.AreEqual(val.Doubles, res.Doubles);
+                Assert.AreEqual(val.Doubles, bin.GetField<double[]>("doubles"));
+
+                Assert.AreEqual(val.Decimal, res.Decimal);
+                Assert.AreEqual(val.Decimal, bin.GetField<decimal>("decimal"));
+
+                Assert.AreEqual(val.Decimals, res.Decimals);
+                Assert.AreEqual(val.Decimals, bin.GetField<decimal[]>("decimals"));
+
+                Assert.AreEqual(val.Guid, res.Guid);
+                Assert.AreEqual(val.Guid, bin.GetField<Guid>("guid"));
+
+                Assert.AreEqual(val.Guids, res.Guids);
+                Assert.AreEqual(val.Guids, bin.GetField<Guid[]>("guids"));
+
+                Assert.AreEqual(val.DateTime, res.DateTime);
+                Assert.AreEqual(val.DateTime, bin.GetField<IBinaryObject>("datetime").Deserialize<DateTime>());
+
+                Assert.AreEqual(val.DateTimes, res.DateTimes);
+                var dts = bin.GetField<IBinaryObject[]>("datetimes");
+                Assert.AreEqual(val.DateTimes, dts == null ? null : dts.Select(x => x.Deserialize<DateTime>()));
+
+                Assert.AreEqual(val.String, res.String);
+                Assert.AreEqual(val.String, bin.GetField<string>("string"));
+
+                Assert.AreEqual(val.Strings, res.Strings);
+                Assert.AreEqual(val.Strings, bin.GetField<string[]>("strings"));
+
+                VerifyFieldTypes(bin);
+            }
+        }
+
+        /// <summary>
+        /// Tests that primitive types in nullable form can be serialized with ISerializable mechanism.
+        /// </summary>
+        [Test]
+        public void TestPrimitivesNullable()
+        {
+            var marsh = GetMarshaller();
+
+            var val1 = new PrimitivesNullable
+            {
+                Byte = 1,
+                Bytes = new byte?[] {2, 3, byte.MinValue, byte.MaxValue, null},
+                Sbyte = -64,
+                Sbytes = new sbyte?[] {sbyte.MinValue, sbyte.MaxValue, 1, 2, -4, -5, null},
+                Bool = true,
+                Bools = new bool?[] {true, true, false, null},
+                Char = 'x',
+                Chars = new char?[] {'a', 'z', char.MinValue, char.MaxValue, null},
+                Short = -25,
+                Shorts = new short?[] {5, -7, 9, short.MinValue, short.MaxValue, null},
+                Ushort = 99,
+                Ushorts = new ushort?[] {10, 20, 12, ushort.MinValue, ushort.MaxValue, null},
+                Int = -456,
+                Ints = new int?[] {-100, 200, -300, int.MinValue, int.MaxValue, null},
+                Uint = 456,
+                Uints = new uint?[] {100, 200, 300, uint.MinValue, uint.MaxValue, null},
+                Long = long.MaxValue,
+                Longs = new long?[] {long.MinValue, long.MaxValue, 33, -44, null},
+                Ulong = ulong.MaxValue,
+                Ulongs = new ulong?[] {ulong.MinValue, ulong.MaxValue, 33, null},
+                Float = 1.33f,
+                Floats = new float?[]
+                {
+                    float.MinValue, float.MaxValue,
+                    float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN,
+                    1.23f, -2.5f, null
+                },
+                Double = -6.78,
+                Doubles = new double?[]
+                {
+                    double.MinValue, double.MaxValue, double.Epsilon,
+                    double.NegativeInfinity, double.PositiveInfinity,
+                    3.76, -9.89, null
+                },
+                Decimal = 1.23456789m,
+                Decimals = new decimal?[]
+                {
+                    decimal.MinValue, decimal.MaxValue, decimal.One, decimal.MinusOne, decimal.Zero,
+                    1.35m, -2.46m, null
+                },
+                DateTime = DateTime.UtcNow,
+                DateTimes = new DateTime?[]
+                {
+                    DateTime.Now, DateTime.MinValue, DateTime.MaxValue, DateTime.UtcNow, null
+                },
+                Guid = Guid.NewGuid(),
+                Guids = new Guid?[] {Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), null},
+            };
+
+            var vals = new[] {new PrimitivesNullable(), val1};
+
+            foreach (var val in vals)
+            {
+                Assert.IsFalse(val.GetObjectDataCalled);
+                Assert.IsFalse(val.SerializationCtorCalled);
+
+                // Unmarshal in full and binary form.
+                var bytes = marsh.Marshal(val);
+                var res = marsh.Unmarshal<PrimitivesNullable>(bytes);
+                var bin = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+                // Verify flags.
+                Assert.IsTrue(val.GetObjectDataCalled);
+                Assert.IsFalse(val.SerializationCtorCalled);
+
+                Assert.IsFalse(res.GetObjectDataCalled);
+                Assert.IsTrue(res.SerializationCtorCalled);
+
+                // Verify values.
+                Assert.AreEqual(val.Byte, res.Byte);
+                Assert.AreEqual(val.Byte, bin.GetField<byte?>("byte"));
+
+                Assert.AreEqual(val.Bytes, res.Bytes);
+                Assert.AreEqual(val.Bytes, bin.GetField<byte?[]>("bytes"));
+
+                Assert.AreEqual(val.Sbyte, res.Sbyte);
+                Assert.AreEqual(val.Sbyte, bin.GetField<sbyte?>("sbyte"));
+
+                Assert.AreEqual(val.Sbytes, res.Sbytes);
+                Assert.AreEqual(val.Sbytes, bin.GetField<sbyte?[]>("sbytes"));
+
+                Assert.AreEqual(val.Bool, res.Bool);
+                Assert.AreEqual(val.Bool, bin.GetField<bool?>("bool"));
+
+                Assert.AreEqual(val.Bools, res.Bools);
+                Assert.AreEqual(val.Bools, bin.GetField<bool?[]>("bools"));
+
+                Assert.AreEqual(val.Char, res.Char);
+                Assert.AreEqual(val.Char, bin.GetField<char?>("char"));
+
+                Assert.AreEqual(val.Chars, res.Chars);
+                Assert.AreEqual(val.Chars, bin.GetField<char?[]>("chars"));
+
+                Assert.AreEqual(val.Short, res.Short);
+                Assert.AreEqual(val.Short, bin.GetField<short?>("short"));
+
+                Assert.AreEqual(val.Shorts, res.Shorts);
+                Assert.AreEqual(val.Shorts, bin.GetField<short?[]>("shorts"));
+
+                Assert.AreEqual(val.Ushort, res.Ushort);
+                Assert.AreEqual(val.Ushort, bin.GetField<ushort?>("ushort"));
+
+                Assert.AreEqual(val.Ushorts, res.Ushorts);
+                Assert.AreEqual(val.Ushorts, bin.GetField<ushort?[]>("ushorts"));
+
+                Assert.AreEqual(val.Int, res.Int);
+                Assert.AreEqual(val.Int, bin.GetField<int?>("int"));
+
+                Assert.AreEqual(val.Ints, res.Ints);
+                Assert.AreEqual(val.Ints, bin.GetField<int?[]>("ints"));
+
+                Assert.AreEqual(val.Uint, res.Uint);
+                Assert.AreEqual(val.Uint, bin.GetField<uint?>("uint"));
+
+                Assert.AreEqual(val.Uints, res.Uints);
+                Assert.AreEqual(val.Uints, bin.GetField<uint?[]>("uints"));
+
+                Assert.AreEqual(val.Long, res.Long);
+                Assert.AreEqual(val.Long, bin.GetField<long?>("long"));
+
+                Assert.AreEqual(val.Longs, res.Longs);
+                Assert.AreEqual(val.Longs, bin.GetField<long?[]>("longs"));
+
+                Assert.AreEqual(val.Ulong, res.Ulong);
+                Assert.AreEqual(val.Ulong, bin.GetField<ulong?>("ulong"));
+
+                Assert.AreEqual(val.Ulongs, res.Ulongs);
+                Assert.AreEqual(val.Ulongs, bin.GetField<ulong?[]>("ulongs"));
+
+                Assert.AreEqual(val.Float, res.Float);
+                Assert.AreEqual(val.Float, bin.GetField<float?>("float"));
+
+                Assert.AreEqual(val.Floats, res.Floats);
+                Assert.AreEqual(val.Floats, bin.GetField<float?[]>("floats"));
+
+                Assert.AreEqual(val.Double, res.Double);
+                Assert.AreEqual(val.Double, bin.GetField<double?>("double"));
+
+                Assert.AreEqual(val.Doubles, res.Doubles);
+                Assert.AreEqual(val.Doubles, bin.GetField<double?[]>("doubles"));
+
+                Assert.AreEqual(val.Decimal, res.Decimal);
+                Assert.AreEqual(val.Decimal, bin.GetField<decimal?>("decimal"));
+
+                Assert.AreEqual(val.Decimals, res.Decimals);
+                Assert.AreEqual(val.Decimals, bin.GetField<decimal?[]>("decimals"));
+
+                Assert.AreEqual(val.Guid, res.Guid);
+                Assert.AreEqual(val.Guid, bin.GetField<Guid?>("guid"));
+
+                Assert.AreEqual(val.Guids, res.Guids);
+                Assert.AreEqual(val.Guids, bin.GetField<Guid?[]>("guids"));
+
+                Assert.AreEqual(val.DateTime, res.DateTime);
+                var dt = bin.GetField<IBinaryObject>("datetime");
+                Assert.AreEqual(val.DateTime, dt == null ? null : dt.Deserialize<DateTime?>());
+
+                Assert.AreEqual(val.DateTimes, res.DateTimes);
+                var dts = bin.GetField<IBinaryObject[]>("datetimes");
+                Assert.AreEqual(val.DateTimes, dts == null
+                    ? null
+                    : dts.Select(x => x == null ? null : x.Deserialize<DateTime?>()));
+            }
+        }
+
+        /// <summary>
+        /// Verifies the field types.
+        /// </summary>
+        private static void VerifyFieldTypes(IBinaryObject bin)
+        {
+            var binType = bin.GetBinaryType();
+            
+            Assert.AreEqual("byte", binType.GetFieldTypeName("byte"));
+            Assert.AreEqual("byte", binType.GetFieldTypeName("sbyte"));
+            
+            Assert.AreEqual("byte[]", binType.GetFieldTypeName("bytes"));
+            Assert.AreEqual("byte[]", binType.GetFieldTypeName("sbytes"));
+            
+            Assert.AreEqual("boolean", binType.GetFieldTypeName("bool"));
+            Assert.AreEqual("boolean[]", binType.GetFieldTypeName("bools"));
+            
+            Assert.AreEqual("char", binType.GetFieldTypeName("char"));
+            Assert.AreEqual("char[]", binType.GetFieldTypeName("chars"));
+
+            Assert.AreEqual("short", binType.GetFieldTypeName("short"));
+            Assert.AreEqual("short[]", binType.GetFieldTypeName("shorts"));
+
+            Assert.AreEqual("short", binType.GetFieldTypeName("ushort"));
+            Assert.AreEqual("short[]", binType.GetFieldTypeName("ushorts"));
+
+            Assert.AreEqual("int", binType.GetFieldTypeName("int"));
+            Assert.AreEqual("int[]", binType.GetFieldTypeName("ints"));
+
+            Assert.AreEqual("int", binType.GetFieldTypeName("uint"));
+            Assert.AreEqual("int[]", binType.GetFieldTypeName("uints"));
+
+            Assert.AreEqual("long", binType.GetFieldTypeName("long"));
+            Assert.AreEqual("long[]", binType.GetFieldTypeName("longs"));
+
+            Assert.AreEqual("long", binType.GetFieldTypeName("ulong"));
+            Assert.AreEqual("long[]", binType.GetFieldTypeName("ulongs"));
+
+            Assert.AreEqual("float", binType.GetFieldTypeName("float"));
+            Assert.AreEqual("float[]", binType.GetFieldTypeName("floats"));
+
+            Assert.AreEqual("double", binType.GetFieldTypeName("double"));
+            Assert.AreEqual("double[]", binType.GetFieldTypeName("doubles"));
+
+            Assert.AreEqual("decimal", binType.GetFieldTypeName("decimal"));
+            Assert.AreEqual("Object", binType.GetFieldTypeName("decimals"));
+
+            Assert.AreEqual("UUID", binType.GetFieldTypeName("guid"));
+            Assert.AreEqual("Object", binType.GetFieldTypeName("guids"));
+
+            Assert.AreEqual("Object", binType.GetFieldTypeName("datetime"));
+            Assert.AreEqual("Object", binType.GetFieldTypeName("datetimes"));
+        }
+
+        /// <summary>
+        /// Gets the marshaller.
+        /// </summary>
+        private Marshaller GetMarshaller()
+        {
+            return ((Ignite) _ignite).Marshaller;
+        }
+
+        [Serializable]
+        public class Primitives : ISerializable
+        {
+            public bool GetObjectDataCalled { get; private set; }
+            public bool SerializationCtorCalled { get; private set; }
+
+            public byte Byte { get; set; }
+            public byte[] Bytes { get; set; }
+            public sbyte Sbyte { get; set; }
+            public sbyte[] Sbytes { get; set; }
+            public bool Bool { get; set; }
+            public bool[] Bools { get; set; }
+            public char Char { get; set; }
+            public char[] Chars { get; set; }
+            public short Short { get; set; }
+            public short[] Shorts { get; set; }
+            public ushort Ushort { get; set; }
+            public ushort[] Ushorts { get; set; }
+            public int Int { get; set; }
+            public int[] Ints { get; set; }
+            public uint Uint { get; set; }
+            public uint[] Uints { get; set; }
+            public long Long { get; set; }
+            public long[] Longs { get; set; }
+            public ulong Ulong { get; set; }
+            public ulong[] Ulongs { get; set; }
+            public float Float { get; set; }
+            public float[] Floats { get; set; }
+            public double Double { get; set; }
+            public double[] Doubles { get; set; }
+            public decimal Decimal { get; set; }
+            public decimal[] Decimals { get; set; }
+            public Guid Guid { get; set; }
+            public Guid[] Guids { get; set; }
+            public DateTime DateTime { get; set; }
+            public DateTime[] DateTimes { get; set; }
+            public string String { get; set; }
+            public string[] Strings { get; set; }
+
+            public Primitives()
+            {
+                // No-op.
+            }
+
+            protected Primitives(SerializationInfo info, StreamingContext context)
+            {
+                SerializationCtorCalled = true;
+
+                Byte = info.GetByte("byte");
+                Bytes = (byte[]) info.GetValue("bytes", typeof(byte[]));
+
+                Sbyte = info.GetSByte("sbyte");
+                Sbytes = (sbyte[]) info.GetValue("sbytes", typeof(sbyte[]));
+
+                Bool = info.GetBoolean("bool");
+                Bools = (bool[]) info.GetValue("bools", typeof(bool[]));
+
+                Char = info.GetChar("char");
+                Chars = (char[]) info.GetValue("chars", typeof(char[]));
+
+                Short = info.GetInt16("short");
+                Shorts = (short[]) info.GetValue("shorts", typeof(short[]));
+
+                Ushort = info.GetUInt16("ushort");
+                Ushorts = (ushort[]) info.GetValue("ushorts", typeof(ushort[]));
+
+                Int = info.GetInt32("int");
+                Ints = (int[]) info.GetValue("ints", typeof(int[]));
+
+                Uint = info.GetUInt32("uint");
+                Uints = (uint[]) info.GetValue("uints", typeof(uint[]));
+
+                Long = info.GetInt64("long");
+                Longs = (long[]) info.GetValue("longs", typeof(long[]));
+
+                Ulong = info.GetUInt64("ulong");
+                Ulongs = (ulong[]) info.GetValue("ulongs", typeof(ulong[]));
+
+                Float = info.GetSingle("float");
+                Floats = (float[]) info.GetValue("floats", typeof(float[]));
+
+                Double = info.GetDouble("double");
+                Doubles = (double[]) info.GetValue("doubles", typeof(double[]));
+
+                Decimal = info.GetDecimal("decimal");
+                Decimals = (decimal[]) info.GetValue("decimals", typeof(decimal[]));
+
+                Guid = (Guid) info.GetValue("guid", typeof(Guid));
+                Guids = (Guid[]) info.GetValue("guids", typeof(Guid[]));
+
+                DateTime = info.GetDateTime("datetime");
+                DateTimes = (DateTime[]) info.GetValue("datetimes", typeof(DateTime[]));
+
+                String = info.GetString("string");
+                Strings = (string[]) info.GetValue("strings", typeof(string[]));
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                GetObjectDataCalled = true;
+
+                info.AddValue("byte", Byte);
+                info.AddValue("bytes", Bytes, typeof(byte[]));
+                info.AddValue("sbyte", Sbyte);
+                info.AddValue("sbytes", Sbytes, typeof(sbyte[]));
+                info.AddValue("bool", Bool);
+                info.AddValue("bools", Bools, typeof(bool[]));
+                info.AddValue("char", Char);
+                info.AddValue("chars", Chars, typeof(char[]));
+                info.AddValue("short", Short);
+                info.AddValue("shorts", Shorts, typeof(short[]));
+                info.AddValue("ushort", Ushort);
+                info.AddValue("ushorts", Ushorts, typeof(ushort[]));
+                info.AddValue("int", Int);
+                info.AddValue("ints", Ints, typeof(int[]));
+                info.AddValue("uint", Uint);
+                info.AddValue("uints", Uints, typeof(uint[]));
+                info.AddValue("long", Long);
+                info.AddValue("longs", Longs, typeof(long[]));
+                info.AddValue("ulong", Ulong);
+                info.AddValue("ulongs", Ulongs, typeof(ulong[]));
+                info.AddValue("float", Float);
+                info.AddValue("floats", Floats, typeof(float[]));
+                info.AddValue("double", Double);
+                info.AddValue("doubles", Doubles, typeof(double[]));
+                info.AddValue("decimal", Decimal);
+                info.AddValue("decimals", Decimals, typeof(decimal[]));
+                info.AddValue("guid", Guid);
+                info.AddValue("guids", Guids, typeof(Guid[]));
+                info.AddValue("datetime", DateTime);
+                info.AddValue("datetimes", DateTimes, typeof(DateTime[]));
+                info.AddValue("string", String, typeof(string));
+                info.AddValue("strings", Strings, typeof(string[]));
+            }
+        }
+
+        [Serializable]
+        private class PrimitivesNullable : ISerializable
+        {
+            public bool GetObjectDataCalled { get; private set; }
+            public bool SerializationCtorCalled { get; private set; }
+
+            public byte? Byte { get; set; }
+            public byte?[] Bytes { get; set; }
+            public sbyte? Sbyte { get; set; }
+            public sbyte?[] Sbytes { get; set; }
+            public bool? Bool { get; set; }
+            public bool?[] Bools { get; set; }
+            public char? Char { get; set; }
+            public char?[] Chars { get; set; }
+            public short? Short { get; set; }
+            public short?[] Shorts { get; set; }
+            public ushort? Ushort { get; set; }
+            public ushort?[] Ushorts { get; set; }
+            public int? Int { get; set; }
+            public int?[] Ints { get; set; }
+            public uint? Uint { get; set; }
+            public uint?[] Uints { get; set; }
+            public long? Long { get; set; }
+            public long?[] Longs { get; set; }
+            public ulong? Ulong { get; set; }
+            public ulong?[] Ulongs { get; set; }
+            public float? Float { get; set; }
+            public float?[] Floats { get; set; }
+            public double? Double { get; set; }
+            public double?[] Doubles { get; set; }
+            public decimal? Decimal { get; set; }
+            public decimal?[] Decimals { get; set; }
+            public Guid? Guid { get; set; }
+            public Guid?[] Guids { get; set; }
+            public DateTime? DateTime { get; set; }
+            public DateTime?[] DateTimes { get; set; }
+
+            public PrimitivesNullable()
+            {
+                // No-op.
+            }
+
+            protected PrimitivesNullable(SerializationInfo info, StreamingContext context)
+            {
+                SerializationCtorCalled = true;
+
+                Byte = (byte?) info.GetValue("byte", typeof(byte?));
+                Bytes = (byte?[]) info.GetValue("bytes", typeof(byte?[]));
+
+                Sbyte = (sbyte?) info.GetValue("sbyte", typeof(sbyte?));
+                Sbytes = (sbyte?[]) info.GetValue("sbytes", typeof(sbyte?[]));
+
+                Bool = (bool?) info.GetValue("bool", typeof(bool?));
+                Bools = (bool?[]) info.GetValue("bools", typeof(bool?[]));
+
+                Char = (char?) info.GetValue("char", typeof(char?));
+                Chars = (char?[]) info.GetValue("chars", typeof(char?[]));
+
+                Short = (short?) info.GetValue("short", typeof(short?));
+                Shorts = (short?[]) info.GetValue("shorts", typeof(short?[]));
+
+                Ushort = (ushort?) info.GetValue("ushort", typeof(ushort?));
+                Ushorts = (ushort?[]) info.GetValue("ushorts", typeof(ushort?[]));
+
+                Int = (int?) info.GetValue("int", typeof(int?));
+                Ints = (int?[]) info.GetValue("ints", typeof(int?[]));
+
+                Uint = (uint?) info.GetValue("uint", typeof(uint?));
+                Uints = (uint?[]) info.GetValue("uints", typeof(uint?[]));
+
+                Long = (long?) info.GetValue("long", typeof(long?));
+                Longs = (long?[]) info.GetValue("longs", typeof(long?[]));
+
+                Ulong = (ulong?) info.GetValue("ulong", typeof(ulong?));
+                Ulongs = (ulong?[]) info.GetValue("ulongs", typeof(ulong?[]));
+
+                Float = (float?) info.GetValue("float", typeof(float?));
+                Floats = (float?[]) info.GetValue("floats", typeof(float?[]));
+
+                Double = (double?) info.GetValue("double", typeof(double?));
+                Doubles = (double?[]) info.GetValue("doubles", typeof(double?[]));
+
+                Decimal = (decimal?) info.GetValue("decimal", typeof(decimal?));
+                Decimals = (decimal?[]) info.GetValue("decimals", typeof(decimal?[]));
+
+                Guid = (Guid?) info.GetValue("guid", typeof(Guid?));
+                Guids = (Guid?[]) info.GetValue("guids", typeof(Guid?[]));
+
+                DateTime = (DateTime?) info.GetValue("datetime", typeof(DateTime?));
+                DateTimes = (DateTime?[]) info.GetValue("datetimes", typeof(DateTime?[]));
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                GetObjectDataCalled = true;
+
+                info.AddValue("byte", Byte, typeof(object));
+                info.AddValue("bytes", Bytes, typeof(object));
+                info.AddValue("sbyte", Sbyte, typeof(object));
+                info.AddValue("sbytes", Sbytes, typeof(object));
+                info.AddValue("bool", Bool, typeof(object));
+                info.AddValue("bools", Bools, typeof(object));
+                info.AddValue("char", Char, typeof(object));
+                info.AddValue("chars", Chars, typeof(object));
+                info.AddValue("short", Short, typeof(object));
+                info.AddValue("shorts", Shorts, typeof(object));
+                info.AddValue("ushort", Ushort, typeof(object));
+                info.AddValue("ushorts", Ushorts, typeof(object));
+                info.AddValue("int", Int, typeof(object));
+                info.AddValue("ints", Ints, typeof(object));
+                info.AddValue("uint", Uint, typeof(object));
+                info.AddValue("uints", Uints, typeof(object));
+                info.AddValue("long", Long, typeof(object));
+                info.AddValue("longs", Longs, typeof(object));
+                info.AddValue("ulong", Ulong, typeof(object));
+                info.AddValue("ulongs", Ulongs, typeof(object));
+                info.AddValue("float", Float, typeof(object));
+                info.AddValue("floats", Floats, typeof(object));
+                info.AddValue("double", Double, typeof(object));
+                info.AddValue("doubles", Doubles, typeof(object));
+                info.AddValue("decimal", Decimal, typeof(object));
+                info.AddValue("decimals", Decimals, typeof(object));
+                info.AddValue("guid", Guid, typeof(object));
+                info.AddValue("guids", Guids, typeof(object));
+                info.AddValue("datetime", DateTime, typeof(object));
+                info.AddValue("datetimes", DateTimes, typeof(object));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
new file mode 100644
index 0000000..b59247e
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
@@ -0,0 +1,277 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ReSharper disable UnusedMember.Local
+// ReSharper disable UnusedParameter.Local
+namespace Apache.Ignite.Core.Tests.Binary.Serializable
+{
+    using System;
+    using System.IO;
+    using System.Linq;
+    using System.Runtime.Serialization;
+    using System.Text;
+    using System.Threading;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Cache.Configuration;
+    using Apache.Ignite.Core.Cache.Query;
+    using Apache.Ignite.Linq;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests SQL and DML with Serializable types.
+    /// </summary>
+    public class SqlDmlTest
+    {
+        /** */
+        private IIgnite _ignite;
+        
+        /** */
+        private StringBuilder _outSb;
+
+        /// <summary>
+        /// Sets up the test fixture.
+        /// </summary>
+        [TestFixtureSetUp]
+        public void FixtureSetUp()
+        {
+            _outSb = new StringBuilder();
+            Console.SetError(new StringWriter(_outSb));
+
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                BinaryConfiguration = new BinaryConfiguration(typeof(SimpleSerializable))
+            };
+
+            _ignite = Ignition.Start(cfg);
+        }
+
+        /// <summary>
+        /// Tears down the test fixture.
+        /// </summary>
+        [TestFixtureTearDown]
+        public void FixtureTearDown()
+        {
+            Ignition.StopAll(true);
+        }
+
+        /// <summary>
+        /// Tests the simple serializable.
+        /// </summary>
+        [Test]
+        public void TestSimpleSerializable()
+        {
+            var cache = _ignite.CreateCache<int, SimpleSerializable>(
+                new CacheConfiguration("simple", new QueryEntity(typeof(int), typeof(SimpleSerializable))));
+
+            cache[1] = new SimpleSerializable
+            {
+                String = "abc"
+            };
+            cache[2] = new SimpleSerializable
+            {
+                Byte = 25,
+                Bool = true,
+                Short = 66,
+                Int = 2,
+                Long = 98,
+                Float = 2.25f,
+                Double = 1.123,
+                Decimal = 5.67m,
+                Guid = Guid.NewGuid(),
+                String = "bar2"
+            };
+
+            // Test SQL.
+            var res = cache.Query(new SqlQuery(typeof(SimpleSerializable), "where Int = 2")).GetAll().Single();
+
+            Assert.AreEqual(2, res.Key);
+            Assert.AreEqual(2, res.Value.Int);
+            Assert.AreEqual("bar2", res.Value.String);
+
+            // Test DML.
+            var guid = Guid.NewGuid();
+            var insertRes = cache.QueryFields(new SqlFieldsQuery(
+                "insert into SimpleSerializable(_key, Byte, Bool, Short, Int, Long, Float, Double, " +
+                "Decimal, Guid, String) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", 
+                3, 45, true, 43, 33, 99, 4.5f, 6.7, 9.04m, guid, "bar33")).GetAll();
+
+            Assert.AreEqual(1, insertRes.Count);
+            Assert.AreEqual(1, insertRes[0][0]);
+
+            var dmlRes = cache[3];
+            Assert.AreEqual(45, dmlRes.Byte);
+            Assert.AreEqual(true, dmlRes.Bool);
+            Assert.AreEqual(43, dmlRes.Short);
+            Assert.AreEqual(33, dmlRes.Int);
+            Assert.AreEqual(99, dmlRes.Long);
+            Assert.AreEqual(4.5f, dmlRes.Float);
+            Assert.AreEqual(6.7, dmlRes.Double);
+            Assert.AreEqual(9.04m, dmlRes.Decimal);
+            Assert.AreEqual(guid, dmlRes.Guid);
+            Assert.AreEqual("bar33", dmlRes.String);
+        }
+
+        /// <summary>
+        /// Tests the .NET specific serializable.
+        /// </summary>
+        [Test]
+        public void TestDotNetSpecificSerializable()
+        {
+            var cache = _ignite.CreateCache<int, DotNetSpecificSerializable>(new CacheConfiguration("dotnet-ser",
+                new QueryEntity(typeof(int), typeof(DotNetSpecificSerializable))));
+
+            cache[1] = new DotNetSpecificSerializable(uint.MaxValue);
+            Assert.AreEqual(uint.MaxValue, cache[1].Uint);
+
+            // Test SQL.
+            var sqlRes = cache.QueryFields(new SqlFieldsQuery(
+                "select uint from DotNetSpecificSerializable where uint <> 0")).GetAll();
+
+            Assert.AreEqual(1, sqlRes.Count);
+            Assert.AreEqual(uint.MaxValue, (uint) (int) sqlRes[0][0]);
+
+            // Test LINQ.
+            var linqRes = cache.AsCacheQueryable().Select(x => x.Value.Uint).Single();
+            Assert.AreEqual(uint.MaxValue, linqRes);
+
+            // Test DML.
+            var dmlRes = cache.QueryFields(new SqlFieldsQuery(
+                "insert into DotNetSpecificSerializable(_key, uint) values (?, ?), (?, ?)",
+                2, uint.MaxValue, 3, 88)).GetAll();
+            Assert.AreEqual(1, dmlRes.Count);
+
+            Assert.AreEqual(88, cache[3].Uint);  // Works when value is in int range.
+
+            var ex = Assert.Throws<OverflowException>(() => cache.Get(2));  // Fails when out of int range.
+            Assert.AreEqual("Value was either too large or too small for a UInt32.", ex.Message);
+        }
+
+        /// <summary>
+        /// Tests the log warning.
+        /// </summary>
+        [Test]
+        public void TestLogWarning()
+        {
+            Thread.Sleep(10);  // Wait for logger update.
+
+            var expected =
+                string.Format("[WARN ][main][Marshaller] Type '{0}' implements '{1}'. " +
+                              "It will be written in Ignite binary format, however, " +
+                              "the following limitations apply: DateTime fields would not work in SQL; " +
+                              "sbyte, ushort, uint, ulong fields would not work in DML.",
+                    typeof(SimpleSerializable), typeof(ISerializable));
+
+            Assert.IsTrue(_outSb.ToString().Contains(expected));
+        }
+
+        /// <summary>
+        /// Serializable with Java-compatible fields.
+        /// </summary>
+        private class SimpleSerializable : ISerializable
+        {
+            [QuerySqlField]
+            public byte Byte { get; set; }
+
+            [QuerySqlField]
+            public bool Bool { get; set; }
+
+            [QuerySqlField]
+            public short Short { get; set; }
+            
+            [QuerySqlField]
+            public int Int { get; set; }
+            
+            [QuerySqlField]
+            public long Long { get; set; }
+            
+            [QuerySqlField]
+            public float Float { get; set; }
+            
+            [QuerySqlField]
+            public double Double { get; set; }
+            
+            [QuerySqlField]
+            public decimal Decimal { get; set; }
+            
+            [QuerySqlField]
+            public Guid Guid { get; set; }
+            
+            [QuerySqlField]
+            public string String { get; set; }
+
+            public SimpleSerializable()
+            {
+                // No-op.
+            }
+
+            public SimpleSerializable(SerializationInfo info, StreamingContext context)
+            {
+                Byte = info.GetByte("Byte");
+                Bool = info.GetBoolean("Bool");
+                Short = info.GetInt16("Short");
+                Int = info.GetInt32("Int");
+                Long = info.GetInt64("Long");
+                Float = info.GetSingle("Float");
+                Double = info.GetDouble("Double");
+                Decimal = info.GetDecimal("Decimal");
+                Guid = (Guid) info.GetValue("Guid", typeof(Guid));
+                String = info.GetString("String");
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.AddValue("Byte", Byte);
+                info.AddValue("Bool", Bool);
+                info.AddValue("Short", Short);
+                info.AddValue("Int", Int);
+                info.AddValue("Long", Long);
+                info.AddValue("Float", Float);
+                info.AddValue("Double", Double);
+                info.AddValue("Decimal", Decimal);
+                info.AddValue("Guid", Guid);
+                info.AddValue("String", String);
+            }
+        }
+
+        /// <summary>
+        /// Serializable with incompatible fields.
+        /// </summary>
+        private class DotNetSpecificSerializable : ISerializable
+        {
+            /// <summary>
+            /// Uint is not supported in Java.
+            /// </summary>
+            [QuerySqlField]
+            public uint Uint { get; set; }
+
+            public DotNetSpecificSerializable(uint u)
+            {
+                Uint = u;
+            }
+
+            public DotNetSpecificSerializable(SerializationInfo info, StreamingContext context)
+            {
+                Uint = info.GetUInt32("uint");
+            }
+
+            public void GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                info.AddValue("uint", Uint);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
index 9348449..a3e6252 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
@@ -233,21 +233,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
         }
 
         /// <summary>
-        /// Tests the error on non-serializable function.
-        /// </summary>
-        [Test]
-        public void TestNonSerializableFunction()
-        {
-            var ex = Assert.Throws<IgniteException>(() =>
-                _ignite.CreateCache<int, int>(new CacheConfiguration("failCache")
-                {
-                    AffinityFunction = new NonSerializableAffinityFunction()
-                }));
-
-            Assert.AreEqual(ex.Message, "AffinityFunction should be serializable.");
-        }
-
-        /// <summary>
         /// Tests the exception propagation.
         /// </summary>
         [Test]
@@ -388,12 +373,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
             }
         }
 
-        private class NonSerializableAffinityFunction : SimpleAffinityFunction
-        {
-            // No-op.
-        }
-
-        [Serializable]
         private class FailInGetPartitionAffinityFunction : IAffinityFunction
         {
             public int Partitions

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index f97741a..ce0441d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -232,9 +232,19 @@ namespace Apache.Ignite.Core.Tests.Cache
     /// <summary>
     /// Non-serializable processor.
     /// </summary>
-    public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor
+    public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
     {
-        // No-op.
+        /** <inheritdoc /> */
+        public void WriteBinary(IBinaryWriter writer)
+        {
+            throw new Exception("ExpectedException");
+        }
+
+        /** <inheritdoc /> */
+        public void ReadBinary(IBinaryReader reader)
+        {
+            throw new Exception("ExpectedException");
+        }
     }
 
     /// <summary>
@@ -269,9 +279,19 @@ namespace Apache.Ignite.Core.Tests.Cache
     /// <summary>
     /// Non-serializable exception.
     /// </summary>
-    public class NonSerializableException : Exception
+    public class NonSerializableException : Exception, IBinarizable
     {
-        // No-op
+        /** <inheritdoc /> */
+        public void WriteBinary(IBinaryWriter writer)
+        {
+            throw new Exception("ExpectedException");
+        }
+
+        /** <inheritdoc /> */
+        public void ReadBinary(IBinaryReader reader)
+        {
+            throw new Exception("ExpectedException");
+        }
     }
 
     /// <summary>
@@ -2356,15 +2376,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             TestInvoke<AddArgCacheEntryProcessor>(async);
             TestInvoke<BinarizableAddArgCacheEntryProcessor>(async);
 
-            try
-            {
-                TestInvoke<NonSerializableCacheEntryProcessor>(async);
-                Assert.Fail();
-            }
-            catch (BinaryObjectException)
-            {
-                // Expected
-            }
+            Assert.Throws<Exception>(() => TestInvoke<NonSerializableCacheEntryProcessor>(async));
         }
 
         private void TestInvoke<T>(bool async) where T: AddArgCacheEntryProcessor, new()
@@ -2396,7 +2408,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             AssertThrowsCacheEntryProcessorException(
                 () => cache.Invoke(key, new T {ThrowErrBinarizable = true}, arg));
             AssertThrowsCacheEntryProcessorException(
-                () => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "BinaryObjectException");
+                () => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "ExpectedException");
         }
 
         private static void AssertThrowsCacheEntryProcessorException(Action action, string containsText = null)
@@ -2417,7 +2429,8 @@ namespace Apache.Ignite.Core.Tests.Cache
                     Assert.AreEqual(AddArgCacheEntryProcessor.ExceptionText, ex.InnerException.Message);
                 }
                 else
-                    Assert.IsTrue(ex.ToString().Contains(containsText));
+                    Assert.IsTrue(ex.ToString().Contains(containsText), 
+                        "Expected: " + containsText + ", actual: " + ex);
             }
         }
 
@@ -2439,16 +2452,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             {
                 TestInvokeAll<AddArgCacheEntryProcessor>(async, i);
                 TestInvokeAll<BinarizableAddArgCacheEntryProcessor>(async, i);
-
-                try
-                {
-                    TestInvokeAll<NonSerializableCacheEntryProcessor>(async, i);
-                    Assert.Fail();
-                }
-                catch (BinaryObjectException)
-                {
-                    // Expected
-                }
+                Assert.Throws<Exception>(() => TestInvokeAll<NonSerializableCacheEntryProcessor>(async, i));
             }
         }
 
@@ -2493,7 +2497,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             TestInvokeAllException(cache, entries, new T { ThrowErrBinarizable = true, ThrowOnKey = errKey }, 
                 arg, errKey);
             TestInvokeAllException(cache, entries, new T { ThrowErrNonSerializable = true, ThrowOnKey = errKey },
-                arg, errKey, "BinaryObjectException");
+                arg, errKey, "ExpectedException");
 
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index fc47f52..d6705d4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -55,7 +55,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         [TestFixtureSetUp]
         public void StartGrids()
         {
-            TestUtils.JvmDebug = true;
             TestUtils.KillProcesses();
 
             IgniteConfiguration cfg = new IgniteConfiguration
@@ -867,8 +866,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
     /// <summary>
     /// Filter that can't be serialized.
     /// </summary>
-    public class InvalidScanQueryFilter<TV> : ScanQueryFilter<TV>
+    public class InvalidScanQueryFilter<TV> : ScanQueryFilter<TV>, IBinarizable
     {
-        // No-op.
+        public void WriteBinary(IBinaryWriter writer)
+        {
+            throw new BinaryObjectException("Expected");
+        }
+
+        public void ReadBinary(IBinaryReader reader)
+        {
+            throw new BinaryObjectException("Expected");
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index e890198..3c0633d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+#pragma warning disable 618
 namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
 {
     using System;
@@ -1108,9 +1109,19 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
         /// <summary>
         /// Filter which cannot be serialized.
         /// </summary>
-        public class LocalFilter : AbstractFilter<BinarizableEntry>
+        public class LocalFilter : AbstractFilter<BinarizableEntry>, IBinarizable
         {
-            // No-op.
+            /** <inheritDoc /> */
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                throw new BinaryObjectException("Expected");
+            }
+
+            /** <inheritDoc /> */
+            public void ReadBinary(IBinaryReader reader)
+            {
+                throw new BinaryObjectException("Expected");
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index 4b13b9f..76241d2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -23,7 +23,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
     using System.Linq;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
+    using Apache.Ignite.Core.Cache.Configuration;
     using Apache.Ignite.Core.Cache.Store;
+    using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl;
     using NUnit.Framework;
 
@@ -107,9 +109,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
             for (int i = 105; i < 110; i++)
                 Assert.AreEqual("val_" + i, cache.Get(i));
 
-            // Test invalid filter
-            Assert.Throws<BinaryObjectException>(() => cache.LoadCache(new InvalidCacheEntryFilter(), 100, 10));
-
             // Test exception in filter
             Assert.Throws<CacheStoreException>(() => cache.LoadCache(new ExceptionalEntryFilter(), 100, 10));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index e82e238..3ef9ad0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -911,10 +911,12 @@ namespace Apache.Ignite.Core.Tests.Compute
             Assert.AreEqual(1, res.GetField<int>("field"));
 
             // This call must fail because "keepBinary" flag is reset.
-            Assert.Catch(typeof(BinaryObjectException), () =>
+            var ex = Assert.Throws<BinaryObjectException>(() =>
             {
                 compute.ExecuteJavaTask<IBinaryObject>(EchoTask, EchoTypeBinarizableJava);
             });
+
+            Assert.AreEqual("Unknown pair [platformId=1, typeId=2009791293]", ex.Message);
         }
 
         /// <summary>
@@ -1386,9 +1388,17 @@ namespace Apache.Ignite.Core.Tests.Compute
         }
     }
 
-    class InvalidNetSimpleJob : NetSimpleJob
+    class InvalidNetSimpleJob : NetSimpleJob, IBinarizable
     {
-        // No-op.
+        public void WriteBinary(IBinaryWriter writer)
+        {
+            throw new BinaryObjectException("Expected");
+        }
+
+        public void ReadBinary(IBinaryReader reader)
+        {
+            throw new BinaryObjectException("Expected");
+        }
     }
 
     [Serializable]
@@ -1460,9 +1470,17 @@ namespace Apache.Ignite.Core.Tests.Compute
         }
     }
 
-    class InvalidComputeAction : ComputeAction
+    class InvalidComputeAction : ComputeAction, IBinarizable
     {
-        // No-op.
+        public void WriteBinary(IBinaryWriter writer)
+        {
+            throw new BinaryObjectException("Expected");
+        }
+
+        public void ReadBinary(IBinaryReader reader)
+        {
+            throw new BinaryObjectException("Expected");
+        }
     }
 
     interface IUserInterface<out T>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
index 912102c..21cd263 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
@@ -88,9 +88,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         {
             Mode = ErrorMode.MapJobNotMarshalable;
 
-            var e = ExecuteWithError() as BinaryObjectException;
-
-            Assert.IsNotNull(e);
+            Assert.IsInstanceOf<BinaryObjectException>(ExecuteWithError());
         }
 
         /// <summary>
@@ -168,13 +166,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         {
             Mode = ErrorMode.RmtJobErrNotMarshalable;
 
-            int res = Execute();
-
-            Assert.AreEqual(1, res);
-
-            Assert.AreEqual(4, JobErrs.Count);
-
-            Assert.IsNotNull(JobErrs.ElementAt(0) as IgniteException);
+            Assert.Throws<SerializationException>(() => Execute());
         }
 
         /// <summary>
@@ -566,7 +558,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         /// <summary>
         /// 
         /// </summary>
-        public class BadJob : IComputeJob<object>
+        public class BadJob : IComputeJob<object>, IBinarizable
         {
             [InstanceResource]
 
@@ -581,6 +573,18 @@ namespace Apache.Ignite.Core.Tests.Compute
             {
                 // No-op.
             }
+
+            /** <inheritDoc /> */
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                throw new BinaryObjectException("Expected");
+            }
+
+            /** <inheritDoc /> */
+            public void ReadBinary(IBinaryReader reader)
+            {
+                throw new BinaryObjectException("Expected");
+            }
         }
 
         /// <summary>
@@ -621,7 +625,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         /// <summary>
         /// 
         /// </summary>
-        public class BadJobResult
+        public class BadJobResult : IBinarizable
         {
             /** */
             public bool Rmt;
@@ -634,6 +638,18 @@ namespace Apache.Ignite.Core.Tests.Compute
             {
                 Rmt = rmt;
             }
+
+            /** <inheritDoc /> */
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                throw new BinaryObjectException("Expected");
+            }
+
+            /** <inheritDoc /> */
+            public void ReadBinary(IBinaryReader reader)
+            {
+                throw new BinaryObjectException("Expected");
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
index 433b635..c693a8b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests.Compute
     using System.Collections.Generic;
     using System.Linq;
     using System.Runtime.Serialization;
+    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cluster;
     using Apache.Ignite.Core.Compute;
     using Apache.Ignite.Core.Resource;
@@ -158,9 +159,17 @@ namespace Apache.Ignite.Core.Tests.Compute
         /// <summary>
         /// Binarizable job.
         /// </summary>
-        public class InjectionJobBinarizable : InjectionJob
+        public class InjectionJobBinarizable : InjectionJob, IBinarizable
         {
-            // No-op.
+            public void WriteBinary(IBinaryWriter writer)
+            {
+                // No-op.
+            }
+
+            public void ReadBinary(IBinaryReader reader)
+            {
+                // No-op.
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
index ab5a1a6..ece4894 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-#pragma warning disable 649
-#pragma warning disable 169
 namespace Apache.Ignite.Core.Tests
 {
     using System;
@@ -53,15 +51,21 @@ namespace Apache.Ignite.Core.Tests
             Assert.Greater(jars.Length, 3);
 
             foreach (var jar in jars)
-                // ReSharper disable once AssignNullToNotNullAttribute
-                File.Copy(jar, Path.Combine(folder, Path.GetFileName(jar)), true);
+            {
+                var fileName = Path.GetFileName(jar);
+                Assert.IsNotNull(fileName);
+                File.Copy(jar, Path.Combine(folder, fileName), true);
+            }
 
             // Build classpath
             var classpath = string.Join(";", Directory.GetFiles(folder).Select(Path.GetFileName));
 
             // Copy .NET binaries
-            foreach (var asm in new[] {typeof (IgniteRunner).Assembly, typeof (Ignition).Assembly, GetType().Assembly})
+            foreach (var asm in new[] {typeof(IgniteRunner).Assembly, typeof(Ignition).Assembly, GetType().Assembly})
+            {
+                Assert.IsNotNull(asm.Location);
                 File.Copy(asm.Location, Path.Combine(folder, Path.GetFileName(asm.Location)));
+            }
 
             // Copy config
             var springPath = Path.GetFullPath("config\\compute\\compute-grid2.xml");
@@ -76,7 +80,6 @@ namespace Apache.Ignite.Core.Tests
                 "-springConfigUrl=" + springFile,
                 "-jvmClasspath=" + classpath,
                 "-J-ea",
-                "-J-Xcheck:jni",
                 "-J-Xms512m",
                 "-J-Xmx512m"
             });
@@ -157,6 +160,7 @@ namespace Apache.Ignite.Core.Tests
             throw new InvalidOperationException();
         }
 
+        #pragma warning disable 649
         /// <summary>
         /// Function that returns process path.
         /// </summary>


[10/18] ignite git commit: IGNITE-2703 .NET: Dynamic type registration

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs
index 7053e78..0bacdb7 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Binary/Address.cs
@@ -17,14 +17,12 @@
 
 namespace Apache.Ignite.ExamplesDll.Binary
 {
-    using System;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache.Configuration;
 
     /// <summary>
     /// Address.
     /// </summary>
-    [Serializable]
     public class Address : IBinarizable
     {
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
index a34c3fa..9d407cf 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
@@ -23,7 +23,6 @@ namespace Apache.Ignite.ExamplesDll.Compute
     /// <summary>
     /// Closure counting characters in a string.
     /// </summary>
-    [Serializable]
     public class CharacterCountClosure : IComputeFunc<string, int>
     {
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
index f569f3e..e8d4fd3 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
@@ -17,13 +17,11 @@
 
 namespace Apache.Ignite.ExamplesDll.Datagrid
 {
-    using System;
     using Apache.Ignite.Core.Cache.Event;
 
     /// <summary>
     /// Filter for continuous query example.
     /// </summary>
-    [Serializable]
     public class ContinuousQueryFilter : ICacheEntryEventFilter<int, string>
     {
         /// <summary> Threshold. </summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
index 5c3bf89..1df7630 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
@@ -17,14 +17,12 @@
 
 namespace Apache.Ignite.ExamplesDll.Datagrid
 {
-    using System;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.ExamplesDll.Binary;
 
     /// <summary>
     /// Example cache entry predicate.
     /// </summary>
-    [Serializable]
     public class EmployeeStorePredicate : ICacheEntryFilter<int, Employee>
     {
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
index edf38f2..fd7e6ff 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
@@ -25,7 +25,6 @@ namespace Apache.Ignite.ExamplesDll.Messaging
     /// <summary>
     /// Listener for Ordered topic.
     /// </summary>
-    [Serializable]
     public class RemoteOrderedListener : IMessageListener<int>
     {
         /** Injected Ignite instance. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
index 8054d36..1432f11 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
@@ -25,7 +25,6 @@ namespace Apache.Ignite.ExamplesDll.Messaging
     /// <summary>
     /// Listener for Unordered topic.
     /// </summary>
-    [Serializable]
     public class RemoteUnorderedListener : IMessageListener<int>
     {
         /** Injected Ignite instance. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/79bac4f8/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Services/MapService.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
index 7071cd4..8ca9ab0 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
@@ -26,7 +26,6 @@ namespace Apache.Ignite.ExamplesDll.Services
     /// <summary>
     /// Service implementation.
     /// </summary>
-    [Serializable]
     public class MapService<TK, TV> : IService
     {
         /** Injected Ignite instance. */


[17/18] ignite git commit: IGNITE-4884 Fixed typo. - Fixes #1698.

Posted by ag...@apache.org.
IGNITE-4884 Fixed typo. - Fixes #1698.

Signed-off-by: Alexey Kuznetsov <ak...@gridgain.com>


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

Branch: refs/heads/ignite-3477-master
Commit: b43dd2bbf366528a311ff0a10236adbd9adaf64c
Parents: d4da92b
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Fri Mar 31 20:50:15 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Fri Mar 31 20:50:15 2017 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b43dd2bb/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 19b04f2..2a83c4a 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -456,7 +456,7 @@ class VisorCacheCommand {
                     // Print footnote.
                     println("'Hi' - Number of cache hits.")
                     println("'Mi' - Number of cache misses.")
-                    println("'Rd' - number of cache reads.")
+                    println("'Rd' - Number of cache reads.")
                     println("'Wr' - Number of cache writes.")
 
                     // Print metrics.