You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/17 08:21:23 UTC

[01/50] [abbrv] ignite git commit: IGNITE-4915: Removed deprecated getters/setters from TcpCommunicationSpi. This closes #1734.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1561-1 ead80c01d -> 045a1b29f


IGNITE-4915: Removed deprecated getters/setters from TcpCommunicationSpi. This closes #1734.


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

Branch: refs/heads/ignite-1561-1
Commit: e96682f3ef88d904885699f13a32d03b40810a39
Parents: 0f9eefb
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Fri Apr 14 15:53:59 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 15:53:59 2017 +0300

----------------------------------------------------------------------
 .../communication/tcp/TcpCommunicationSpi.java  | 109 -------------------
 .../tcp/TcpCommunicationSpiMBean.java           |  54 ---------
 .../GridCommunicationSendMessageSelfTest.java   |   2 -
 .../communication/GridIoManagerBenchmark0.java  |   1 -
 4 files changed, 166 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e96682f3/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 0c50b50..1fedf83 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
@@ -184,15 +184,12 @@ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.SSL_META
  * <li>Node local port number (see {@link #setLocalPort(int)})</li>
  * <li>Local port range (see {@link #setLocalPortRange(int)}</li>
  * <li>Connections per node (see {@link #setConnectionsPerNode(int)})</li>
- * <li>Connection buffer flush frequency (see {@link #setConnectionBufferFlushFrequency(long)})</li>
- * <li>Connection buffer size (see {@link #setConnectionBufferSize(int)})</li>
  * <li>Idle connection timeout (see {@link #setIdleConnectionTimeout(long)})</li>
  * <li>Direct or heap buffer allocation (see {@link #setDirectBuffer(boolean)})</li>
  * <li>Direct or heap buffer allocation for sending (see {@link #setDirectSendBuffer(boolean)})</li>
  * <li>Count of selectors and selector threads for NIO server (see {@link #setSelectorsCount(int)})</li>
  * <li>{@code TCP_NODELAY} socket option for sockets (see {@link #setTcpNoDelay(boolean)})</li>
  * <li>Message queue limit (see {@link #setMessageQueueLimit(int)})</li>
- * <li>Minimum buffered message count (see {@link #setMinimumBufferedMessageCount(int)})</li>
  * <li>Connect timeout (see {@link #setConnectTimeout(long)})</li>
  * <li>Maximum connect timeout (see {@link #setMaxConnectTimeout(long)})</li>
  * <li>Reconnect attempts count (see {@link #setReconnectCount(int)})</li>
@@ -1394,63 +1391,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
     }
 
     /**
-     * Sets connection buffer size. If set to {@code 0} connection buffer is disabled.
-     *
-     * @param connBufSize Connection buffer size.
-     * @deprecated Not used any more.
-     */
-    @Deprecated
-    @IgniteSpiConfiguration(optional = true)
-    public void setConnectionBufferSize(int connBufSize) {
-        // No-op.
-    }
-
-    /**
-     * Gets connection buffer size.
-     * <p>
-     * If set to {@code 0} connection buffer is disabled.
-     *
-     * @return Connection buffer size.
-     * @deprecated Not used anymore.
-     */
-    @Deprecated
-    public int getConnectionBufferSize() {
-        return 0;
-    }
-
-    /**
-     * 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)
-    public void setConnectionBufferFlushFrequency(long connBufFlushFreq) {
-        // No-op.
-    }
-
-    /**
-     * Gets connection buffer size.
-     * <p>
-     * If set to {@code 0} connection buffer is disabled.
-     *
-     * @return Connection buffer size.
-     * @deprecated Not used anymore.
-     */
-    @Deprecated
-    public long getConnectionBufferFlushFrequency() {
-        return 0;
-    }
-
-    /**
      * Sets connect timeout used when establishing connection
      * with remote nodes.
      * <p>
@@ -1774,31 +1714,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
         return this;
     }
 
-    /**
-     * Sets the minimum number of messages for this SPI, that are buffered
-     * prior to sending.
-     *
-     * @param minBufferedMsgCnt Minimum buffered message count.
-     * @deprecated Not used any more.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    @Deprecated
-    public void setMinimumBufferedMessageCount(int minBufferedMsgCnt) {
-        // No-op.
-    }
-
-    /**
-     * 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
-    public int getMinimumBufferedMessageCount() {
-        return 0;
-    }
-
     /** {@inheritDoc} */
     @Override public void setListener(CommunicationListener<Message> lsnr) {
         this.lsnr = lsnr;
@@ -4883,24 +4798,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
         }
 
         /** {@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();
         }
@@ -4946,12 +4843,6 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
         }
 
         /** {@inheritDoc} */
-        @Deprecated
-        @Override public int getMinimumBufferedMessageCount() {
-            return TcpCommunicationSpi.this.getMinimumBufferedMessageCount();
-        }
-
-        /** {@inheritDoc} */
         @Override public void dumpStats() {
             TcpCommunicationSpi.this.dumpStats();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e96682f3/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
index 9271314..953245a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
@@ -199,49 +199,6 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
     public boolean isTcpNoDelay();
 
     /**
-     * Gets 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.
-     *
-     * @return Flush frequency.
-     * @deprecated Not used anymore.
-     */
-    @Deprecated
-    @MXBeanDescription("Connection buffer flush frequency.")
-    public long getConnectionBufferFlushFrequency();
-
-    /**
-     * 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
-    @MXBeanDescription("Sets connection buffer flush frequency.")
-    public void setConnectionBufferFlushFrequency(long connBufFlushFreq);
-
-    /**
-     * Gets connection buffer size.
-     * <p>
-     * If set to {@code 0} connection buffer is disabled.
-     *
-     * @return Connection buffer size.
-     * @deprecated Not used anymore.
-     */
-    @Deprecated
-    @MXBeanDescription("Connection buffer size.")
-    public int getConnectionBufferSize();
-
-    /**
      * Gets flag defining whether direct send buffer should be used.
      *
      * @return {@code True} if direct buffers should be used.
@@ -278,17 +235,6 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
     public int getMessageQueueLimit();
 
     /**
-     * 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
-    @MXBeanDescription("Minimum buffered message count.")
-    public int getMinimumBufferedMessageCount();
-
-    /**
      * Gets socket write timeout for TCP connections. If message can not be written to
      * socket within this time then connection is closed and reconnect is attempted.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/e96682f3/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
index 796210e..29b7847 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
@@ -79,8 +79,6 @@ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest
 
         TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
 
-        commSpi.setConnectionBufferSize(bufSize);
-
         c.setCommunicationSpi(commSpi);
 
         return c;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e96682f3/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java
index f6a0b03..0f0332f 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/communication/GridIoManagerBenchmark0.java
@@ -463,7 +463,6 @@ public class GridIoManagerBenchmark0 extends GridCommonAbstractTest {
         TcpCommunicationSpi spi = new TcpCommunicationSpi();
 
         spi.setTcpNoDelay(true);
-        spi.setConnectionBufferSize(0);
         spi.setSharedMemoryPort(-1);
 
         info("Comm SPI: " + spi);


[11/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
index a6d8c4c..79b468d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorAtomicConfiguration.java
@@ -17,16 +17,19 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.AtomicConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for configuration of atomic data structures.
  */
-public class VisorAtomicConfiguration implements Serializable, LessNamingBean {
+public class VisorAtomicConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -40,43 +43,59 @@ public class VisorAtomicConfiguration implements Serializable, LessNamingBean {
     private int backups;
 
     /**
+     * Default constructor.
+     */
+    public VisorAtomicConfiguration() {
+        // No-op.
+    }
+
+    /**
      * Create data transfer object for atomic configuration.
      *
      * @param src Atomic configuration.
-     * @return Data transfer object.
      */
-    public static VisorAtomicConfiguration from(AtomicConfiguration src) {
-        VisorAtomicConfiguration cfg = new VisorAtomicConfiguration();
-
-        cfg.seqReserveSize = src.getAtomicSequenceReserveSize();
-        cfg.cacheMode = src.getCacheMode();
-        cfg.backups = src.getBackups();
-
-        return cfg;
+    public VisorAtomicConfiguration(AtomicConfiguration src) {
+        seqReserveSize = src.getAtomicSequenceReserveSize();
+        cacheMode = src.getCacheMode();
+        backups = src.getBackups();
     }
 
     /**
      * @return Atomic sequence reservation size.
      */
-    public int atomicSequenceReserveSize() {
+    public int getAtomicSequenceReserveSize() {
         return seqReserveSize;
     }
 
     /**
      * @return Cache mode.
      */
-    public CacheMode cacheMode() {
+    public CacheMode getCacheMode() {
         return cacheMode;
     }
 
     /**
      * @return Number of backup nodes.
      */
-    public int backups() {
+    public int getBackups() {
         return backups;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeInt(seqReserveSize);
+        U.writeEnum(out, cacheMode);
+        out.writeInt(backups);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        seqReserveSize = in.readInt();
+        cacheMode = CacheMode.fromOrdinal(in.readByte());
+        backups = in.readInt();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorAtomicConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
index 0dae4da..a70cfdd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
@@ -17,12 +17,16 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.UUID;
+import org.apache.ignite.configuration.DeploymentMode;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static java.lang.System.getProperty;
@@ -38,12 +42,11 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_SUCCESS_FILE;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER;
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.boolValue;
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject;
 
 /**
  * Data transfer object for node basic configuration properties.
  */
-public class VisorBasicConfiguration implements Serializable, LessNamingBean {
+public class VisorBasicConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -63,7 +66,7 @@ public class VisorBasicConfiguration implements Serializable, LessNamingBean {
     private String marsh;
 
     /** Deployment Mode. */
-    private Object deployMode;
+    private DeploymentMode deployMode;
 
     /** Client mode flag. */
     private Boolean clientMode;
@@ -111,186 +114,240 @@ public class VisorBasicConfiguration implements Serializable, LessNamingBean {
     private boolean updateNtf;
 
     /**
+     * Default constructor.
+     */
+    public VisorBasicConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for node basic configuration properties.
+     *
      * @param ignite Grid.
      * @param c Grid configuration.
-     * @return Data transfer object for node basic configuration properties.
      */
-    public static VisorBasicConfiguration from(IgniteEx ignite, IgniteConfiguration c) {
-        VisorBasicConfiguration cfg = new VisorBasicConfiguration();
-
-        cfg.igniteInstanceName = c.getIgniteInstanceName();
-        cfg.ggHome = getProperty(IGNITE_HOME, c.getIgniteHome());
-        cfg.locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost());
-        cfg.nodeId = ignite.localNode().id();
-        cfg.marsh = compactClass(c.getMarshaller());
-        cfg.deployMode = compactObject(c.getDeploymentMode());
-        cfg.clientMode = c.isClientMode();
-        cfg.daemon = boolValue(IGNITE_DAEMON, c.isDaemon());
-        cfg.jmxRemote = ignite.isJmxRemoteEnabled();
-        cfg.restart = ignite.isRestartEnabled();
-        cfg.netTimeout = c.getNetworkTimeout();
-        cfg.log = compactClass(c.getGridLogger());
-        cfg.discoStartupDelay = c.getDiscoveryStartupDelay();
-        cfg.mBeanSrv = compactClass(c.getMBeanServer());
-        cfg.noAscii = boolValue(IGNITE_NO_ASCII, false);
-        cfg.noDiscoOrder = boolValue(IGNITE_NO_DISCO_ORDER, false);
-        cfg.noShutdownHook = boolValue(IGNITE_NO_SHUTDOWN_HOOK, false);
-        cfg.progName = getProperty(IGNITE_PROG_NAME);
-        cfg.quiet = boolValue(IGNITE_QUIET, true);
-        cfg.successFile = getProperty(IGNITE_SUCCESS_FILE);
-        cfg.updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true);
-
-        return cfg;
+    public VisorBasicConfiguration(IgniteEx ignite, IgniteConfiguration c) {
+        igniteInstanceName = c.getIgniteInstanceName();
+        ggHome = getProperty(IGNITE_HOME, c.getIgniteHome());
+        locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost());
+        nodeId = ignite.localNode().id();
+        marsh = compactClass(c.getMarshaller());
+        deployMode = c.getDeploymentMode();
+        clientMode = c.isClientMode();
+        daemon = boolValue(IGNITE_DAEMON, c.isDaemon());
+        jmxRemote = ignite.isJmxRemoteEnabled();
+        restart = ignite.isRestartEnabled();
+        netTimeout = c.getNetworkTimeout();
+        log = compactClass(c.getGridLogger());
+        discoStartupDelay = c.getDiscoveryStartupDelay();
+        mBeanSrv = compactClass(c.getMBeanServer());
+        noAscii = boolValue(IGNITE_NO_ASCII, false);
+        noDiscoOrder = boolValue(IGNITE_NO_DISCO_ORDER, false);
+        noShutdownHook = boolValue(IGNITE_NO_SHUTDOWN_HOOK, false);
+        progName = getProperty(IGNITE_PROG_NAME);
+        quiet = boolValue(IGNITE_QUIET, true);
+        successFile = getProperty(IGNITE_SUCCESS_FILE);
+        updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true);
     }
 
     /**
      * @return Ignite instance name.
      */
-    @Nullable public String igniteInstanceName() {
+    @Nullable public String getIgniteInstanceName() {
         return igniteInstanceName;
     }
 
     /**
      * @return IGNITE_HOME determined at startup.
      */
-    @Nullable public String ggHome() {
+    @Nullable public String getGgHome() {
         return ggHome;
     }
 
     /**
      * @return Local host value used.
      */
-    @Nullable public String localHost() {
+    @Nullable public String getLocalHost() {
         return locHost;
     }
 
     /**
      * @return Node id.
      */
-    public UUID nodeId() {
+    public UUID getNodeId() {
         return nodeId;
     }
 
     /**
      * @return Marshaller used.
      */
-    public String marshaller() {
+    public String getMarshaller() {
         return marsh;
     }
 
     /**
      * @return Deployment Mode.
      */
-    public Object deploymentMode() {
+    public Object getDeploymentMode() {
         return deployMode;
     }
 
     /**
      * @return Client mode flag.
      */
-    public Boolean clientMode() {
+    public Boolean isClientMode() {
         return clientMode;
     }
 
     /**
      * @return Whether this node daemon or not.
      */
-    public boolean daemon() {
+    public boolean isDaemon() {
         return daemon;
     }
 
     /**
      * @return Whether remote JMX is enabled.
      */
-    public boolean jmxRemote() {
+    public boolean isJmxRemote() {
         return jmxRemote;
     }
 
     /**
      * @return Is node restart enabled.
      */
-    public boolean restart() {
+    public boolean isRestart() {
         return restart;
     }
 
     /**
      * @return Network timeout.
      */
-    public long networkTimeout() {
+    public long getNetworkTimeout() {
         return netTimeout;
     }
 
     /**
      * @return Logger used on node.
      */
-    public String logger() {
+    public String getLogger() {
         return log;
     }
 
     /**
      * @return Discovery startup delay.
      */
-    public long discoStartupDelay() {
+    public long getDiscoStartupDelay() {
         return discoStartupDelay;
     }
 
     /**
      * @return MBean server name
      */
-    @Nullable public String mBeanServer() {
+    @Nullable public String getMBeanServer() {
         return mBeanSrv;
     }
 
     /**
      * @return Whether ASCII logo is disabled.
      */
-    public boolean noAscii() {
+    public boolean isNoAscii() {
         return noAscii;
     }
 
     /**
      * @return Whether no discovery order is allowed.
      */
-    public boolean noDiscoOrder() {
+    public boolean isNoDiscoOrder() {
         return noDiscoOrder;
     }
 
     /**
      * @return Whether shutdown hook is disabled.
      */
-    public boolean noShutdownHook() {
+    public boolean isNoShutdownHook() {
         return noShutdownHook;
     }
 
     /**
      * @return Name of command line program.
      */
-    public String programName() {
+    public String getProgramName() {
         return progName;
     }
 
     /**
      * @return Whether node is in quiet mode.
      */
-    public boolean quiet() {
+    public boolean isQuiet() {
         return quiet;
     }
 
     /**
      * @return Success file name.
      */
-    public String successFile() {
+    public String getSuccessFile() {
         return successFile;
     }
 
     /**
      * @return Whether update checker is enabled.
      */
-    public boolean updateNotifier() {
+    public boolean isUpdateNotifier() {
         return updateNtf;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, igniteInstanceName);
+        U.writeString(out, ggHome);
+        U.writeString(out, locHost);
+        U.writeUuid(out, nodeId);
+        U.writeString(out, marsh);
+        U.writeEnum(out, deployMode);
+        out.writeObject(clientMode);
+        out.writeBoolean(daemon);
+        out.writeBoolean(jmxRemote);
+        out.writeBoolean(restart);
+        out.writeLong(netTimeout);
+        U.writeString(out, log);
+        out.writeLong(discoStartupDelay);
+        U.writeString(out, mBeanSrv);
+        out.writeBoolean(noAscii);
+        out.writeBoolean(noDiscoOrder);
+        out.writeBoolean(noShutdownHook);
+        U.writeString(out, progName);
+        out.writeBoolean(quiet);
+        U.writeString(out, successFile);
+        out.writeBoolean(updateNtf);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        igniteInstanceName = U.readString(in);
+        ggHome = U.readString(in);
+        locHost = U.readString(in);
+        nodeId = U.readUuid(in);
+        marsh = U.readString(in);
+        deployMode = DeploymentMode.fromOrdinal(in.readByte());
+        clientMode = (Boolean)in.readObject();
+        daemon = in.readBoolean();
+        jmxRemote = in.readBoolean();
+        restart = in.readBoolean();
+        netTimeout = in.readLong();
+        log = U.readString(in);
+        discoStartupDelay = in.readLong();
+        mBeanSrv = U.readString(in);
+        noAscii = in.readBoolean();
+        noDiscoOrder = in.readBoolean();
+        noShutdownHook = in.readBoolean();
+        progName = U.readString(in);
+        quiet = in.readBoolean();
+        successFile = U.readString(in);
+        updateNtf = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorBasicConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
index df083f5..0ad9288 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorExecutorServiceConfiguration.java
@@ -17,16 +17,18 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.ConnectorConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for node executors configuration properties.
  */
-public class VisorExecutorServiceConfiguration implements Serializable, LessNamingBean {
+public class VisorExecutorServiceConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -45,73 +47,110 @@ public class VisorExecutorServiceConfiguration implements Serializable, LessNami
     /** Peer-to-peer pool size. */
     private int p2pPoolSz;
 
+    /** Rebalance thread pool size. */
+    private int rebalanceThreadPoolSize;
+
     /** REST requests pool size. */
     private int restPoolSz;
 
     /**
-     * @param c Grid configuration.
-     * @return Data transfer object for node executors configuration properties.
+     * Default constructor.
      */
-    public static VisorExecutorServiceConfiguration from(IgniteConfiguration c) {
-        VisorExecutorServiceConfiguration cfg = new VisorExecutorServiceConfiguration();
+    public VisorExecutorServiceConfiguration() {
+        // No-op.
+    }
 
-        cfg.pubPoolSize = c.getPublicThreadPoolSize();
-        cfg.sysPoolSz = c.getSystemThreadPoolSize();
-        cfg.mgmtPoolSize = c.getManagementThreadPoolSize();
-        cfg.p2pPoolSz = c.getPeerClassLoadingThreadPoolSize();
-        cfg.igfsPoolSize = c.getIgfsThreadPoolSize();
+    /**
+     * Create data transfer object for node executors configuration properties.
+     *
+     * @param c Grid configuration.
+     */
+    public VisorExecutorServiceConfiguration(IgniteConfiguration c) {
+        pubPoolSize = c.getPublicThreadPoolSize();
+        sysPoolSz = c.getSystemThreadPoolSize();
+        mgmtPoolSize = c.getManagementThreadPoolSize();
+        p2pPoolSz = c.getPeerClassLoadingThreadPoolSize();
+        igfsPoolSize = c.getIgfsThreadPoolSize();
+        rebalanceThreadPoolSize = c.getRebalanceThreadPoolSize();
 
         ConnectorConfiguration cc = c.getConnectorConfiguration();
 
         if (cc != null)
-            cfg.restPoolSz = cc.getThreadPoolSize();
-
-        return cfg;
+            restPoolSz = cc.getThreadPoolSize();
     }
 
     /**
      * @return Public pool size.
      */
-    public int publicThreadPoolSize() {
+    public int getPublicThreadPoolSize() {
         return pubPoolSize;
     }
 
     /**
      * @return System pool size.
      */
-    public int systemThreadPoolSize() {
+    public int getSystemThreadPoolSize() {
         return sysPoolSz;
     }
 
     /**
      * @return Management pool size.
      */
-    public int managementThreadPoolSize() {
+    public int getManagementThreadPoolSize() {
         return mgmtPoolSize;
     }
 
     /**
      * @return IGFS pool size.
      */
-    public int igfsThreadPoolSize() {
+    public int getIgfsThreadPoolSize() {
         return igfsPoolSize;
     }
 
     /**
      * @return Peer-to-peer pool size.
      */
-    public int peerClassLoadingThreadPoolSize() {
+    public int getPeerClassLoadingThreadPoolSize() {
         return p2pPoolSz;
     }
 
     /**
+     * @return Rebalance thread pool size.
+     */
+    public int getRebalanceThreadPoolSize() {
+        return rebalanceThreadPoolSize;
+    }
+
+    /**
      * @return REST requests pool size.
      */
-    public int restThreadPoolSize() {
+    public int getRestThreadPoolSize() {
         return restPoolSz;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeInt(pubPoolSize);
+        out.writeInt(sysPoolSz);
+        out.writeInt(mgmtPoolSize);
+        out.writeInt(igfsPoolSize);
+        out.writeInt(p2pPoolSz);
+        out.writeInt(rebalanceThreadPoolSize);
+        out.writeInt(restPoolSz);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        pubPoolSize = in.readInt();
+        sysPoolSz = in.readInt();
+        mgmtPoolSize = in.readInt();
+        igfsPoolSize = in.readInt();
+        p2pPoolSz = in.readInt();
+        rebalanceThreadPoolSize = in.readInt();
+        restPoolSz = in.readInt();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorExecutorServiceConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index 0ce13df..23a74e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -17,22 +17,26 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 
 /**
  * Data transfer object for node configuration data.
  */
-public class VisorGridConfiguration implements Serializable, LessNamingBean {
+public class VisorGridConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -69,8 +73,8 @@ public class VisorGridConfiguration implements Serializable, LessNamingBean {
     /** User attributes. */
     private Map<String, ?> userAttrs;
 
-    /** Igfss. */
-    private Iterable<VisorIgfsConfiguration> igfss;
+    /** IGFSs. */
+    private List<VisorIgfsConfiguration> igfss;
 
     /** Environment. */
     private Map<String, String> env;
@@ -88,155 +92,205 @@ public class VisorGridConfiguration implements Serializable, LessNamingBean {
     private VisorMemoryConfiguration memCfg;
 
     /**
+     * Default constructor.
+     */
+    public VisorGridConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object with node configuration data.
+     *
      * @param ignite Grid.
-     * @return Fill data transfer object with node configuration data.
      */
-    public VisorGridConfiguration from(IgniteEx ignite) {
+    public VisorGridConfiguration(IgniteEx ignite) {
         assert ignite != null;
 
         IgniteConfiguration c = ignite.configuration();
 
-        basic = VisorBasicConfiguration.from(ignite, c);
-        metrics = VisorMetricsConfiguration.from(c);
-        spis = VisorSpisConfiguration.from(c);
-        p2p = VisorPeerToPeerConfiguration.from(c);
-        lifecycle = VisorLifecycleConfiguration.from(c);
-        execSvc = VisorExecutorServiceConfiguration.from(c);
-        seg = VisorSegmentationConfiguration.from(c);
+        basic = new VisorBasicConfiguration(ignite, c);
+        metrics = new VisorMetricsConfiguration(c);
+        spis = new VisorSpisConfiguration(c);
+        p2p = new VisorPeerToPeerConfiguration(c);
+        lifecycle = new VisorLifecycleConfiguration(c);
+        execSvc = new VisorExecutorServiceConfiguration(c);
+        seg = new VisorSegmentationConfiguration(c);
         inclProps = compactArray(c.getIncludeProperties());
         inclEvtTypes = c.getIncludeEventTypes();
-        rest = VisorRestConfiguration.from(c);
+        rest = new VisorRestConfiguration(c);
         userAttrs = c.getUserAttributes();
         igfss = VisorIgfsConfiguration.list(c.getFileSystemConfiguration());
         env = new HashMap<>(System.getenv());
         sysProps = IgniteSystemProperties.snapshot();
-        atomic = VisorAtomicConfiguration.from(c.getAtomicConfiguration());
-        txCfg = VisorTransactionConfiguration.from(c.getTransactionConfiguration());
-        memCfg = new VisorMemoryConfiguration(c.getMemoryConfiguration());
+        atomic = new VisorAtomicConfiguration(c.getAtomicConfiguration());
+        txCfg = new VisorTransactionConfiguration(c.getTransactionConfiguration());
 
-        return this;
+        if (c.getMemoryConfiguration() != null)
+            memCfg = new VisorMemoryConfiguration(c.getMemoryConfiguration());
     }
 
     /**
      * @return Basic.
      */
-    public VisorBasicConfiguration basic() {
+    public VisorBasicConfiguration getBasic() {
         return basic;
     }
 
     /**
      * @return Metrics.
      */
-    public VisorMetricsConfiguration metrics() {
+    public VisorMetricsConfiguration getMetrics() {
         return metrics;
     }
 
     /**
      * @return SPIs.
      */
-    public VisorSpisConfiguration spis() {
+    public VisorSpisConfiguration getSpis() {
         return spis;
     }
 
     /**
      * @return P2P.
      */
-    public VisorPeerToPeerConfiguration p2p() {
+    public VisorPeerToPeerConfiguration getP2p() {
         return p2p;
     }
 
     /**
      * @return Lifecycle.
      */
-    public VisorLifecycleConfiguration lifecycle() {
+    public VisorLifecycleConfiguration getLifecycle() {
         return lifecycle;
     }
 
     /**
      * @return Executors service configuration.
      */
-    public VisorExecutorServiceConfiguration executeService() {
+    public VisorExecutorServiceConfiguration getExecutorService() {
         return execSvc;
     }
 
     /**
      * @return Segmentation.
      */
-    public VisorSegmentationConfiguration segmentation() {
+    public VisorSegmentationConfiguration getSegmentation() {
         return seg;
     }
 
     /**
      * @return Include properties.
      */
-    public String includeProperties() {
+    public String getIncludeProperties() {
         return inclProps;
     }
 
     /**
      * @return Include events types.
      */
-    public int[] includeEventTypes() {
+    public int[] getIncludeEventTypes() {
         return inclEvtTypes;
     }
 
     /**
      * @return Rest.
      */
-    public VisorRestConfiguration rest() {
+    public VisorRestConfiguration getRest() {
         return rest;
     }
 
     /**
      * @return User attributes.
      */
-    public Map<String, ?> userAttributes() {
+    public Map<String, ?> getUserAttributes() {
         return userAttrs;
     }
 
     /**
      * @return Igfss.
      */
-    public Iterable<VisorIgfsConfiguration> igfss() {
+    public List<VisorIgfsConfiguration> getIgfss() {
         return igfss;
     }
 
     /**
      * @return Environment.
      */
-    public Map<String, String> env() {
+    public Map<String, String> getEnv() {
         return env;
     }
 
     /**
      * @return System properties.
      */
-    public Properties systemProperties() {
+    public Properties getSystemProperties() {
         return sysProps;
     }
 
     /**
      * @return Configuration of atomic data structures.
      */
-    public VisorAtomicConfiguration atomic() {
+    public VisorAtomicConfiguration getAtomic() {
         return atomic;
     }
 
     /**
      * @return Transactions configuration.
      */
-    public VisorTransactionConfiguration transaction() {
+    public VisorTransactionConfiguration getTransaction() {
         return txCfg;
     }
 
     /**
      * @return Memory configuration.
      */
-    public VisorMemoryConfiguration memoryConfiguration() {
+    public VisorMemoryConfiguration getMemoryConfiguration() {
         return memCfg;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeObject(basic);
+        out.writeObject(metrics);
+        out.writeObject(spis);
+        out.writeObject(p2p);
+        out.writeObject(lifecycle);
+        out.writeObject(execSvc);
+        out.writeObject(seg);
+        U.writeString(out, inclProps);
+        out.writeObject(inclEvtTypes);
+        out.writeObject(rest);
+        U.writeMap(out, userAttrs);
+        U.writeCollection(out, igfss);
+        U.writeMap(out, env);
+        out.writeObject(sysProps);
+        out.writeObject(atomic);
+        out.writeObject(txCfg);
+        out.writeObject(memCfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        basic = (VisorBasicConfiguration)in.readObject();
+        metrics = (VisorMetricsConfiguration)in.readObject();
+        spis = (VisorSpisConfiguration)in.readObject();
+        p2p = (VisorPeerToPeerConfiguration)in.readObject();
+        lifecycle = (VisorLifecycleConfiguration)in.readObject();
+        execSvc = (VisorExecutorServiceConfiguration)in.readObject();
+        seg = (VisorSegmentationConfiguration)in.readObject();
+        inclProps = U.readString(in);
+        inclEvtTypes = (int[])in.readObject();
+        rest = (VisorRestConfiguration)in.readObject();
+        userAttrs = U.readMap(in);
+        igfss = U.readList(in);
+        env = U.readMap(in);
+        sysProps = (Properties)in.readObject();
+        atomic = (VisorAtomicConfiguration)in.readObject();
+        txCfg = (VisorTransactionConfiguration)in.readObject();
+        memCfg = (VisorMemoryConfiguration)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorGridConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
index 664dac1..15c1fc6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
@@ -17,16 +17,19 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import org.apache.ignite.configuration.FileSystemConfiguration;
 import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
 import org.apache.ignite.igfs.IgfsMode;
-import org.apache.ignite.internal.LessNamingBean;
+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.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -34,7 +37,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for IGFS configuration properties.
  */
-public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
+public class VisorIgfsConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -114,44 +117,47 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
     private long trashPurgeTimeout;
 
     /**
+     * Default constructor.
+     */
+    public VisorIgfsConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for IGFS configuration properties.
      * @param igfs IGFS configuration.
-     * @return Data transfer object for IGFS configuration properties.
      */
-    public static VisorIgfsConfiguration from(FileSystemConfiguration igfs) {
-        VisorIgfsConfiguration cfg = new VisorIgfsConfiguration();
-
-        cfg.name = igfs.getName();
-        cfg.metaCacheName = igfs.getMetaCacheConfiguration().getName();
-        cfg.dataCacheName = igfs.getDataCacheConfiguration().getName();
-        cfg.blockSize = igfs.getBlockSize();
-        cfg.prefetchBlocks = igfs.getPrefetchBlocks();
-        cfg.streamBufSize = igfs.getBufferSize();
-        cfg.perNodeBatchSize = igfs.getPerNodeBatchSize();
-        cfg.perNodeParallelBatchCnt = igfs.getPerNodeParallelBatchCount();
-
-        cfg.dfltMode = igfs.getDefaultMode();
-        cfg.pathModes = igfs.getPathModes();
-        cfg.dualModePutExecutorSrvc = compactClass(igfs.getDualModePutExecutorService());
-        cfg.dualModePutExecutorSrvcShutdown = igfs.getDualModePutExecutorServiceShutdown();
-        cfg.dualModeMaxPendingPutsSize = igfs.getDualModeMaxPendingPutsSize();
-        cfg.maxTaskRangeLen = igfs.getMaximumTaskRangeLength();
-        cfg.fragmentizerConcurrentFiles = igfs.getFragmentizerConcurrentFiles();
-        cfg.fragmentizerLocWritesRatio = igfs.getFragmentizerLocalWritesRatio();
-        cfg.fragmentizerEnabled = igfs.isFragmentizerEnabled();
-        cfg.fragmentizerThrottlingBlockLen = igfs.getFragmentizerThrottlingBlockLength();
-        cfg.fragmentizerThrottlingDelay = igfs.getFragmentizerThrottlingDelay();
+    public VisorIgfsConfiguration(FileSystemConfiguration igfs) {
+        name = igfs.getName();
+        metaCacheName = igfs.getMetaCacheConfiguration().getName();
+        dataCacheName = igfs.getDataCacheConfiguration().getName();
+        blockSize = igfs.getBlockSize();
+        prefetchBlocks = igfs.getPrefetchBlocks();
+        streamBufSize = igfs.getBufferSize();
+        perNodeBatchSize = igfs.getPerNodeBatchSize();
+        perNodeParallelBatchCnt = igfs.getPerNodeParallelBatchCount();
+
+        dfltMode = igfs.getDefaultMode();
+        pathModes = igfs.getPathModes();
+        dualModePutExecutorSrvc = compactClass(igfs.getDualModePutExecutorService());
+        dualModePutExecutorSrvcShutdown = igfs.getDualModePutExecutorServiceShutdown();
+        dualModeMaxPendingPutsSize = igfs.getDualModeMaxPendingPutsSize();
+        maxTaskRangeLen = igfs.getMaximumTaskRangeLength();
+        fragmentizerConcurrentFiles = igfs.getFragmentizerConcurrentFiles();
+        fragmentizerLocWritesRatio = igfs.getFragmentizerLocalWritesRatio();
+        fragmentizerEnabled = igfs.isFragmentizerEnabled();
+        fragmentizerThrottlingBlockLen = igfs.getFragmentizerThrottlingBlockLength();
+        fragmentizerThrottlingDelay = igfs.getFragmentizerThrottlingDelay();
 
         IgfsIpcEndpointConfiguration endpointCfg = igfs.getIpcEndpointConfiguration();
 
-        cfg.ipcEndpointCfg = endpointCfg != null ? endpointCfg.toString() : null;
-
-        cfg.ipcEndpointEnabled = igfs.isIpcEndpointEnabled();
-        cfg.maxSpace = igfs.getMaxSpaceSize();
-        cfg.mgmtPort = igfs.getManagementPort();
-        cfg.seqReadsBeforePrefetch = igfs.getSequentialReadsBeforePrefetch();
-        cfg.trashPurgeTimeout = igfs.getTrashPurgeTimeout();
+        ipcEndpointCfg = endpointCfg != null ? endpointCfg.toString() : null;
 
-        return cfg;
+        ipcEndpointEnabled = igfs.isIpcEndpointEnabled();
+        maxSpace = igfs.getMaxSpaceSize();
+        mgmtPort = igfs.getManagementPort();
+        seqReadsBeforePrefetch = igfs.getSequentialReadsBeforePrefetch();
+        trashPurgeTimeout = igfs.getTrashPurgeTimeout();
     }
 
     /**
@@ -160,194 +166,251 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
      * @param igfss Igfs configurations.
      * @return igfs configurations properties.
      */
-    public static Iterable<VisorIgfsConfiguration> list(FileSystemConfiguration[] igfss) {
-        if (igfss == null)
-            return Collections.emptyList();
-
-        final Collection<VisorIgfsConfiguration> cfgs = new ArrayList<>(igfss.length);
+    public static List<VisorIgfsConfiguration> list(FileSystemConfiguration[] igfss) {
+        List<VisorIgfsConfiguration> res = new ArrayList<>();
 
-        for (FileSystemConfiguration igfs : igfss)
-            cfgs.add(from(igfs));
+        if (!F.isEmpty(igfss)) {
+            for (FileSystemConfiguration igfs : igfss)
+                res.add(new VisorIgfsConfiguration(igfs));
+        }
 
-        return cfgs;
+        return res;
     }
 
     /**
      * @return IGFS instance name.
      */
-    @Nullable public String name() {
+    @Nullable public String getName() {
         return name;
     }
 
     /**
      * @return Cache name to store IGFS meta information.
      */
-    @Nullable public String metaCacheName() {
+    @Nullable public String getMetaCacheName() {
         return metaCacheName;
     }
 
     /**
      * @return Cache name to store IGFS data.
      */
-    @Nullable public String dataCacheName() {
+    @Nullable public String getDataCacheName() {
         return dataCacheName;
     }
 
     /**
      * @return File's data block size.
      */
-    public int blockSize() {
+    public int getBlockSize() {
         return blockSize;
     }
 
     /**
      * @return Number of pre-fetched blocks if specific file's chunk is requested.
      */
-    public int prefetchBlocks() {
+    public int getPrefetchBlocks() {
         return prefetchBlocks;
     }
 
     /**
      * @return Read/write buffer size for IGFS stream operations in bytes.
      */
-    public int streamBufferSize() {
+    public int getStreamBufferSize() {
         return streamBufSize;
     }
 
     /**
      * @return Number of file blocks buffered on local node before sending batch to remote node.
      */
-    public int perNodeBatchSize() {
+    public int getPerNodeBatchSize() {
         return perNodeBatchSize;
     }
 
     /**
      * @return Number of batches that can be concurrently sent to remote node.
      */
-    public int perNodeParallelBatchCount() {
+    public int getPerNodeParallelBatchCount() {
         return perNodeParallelBatchCnt;
     }
 
     /**
      * @return IGFS instance mode.
      */
-    public IgfsMode defaultMode() {
+    public IgfsMode getDefaultMode() {
         return dfltMode;
     }
 
     /**
      * @return Map of paths to IGFS modes.
      */
-    @Nullable public Map<String, IgfsMode> pathModes() {
+    @Nullable public Map<String, IgfsMode> getPathModes() {
         return pathModes;
     }
 
     /**
      * @return Dual mode PUT operations executor service.
      */
-    public String dualModePutExecutorService() {
+    public String getDualModePutExecutorService() {
         return dualModePutExecutorSrvc;
     }
 
     /**
      * @return Dual mode PUT operations executor service shutdown flag.
      */
-    public boolean dualModePutExecutorServiceShutdown() {
+    public boolean getDualModePutExecutorServiceShutdown() {
         return dualModePutExecutorSrvcShutdown;
     }
 
     /**
      * @return Maximum amount of data in pending puts.
      */
-    public long dualModeMaxPendingPutsSize() {
+    public long getDualModeMaxPendingPutsSize() {
         return dualModeMaxPendingPutsSize;
     }
 
     /**
      * @return Maximum range length.
      */
-    public long maxTaskRangeLength() {
+    public long getMaxTaskRangeLength() {
         return maxTaskRangeLen;
     }
 
     /**
      * @return Fragmentizer concurrent files.
      */
-    public int fragmentizerConcurrentFiles() {
+    public int getFragmentizerConcurrentFiles() {
         return fragmentizerConcurrentFiles;
     }
 
     /**
      * @return Fragmentizer local writes ratio.
      */
-    public float fragmentizerLocalWritesRatio() {
+    public float getFragmentizerLocalWritesRatio() {
         return fragmentizerLocWritesRatio;
     }
 
     /**
      * @return Fragmentizer enabled flag.
      */
-    public boolean fragmentizerEnabled() {
+    public boolean isFragmentizerEnabled() {
         return fragmentizerEnabled;
     }
 
     /**
      * @return Fragmentizer throttling block length.
      */
-    public long fragmentizerThrottlingBlockLength() {
+    public long getFragmentizerThrottlingBlockLength() {
         return fragmentizerThrottlingBlockLen;
     }
 
     /**
      * @return Fragmentizer throttling delay.
      */
-    public long fragmentizerThrottlingDelay() {
+    public long getFragmentizerThrottlingDelay() {
         return fragmentizerThrottlingDelay;
     }
 
     /**
      * @return IPC endpoint config to publish IGFS over.
      */
-    @Nullable public String ipcEndpointConfiguration() {
+    @Nullable public String getIpcEndpointConfiguration() {
         return ipcEndpointCfg;
     }
 
     /**
      * @return IPC endpoint enabled flag.
      */
-    public boolean ipcEndpointEnabled() {
+    public boolean isIpcEndpointEnabled() {
         return ipcEndpointEnabled;
     }
 
     /**
      * @return Maximum space.
      */
-    public long maxSpace() {
+    public long getMaxSpace() {
         return maxSpace;
     }
 
     /**
      * @return Management port.
      */
-    public int managementPort() {
+    public int getManagementPort() {
         return mgmtPort;
     }
 
     /**
      * @return Amount of sequential block reads before prefetch is triggered.
      */
-    public int sequenceReadsBeforePrefetch() {
+    public int getSequenceReadsBeforePrefetch() {
         return seqReadsBeforePrefetch;
     }
 
     /**
      * @return Trash purge await timeout.
      */
-    public long trashPurgeTimeout() {
+    public long getTrashPurgeTimeout() {
         return trashPurgeTimeout;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeString(out, metaCacheName);
+        U.writeString(out, dataCacheName);
+        out.writeInt(blockSize);
+        out.writeInt(prefetchBlocks);
+        out.writeInt(streamBufSize);
+        out.writeInt(perNodeBatchSize);
+        out.writeInt(perNodeParallelBatchCnt);
+        U.writeEnum(out, dfltMode);
+        U.writeMap(out, pathModes);
+        U.writeString(out, dualModePutExecutorSrvc);
+        out.writeBoolean(dualModePutExecutorSrvcShutdown);
+        out.writeLong(dualModeMaxPendingPutsSize);
+        out.writeLong(maxTaskRangeLen);
+        out.writeInt(fragmentizerConcurrentFiles);
+        out.writeFloat(fragmentizerLocWritesRatio);
+        out.writeBoolean(fragmentizerEnabled);
+        out.writeLong(fragmentizerThrottlingBlockLen);
+        out.writeLong(fragmentizerThrottlingDelay);
+        U.writeString(out, ipcEndpointCfg);
+        out.writeBoolean(ipcEndpointEnabled);
+        out.writeLong(maxSpace);
+        out.writeInt(mgmtPort);
+        out.writeInt(seqReadsBeforePrefetch);
+        out.writeLong(trashPurgeTimeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        metaCacheName = U.readString(in);
+        dataCacheName = U.readString(in);
+        blockSize = in.readInt();
+        prefetchBlocks = in.readInt();
+        streamBufSize = in.readInt();
+        perNodeBatchSize = in.readInt();
+        perNodeParallelBatchCnt = in.readInt();
+        dfltMode = IgfsMode.fromOrdinal(in.readByte());
+        pathModes = U.readMap(in);
+        dualModePutExecutorSrvc = U.readString(in);
+        dualModePutExecutorSrvcShutdown = in.readBoolean();
+        dualModeMaxPendingPutsSize = in.readLong();
+        maxTaskRangeLen = in.readLong();
+        fragmentizerConcurrentFiles = in.readInt();
+        fragmentizerLocWritesRatio = in.readFloat();
+        fragmentizerEnabled = in.readBoolean();
+        fragmentizerThrottlingBlockLen = in.readLong();
+        fragmentizerThrottlingDelay = in.readLong();
+        ipcEndpointCfg = U.readString(in);
+        ipcEndpointEnabled = in.readBoolean();
+        maxSpace = in.readLong();
+        mgmtPort = in.readInt();
+        seqReadsBeforePrefetch = in.readInt();
+        trashPurgeTimeout = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorIgfsConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
index 838a6cc..5407699 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorLifecycleConfiguration.java
@@ -17,10 +17,13 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
@@ -28,7 +31,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 /**
  * Data transfer object for node lifecycle configuration properties.
  */
-public class VisorLifecycleConfiguration implements Serializable, LessNamingBean {
+public class VisorLifecycleConfiguration extends VisorDataTransferObject{
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -36,25 +39,39 @@ public class VisorLifecycleConfiguration implements Serializable, LessNamingBean
     private String beans;
 
     /**
-     * @param c Grid configuration.
-     * @return Data transfer object for node lifecycle configuration properties.
+     * Default constructor.
      */
-    public static VisorLifecycleConfiguration from(IgniteConfiguration c) {
-        VisorLifecycleConfiguration cfg = new VisorLifecycleConfiguration();
-
-        cfg.beans = compactArray(c.getLifecycleBeans());
+    public VisorLifecycleConfiguration() {
+        // No-op.
+    }
 
-        return cfg;
+    /**
+     * Create data transfer object for node lifecycle configuration properties.
+     *
+     * @param c Grid configuration.
+     */
+    public VisorLifecycleConfiguration(IgniteConfiguration c) {
+        beans = compactArray(c.getLifecycleBeans());
     }
 
     /**
      * @return Lifecycle beans.
      */
-    @Nullable public String beans() {
+    @Nullable public String getBeans() {
         return beans;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, beans);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        beans = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorLifecycleConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
index f380394..7a0bc76 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryConfiguration.java
@@ -17,25 +17,27 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.configuration.MemoryPolicyConfiguration;
 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.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for memory configuration.
  */
-public class VisorMemoryConfiguration implements Serializable {
+public class VisorMemoryConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** File cache allocation path. */
-    private String fileCacheAllocationPath;
-
-    /** Amount of memory allocated for the page cache. */
-    private long pageCacheSize;
+    /** Size of memory for system cache. */
+    private long sysCacheMemSize;
 
     /** Page size. */
     private int pageSize;
@@ -50,6 +52,13 @@ public class VisorMemoryConfiguration implements Serializable {
     private List<VisorMemoryPolicyConfiguration> memPlcs;
 
     /**
+     * Default constructor.
+     */
+    public VisorMemoryConfiguration() {
+        // No-op.
+    }
+
+    /**
      * Create data transfer object.
      *
      * @param memCfg Memory configuration.
@@ -57,6 +66,7 @@ public class VisorMemoryConfiguration implements Serializable {
     public VisorMemoryConfiguration(MemoryConfiguration memCfg) {
         assert memCfg != null;
 
+        sysCacheMemSize = memCfg.getSystemCacheMemorySize();
         pageSize = memCfg.getPageSize();
         concLvl = memCfg.getConcurrencyLevel();
         dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
@@ -79,17 +89,10 @@ public class VisorMemoryConfiguration implements Serializable {
     }
 
     /**
-     * @return File allocation path.
+     * @return Size of memory for system cache.
      */
-    public String fileCacheAllocationPath() {
-        return fileCacheAllocationPath;
-    }
-
-    /**
-     * @return Page cache size, in bytes.
-     */
-    public long pageCacheSize() {
-        return pageCacheSize;
+    public long getSystemCacheMemorySize() {
+        return sysCacheMemSize;
     }
 
     /**
@@ -112,4 +115,27 @@ public class VisorMemoryConfiguration implements Serializable {
     public List<VisorMemoryPolicyConfiguration> getMemoryPolicies() {
         return memPlcs;
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(sysCacheMemSize);
+        out.writeInt(pageSize);
+        out.writeInt(concLvl);
+        U.writeString(out, dfltMemPlcName);
+        U.writeCollection(out, memPlcs);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        sysCacheMemSize = in.readLong();
+        pageSize = in.readInt();
+        concLvl = in.readInt();
+        dfltMemPlcName = U.readString(in);
+        memPlcs = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorMemoryConfiguration.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
index 28eebd2..509aa48 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMemoryPolicyConfiguration.java
@@ -17,13 +17,18 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for memory configuration.
  */
-public class VisorMemoryPolicyConfiguration implements Serializable {
+public class VisorMemoryPolicyConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -36,6 +41,14 @@ public class VisorMemoryPolicyConfiguration implements Serializable {
     /** Path for memory mapped file. */
     private String swapFilePath;
 
+
+    /**
+     * Default constructor.
+     */
+    public VisorMemoryPolicyConfiguration() {
+        // No-op.
+    }
+
     /**
      * Constructor.
      *
@@ -69,4 +82,24 @@ public class VisorMemoryPolicyConfiguration implements Serializable {
     public String getSwapFilePath() {
         return swapFilePath;
     }
+
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        out.writeLong(size);
+        U.writeString(out, swapFilePath);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        size = in.readLong();
+        swapFilePath = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorMemoryPolicyConfiguration.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
index 4e812b7..4ce7b6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorMetricsConfiguration.java
@@ -17,15 +17,17 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for node metrics configuration properties.
  */
-public class VisorMetricsConfiguration implements Serializable, LessNamingBean {
+public class VisorMetricsConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -39,41 +41,59 @@ public class VisorMetricsConfiguration implements Serializable, LessNamingBean {
     private long logFreq;
 
     /**
-     * @param c Grid configuration.
-     * @return Data transfer object for node metrics configuration properties.
+     * Default constructor.
      */
-    public static VisorMetricsConfiguration from(IgniteConfiguration c) {
-        VisorMetricsConfiguration cfg = new VisorMetricsConfiguration();
-
-        cfg.expTime = c.getMetricsExpireTime();
-        cfg.histSize = c.getMetricsHistorySize();
-        cfg.logFreq = c.getMetricsLogFrequency();
+    public VisorMetricsConfiguration() {
+        // No-op.
+    }
 
-        return cfg;
+    /**
+     * Create transfer object for node metrics configuration properties.
+     *
+     * @param c Grid configuration.
+     */
+    public VisorMetricsConfiguration(IgniteConfiguration c) {
+        expTime = c.getMetricsExpireTime();
+        histSize = c.getMetricsHistorySize();
+        logFreq = c.getMetricsLogFrequency();
     }
 
     /**
      * @return Metrics expired time.
      */
-    public long expireTime() {
+    public long getExpireTime() {
         return expTime;
     }
 
     /**
      * @return Number of node metrics stored in memory.
      */
-    public int historySize() {
+    public int getHistorySize() {
         return histSize;
     }
 
     /**
      * @return Frequency of metrics log printout.
      */
-    public long loggerFrequency() {
+    public long getLoggerFrequency() {
         return logFreq;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(expTime);
+        out.writeInt(histSize);
+        out.writeLong(logFreq);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        expTime = in.readLong();
+        histSize = in.readInt();
+        logFreq = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorMetricsConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java
index 109b1d8..35b7ad3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeConfigurationCollectorJob.java
@@ -37,11 +37,11 @@ public class VisorNodeConfigurationCollectorJob extends VisorJob<Void, VisorGrid
 
     /** {@inheritDoc} */
     @Override protected VisorGridConfiguration run(Void arg) {
-        return new VisorGridConfiguration().from(ignite);
+        return new VisorGridConfiguration(ignite);
     }
 
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorNodeConfigurationCollectorJob.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 0617e70..125e219 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -24,6 +24,8 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.FileSystemConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.igfs.IgfsProcessorAdapter;
 import org.apache.ignite.internal.util.ipc.IpcServerEndpoint;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -33,6 +35,7 @@ import org.apache.ignite.internal.visor.cache.VisorCache;
 import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder;
 import org.apache.ignite.internal.visor.igfs.VisorIgfs;
 import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
+import org.apache.ignite.lang.IgniteProductVersion;
 
 import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
 import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
@@ -70,7 +73,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
      */
     protected void events0(VisorNodeDataCollectorJobResult res, String evtOrderKey, String evtThrottleCntrKey,
         final boolean all) {
-        res.events().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all, EVT_MAPPER));
+        res.getEvents().addAll(collectEvents(ignite, evtOrderKey, evtThrottleCntrKey, all, EVT_MAPPER));
     }
 
     /**
@@ -83,12 +86,12 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
         try {
             // Visor events explicitly enabled in configuration.
             if (checkExplicitTaskMonitoring(ignite))
-                res.taskMonitoringEnabled(true);
+                res.setTaskMonitoringEnabled(true);
             else {
                 // Get current task monitoring state.
-                res.taskMonitoringEnabled(arg.taskMonitoringEnabled());
+                res.setTaskMonitoringEnabled(arg.isTaskMonitoringEnabled());
 
-                if (arg.taskMonitoringEnabled()) {
+                if (arg.isTaskMonitoringEnabled()) {
                     ConcurrentMap<String, VisorComputeMonitoringHolder> storage = ignite.cluster().nodeLocalMap();
 
                     VisorComputeMonitoringHolder holder = storage.get(COMPUTE_MONITORING_HOLDER_KEY);
@@ -102,21 +105,33 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
                     }
 
                     // Enable task monitoring for new node in grid.
-                    holder.startCollect(ignite, arg.eventsOrderKey());
+                    holder.startCollect(ignite, arg.getEventsOrderKey());
 
                     // Update current state after change (it may not changed in some cases).
-                    res.taskMonitoringEnabled(ignite.allEventsUserRecordable(VISOR_TASK_EVTS));
+                    res.setTaskMonitoringEnabled(ignite.allEventsUserRecordable(VISOR_TASK_EVTS));
                 }
             }
 
-            events0(res, arg.eventsOrderKey(), arg.eventsThrottleCounterKey(), arg.taskMonitoringEnabled());
+            events0(res, arg.getEventsOrderKey(), arg.getEventsThrottleCounterKey(), arg.isTaskMonitoringEnabled());
         }
         catch (Exception eventsEx) {
-            res.eventsEx(eventsEx);
+            res.setEventsEx(eventsEx);
         }
     }
 
     /**
+     * @param ver Version to check.
+     * @return {@code true} if found at least one compatible node with specified version.
+     */
+    protected boolean compatibleWith(IgniteProductVersion ver) {
+        for (ClusterNode node : ignite.cluster().nodes())
+            if (node.version().compareToIgnoreTimestamp(ver) <= 0)
+                return true;
+
+        return false;
+    }
+
+    /**
      * @param cacheName Cache name to check.
      * @return {@code true} if cache on local node is not a data cache or near cache disabled.
      */
@@ -138,19 +153,22 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
         try {
             IgniteConfiguration cfg = ignite.configuration();
 
-            for (String cacheName : ignite.context().cache().cacheNames()) {
+            GridCacheProcessor cacheProc = ignite.context().cache();
+
+            for (String cacheName : cacheProc.cacheNames()) {
                 if (proxyCache(cacheName))
                     continue;
 
-                if (arg.systemCaches() ||
-                    !(isSystemCache(cacheName) || isIgfsCache(cfg, cacheName))) {
+                if (arg.getSystemCaches() || !(isSystemCache(cacheName) || isIgfsCache(cfg, cacheName))) {
                     long start0 = U.currentTimeMillis();
 
                     try {
-                        VisorCache cache = new VisorCache().from(ignite, cacheName, arg.sample());
+                        GridCacheAdapter ca = cacheProc.internalCache(cacheName);
+
+                        if (ca == null || !ca.context().started())
+                            continue;
 
-                        if (cache != null)
-                            res.caches().add(cache);
+                        res.getCaches().add(new VisorCache(ignite, ca, arg.getSample()));
                     }
                     catch(IllegalStateException | IllegalArgumentException e) {
                         if (debug && ignite.log() != null)
@@ -164,7 +182,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
             }
         }
         catch (Exception cachesEx) {
-            res.cachesEx(cachesEx);
+            res.setCachesEx(cachesEx);
         }
     }
 
@@ -182,8 +200,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
 
                 FileSystemConfiguration igfsCfg = igfs.configuration();
 
-                if (proxyCache(igfsCfg.getDataCacheConfiguration().getName())
-                    || proxyCache(igfsCfg.getMetaCacheConfiguration().getName()))
+                if (proxyCache(igfsCfg.getDataCacheConfiguration().getName()) || proxyCache(igfsCfg.getMetaCacheConfiguration().getName()))
                     continue;
 
                 try {
@@ -192,11 +209,11 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
                     if (endPoints != null) {
                         for (IpcServerEndpoint ep : endPoints)
                             if (ep.isManagement())
-                                res.igfsEndpoints().add(new VisorIgfsEndpoint(igfs.name(), ignite.name(),
+                                res.getIgfsEndpoints().add(new VisorIgfsEndpoint(igfs.name(), ignite.name(),
                                     ep.getHost(), ep.getPort()));
                     }
 
-                    res.igfss().add(VisorIgfs.from(igfs));
+                    res.getIgfss().add(new VisorIgfs(igfs));
                 }
                 finally {
                     if (debug)
@@ -205,7 +222,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
             }
         }
         catch (Exception igfssEx) {
-            res.igfssEx(igfssEx);
+            res.setIgfssEx(igfssEx);
         }
     }
 
@@ -223,9 +240,9 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
      */
     protected VisorNodeDataCollectorJobResult run(VisorNodeDataCollectorJobResult res,
         VisorNodeDataCollectorTaskArg arg) {
-        res.igniteInstanceName(ignite.name());
+        res.setGridName(ignite.name());
 
-        res.topologyVersion(ignite.cluster().topologyVersion());
+        res.setTopologyVersion(ignite.cluster().topologyVersion());
 
         long start0 = U.currentTimeMillis();
 
@@ -244,7 +261,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
         if (debug)
             log(ignite.log(), "Collected igfs", getClass(), start0);
 
-        res.errorCount(ignite.context().exceptionRegistry().errorCount());
+        res.setErrorCount(ignite.context().exceptionRegistry().errorCount());
 
         return res;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
index d463baa..41f9468 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
@@ -17,9 +17,14 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.internal.visor.cache.VisorCache;
 import org.apache.ignite.internal.visor.event.VisorGridEvent;
 import org.apache.ignite.internal.visor.igfs.VisorIgfs;
@@ -28,12 +33,12 @@ import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
 /**
  * Data collector job result.
  */
-public class VisorNodeDataCollectorJobResult implements Serializable {
+public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Ignite instance name. */
-    private String igniteInstanceName;
+    /** Grid name. */
+    private String gridName;
 
     /** Node topology version. */
     private long topVer;
@@ -42,22 +47,22 @@ public class VisorNodeDataCollectorJobResult implements Serializable {
     private boolean taskMonitoringEnabled;
 
     /** Node events. */
-    private final Collection<VisorGridEvent> evts = new ArrayList<>();
+    private List<VisorGridEvent> evts = new ArrayList<>();
 
     /** Exception while collecting node events. */
     private Throwable evtsEx;
 
     /** Node caches. */
-    private final Collection<VisorCache> caches = new ArrayList<>();
+    private List<VisorCache> caches = new ArrayList<>();
 
     /** Exception while collecting node caches. */
     private Throwable cachesEx;
 
     /** Node IGFSs. */
-    private final Collection<VisorIgfs> igfss = new ArrayList<>();
+    private List<VisorIgfs> igfss = new ArrayList<>();
 
     /** All IGFS endpoints collected from nodes. */
-    private final Collection<VisorIgfsEndpoint> igfsEndpoints = new ArrayList<>();
+    private List<VisorIgfsEndpoint> igfsEndpoints = new ArrayList<>();
 
     /** Exception while collecting node IGFSs. */
     private Throwable igfssEx;
@@ -66,128 +71,170 @@ public class VisorNodeDataCollectorJobResult implements Serializable {
     private long errCnt;
 
     /**
-     * @return Ignite instance name.
+     * Default constructor.
      */
-    public String igniteInstanceName() {
-        return igniteInstanceName;
+    public VisorNodeDataCollectorJobResult() {
+        // No-op.
     }
 
     /**
-     * @param igniteInstanceName New Ignite instance name.
+     * @return Grid name.
      */
-    public void igniteInstanceName(String igniteInstanceName) {
-        this.igniteInstanceName = igniteInstanceName;
+    public String getGridName() {
+        return gridName;
+    }
+
+    /**
+     * @param gridName New grid name value.
+     */
+    public void setGridName(String gridName) {
+        this.gridName = gridName;
     }
 
     /**
      * @return Current topology version.
      */
-    public long topologyVersion() {
+    public long getTopologyVersion() {
         return topVer;
     }
 
     /**
      * @param topVer New topology version value.
      */
-    public void topologyVersion(long topVer) {
+    public void setTopologyVersion(long topVer) {
         this.topVer = topVer;
     }
 
     /**
      * @return Current task monitoring state.
      */
-    public boolean taskMonitoringEnabled() {
+    public boolean isTaskMonitoringEnabled() {
         return taskMonitoringEnabled;
     }
 
     /**
      * @param taskMonitoringEnabled New value of task monitoring state.
      */
-    public void taskMonitoringEnabled(boolean taskMonitoringEnabled) {
+    public void setTaskMonitoringEnabled(boolean taskMonitoringEnabled) {
         this.taskMonitoringEnabled = taskMonitoringEnabled;
     }
 
     /**
      * @return Collection of collected events.
      */
-    public Collection<VisorGridEvent> events() {
+    public List<VisorGridEvent> getEvents() {
         return evts;
     }
 
     /**
      * @return Exception caught during collecting events.
      */
-    public Throwable eventsEx() {
+    public Throwable getEventsEx() {
         return evtsEx;
     }
 
     /**
      * @param evtsEx Exception caught during collecting events.
      */
-    public void eventsEx(Throwable evtsEx) {
+    public void setEventsEx(Throwable evtsEx) {
         this.evtsEx = evtsEx;
     }
 
     /**
      * @return Collected cache metrics.
      */
-    public Collection<VisorCache> caches() {
+    public List<VisorCache> getCaches() {
         return caches;
     }
 
     /**
      * @return Exception caught during collecting caches metrics.
      */
-    public Throwable cachesEx() {
+    public Throwable getCachesEx() {
         return cachesEx;
     }
 
     /**
      * @param cachesEx Exception caught during collecting caches metrics.
      */
-    public void cachesEx(Throwable cachesEx) {
+    public void setCachesEx(Throwable cachesEx) {
         this.cachesEx = cachesEx;
     }
 
     /**
      * @return Collected IGFSs metrics.
      */
-    public Collection<VisorIgfs> igfss() {
+    public List<VisorIgfs> getIgfss() {
         return igfss;
     }
 
     /**
      * @return Collected IGFSs endpoints.
      */
-    public Collection<VisorIgfsEndpoint> igfsEndpoints() {
+    public List<VisorIgfsEndpoint> getIgfsEndpoints() {
         return igfsEndpoints;
     }
 
     /**
      * @return Exception caught during collecting IGFSs metrics.
      */
-    public Throwable igfssEx() {
+    public Throwable getIgfssEx() {
         return igfssEx;
     }
 
     /**
      * @param igfssEx Exception caught during collecting IGFSs metrics.
      */
-    public void igfssEx(Throwable igfssEx) {
+    public void setIgfssEx(Throwable igfssEx) {
         this.igfssEx = igfssEx;
     }
 
     /**
      * @return Errors count.
      */
-    public long errorCount() {
+    public long getErrorCount() {
         return errCnt;
     }
 
     /**
      * @param errCnt Errors count.
      */
-    public void errorCount(long errCnt) {
+    public void setErrorCount(long errCnt) {
         this.errCnt = errCnt;
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, gridName);
+        out.writeLong(topVer);
+        out.writeBoolean(taskMonitoringEnabled);
+        U.writeCollection(out, evts);
+        out.writeObject(evtsEx);
+        U.writeCollection(out, caches);
+        out.writeObject(cachesEx);
+        U.writeCollection(out, igfss);
+        U.writeCollection(out, igfsEndpoints);
+        out.writeObject(igfssEx);
+        out.writeLong(errCnt);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        gridName = U.readString(in);
+        topVer = in.readLong();
+        taskMonitoringEnabled = in.readBoolean();
+        evts = U.readList(in);
+        evtsEx = (Throwable)in.readObject();
+        caches = U.readList(in);
+        cachesEx = (Throwable)in.readObject();
+        igfss = U.readList(in);
+        igfsEndpoints = U.readList(in);
+        igfssEx = (Throwable)in.readObject();
+        errCnt = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodeDataCollectorJobResult.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
index 08d5f9f..af02e34 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
@@ -66,11 +66,13 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
                 else {
                     // Ignore nodes that left topology.
                     if (!(unhandledEx instanceof ClusterGroupEmptyException))
-                        taskRes.unhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx));
+                        taskRes.getUnhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx));
                 }
             }
         }
 
+        taskRes.active(true /*ignite.active()*/);
+
         taskRes.active(ignite.active());
 
         return taskRes;
@@ -85,33 +87,33 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
      */
     protected void reduceJobResult(VisorNodeDataCollectorTaskResult taskRes,
         VisorNodeDataCollectorJobResult jobRes, UUID nid) {
-        taskRes.igniteInstanceNames().put(nid, jobRes.igniteInstanceName());
+        taskRes.getGridNames().put(nid, jobRes.getGridName());
 
-        taskRes.topologyVersions().put(nid, jobRes.topologyVersion());
+        taskRes.getTopologyVersions().put(nid, jobRes.getTopologyVersion());
 
-        taskRes.taskMonitoringEnabled().put(nid, jobRes.taskMonitoringEnabled());
+        taskRes.isTaskMonitoringEnabled().put(nid, jobRes.isTaskMonitoringEnabled());
 
-        taskRes.errorCounts().put(nid, jobRes.errorCount());
+        taskRes.getErrorCounts().put(nid, jobRes.getErrorCount());
 
-        if (!jobRes.events().isEmpty())
-            taskRes.events().addAll(jobRes.events());
+        if (!jobRes.getEvents().isEmpty())
+            taskRes.getEvents().addAll(jobRes.getEvents());
 
-        if (jobRes.eventsEx() != null)
-            taskRes.eventsEx().put(nid, new VisorExceptionWrapper(jobRes.eventsEx()));
+        if (jobRes.getEventsEx() != null)
+            taskRes.getEventsEx().put(nid, new VisorExceptionWrapper(jobRes.getEventsEx()));
 
-        if (!jobRes.caches().isEmpty())
-            taskRes.caches().put(nid, jobRes.caches());
+        if (!jobRes.getCaches().isEmpty())
+            taskRes.getCaches().put(nid, jobRes.getCaches());
 
-        if (jobRes.cachesEx() != null)
-            taskRes.cachesEx().put(nid, new VisorExceptionWrapper(jobRes.cachesEx()));
+        if (jobRes.getCachesEx() != null)
+            taskRes.getCachesEx().put(nid, new VisorExceptionWrapper(jobRes.getCachesEx()));
 
-        if (!jobRes.igfss().isEmpty())
-            taskRes.igfss().put(nid, jobRes.igfss());
+        if (!jobRes.getIgfss().isEmpty())
+            taskRes.getIgfss().put(nid, jobRes.getIgfss());
 
-        if (!jobRes.igfsEndpoints().isEmpty())
-            taskRes.igfsEndpoints().put(nid, jobRes.igfsEndpoints());
+        if (!jobRes.getIgfsEndpoints().isEmpty())
+            taskRes.getIgfsEndpoints().put(nid, jobRes.getIgfsEndpoints());
 
-        if (jobRes.igfssEx() != null)
-            taskRes.igfssEx().put(nid, new VisorExceptionWrapper(jobRes.igfssEx()));
+        if (jobRes.getIgfssEx() != null)
+            taskRes.getIgfssEx().put(nid, new VisorExceptionWrapper(jobRes.getIgfssEx()));
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java
index 975dd28..825560b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java
@@ -17,12 +17,17 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data collector task arguments.
  */
-public class VisorNodeDataCollectorTaskArg implements Serializable {
+public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -74,70 +79,93 @@ public class VisorNodeDataCollectorTaskArg implements Serializable {
     /**
      * @return {@code true} if Visor should collect information about tasks.
      */
-    public boolean taskMonitoringEnabled() {
+    public boolean isTaskMonitoringEnabled() {
         return taskMonitoringEnabled;
     }
 
     /**
      * @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks.
      */
-    public void taskMonitoringEnabled(boolean taskMonitoringEnabled) {
+    public void setTaskMonitoringEnabled(boolean taskMonitoringEnabled) {
         this.taskMonitoringEnabled = taskMonitoringEnabled;
     }
 
     /**
      * @return Key for store and read last event order number.
      */
-    public String eventsOrderKey() {
+    public String getEventsOrderKey() {
         return evtOrderKey;
     }
 
     /**
      * @param evtOrderKey Key for store and read last event order number.
      */
-    public void eventsOrderKey(String evtOrderKey) {
+    public void setEventsOrderKey(String evtOrderKey) {
         this.evtOrderKey = evtOrderKey;
     }
 
     /**
      * @return Key for store and read events throttle counter.
      */
-    public String eventsThrottleCounterKey() {
+    public String getEventsThrottleCounterKey() {
         return evtThrottleCntrKey;
     }
 
     /**
      * @param evtThrottleCntrKey Key for store and read events throttle counter.
      */
-    public void eventsThrottleCounterKey(String evtThrottleCntrKey) {
+    public void setEventsThrottleCounterKey(String evtThrottleCntrKey) {
         this.evtThrottleCntrKey = evtThrottleCntrKey;
     }
 
     /**
      * @return Number of items to evaluate cache size.
      */
-    public int sample() {
+    public int getSample() {
         return sample;
     }
 
     /**
      * @param sample Number of items to evaluate cache size.
      */
-    public void sample(int sample) {
+    public void setSample(int sample) {
         this.sample = sample;
     }
 
     /**
      * @return {@code true} if Visor should collect metrics for system caches.
      */
-    public boolean systemCaches() {
+    public boolean getSystemCaches() {
         return sysCaches;
     }
 
     /**
      * @param sysCaches {@code true} if Visor should collect metrics for system caches.
      */
-    public void systemCaches(boolean sysCaches) {
+    public void setSystemCaches(boolean sysCaches) {
         this.sysCaches = sysCaches;
     }
-}
\ No newline at end of file
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(taskMonitoringEnabled);
+        U.writeString(out, evtOrderKey);
+        U.writeString(out, evtThrottleCntrKey);
+        out.writeInt(sample);
+        out.writeBoolean(sysCaches);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        taskMonitoringEnabled = in.readBoolean();
+        evtOrderKey = U.readString(in);
+        evtThrottleCntrKey = U.readString(in);
+        sample = in.readInt();
+        sysCaches = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodeDataCollectorTaskArg.class, this);
+    }
+}


[05/50] [abbrv] ignite git commit: IGNITE-3469: Removed unused static fields from IgniteConfiguration.

Posted by sb...@apache.org.
IGNITE-3469: Removed unused static fields from IgniteConfiguration.


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

Branch: refs/heads/ignite-1561-1
Commit: 8b56a43f28ef8ddd6b0b82ed03dfe1afbb6ded99
Parents: d57ef07
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 16:21:20 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 16:21:20 2017 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      | 24 --------------------
 1 file changed, 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8b56a43f/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index e3fd342..44fb311 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -150,39 +150,15 @@ public class IgniteConfiguration {
     /** Default size of data streamer thread pool. */
     public static final int DFLT_DATA_STREAMER_POOL_SIZE = DFLT_PUBLIC_THREAD_CNT;
 
-    /** Default keep alive time for public thread pool. */
-    @Deprecated
-    public static final long DFLT_PUBLIC_KEEP_ALIVE_TIME = 0;
-
     /** Default limit of threads used for rebalance. */
     public static final int DFLT_REBALANCE_THREAD_POOL_SIZE = 1;
 
-    /** Default max queue capacity of public thread pool. */
-    @Deprecated
-    public static final int DFLT_PUBLIC_THREADPOOL_QUEUE_CAP = Integer.MAX_VALUE;
-
     /** Default size of system thread pool. */
     public static final int DFLT_SYSTEM_CORE_THREAD_CNT = DFLT_PUBLIC_THREAD_CNT;
 
-    /** Default max size of system thread pool. */
-    @Deprecated
-    public static final int DFLT_SYSTEM_MAX_THREAD_CNT = DFLT_PUBLIC_THREAD_CNT;
-
     /** Default size of query thread pool. */
     public static final int DFLT_QUERY_THREAD_POOL_SIZE = DFLT_PUBLIC_THREAD_CNT;
 
-    /** Default keep alive time for system thread pool. */
-    @Deprecated
-    public static final long DFLT_SYSTEM_KEEP_ALIVE_TIME = 0;
-
-    /** Default keep alive time for utility thread pool. */
-    @Deprecated
-    public static final long DFLT_UTILITY_KEEP_ALIVE_TIME = 10_000;
-
-    /** Default max queue capacity of system thread pool. */
-    @Deprecated
-    public static final int DFLT_SYSTEM_THREADPOOL_QUEUE_CAP = Integer.MAX_VALUE;
-
     /** Default Ignite thread keep alive time. */
     public static final long DFLT_THREAD_KEEP_ALIVE_TIME = 60_000L;
 


[31/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/StorageConstants.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/StorageConstants.java b/modules/math/src/main/java/org/apache/ignite/math/StorageConstants.java
new file mode 100644
index 0000000..e8bfdf6
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/StorageConstants.java
@@ -0,0 +1,49 @@
+/*
+ * 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.math;
+
+/**
+ * Support for different modes of accessing data storage.
+ */
+public interface StorageConstants {
+    /** Storage mode optimized for sequential access. */
+    public static final int SEQUENTIAL_ACCESS_MODE = 1001;
+
+    /** Storage mode optimized for random access. */
+    public static final int RANDOM_ACCESS_MODE = 1002;
+
+    /** Storage mode optimized for row access. */
+    public static final int ROW_STORAGE_MODE = 2001;
+
+    /** Storage mode optimized for column access. */
+    public static final int COLUMN_STORAGE_MODE = 2002;
+
+    /**
+     * @param mode Access mode to verify.
+     */
+    public default void assertAccessMode(int mode) {
+        assert mode == SEQUENTIAL_ACCESS_MODE || mode == RANDOM_ACCESS_MODE;
+    }
+
+    /**
+     * @param mode Storage mode to verify.
+     */
+    public default void assertStorageMode(int mode) {
+        assert mode == ROW_STORAGE_MODE || mode == COLUMN_STORAGE_MODE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/StorageOpsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/StorageOpsMetrics.java b/modules/math/src/main/java/org/apache/ignite/math/StorageOpsMetrics.java
new file mode 100644
index 0000000..c3252ba
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/StorageOpsMetrics.java
@@ -0,0 +1,49 @@
+/*
+ * 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.math;
+
+/**
+ * Storage and operation cost characteristics.
+ */
+public interface StorageOpsMetrics {
+    /**
+     * Checks if this implementation should be considered to be iterable in index order in an efficient way.
+     */
+    public boolean isSequentialAccess();
+
+    /**
+     * Checks if this implementation is optimized for random access.
+     */
+    public boolean isRandomAccess();
+
+    /**
+     * Checks if this implementation should be considered dense so that it explicitly
+     * represents every value.
+     */
+    public boolean isDense();
+
+    /**
+     * Checks if implementation is based on Java arrays.
+     */
+    public boolean isArrayBased();
+
+    /**
+     * Checks whether implementation is JVM-local or distributed (multi-JVM).
+     */
+    public boolean isDistributed();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/Tracer.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/Tracer.java b/modules/math/src/main/java/org/apache/ignite/math/Tracer.java
new file mode 100644
index 0000000..89d4669
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/Tracer.java
@@ -0,0 +1,456 @@
+/*
+ * 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.math;
+
+import java.awt.Color;
+import java.awt.Desktop;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.Locale;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ * Utility methods to support output of {@link Vector} and {@link Matrix} instances to plain text or HTML.
+ */
+public class Tracer {
+    /**
+     * Double to color mapper.
+     */
+    public interface ColorMapper extends Function<Double, Color> {
+    }
+
+    /** Continuous red-to-blue color mapping. */
+    static private ColorMapper defaultColorMapper(double min, double max) {
+        double range = max - min;
+
+        return new ColorMapper() {
+            /** {@inheritDoc} */
+            @Override public Color apply(Double d) {
+                int r = (int)Math.round(255 * d);
+                int g = 0;
+                int b = (int)Math.round(255 * (1 - d));
+
+                return new Color(r, g, b);
+            }
+        };
+    }
+
+    /**
+     * Default vector color mapper implementation that map given double value
+     * to continuous red-blue (R_B) specter.
+     *
+     * @param vec Vector to map.
+     * @return {@link ColorMapper} for the given vector.
+     */
+    static private ColorMapper mkVectorColorMapper(Vector vec) {
+        return defaultColorMapper(vec.minValue(), vec.maxValue());
+    }
+
+    /** Default matrix color mapper implementation that map given double value
+     * to continuous red-blue (R_B) specter.
+     * @param mtx Matrix to be mapped.
+     * @return Color mapper for given matrix.
+     */
+    static private ColorMapper mkMatrixColorMapper(Matrix mtx) {
+        return defaultColorMapper(mtx.minValue(), mtx.maxValue());
+    }
+
+    /**
+     * @param vec Vector to show.
+     * @param log {@link IgniteLogger} instance for output.
+     * @param fmt Format string for vector elements.
+     */
+    public static void showAscii(Vector vec, IgniteLogger log, String fmt) {
+        String cls = vec.getClass().getSimpleName();
+
+        log.info(String.format("%s(%d) [%s]", cls, vec.size(), mkString(vec, fmt)));
+    }
+
+    /**
+     * @param vec Vector to show as plain text.
+     * @param log {@link IgniteLogger} instance for output.
+     */
+    public static void showAscii(Vector vec, IgniteLogger log) {
+        showAscii(vec, log, "%4f");
+    }
+
+    /**
+     * @param vec Vector to show as plain text.
+     * @param fmt Format string for vector elements.
+     */
+    public static void showAscii(Vector vec, String fmt) {
+        String cls = vec.getClass().getSimpleName();
+
+        System.out.println(String.format("%s(%d) [%s]", cls, vec.size(), mkString(vec, fmt)));
+    }
+
+    /**
+     * @param mtx Matrix to show as plain text.
+     */
+    public static void showAscii(Matrix mtx) {
+        showAscii(mtx, "%4f");
+    }
+
+    /**
+     * @param mtx Matrix to show.
+     * @param row Matrix row to output.
+     * @param fmt Format string for matrix elements in the row.
+     * @return String representation of given matrix row according to given format.
+     */
+    static private String rowStr(Matrix mtx, int row, String fmt) {
+        StringBuilder buf = new StringBuilder();
+
+        boolean first = true;
+
+        int cols = mtx.columnSize();
+
+        for (int col = 0; col < cols; col++) {
+            String s = String.format(fmt, mtx.get(row, col));
+
+            if (!first)
+                buf.append(", ");
+
+            buf.append(s);
+
+            first = false;
+        }
+
+        return buf.toString();
+    }
+
+    /**
+     * @param mtx {@link Matrix} object to show as a plain text.
+     * @param fmt Format string for matrix rows.
+     */
+    public static void showAscii(Matrix mtx, String fmt) {
+        String cls = mtx.getClass().getSimpleName();
+
+        int rows = mtx.rowSize();
+        int cols = mtx.columnSize();
+
+        System.out.println(String.format("%s(%dx%d)", cls, rows, cols));
+
+        for (int row = 0; row < rows; row++)
+            System.out.println(rowStr(mtx, row, fmt));
+    }
+
+    /**
+     * @param mtx {@link Matrix} object to show as a plain text.
+     * @param log {@link IgniteLogger} instance to output the logged matrix.
+     * @param fmt Format string for matrix rows.
+     */
+    public static void showAscii(Matrix mtx, IgniteLogger log, String fmt) {
+        String cls = mtx.getClass().getSimpleName();
+
+        int rows = mtx.rowSize();
+        int cols = mtx.columnSize();
+
+        log.info(String.format("%s(%dx%d)", cls, rows, cols));
+
+        for (int row = 0; row < rows; row++)
+            log.info(rowStr(mtx, row, fmt));
+    }
+
+    /**
+     * @param vec {@link Vector} object to show as a plain text.
+     */
+    public static void showAscii(Vector vec) {
+        showAscii(vec, "%4f");
+    }
+
+    /**
+     * Saves given vector as CSV file.
+     *
+     * @param vec Vector to save.
+     * @param fmt Format to use.
+     * @param filePath Path of the file to save to.
+     */
+    public static void saveAsCsv(Vector vec, String fmt, String filePath) throws IOException {
+        String s = mkString(vec, fmt);
+
+        Files.write(Paths.get(filePath), s.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.WRITE);
+    }
+
+    /**
+     * Saves given matrix as CSV file.
+     *
+     * @param mtx Matrix to save.
+     * @param fmt Format to use.
+     * @param filePath Path of the file to save to.
+     */
+    public static void saveAsCsv(Matrix mtx, String fmt, String filePath) throws IOException {
+        String s = mkString(mtx, fmt);
+
+        Files.write(Paths.get(filePath), s.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.WRITE);
+    }
+
+    /**
+     * Shows given matrix in the browser with D3-based visualization.
+     *
+     * @param mtx Matrix to show.
+     * @throws IOException Thrown in case of any errors.
+     */
+    public static void showHtml(Matrix mtx) throws IOException {
+        showHtml(mtx, mkMatrixColorMapper(mtx));
+    }
+
+    /**
+     * Shows given matrix in the browser with D3-based visualization.
+     *
+     * @param mtx Matrix to show.
+     * @param cm Optional color mapper. If not provided - red-to-blue (R_B) mapper will be used.
+     * @throws IOException Thrown in case of any errors.
+     */
+    public static void showHtml(Matrix mtx, ColorMapper cm) throws IOException {
+        // Read it every time so that we can change it at runtime.
+        String tmpl = fileToString("d3-matrix-template.html");
+
+        String cls = mtx.getClass().getSimpleName();
+
+        double min = mtx.minValue();
+        double max = mtx.maxValue();
+
+        openHtmlFile(tmpl.
+            replaceAll("/\\*@NAME@\\*/.*\n", "var name = \"" + cls + "\";\n").
+            replaceAll("/\\*@MIN@\\*/.*\n", "var min = " + dataColorJson(min, cm.apply(min)) + ";\n").
+            replaceAll("/\\*@MAX@\\*/.*\n", "var max = " + dataColorJson(max, cm.apply(max)) + ";\n").
+            replaceAll("/\\*@DATA@\\*/.*\n", "var data = " + mkJsArrayString(mtx, cm) + ";\n")
+        );
+    }
+
+    /**
+     * Shows given vector in the browser with D3-based visualization.
+     *
+     * @param vec Vector to show.
+     * @throws IOException Thrown in case of any errors.
+     */
+    public static void showHtml(Vector vec) throws IOException {
+        showHtml(vec, mkVectorColorMapper(vec));
+    }
+
+    /**
+     * @param d Value of {@link Matrix} or {@link Vector} element.
+     * @param clr {@link Color} to paint.
+     * @return JSON representation for given value and color.
+     */
+    static private String dataColorJson(double d, Color clr) {
+        return "{" +
+            "d: " + String.format("%4f", d) +
+            ", r: " + clr.getRed() +
+            ", g: " + clr.getGreen() +
+            ", b: " + clr.getBlue() +
+            "}";
+    }
+
+    /**
+     * Shows given vector in the browser with D3-based visualization.
+     *
+     * @param vec Vector to show.
+     * @param cm Optional color mapper. If not provided - red-to-blue (R_B) mapper will be used.
+     * @throws IOException Thrown in case of any errors.
+     */
+    public static void showHtml(Vector vec, ColorMapper cm) throws IOException {
+        // Read it every time so that we can change it at runtime.
+        String tmpl = fileToString("d3-vector-template.html");
+
+        String cls = vec.getClass().getSimpleName();
+
+        double min = vec.minValue();
+        double max = vec.maxValue();
+
+        openHtmlFile(tmpl.
+            replaceAll("/\\*@NAME@\\*/.*\n", "var name = \"" + cls + "\";\n").
+            replaceAll("/\\*@MIN@\\*/.*\n", "var min = " + dataColorJson(min, cm.apply(min)) + ";\n").
+            replaceAll("/\\*@MAX@\\*/.*\n", "var max = " + dataColorJson(max, cm.apply(max)) + ";\n").
+            replaceAll("/\\*@DATA@\\*/.*\n", "var data = " + mkJsArrayString(vec, cm) + ";\n")
+        );
+    }
+
+    /**
+     * Reads file content into the string.
+     *
+     * @param fileName Name of the file (on classpath) to read.
+     * @return Content of the file.
+     * @throws IOException If an I/O error of some sort has occurred.
+     */
+    private static String fileToString(String fileName) throws IOException {
+        assert Tracer.class.getResourceAsStream(fileName) != null : "Can't get resource: " + fileName;
+
+        InputStreamReader is = new InputStreamReader(Tracer.class.getResourceAsStream(fileName));
+
+        String str = new BufferedReader(is).lines().collect(Collectors.joining("\n"));
+
+        is.close();
+
+        return str;
+    }
+
+    /**
+     * Opens file in the browser with given HTML content.
+     *
+     * @param html HTML content.
+     * @throws IOException Thrown in case of any errors.
+     */
+    static private void openHtmlFile(String html) throws IOException {
+        File temp = File.createTempFile(IgniteUuid.randomUuid().toString(), ".html");
+
+        BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
+
+        bw.write(html);
+
+        bw.close();
+
+        Desktop.getDesktop().browse(temp.toURI());
+    }
+
+    /**
+     * Gets string presentation of this vector.
+     *
+     * @param vec Vector to string-ify.
+     * @param fmt {@link String#format(Locale, String, Object...)} format.
+     */
+    private static String mkString(Vector vec, String fmt) {
+        boolean first = true;
+
+        StringBuilder buf = new StringBuilder();
+
+        for (Vector.Element x : vec.all()) {
+            String s = String.format(Locale.US, fmt, x.get());
+
+            if (!first) {
+                buf.append(", ");
+                buf.append(s);
+            }
+            else {
+                buf.append(s);
+                first = false;
+            }
+        }
+
+        return buf.toString();
+    }
+
+    /**
+     * Gets JavaScript array presentation of this vector.
+     *
+     * @param vec Vector to JavaScript-ify.
+     * @param cm Color mapper to user.
+     */
+    private static String mkJsArrayString(Vector vec, ColorMapper cm) {
+        boolean first = true;
+
+        StringBuilder buf = new StringBuilder();
+
+        for (Vector.Element x : vec.all()) {
+            double d = x.get();
+
+            String s = dataColorJson(d, cm.apply(d));
+
+            if (!first)
+                buf.append(", ");
+
+            buf.append(s);
+
+            first = false;
+        }
+
+        return '[' + buf.toString() + ']';
+    }
+
+    /**
+     * Gets JavaScript array presentation of this vector.
+     *
+     * @param mtx Matrix to JavaScript-ify.
+     * @param cm Color mapper to user.
+     */
+    private static String mkJsArrayString(Matrix mtx, ColorMapper cm) {
+        boolean first = true;
+
+        StringBuilder buf = new StringBuilder();
+
+        int rows = mtx.rowSize();
+        int cols = mtx.columnSize();
+
+        for (int row = 0; row < rows; row++) {
+            StringBuilder rowBuf = new StringBuilder();
+
+            boolean rowFirst = true;
+
+            for (int col = 0; col < cols; col++) {
+                double d = mtx.get(row, col);
+
+                String s = dataColorJson(d, cm.apply(d));
+
+                if (!rowFirst)
+                    rowBuf.append(", ");
+
+                rowBuf.append(s);
+
+                rowFirst = false;
+            }
+
+            if (!first)
+                buf.append(", ");
+
+            buf.append('[').append(rowBuf.toString()).append(']');
+
+            first = false;
+        }
+
+        return '[' + buf.toString() + ']';
+    }
+
+    /**
+     * @param mtx Matrix to log.
+     * @param fmt Output format.
+     * @return Formatted representation of a matrix.
+     */
+    private static String mkString(Matrix mtx, String fmt) {
+        StringBuilder buf = new StringBuilder();
+
+        int rows = mtx.rowSize();
+        int cols = mtx.columnSize();
+
+        for (int row = 0; row < rows; row++) {
+            for (int col = 0; col < cols; col++) {
+                String s = String.format(Locale.US, fmt, mtx.get(row, col));
+
+                if (col != 0)
+                    buf.append(", ");
+
+                buf.append(s);
+
+                if (col == cols - 1 && row != rows - 1)
+                    buf.append(",\n");
+
+            }
+        }
+
+        return buf.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/ValueMapper.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/ValueMapper.java b/modules/math/src/main/java/org/apache/ignite/math/ValueMapper.java
new file mode 100644
index 0000000..9459bd1
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/ValueMapper.java
@@ -0,0 +1,27 @@
+// @java.file.header
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.math;
+
+import java.io.Serializable;
+
+/**
+ * Utility mapper that can be used to map arbitrary values types to and from double.
+ */
+public interface ValueMapper<V> extends Serializable {
+    /**
+     * @param v
+     */
+    public V fromDouble(double v);
+
+    /**
+     * @param v
+     */
+    public double toDouble(V v);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/Vector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/Vector.java b/modules/math/src/main/java/org/apache/ignite/math/Vector.java
new file mode 100644
index 0000000..ac2a6c7
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/Vector.java
@@ -0,0 +1,498 @@
+/*
+ * 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.math;
+
+import java.io.Externalizable;
+import java.util.Spliterator;
+import java.util.function.IntToDoubleFunction;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+
+/**
+ * A vector interface.
+ *
+ * Based on its flavor it can have vastly different implementations tailored for
+ * for different types of data (e.g. dense vs. sparse), different sizes of data or different operation
+ * optimizations.
+ *
+ * Note also that not all operations can be supported by all underlying implementations. If an operation is not
+ * supported a {@link UnsupportedOperationException} is thrown. This exception can also be thrown in partial cases
+ * where an operation is unsupported only in special cases, e.g. where a given operation cannot be deterministically
+ * completed in polynomial time.
+ *
+ * Based on ideas from <a href="http://mahout.apache.org/">Apache Mahout</a>.
+ */
+public interface Vector extends MetaAttributes, Externalizable, StorageOpsMetrics, Destroyable {
+    /**
+     * Holder for vector's element.
+     */
+    interface Element {
+        /**
+         * Gets element's value.
+         *
+         * @return The value of this vector element.
+         */
+        double get();
+
+        /**
+         * Gets element's index in the vector.
+         *
+         * @return The index of this vector element.
+         */
+        int index();
+
+        /**
+         * Sets element's value.
+         *
+         * @param val Value to set.
+         */
+        void set(double val);
+    }
+
+    /**
+     * Gets cardinality of this vector (maximum number of the elements).
+     *
+     * @return This vector's cardinality.
+     */
+    public int size();
+
+    /**
+     * Creates new copy of this vector.
+     *
+     * @return New copy vector.
+     */
+    public Vector copy();
+
+    /**
+     * Gets iterator over all elements in this vector.
+     *
+     * NOTE: implementation can choose to reuse {@link Element} instance so you need to copy it
+     * if you want to retain it outside of iteration.
+     *
+     * @return Iterator.
+     */
+    public Iterable<Element> all();
+
+    /**
+     * Iterates ove all non-zero elements in this vector.
+     *
+     * NOTE: implementation can choose to reuse {@link Element} instance so you need to copy it
+     * if you want to retain it outside of iteration.
+     *
+     * @return Iterator.
+     */
+    public Iterable<Element> nonZeroes();
+
+    /**
+     * Gets spliterator for all values in this vector.
+     *
+     * @return Spliterator for all values.
+     */
+    public Spliterator<Double> allSpliterator();
+
+    /**
+     * Gets spliterator for all non-zero values in this vector.
+     *
+     * @return Spliterator for all non-zero values.
+     */
+    public Spliterator<Double> nonZeroSpliterator();
+
+    /**
+     * Sorts this vector in ascending order.
+     */
+    public Vector sort();
+
+    /**
+     * Gets element at the given index.
+     *
+     * NOTE: implementation can choose to reuse {@link Element} instance so you need to copy it
+     * if you want to retain it outside of iteration.
+     *
+     * @param idx Element's index.
+     * @return Vector's element at the given index.
+     * @throws IndexException Throw if index is out of bounds.
+     */
+    public Element getElement(int idx);
+
+    /**
+     * Assigns given value to all elements of this vector.
+     *
+     * @param val Value to assign.
+     * @return This vector.
+     */
+    public Vector assign(double val);
+
+    /**
+     * Assigns values from given array to this vector.
+     *
+     * @param vals Values to assign.
+     * @return This vector.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector assign(double[] vals);
+
+    /**
+     * Copies values from the argument vector to this one.
+     *
+     * @param vec Argument vector.
+     * @return This vector.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector assign(Vector vec);
+
+    /**
+     * Assigns each vector element to the value generated by given function.
+     *
+     * @param fun Function that takes the index and returns value.
+     * @return This vector.
+     */
+    public Vector assign(IntToDoubleFunction fun);
+
+    /**
+     * Maps all values in this vector through a given function.
+     *
+     * @param fun Mapping function.
+     * @return This vector.
+     */
+    public Vector map(IgniteDoubleFunction<Double> fun);
+
+    /**
+     * Maps all values in this vector through a given function.
+     *
+     * For this vector <code>A</code>, argument vector <code>B</code> and the
+     * function <code>F</code> this method maps every element <code>x</code> as:
+     * <code>A(x) = F(A(x), B(x))</code>
+     *
+     * @param vec Argument vector.
+     * @param fun Mapping function.
+     * @return This function.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector map(Vector vec, IgniteBiFunction<Double, Double, Double> fun);
+
+    /**
+     * Maps all elements of this vector by applying given function to each element with a constant
+     * second parameter <code>y</code>.
+     *
+     * @param fun Mapping function.
+     * @param y Second parameter for mapping function.
+     * @return This vector.
+     */
+    public Vector map(IgniteBiFunction<Double, Double, Double> fun, double y);
+
+    /**
+     * Creates new vector containing values from this vector divided by the argument.
+     *
+     * @param x Division argument.
+     * @return New vector.
+     */
+    public Vector divide(double x);
+
+    /**
+     * Gets dot product of two vectors.
+     *
+     * @param vec Argument vector.
+     * @return Dot product of two vectors.
+     */
+    public double dot(Vector vec);
+
+    /**
+     * Gets the value at specified index.
+     *
+     * @param idx Vector index.
+     * @return Vector value.
+     * @throws IndexException Throw if index is out of bounds.
+     */
+    public double get(int idx);
+
+    /**
+     * Gets the value at specified index without checking for index boundaries.
+     *
+     * @param idx Vector index.
+     * @return Vector value.
+     */
+    public double getX(int idx);
+
+    /**
+     * Creates new empty vector of the same underlying class but of different cardinality.
+     *
+     * @param crd Cardinality for new vector.
+     * @return New vector.
+     */
+    public Vector like(int crd);
+
+    /**
+     * Creates new matrix of compatible flavor with given size.
+     *
+     * @param rows Number of rows.
+     * @param cols Number of columns.
+     * @return New matrix.
+     */
+    public Matrix likeMatrix(int rows, int cols);
+
+    /**
+     * Converts this vector into [N x 1] or [1 x N] matrix where N is this vector cardinality.
+     *
+     * @param rowLike {@code true} for rowLike [N x 1], or {@code false} for column [1 x N] matrix.
+     * @return Newly created matrix.
+     */
+    public Matrix toMatrix(boolean rowLike);
+
+    /**
+     * Converts this vector into [N+1 x 1] or [1 x N+1] matrix where N is this vector cardinality.
+     * (0,0) element of this matrix will be {@code zeroVal} parameter.
+     *
+     * @param rowLike {@code true} for rowLike [N+1 x 1], or {@code false} for column [1 x N+1] matrix.
+     * @return Newly created matrix.
+     */
+    public Matrix toMatrixPlusOne(boolean rowLike, double zeroVal);
+
+    /**
+     * Creates new vector containing element by element difference between this vector and the argument one.
+     *
+     * @param vec Argument vector.
+     * @return New vector.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector minus(Vector vec);
+
+    /**
+     * Creates new vector containing the normalized (L_2 norm) values of this vector.
+     *
+     * @return New vector.
+     */
+    public Vector normalize();
+
+    /**
+     * Creates new vector containing the normalized (L_power norm) values of this vector.
+     * See http://en.wikipedia.org/wiki/Lp_space for details.
+     *
+     * @param power The power to use. Must be >= 0. May also be {@link Double#POSITIVE_INFINITY}.
+     * @return New vector {@code x} such that {@code norm(x, power) == 1}
+     */
+    public Vector normalize(double power);
+
+    /**
+     * Creates new vector containing the {@code log(1 + entry) / L_2 norm} values of this vector.
+     *
+     * @return New vector.
+     */
+    public Vector logNormalize();
+
+    /**
+     * Creates new vector with a normalized value calculated as {@code log_power(1 + entry) / L_power norm}.
+     *
+     * @param power The power to use. Must be > 1. Cannot be {@link Double#POSITIVE_INFINITY}.
+     * @return New vector
+     */
+    public Vector logNormalize(double power);
+
+    /**
+     * Gets the k-norm of the vector. See http://en.wikipedia.org/wiki/Lp_space for more details.
+     *
+     * @param power The power to use.
+     * @see #normalize(double)
+     */
+    public double kNorm(double power);
+
+    /**
+     * Gets minimal value in this vector.
+     *
+     * @return Minimal value.
+     */
+    public double minValue();
+
+    /**
+     * Gets maximum value in this vector.
+     *
+     * @return Maximum c.
+     */
+    public double maxValue();
+
+    /**
+     * Gets minimal element in this vector.
+     *
+     * @return Minimal element.
+     */
+    public Element minElement();
+
+    /**
+     * Gets maximum element in this vector.
+     *
+     * @return Maximum element.
+     */
+    public Element maxElement();
+
+    /**
+     * Creates new vector containing sum of each element in this vector and argument.
+     *
+     * @param x Argument value.
+     * @return New vector.
+     */
+    public Vector plus(double x);
+
+    /**
+     * Creates new vector containing element by element sum from both vectors.
+     *
+     * @param vec Other argument vector to add.
+     * @return New vector.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector plus(Vector vec);
+
+    /**
+     * Sets value.
+     *
+     * @param idx Vector index to set value at.
+     * @param val Value to set.
+     * @return This vector.
+     * @throws IndexException Throw if index is out of bounds.
+     */
+    public Vector set(int idx, double val);
+
+    /**
+     * Sets value without checking for index boundaries.
+     *
+     * @param idx Vector index to set value at.
+     * @param val Value to set.
+     * @return This vector.
+     */
+    public Vector setX(int idx, double val);
+
+    /**
+     * Increments value at given index without checking for index boundaries.
+     *
+     * @param idx Vector index.
+     * @param val Increment value.
+     * @return This vector.
+     */
+    public Vector incrementX(int idx, double val);
+
+    /**
+     * Increments value at given index.
+     *
+     * @param idx Vector index.
+     * @param val Increment value.
+     * @return This vector.
+     * @throws IndexException Throw if index is out of bounds.
+     */
+    public Vector increment(int idx, double val);
+
+    /**
+     * Gets number of non-zero elements in this vector.
+     *
+     * @return Number of non-zero elements in this vector.
+     */
+    public int nonZeroElements();
+
+    /**
+     * Gets a new vector that contains product of each element and the argument.
+     *
+     * @param x Multiply argument.
+     * @return New vector.
+     */
+    public Vector times(double x);
+
+    /**
+     * Gets a new vector that is an element-wie product of this vector and the argument.
+     *
+     * @param vec Vector to multiply by.
+     * @return New vector.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector times(Vector vec);
+
+    /**
+     * @param off Offset into parent vector.
+     * @param len Length of the view.
+     */
+    public Vector viewPart(int off, int len);
+
+    /**
+     * Gets vector storage model.
+     */
+    public VectorStorage getStorage();
+
+    /**
+     * Gets the sum of all elements in this vector.
+     *
+     * @return Vector's sum
+     */
+    public double sum();
+
+    /**
+     * Gets the cross product of this vector and the other vector.
+     *
+     * @param vec Second vector.
+     * @return New matrix as a cross product of two vectors.
+     */
+    public Matrix cross(Vector vec);
+
+    /**
+     * Folds this vector into a single value.
+     *
+     * @param foldFun Folding function that takes two parameters: accumulator and the current value.
+     * @param mapFun Mapping function that is called on each vector element before its passed to the accumulator (as its
+     * second parameter).
+     * @param <T> Type of the folded value.
+     * @param zeroVal Zero value for fold operation.
+     * @return Folded value of this vector.
+     */
+    public <T> T foldMap(IgniteBiFunction<T, Double, T> foldFun, IgniteDoubleFunction<Double> mapFun, T zeroVal);
+
+    /**
+     * Combines & maps two vector and folds them into a single value.
+     *
+     * @param vec Another vector to combine with.
+     * @param foldFun Folding function.
+     * @param combFun Combine function.
+     * @param <T> Type of the folded value.
+     * @param zeroVal Zero value for fold operation.
+     * @return Folded value of these vectors.
+     * @throws CardinalityException Thrown when cardinalities mismatch.
+     */
+    public <T> T foldMap(Vector vec, IgniteBiFunction<T, Double, T> foldFun, IgniteBiFunction<Double, Double, Double> combFun,
+        T zeroVal);
+
+    /**
+     * Gets the sum of squares of all elements in this vector.
+     *
+     * @return Length squared value.
+     */
+    public double getLengthSquared();
+
+    /**
+     * Get the square of the distance between this vector and the argument vector.
+     *
+     * @param vec Another vector.
+     * @return Distance squared.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public double getDistanceSquared(Vector vec);
+
+    /**
+     * Auto-generated globally unique vector ID.
+     *
+     * @return Vector GUID.
+     */
+    public IgniteUuid guid();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/VectorKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/VectorKeyMapper.java b/modules/math/src/main/java/org/apache/ignite/math/VectorKeyMapper.java
new file mode 100644
index 0000000..17d76f5
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/VectorKeyMapper.java
@@ -0,0 +1,29 @@
+/*
+ * 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.math;
+
+/**
+ * Maps {@link Vector} element index to cache key.
+ */
+public interface VectorKeyMapper<K> extends KeyMapper<K> {
+    /**
+     * @param i Vector element index.
+     * @return Cache key for given element index.
+     */
+    public K apply(int i);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/VectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/VectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/VectorStorage.java
new file mode 100644
index 0000000..f410254
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/VectorStorage.java
@@ -0,0 +1,53 @@
+/*
+ * 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.math;
+
+import java.io.Externalizable;
+
+/**
+ * Data storage support for {@link Vector}.
+ */
+public interface VectorStorage extends Externalizable, StorageOpsMetrics, Destroyable {
+    /**
+     *
+     *
+     */
+    public int size();
+
+    /**
+     * @param i Vector element index.
+     * @return Value obtained for given element index.
+     */
+    public double get(int i);
+
+    /**
+     * @param i Vector element index.
+     * @param v Value to set at given index.
+     */
+    public void set(int i, double v);
+
+    /**
+     * Gets underlying array if {@link StorageOpsMetrics#isArrayBased()} returns {@code true}.
+     * Returns {@code null} if in other cases.
+     *
+     * @see StorageOpsMetrics#isArrayBased()
+     */
+    public default double[] data() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/CholeskyDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/CholeskyDecomposition.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/CholeskyDecomposition.java
new file mode 100644
index 0000000..9554737
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/CholeskyDecomposition.java
@@ -0,0 +1,306 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.NonPositiveDefiniteMatrixException;
+import org.apache.ignite.math.exceptions.NonSymmetricMatrixException;
+
+/**
+ * Calculates the Cholesky decomposition of a matrix.
+ *
+ * This class inspired by class from Apache Common Math with similar name.
+ *
+ * @see <a href="http://mathworld.wolfram.com/CholeskyDecomposition.html">MathWorld</a>
+ * @see <a href="http://en.wikipedia.org/wiki/Cholesky_decomposition">Wikipedia</a>
+ */
+public class CholeskyDecomposition extends DecompositionSupport {
+    /**
+     * Default threshold above which off-diagonal elements are considered too different
+     * and matrix not symmetric.
+     */
+    public static final double DFLT_REL_SYMMETRY_THRESHOLD = 1.0e-15;
+
+    /**
+     * Default threshold below which diagonal elements are considered null
+     * and matrix not positive definite.
+     */
+    public static final double DFLT_ABS_POSITIVITY_THRESHOLD = 1.0e-10;
+
+    /** Row-oriented storage for L<sup>T</sup> matrix data. */
+    private double[][] lTData;
+    /** Cached value of L. */
+    private Matrix cachedL;
+    /** Cached value of LT. */
+    private Matrix cachedLT;
+    /** Origin matrix */
+    private Matrix origin;
+
+    /**
+     * Calculates the Cholesky decomposition of the given matrix.
+     *
+     * Calling this constructor is equivalent to call {@link #CholeskyDecomposition(Matrix, double, double)} with the
+     * thresholds set to the default values {@link #DFLT_REL_SYMMETRY_THRESHOLD} and
+     * {@link #DFLT_ABS_POSITIVITY_THRESHOLD}.
+     *
+     * @param mtx the matrix to decompose.
+     * @throws CardinalityException if matrix is not square.
+     * @see #CholeskyDecomposition(Matrix, double, double)
+     * @see #DFLT_REL_SYMMETRY_THRESHOLD
+     * @see #DFLT_ABS_POSITIVITY_THRESHOLD
+     */
+    public CholeskyDecomposition(final Matrix mtx) {
+        this(mtx, DFLT_REL_SYMMETRY_THRESHOLD, DFLT_ABS_POSITIVITY_THRESHOLD);
+    }
+
+    /**
+     * Calculates the Cholesky decomposition of the given matrix.
+     *
+     * @param mtx the matrix to decompose.
+     * @param relSymmetryThreshold threshold above which off-diagonal elements are considered too different and matrix
+     * not symmetric
+     * @param absPositivityThreshold threshold below which diagonal elements are considered null and matrix not positive
+     * definite
+     * @see #CholeskyDecomposition(Matrix)
+     * @see #DFLT_REL_SYMMETRY_THRESHOLD
+     * @see #DFLT_ABS_POSITIVITY_THRESHOLD
+     */
+    public CholeskyDecomposition(final Matrix mtx, final double relSymmetryThreshold,
+        final double absPositivityThreshold) {
+        assert mtx != null;
+
+        if (mtx.columnSize() != mtx.rowSize())
+            throw new CardinalityException(mtx.rowSize(), mtx.columnSize());
+
+        origin = mtx;
+
+        final int order = mtx.rowSize();
+
+        lTData = toDoubleArr(mtx);
+        cachedL = null;
+        cachedLT = null;
+
+        // Check the matrix before transformation.
+        for (int i = 0; i < order; ++i) {
+            final double[] lI = lTData[i];
+
+            // Check off-diagonal elements (and reset them to 0).
+            for (int j = i + 1; j < order; ++j) {
+                final double[] lJ = lTData[j];
+
+                final double lIJ = lI[j];
+                final double lJI = lJ[i];
+
+                final double maxDelta = relSymmetryThreshold * Math.max(Math.abs(lIJ), Math.abs(lJI));
+
+                if (Math.abs(lIJ - lJI) > maxDelta)
+                    throw new NonSymmetricMatrixException(i, j, relSymmetryThreshold);
+
+                lJ[i] = 0;
+            }
+        }
+
+        // Transform the matrix.
+        for (int i = 0; i < order; ++i) {
+            final double[] ltI = lTData[i];
+
+            // Check diagonal element.
+            if (ltI[i] <= absPositivityThreshold)
+                throw new NonPositiveDefiniteMatrixException(ltI[i], i, absPositivityThreshold);
+
+            ltI[i] = Math.sqrt(ltI[i]);
+            final double inverse = 1.0 / ltI[i];
+
+            for (int q = order - 1; q > i; --q) {
+                ltI[q] *= inverse;
+                final double[] ltQ = lTData[q];
+
+                for (int p = q; p < order; ++p)
+                    ltQ[p] -= ltI[q] * ltI[p];
+            }
+        }
+    }
+
+    /** */
+    @Override public void destroy() {
+        if (cachedL != null)
+            cachedL.destroy();
+        if (cachedLT != null)
+            cachedLT.destroy();
+    }
+
+    /**
+     * Returns the matrix L of the decomposition.
+     * <p>L is an lower-triangular matrix</p>
+     *
+     * @return the L matrix
+     */
+    public Matrix getL() {
+        if (cachedL == null)
+            cachedL = getLT().transpose();
+
+        return cachedL;
+    }
+
+    /**
+     * Returns the transpose of the matrix L of the decomposition.
+     * <p>L<sup>T</sup> is an upper-triangular matrix</p>
+     *
+     * @return the transpose of the matrix L of the decomposition
+     */
+    public Matrix getLT() {
+
+        if (cachedLT == null) {
+            Matrix like = like(origin, origin.rowSize(), origin.columnSize());
+            like.assign(lTData);
+
+            cachedLT = like;
+        }
+
+        // return the cached matrix
+        return cachedLT;
+    }
+
+    /**
+     * Return the determinant of the matrix
+     *
+     * @return determinant of the matrix
+     */
+    public double getDeterminant() {
+        double determinant = 1.0;
+
+        for (int i = 0; i < lTData.length; ++i) {
+            double lTii = lTData[i][i];
+            determinant *= lTii * lTii;
+        }
+
+        return determinant;
+    }
+
+    /**
+     * Solve the linear equation A &times; X = B for matrices A.
+     *
+     * @param b right-hand side of the equation A &times; X = B
+     * @return a vector X that minimizes the two norm of A &times; X - B
+     * @throws CardinalityException if the vectors dimensions do not match
+     */
+    public Vector solve(final Vector b) {
+        final int m = lTData.length;
+
+        if (b.size() != m)
+            throw new CardinalityException(b.size(), m);
+
+        final double[] x = b.getStorage().data();
+
+        // Solve LY = b
+        for (int j = 0; j < m; j++) {
+            final double[] lJ = lTData[j];
+
+            x[j] /= lJ[j];
+
+            final double xJ = x[j];
+
+            for (int i = j + 1; i < m; i++)
+                x[i] -= xJ * lJ[i];
+        }
+
+        // Solve LTX = Y
+        for (int j = m - 1; j >= 0; j--) {
+            x[j] /= lTData[j][j];
+
+            final double xJ = x[j];
+
+            for (int i = 0; i < j; i++)
+                x[i] -= xJ * lTData[i][j];
+        }
+
+        return likeVector(origin, m).assign(x);
+    }
+
+    /**
+     * Solve the linear equation A &times; X = B for matrices A.
+     *
+     * @param b right-hand side of the equation A &times; X = B
+     * @return a matrix X that minimizes the two norm of A &times; X - B
+     * @throws CardinalityException if the matrices dimensions do not match
+     */
+    public Matrix solve(final Matrix b) {
+        final int m = lTData.length;
+
+        if (b.rowSize() != m)
+            throw new CardinalityException(b.rowSize(), m);
+
+        final int nColB = b.columnSize();
+        final double[][] x = b.getStorage().data();
+
+        // Solve LY = b
+        for (int j = 0; j < m; j++) {
+            final double[] lJ = lTData[j];
+            final double lJJ = lJ[j];
+            final double[] xJ = x[j];
+
+            for (int k = 0; k < nColB; ++k)
+                xJ[k] /= lJJ;
+
+            for (int i = j + 1; i < m; i++) {
+                final double[] xI = x[i];
+                final double lJI = lJ[i];
+
+                for (int k = 0; k < nColB; ++k)
+                    xI[k] -= xJ[k] * lJI;
+            }
+        }
+
+        // Solve LTX = Y
+        for (int j = m - 1; j >= 0; j--) {
+            final double lJJ = lTData[j][j];
+            final double[] xJ = x[j];
+
+            for (int k = 0; k < nColB; ++k)
+                xJ[k] /= lJJ;
+
+            for (int i = 0; i < j; i++) {
+                final double[] xI = x[i];
+                final double lIJ = lTData[i][j];
+
+                for (int k = 0; k < nColB; ++k)
+                    xI[k] -= xJ[k] * lIJ;
+            }
+        }
+
+        return like(origin, m, b.columnSize()).assign(x);
+    }
+
+    /** */
+    private double[][] toDoubleArr(Matrix mtx) {
+        if (mtx.isArrayBased())
+            return mtx.getStorage().data();
+
+        double[][] res = new double[mtx.rowSize()][];
+
+        for (int row = 0; row < mtx.rowSize(); row++) {
+            res[row] = new double[mtx.columnSize()];
+            for (int col = 0; col < mtx.columnSize(); col++)
+                res[row][col] = mtx.get(row, col);
+        }
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/DecompositionSupport.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/DecompositionSupport.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/DecompositionSupport.java
new file mode 100644
index 0000000..2c76284
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/DecompositionSupport.java
@@ -0,0 +1,105 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Destroyable;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.CacheMatrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.matrix.PivotedMatrixView;
+import org.apache.ignite.math.impls.matrix.RandomMatrix;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+
+/**
+ * Helper methods to support decomposition of matrix types having some functionality limited.
+ */
+public abstract class DecompositionSupport implements Destroyable {
+    /**
+     * Create the like matrix with read-only matrices support.
+     *
+     * @param matrix Matrix for like.
+     * @return Like matrix.
+     */
+    protected Matrix like(Matrix matrix) {
+        if (isCopyLikeSupport(matrix))
+            return new DenseLocalOnHeapMatrix(matrix.rowSize(), matrix.columnSize());
+        else
+            return matrix.like(matrix.rowSize(), matrix.columnSize());
+    }
+
+    /**
+     * Create the like matrix with specified size with read-only matrices support.
+     *
+     * @param matrix Matrix for like.
+     * @return Like matrix.
+     */
+    protected Matrix like(Matrix matrix, int rows, int cols) {
+        if (isCopyLikeSupport(matrix))
+            return new DenseLocalOnHeapMatrix(rows, cols);
+        else
+            return matrix.like(rows, cols);
+    }
+
+    /**
+     * Create the like vector with read-only matrices support.
+     *
+     * @param matrix Matrix for like.
+     * @param crd Cardinality of the vector.
+     * @return Like vector.
+     */
+    protected Vector likeVector(Matrix matrix, int crd) {
+        if (isCopyLikeSupport(matrix))
+            return new DenseLocalOnHeapVector(crd);
+        else
+            return matrix.likeVector(crd);
+    }
+
+    /**
+     * Create the like vector with read-only matrices support.
+     *
+     * @param matrix Matrix for like.
+     * @return Like vector.
+     */
+    protected Vector likeVector(Matrix matrix) {
+        return likeVector(matrix, matrix.rowSize());
+    }
+
+    /**
+     * Create the copy of matrix with read-only matrices support.
+     *
+     * @param matrix Matrix for copy.
+     * @return Copy.
+     */
+    protected Matrix copy(Matrix matrix) {
+        if (isCopyLikeSupport(matrix)) {
+            DenseLocalOnHeapMatrix cp = new DenseLocalOnHeapMatrix(matrix.rowSize(), matrix.columnSize());
+
+            cp.assign(matrix);
+
+            return cp;
+        }
+        else
+            return matrix.copy();
+    }
+
+    /** */
+    private boolean isCopyLikeSupport(Matrix matrix) {
+        return matrix instanceof RandomMatrix || matrix instanceof PivotedMatrixView || matrix instanceof CacheMatrix;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/EigenDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/EigenDecomposition.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/EigenDecomposition.java
new file mode 100644
index 0000000..66fe13c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/EigenDecomposition.java
@@ -0,0 +1,923 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.functions.Functions;
+
+/**
+ * This class provides EigenDecomposition of given matrix. The class is based on
+ * class with similar name from <a href="http://mahout.apache.org/">Apache Mahout</a> library.
+ *
+ * @see <a href=http://mathworld.wolfram.com/EigenDecomposition.html>MathWorld</a>
+ */
+public class EigenDecomposition extends DecompositionSupport {
+    /** Row and column dimension (square matrix). */
+    private final int n;
+
+    /** Array for internal storage of eigen vectors. */
+    private final Matrix v;
+
+    /** Array for internal storage of eigenvalues. */
+    private final Vector d;
+    /** Array for internal storage of eigenvalues. */
+    private final Vector e;
+
+    /** */
+    public EigenDecomposition(Matrix matrix) {
+        this(matrix, isSymmetric(matrix));
+    }
+
+    /** */
+    public EigenDecomposition(Matrix matrix, boolean isSymmetric) {
+        n = matrix.columnSize();
+
+        d = likeVector(matrix);
+        e = likeVector(matrix);
+        v = like(matrix);
+
+        if (isSymmetric) {
+            v.assign(matrix);
+
+            // Tridiagonalize.
+            tred2();
+
+            // Diagonalize.
+            tql2();
+
+        }
+        else
+            // Reduce to Hessenberg form.
+            // Reduce Hessenberg to real Schur form.
+            hqr2(orthes(matrix));
+    }
+
+    /**
+     * Return the eigen vector matrix
+     *
+     * @return V
+     */
+    public Matrix getV() {
+        return like(v).assign(v);
+    }
+
+    /**
+     * Return the real parts of the eigenvalues
+     */
+    public Vector getRealEigenValues() {
+        return d;
+    }
+
+    /**
+     * Return the imaginary parts of the eigenvalues
+     */
+    public Vector getImagEigenvalues() {
+        return e;
+    }
+
+    /**
+     * Return the block diagonal eigenvalue matrix
+     *
+     * @return D
+     */
+    public Matrix getD() {
+        Matrix res = like(v, d.size(), d.size());
+        res.assign(0);
+        res.viewDiagonal().assign(d);
+        for (int i = 0; i < n; i++) {
+            double v = e.getX(i);
+            if (v > 0)
+                res.setX(i, i + 1, v);
+            else if (v < 0)
+                res.setX(i, i - 1, v);
+        }
+        return res;
+    }
+
+    /**
+     * Destroys decomposition components and other internal components of decomposition.
+     */
+    @Override public void destroy() {
+        e.destroy();
+        v.destroy();
+        d.destroy();
+    }
+
+    /** */
+    private void tred2() {
+        //  This is derived from the Algol procedures tred2 by
+        //  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
+        //  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
+        //  Fortran subroutine in EISPACK.
+
+        d.assign(v.viewColumn(n - 1));
+
+        // Householder reduction to tridiagonal form.
+
+        for (int i = n - 1; i > 0; i--) {
+
+            // Scale to avoid under/overflow.
+            double scale = d.viewPart(0, i).kNorm(1);
+            double h = 0.0;
+
+            if (scale == 0.0) {
+                e.setX(i, d.getX(i - 1));
+                for (int j = 0; j < i; j++) {
+                    d.setX(j, v.getX(i - 1, j));
+                    v.setX(i, j, 0.0);
+                    v.setX(j, i, 0.0);
+                }
+            }
+            else {
+
+                // Generate Householder vector.
+
+                for (int k = 0; k < i; k++) {
+                    d.setX(k, d.getX(k) / scale);
+                    h += d.getX(k) * d.getX(k);
+                }
+
+                double f = d.getX(i - 1);
+                double g = Math.sqrt(h);
+
+                if (f > 0)
+                    g = -g;
+
+                e.setX(i, scale * g);
+                h -= f * g;
+                d.setX(i - 1, f - g);
+
+                for (int j = 0; j < i; j++)
+                    e.setX(j, 0.0);
+
+                // Apply similarity transformation to remaining columns.
+
+                for (int j = 0; j < i; j++) {
+                    f = d.getX(j);
+                    v.setX(j, i, f);
+                    g = e.getX(j) + v.getX(j, j) * f;
+
+                    for (int k = j + 1; k <= i - 1; k++) {
+                        g += v.getX(k, j) * d.getX(k);
+                        e.setX(k, e.getX(k) + v.getX(k, j) * f);
+                    }
+
+                    e.setX(j, g);
+                }
+
+                f = 0.0;
+
+                for (int j = 0; j < i; j++) {
+                    e.setX(j, e.getX(j) / h);
+                    f += e.getX(j) * d.getX(j);
+                }
+
+                double hh = f / (h + h);
+
+                for (int j = 0; j < i; j++)
+                    e.setX(j, e.getX(j) - hh * d.getX(j));
+
+                for (int j = 0; j < i; j++) {
+                    f = d.getX(j);
+                    g = e.getX(j);
+
+                    for (int k = j; k <= i - 1; k++)
+                        v.setX(k, j, v.getX(k, j) - (f * e.getX(k) + g * d.getX(k)));
+
+                    d.setX(j, v.getX(i - 1, j));
+                    v.setX(i, j, 0.0);
+                }
+            }
+
+            d.setX(i, h);
+        }
+    }
+
+    /** */
+    private Matrix orthes(Matrix matrix) {
+        // Working storage for nonsymmetric algorithm.
+        Vector ort = likeVector(matrix);
+        Matrix hessenBerg = like(matrix).assign(matrix);
+
+        //  This is derived from the Algol procedures orthes and ortran,
+        //  by Martin and Wilkinson, Handbook for Auto. Comp.,
+        //  Vol.ii-Linear Algebra, and the corresponding
+        //  Fortran subroutines in EISPACK.
+
+        int low = 0;
+        int high = n - 1;
+
+        for (int m = low + 1; m <= high - 1; m++) {
+
+            // Scale column.
+
+            Vector hCol = hessenBerg.viewColumn(m - 1).viewPart(m, high - m + 1);
+            double scale = hCol.kNorm(1);
+
+            if (scale != 0.0) {
+                // Compute Householder transformation.
+                ort.viewPart(m, high - m + 1).map(hCol, Functions.plusMult(1 / scale));
+                double h = ort.viewPart(m, high - m + 1).getLengthSquared();
+
+                double g = Math.sqrt(h);
+
+                if (ort.getX(m) > 0)
+                    g = -g;
+
+                h -= ort.getX(m) * g;
+                ort.setX(m, ort.getX(m) - g);
+
+                // Apply Householder similarity transformation
+                // H = (I-u*u'/h)*H*(I-u*u')/h)
+
+                Vector ortPiece = ort.viewPart(m, high - m + 1);
+
+                for (int j = m; j < n; j++) {
+                    double f = ortPiece.dot(hessenBerg.viewColumn(j).viewPart(m, high - m + 1)) / h;
+                    hessenBerg.viewColumn(j).viewPart(m, high - m + 1).map(ortPiece, Functions.plusMult(-f));
+                }
+
+                for (int i = 0; i <= high; i++) {
+                    double f = ortPiece.dot(hessenBerg.viewRow(i).viewPart(m, high - m + 1)) / h;
+                    hessenBerg.viewRow(i).viewPart(m, high - m + 1).map(ortPiece, Functions.plusMult(-f));
+                }
+
+                ort.setX(m, scale * ort.getX(m));
+                hessenBerg.setX(m, m - 1, scale * g);
+            }
+        }
+
+        // Accumulate transformations (Algol's ortran).
+
+        v.assign(0);
+        v.viewDiagonal().assign(1);
+
+        for (int m = high - 1; m >= low + 1; m--) {
+            if (hessenBerg.getX(m, m - 1) != 0.0) {
+                ort.viewPart(m + 1, high - m).assign(hessenBerg.viewColumn(m - 1).viewPart(m + 1, high - m));
+
+                for (int j = m; j <= high; j++) {
+                    double g = ort.viewPart(m, high - m + 1).dot(v.viewColumn(j).viewPart(m, high - m + 1));
+
+                    // Double division avoids possible underflow
+                    g = g / ort.getX(m) / hessenBerg.getX(m, m - 1);
+                    v.viewColumn(j).viewPart(m, high - m + 1).map(ort.viewPart(m, high - m + 1), Functions.plusMult(g));
+                }
+            }
+        }
+
+        return hessenBerg;
+    }
+
+    /** Symmetric tridiagonal QL algorithm. */
+    private void tql2() {
+        //  This is derived from the Algol procedures tql2, by
+        //  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
+        //  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
+        //  Fortran subroutine in EISPACK.
+
+        e.viewPart(0, n - 1).assign(e.viewPart(1, n - 1));
+        e.setX(n - 1, 0.0);
+
+        double f = 0.0;
+        double tst1 = 0.0;
+        double eps = Math.pow(2.0, -52.0);
+
+        for (int l = 0; l < n; l++) {
+            // Find small subdiagonal element.
+
+            tst1 = Math.max(tst1, Math.abs(d.getX(l)) + Math.abs(e.getX(l)));
+            int m = l;
+
+            while (m < n) {
+                if (Math.abs(e.getX(m)) <= eps * tst1)
+                    break;
+
+                m++;
+            }
+
+            // If m == l, d.getX(l) is an eigenvalue,
+            // otherwise, iterate.
+
+            if (m > l) {
+                do {
+                    // Compute implicit shift
+
+                    double g = d.getX(l);
+                    double p = (d.getX(l + 1) - g) / (2.0 * e.getX(l));
+                    double r = Math.hypot(p, 1.0);
+
+                    if (p < 0)
+                        r = -r;
+
+                    d.setX(l, e.getX(l) / (p + r));
+                    d.setX(l + 1, e.getX(l) * (p + r));
+                    double dl1 = d.getX(l + 1);
+                    double h = g - d.getX(l);
+
+                    for (int i = l + 2; i < n; i++)
+                        d.setX(i, d.getX(i) - h);
+
+                    f += h;
+
+                    // Implicit QL transformation.
+
+                    p = d.getX(m);
+                    double c = 1.0;
+                    double c2 = c;
+                    double c3 = c;
+                    double el1 = e.getX(l + 1);
+                    double s = 0.0;
+                    double s2 = 0.0;
+
+                    for (int i = m - 1; i >= l; i--) {
+                        c3 = c2;
+                        c2 = c;
+                        s2 = s;
+                        g = c * e.getX(i);
+                        h = c * p;
+                        r = Math.hypot(p, e.getX(i));
+                        e.setX(i + 1, s * r);
+                        s = e.getX(i) / r;
+                        c = p / r;
+                        p = c * d.getX(i) - s * g;
+                        d.setX(i + 1, h + s * (c * g + s * d.getX(i)));
+
+                        // Accumulate transformation.
+
+                        for (int k = 0; k < n; k++) {
+                            h = v.getX(k, i + 1);
+                            v.setX(k, i + 1, s * v.getX(k, i) + c * h);
+                            v.setX(k, i, c * v.getX(k, i) - s * h);
+                        }
+                    }
+
+                    p = -s * s2 * c3 * el1 * e.getX(l) / dl1;
+                    e.setX(l, s * p);
+                    d.setX(l, c * p);
+
+                    // Check for convergence.
+
+                }
+                while (Math.abs(e.getX(l)) > eps * tst1);
+            }
+
+            d.setX(l, d.getX(l) + f);
+            e.setX(l, 0.0);
+        }
+
+        // Sort eigenvalues and corresponding vectors.
+
+        for (int i = 0; i < n - 1; i++) {
+            int k = i;
+            double p = d.getX(i);
+
+            for (int j = i + 1; j < n; j++)
+                if (d.getX(j) > p) {
+                    k = j;
+                    p = d.getX(j);
+                }
+
+            if (k != i) {
+                d.setX(k, d.getX(i));
+                d.setX(i, p);
+
+                for (int j = 0; j < n; j++) {
+                    p = v.getX(j, i);
+                    v.setX(j, i, v.getX(j, k));
+                    v.setX(j, k, p);
+                }
+            }
+        }
+    }
+
+    /** */
+    private void hqr2(Matrix h) {
+        //  This is derived from the Algol procedure hqr2,
+        //  by Martin and Wilkinson, Handbook for Auto. Comp.,
+        //  Vol.ii-Linear Algebra, and the corresponding
+        //  Fortran subroutine in EISPACK.
+
+        // Initialize
+
+        int nn = this.n;
+        int n = nn - 1;
+        int low = 0;
+        int high = nn - 1;
+        double eps = Math.pow(2.0, -52.0);
+        double exshift = 0.0;
+        double p = 0;
+        double q = 0;
+        double r = 0;
+        double s = 0;
+        double z = 0;
+        double w;
+        double x;
+        double y;
+
+        // Store roots isolated by balanc and compute matrix norm
+
+        double norm = h.foldMap(Functions.PLUS, Functions.ABS, 0.0);
+
+        // Outer loop over eigenvalue index
+
+        int iter = 0;
+        while (n >= low) {
+            // Look for single small sub-diagonal element
+            int l = n;
+
+            while (l > low) {
+                s = Math.abs(h.getX(l - 1, l - 1)) + Math.abs(h.getX(l, l));
+
+                if (s == 0.0)
+                    s = norm;
+
+                if (Math.abs(h.getX(l, l - 1)) < eps * s)
+                    break;
+
+                l--;
+            }
+
+            // Check for convergence
+
+            if (l == n) {
+                // One root found
+                h.setX(n, n, h.getX(n, n) + exshift);
+                d.setX(n, h.getX(n, n));
+                e.setX(n, 0.0);
+                n--;
+                iter = 0;
+            }
+            else if (l == n - 1) {
+                // Two roots found
+                w = h.getX(n, n - 1) * h.getX(n - 1, n);
+                p = (h.getX(n - 1, n - 1) - h.getX(n, n)) / 2.0;
+                q = p * p + w;
+                z = Math.sqrt(Math.abs(q));
+                h.setX(n, n, h.getX(n, n) + exshift);
+                h.setX(n - 1, n - 1, h.getX(n - 1, n - 1) + exshift);
+                x = h.getX(n, n);
+
+                // Real pair
+                if (q >= 0) {
+                    if (p >= 0)
+                        z = p + z;
+                    else
+                        z = p - z;
+
+                    d.setX(n - 1, x + z);
+                    d.setX(n, d.getX(n - 1));
+
+                    if (z != 0.0)
+                        d.setX(n, x - w / z);
+
+                    e.setX(n - 1, 0.0);
+                    e.setX(n, 0.0);
+                    x = h.getX(n, n - 1);
+                    s = Math.abs(x) + Math.abs(z);
+                    p = x / s;
+                    q = z / s;
+                    r = Math.sqrt(p * p + q * q);
+                    p /= r;
+                    q /= r;
+
+                    // Row modification
+
+                    for (int j = n - 1; j < nn; j++) {
+                        z = h.getX(n - 1, j);
+                        h.setX(n - 1, j, q * z + p * h.getX(n, j));
+                        h.setX(n, j, q * h.getX(n, j) - p * z);
+                    }
+
+                    // Column modification
+
+                    for (int i = 0; i <= n; i++) {
+                        z = h.getX(i, n - 1);
+                        h.setX(i, n - 1, q * z + p * h.getX(i, n));
+                        h.setX(i, n, q * h.getX(i, n) - p * z);
+                    }
+
+                    // Accumulate transformations
+
+                    for (int i = low; i <= high; i++) {
+                        z = v.getX(i, n - 1);
+                        v.setX(i, n - 1, q * z + p * v.getX(i, n));
+                        v.setX(i, n, q * v.getX(i, n) - p * z);
+                    }
+
+                    // Complex pair
+
+                }
+                else {
+                    d.setX(n - 1, x + p);
+                    d.setX(n, x + p);
+                    e.setX(n - 1, z);
+                    e.setX(n, -z);
+                }
+
+                n -= 2;
+                iter = 0;
+
+                // No convergence yet
+
+            }
+            else {
+                // Form shift
+                x = h.getX(n, n);
+                y = 0.0;
+                w = 0.0;
+
+                if (l < n) {
+                    y = h.getX(n - 1, n - 1);
+                    w = h.getX(n, n - 1) * h.getX(n - 1, n);
+                }
+
+                // Wilkinson's original ad hoc shift
+
+                if (iter == 10) {
+                    exshift += x;
+
+                    for (int i = low; i <= n; i++)
+                        h.setX(i, i, x);
+
+                    s = Math.abs(h.getX(n, n - 1)) + Math.abs(h.getX(n - 1, n - 2));
+                    x = y = 0.75 * s;
+                    w = -0.4375 * s * s;
+                }
+
+                // MATLAB's new ad hoc shift
+
+                if (iter == 30) {
+                    s = (y - x) / 2.0;
+                    s = s * s + w;
+
+                    if (s > 0) {
+                        s = Math.sqrt(s);
+
+                        if (y < x)
+                            s = -s;
+
+                        s = x - w / ((y - x) / 2.0 + s);
+
+                        for (int i = low; i <= n; i++)
+                            h.setX(i, i, h.getX(i, i) - s);
+
+                        exshift += s;
+                        x = y = w = 0.964;
+                    }
+                }
+
+                iter++;   // (Could check iteration count here.)
+
+                // Look for two consecutive small sub-diagonal elements
+
+                int m = n - 2;
+
+                while (m >= l) {
+                    z = h.getX(m, m);
+                    r = x - z;
+                    s = y - z;
+                    p = (r * s - w) / h.getX(m + 1, m) + h.getX(m, m + 1);
+                    q = h.getX(m + 1, m + 1) - z - r - s;
+                    r = h.getX(m + 2, m + 1);
+                    s = Math.abs(p) + Math.abs(q) + Math.abs(r);
+                    p /= s;
+                    q /= s;
+                    r /= s;
+
+                    if (m == l)
+                        break;
+
+                    double hmag = Math.abs(h.getX(m - 1, m - 1)) + Math.abs(h.getX(m + 1, m + 1));
+                    double threshold = eps * Math.abs(p) * (Math.abs(z) + hmag);
+
+                    if (Math.abs(h.getX(m, m - 1)) * (Math.abs(q) + Math.abs(r)) < threshold)
+                        break;
+
+                    m--;
+                }
+
+                for (int i = m + 2; i <= n; i++) {
+                    h.setX(i, i - 2, 0.0);
+
+                    if (i > m + 2)
+                        h.setX(i, i - 3, 0.0);
+                }
+
+                // Double QR step involving rows l:n and columns m:n
+
+                for (int k = m; k <= n - 1; k++) {
+                    boolean notlast = k != n - 1;
+
+                    if (k != m) {
+                        p = h.getX(k, k - 1);
+                        q = h.getX(k + 1, k - 1);
+                        r = notlast ? h.getX(k + 2, k - 1) : 0.0;
+                        x = Math.abs(p) + Math.abs(q) + Math.abs(r);
+                        if (x != 0.0) {
+                            p /= x;
+                            q /= x;
+                            r /= x;
+                        }
+                    }
+
+                    if (x == 0.0)
+                        break;
+
+                    s = Math.sqrt(p * p + q * q + r * r);
+
+                    if (p < 0)
+                        s = -s;
+
+                    if (s != 0) {
+                        if (k != m)
+                            h.setX(k, k - 1, -s * x);
+                        else if (l != m)
+                            h.setX(k, k - 1, -h.getX(k, k - 1));
+
+                        p += s;
+                        x = p / s;
+                        y = q / s;
+                        z = r / s;
+                        q /= p;
+                        r /= p;
+
+                        // Row modification
+
+                        for (int j = k; j < nn; j++) {
+                            p = h.getX(k, j) + q * h.getX(k + 1, j);
+
+                            if (notlast) {
+                                p += r * h.getX(k + 2, j);
+                                h.setX(k + 2, j, h.getX(k + 2, j) - p * z);
+                            }
+
+                            h.setX(k, j, h.getX(k, j) - p * x);
+                            h.setX(k + 1, j, h.getX(k + 1, j) - p * y);
+                        }
+
+                        // Column modification
+
+                        for (int i = 0; i <= Math.min(n, k + 3); i++) {
+                            p = x * h.getX(i, k) + y * h.getX(i, k + 1);
+
+                            if (notlast) {
+                                p += z * h.getX(i, k + 2);
+                                h.setX(i, k + 2, h.getX(i, k + 2) - p * r);
+                            }
+
+                            h.setX(i, k, h.getX(i, k) - p);
+                            h.setX(i, k + 1, h.getX(i, k + 1) - p * q);
+                        }
+
+                        // Accumulate transformations
+
+                        for (int i = low; i <= high; i++) {
+                            p = x * v.getX(i, k) + y * v.getX(i, k + 1);
+
+                            if (notlast) {
+                                p += z * v.getX(i, k + 2);
+                                v.setX(i, k + 2, v.getX(i, k + 2) - p * r);
+                            }
+
+                            v.setX(i, k, v.getX(i, k) - p);
+                            v.setX(i, k + 1, v.getX(i, k + 1) - p * q);
+                        }
+                    }  // (s != 0)
+                }  // k loop
+            }  // check convergence
+        }  // while (n >= low)
+
+        // Back substitute to find vectors of upper triangular form
+
+        if (norm == 0.0)
+            return;
+
+        for (n = nn - 1; n >= 0; n--) {
+            p = d.getX(n);
+            q = e.getX(n);
+
+            // Real vector
+
+            double t;
+
+            if (q == 0) {
+                int l = n;
+                h.setX(n, n, 1.0);
+
+                for (int i = n - 1; i >= 0; i--) {
+                    w = h.getX(i, i) - p;
+                    r = 0.0;
+
+                    for (int j = l; j <= n; j++)
+                        r += h.getX(i, j) * h.getX(j, n);
+
+                    if (e.getX(i) < 0.0) {
+                        z = w;
+                        s = r;
+                    }
+                    else {
+                        l = i;
+
+                        if (e.getX(i) == 0.0) {
+                            if (w == 0.0)
+                                h.setX(i, n, -r / (eps * norm));
+                            else
+                                h.setX(i, n, -r / w);
+
+                            // Solve real equations
+
+                        }
+                        else {
+                            x = h.getX(i, i + 1);
+                            y = h.getX(i + 1, i);
+                            q = (d.getX(i) - p) * (d.getX(i) - p) + e.getX(i) * e.getX(i);
+                            t = (x * s - z * r) / q;
+                            h.setX(i, n, t);
+
+                            if (Math.abs(x) > Math.abs(z))
+                                h.setX(i + 1, n, (-r - w * t) / x);
+                            else
+                                h.setX(i + 1, n, (-s - y * t) / z);
+                        }
+
+                        // Overflow control
+
+                        t = Math.abs(h.getX(i, n));
+
+                        if (eps * t * t > 1) {
+                            for (int j = i; j <= n; j++)
+                                h.setX(j, n, h.getX(j, n) / t);
+                        }
+                    }
+                }
+
+                // Complex vector
+
+            }
+            else if (q < 0) {
+                int l = n - 1;
+
+                // Last vector component imaginary so matrix is triangular
+
+                if (Math.abs(h.getX(n, n - 1)) > Math.abs(h.getX(n - 1, n))) {
+                    h.setX(n - 1, n - 1, q / h.getX(n, n - 1));
+                    h.setX(n - 1, n, -(h.getX(n, n) - p) / h.getX(n, n - 1));
+                }
+                else {
+                    cdiv(0.0, -h.getX(n - 1, n), h.getX(n - 1, n - 1) - p, q);
+                    h.setX(n - 1, n - 1, cdivr);
+                    h.setX(n - 1, n, cdivi);
+                }
+
+                h.setX(n, n - 1, 0.0);
+                h.setX(n, n, 1.0);
+
+                for (int i = n - 2; i >= 0; i--) {
+                    double ra = 0.0;
+                    double sa = 0.0;
+
+                    for (int j = l; j <= n; j++) {
+                        ra += h.getX(i, j) * h.getX(j, n - 1);
+                        sa += h.getX(i, j) * h.getX(j, n);
+                    }
+
+                    w = h.getX(i, i) - p;
+
+                    if (e.getX(i) < 0.0) {
+                        z = w;
+                        r = ra;
+                        s = sa;
+                    }
+                    else {
+                        l = i;
+
+                        if (e.getX(i) == 0) {
+                            cdiv(-ra, -sa, w, q);
+                            h.setX(i, n - 1, cdivr);
+                            h.setX(i, n, cdivi);
+                        }
+                        else {
+
+                            // Solve complex equations
+
+                            x = h.getX(i, i + 1);
+                            y = h.getX(i + 1, i);
+
+                            double vr = (d.getX(i) - p) * (d.getX(i) - p) + e.getX(i) * e.getX(i) - q * q;
+                            double vi = (d.getX(i) - p) * 2.0 * q;
+
+                            if (vr == 0.0 && vi == 0.0) {
+                                double hmag = Math.abs(x) + Math.abs(y);
+                                vr = eps * norm * (Math.abs(w) + Math.abs(q) + hmag + Math.abs(z));
+                            }
+
+                            cdiv(x * r - z * ra + q * sa, x * s - z * sa - q * ra, vr, vi);
+
+                            h.setX(i, n - 1, cdivr);
+                            h.setX(i, n, cdivi);
+
+                            if (Math.abs(x) > (Math.abs(z) + Math.abs(q))) {
+                                h.setX(i + 1, n - 1, (-ra - w * h.getX(i, n - 1) + q * h.getX(i, n)) / x);
+                                h.setX(i + 1, n, (-sa - w * h.getX(i, n) - q * h.getX(i, n - 1)) / x);
+                            }
+                            else {
+                                cdiv(-r - y * h.getX(i, n - 1), -s - y * h.getX(i, n), z, q);
+
+                                h.setX(i + 1, n - 1, cdivr);
+                                h.setX(i + 1, n, cdivi);
+                            }
+                        }
+
+                        // Overflow control
+
+                        t = Math.max(Math.abs(h.getX(i, n - 1)), Math.abs(h.getX(i, n)));
+
+                        if (eps * t * t > 1)
+                            for (int j = i; j <= n; j++) {
+                                h.setX(j, n - 1, h.getX(j, n - 1) / t);
+                                h.setX(j, n, h.getX(j, n) / t);
+                            }
+                    }
+                }
+            }
+        }
+
+        // Vectors of isolated roots
+
+        for (int i = 0; i < nn; i++)
+            if (i < low || i > high) {
+                for (int j = i; j < nn; j++)
+                    v.setX(i, j, h.getX(i, j));
+            }
+
+        // Back transformation to get eigen vectors of original matrix
+
+        for (int j = nn - 1; j >= low; j--)
+            for (int i = low; i <= high; i++) {
+                z = 0.0;
+
+                for (int k = low; k <= Math.min(j, high); k++)
+                    z += v.getX(i, k) * h.getX(k, j);
+
+                v.setX(i, j, z);
+            }
+    }
+
+    /** */
+    private static boolean isSymmetric(Matrix matrix) {
+        int cols = matrix.columnSize();
+        int rows = matrix.rowSize();
+
+        if (cols != rows)
+            return false;
+
+        for (int i = 0; i < cols; i++)
+            for (int j = 0; j < rows; j++) {
+                if (matrix.getX(i, j) != matrix.get(j, i))
+                    return false;
+            }
+
+        return true;
+    }
+
+    /** Complex scalar division - real part. */
+    private double cdivr;
+    /** Complex scalar division - imaginary part. */
+    private double cdivi;
+
+    /** */
+    private void cdiv(double xr, double xi, double yr, double yi) {
+        double r;
+        double d;
+
+        if (Math.abs(yr) > Math.abs(yi)) {
+            r = yi / yr;
+            d = yr + r * yi;
+            cdivr = (xr + r * xi) / d;
+            cdivi = (xi - r * xr) / d;
+        }
+        else {
+            r = yr / yi;
+            d = yi + r * yr;
+            cdivr = (r * xr + xi) / d;
+            cdivi = (r * xi - xr) / d;
+        }
+    }
+}


[19/50] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-1561-1
Commit: ecadf6a0da77efaf33a7fb7924ea02c385be1e90
Parents: af55d72 9b61a76
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 17:09:13 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 17:09:13 2017 +0300

----------------------------------------------------------------------
 .../examples/ScalarCacheAffinityExample.scala   |   2 +-
 .../ignite/ignite-cassandra-server-template.xml |   6 -
 .../tests/ignite-cassandra-client-template.xml  |   6 -
 .../JettyRestProcessorAbstractSelfTest.java     |  12 +-
 .../ignite/cache/PartitionLossPolicy.java       |  16 +-
 .../org/apache/ignite/cache/QueryIndexType.java |  17 +-
 .../apache/ignite/internal/LessNamingBean.java  |  28 --
 .../cache/query/GridCacheSqlIndexMetadata.java  |   3 +-
 .../cache/query/GridCacheSqlMetadata.java       |   3 +-
 .../internal/util/IgniteExceptionRegistry.java  |   3 +-
 .../internal/visor/VisorDataTransferObject.java |  87 ++++++
 .../visor/VisorDataTransferObjectInput.java     | 156 ++++++++++
 .../visor/VisorDataTransferObjectOutput.java    | 141 +++++++++
 .../ignite/internal/visor/VisorEither.java      | 103 +++++++
 .../internal/visor/VisorMultiNodeTask.java      |   6 +-
 .../ignite/internal/visor/VisorOneNodeTask.java |   5 +-
 .../internal/visor/VisorTaskArgument.java       |  51 +++-
 .../visor/binary/VisorBinaryMetadata.java       | 139 +++++++++
 .../VisorBinaryMetadataCollectorTask.java       |  70 +++++
 .../VisorBinaryMetadataCollectorTaskResult.java |  87 ++++++
 .../visor/binary/VisorBinaryMetadataField.java  | 101 +++++++
 .../ignite/internal/visor/cache/VisorCache.java | 124 +++++---
 .../cache/VisorCacheAffinityConfiguration.java  |  91 ++++--
 .../visor/cache/VisorCacheAffinityNodeTask.java |  13 +-
 .../cache/VisorCacheAffinityNodeTaskArg.java    |  86 ++++++
 .../cache/VisorCacheAggregatedMetrics.java      | 205 ++++++++-----
 .../visor/cache/VisorCacheClearTask.java        | 100 ++-----
 .../visor/cache/VisorCacheClearTaskResult.java  |  85 ++++++
 .../visor/cache/VisorCacheConfiguration.java    | 283 +++++++++++++-----
 .../VisorCacheConfigurationCollectorJob.java    |   4 +-
 .../cache/VisorCacheDefaultConfiguration.java   |  58 ----
 .../cache/VisorCacheEvictionConfiguration.java  |  52 +++-
 .../visor/cache/VisorCacheJdbcType.java         | 189 ++++++++++++
 .../visor/cache/VisorCacheJdbcTypeField.java    | 117 ++++++++
 .../visor/cache/VisorCacheLoadTask.java         |  20 +-
 .../visor/cache/VisorCacheLoadTaskArg.java      | 101 +++++++
 .../visor/cache/VisorCacheMetadataTask.java     |  18 +-
 .../internal/visor/cache/VisorCacheMetrics.java | 208 +++++++++----
 .../cache/VisorCacheMetricsCollectorTask.java   |  29 +-
 .../VisorCacheMetricsCollectorTaskArg.java      |  87 ++++++
 .../cache/VisorCacheNearConfiguration.java      |  59 ++--
 .../visor/cache/VisorCachePartition.java        |  57 ++--
 .../visor/cache/VisorCachePartitions.java       |  43 ++-
 .../visor/cache/VisorCachePartitionsTask.java   |   7 +-
 .../cache/VisorCacheQueryConfiguration.java     | 122 --------
 .../cache/VisorCacheQueryDetailMetrics.java     | 167 -----------
 ...sorCacheQueryDetailMetricsCollectorTask.java | 146 ---------
 .../visor/cache/VisorCacheQueryMetrics.java     | 102 -------
 .../cache/VisorCacheRebalanceConfiguration.java |  71 +++--
 .../VisorCacheResetQueryDetailMetricsTask.java  |  71 -----
 .../cache/VisorCacheResetQueryMetricsTask.java  |  69 -----
 .../visor/cache/VisorCacheSqlIndexMetadata.java | 115 ++++++++
 .../visor/cache/VisorCacheSqlMetadata.java      | 162 ++++++++++
 .../visor/cache/VisorCacheStartArg.java         | 100 +++++++
 .../visor/cache/VisorCacheStartTask.java        |  60 +---
 .../cache/VisorCacheStoreConfiguration.java     |  77 +++--
 .../cache/VisorCacheTypeFieldMetadata.java      |  92 ------
 .../visor/cache/VisorCacheTypeMetadata.java     | 294 -------------------
 .../internal/visor/cache/VisorPartitionMap.java |  90 ++++++
 .../compute/VisorComputeMonitoringHolder.java   |   8 +-
 .../VisorComputeToggleMonitoringTask.java       |  52 ++--
 .../VisorComputeToggleMonitoringTaskArg.java    |  86 ++++++
 .../visor/compute/VisorGatewayTask.java         |   4 +-
 .../visor/debug/VisorThreadDumpTask.java        |  13 +-
 .../visor/debug/VisorThreadDumpTaskResult.java  |  88 ++++++
 .../internal/visor/debug/VisorThreadInfo.java   | 234 ++++++++-------
 .../visor/debug/VisorThreadLockInfo.java        |  51 +++-
 .../visor/debug/VisorThreadMonitorInfo.java     |  76 +++--
 .../visor/event/VisorGridDeploymentEvent.java   |  43 ++-
 .../visor/event/VisorGridDiscoveryEvent.java    |  59 +++-
 .../internal/visor/event/VisorGridEvent.java    |  66 +++--
 .../visor/event/VisorGridEventsLost.java        |  15 +-
 .../internal/visor/event/VisorGridJobEvent.java |  61 +++-
 .../visor/event/VisorGridTaskEvent.java         |  61 +++-
 .../internal/visor/file/VisorFileBlock.java     |  60 +++-
 .../internal/visor/file/VisorFileBlockArg.java  | 114 +++++++
 .../internal/visor/file/VisorFileBlockTask.java |  64 +---
 .../visor/file/VisorLatestTextFilesTask.java    |  17 +-
 .../visor/file/VisorLatestTextFilesTaskArg.java |  86 ++++++
 .../ignite/internal/visor/igfs/VisorIgfs.java   |  76 +++--
 .../internal/visor/igfs/VisorIgfsEndpoint.java  |  72 +++--
 .../internal/visor/igfs/VisorIgfsMetrics.java   | 118 +++++---
 .../internal/visor/igfs/VisorIgfsProfiler.java  |  24 +-
 .../visor/igfs/VisorIgfsProfilerClearTask.java  |  11 +-
 .../igfs/VisorIgfsProfilerClearTaskResult.java  |  85 ++++++
 .../visor/igfs/VisorIgfsProfilerEntry.java      | 106 +++++--
 .../visor/igfs/VisorIgfsProfilerTask.java       |  31 +-
 .../VisorIgfsProfilerUniformityCounters.java    |  38 ++-
 .../visor/igfs/VisorIgfsSamplingStateTask.java  |  17 +-
 .../igfs/VisorIgfsSamplingStateTaskArg.java     |  86 ++++++
 .../ignite/internal/visor/log/VisorLogFile.java |  43 ++-
 .../internal/visor/log/VisorLogSearchArg.java   | 114 +++++++
 .../visor/log/VisorLogSearchResult.java         |  80 +++--
 .../internal/visor/log/VisorLogSearchTask.java  |  74 +----
 .../visor/log/VisorLogSearchTaskResult.java     |  92 ++++++
 .../visor/node/VisorAtomicConfiguration.java    |  49 +++-
 .../visor/node/VisorBasicConfiguration.java     | 163 ++++++----
 .../node/VisorExecutorServiceConfiguration.java |  81 +++--
 .../visor/node/VisorGridConfiguration.java      | 126 +++++---
 .../visor/node/VisorIgfsConfiguration.java      | 203 ++++++++-----
 .../visor/node/VisorLifecycleConfiguration.java |  39 ++-
 .../visor/node/VisorMemoryConfiguration.java    |  60 ++--
 .../node/VisorMemoryPolicyConfiguration.java    |  37 ++-
 .../visor/node/VisorMetricsConfiguration.java   |  50 +++-
 .../VisorNodeConfigurationCollectorJob.java     |   4 +-
 .../visor/node/VisorNodeDataCollectorJob.java   |  63 ++--
 .../node/VisorNodeDataCollectorJobResult.java   | 109 +++++--
 .../visor/node/VisorNodeDataCollectorTask.java  |  40 +--
 .../node/VisorNodeDataCollectorTaskArg.java     |  54 +++-
 .../node/VisorNodeDataCollectorTaskResult.java  | 110 +++++--
 .../node/VisorNodeEventsCollectorTask.java      | 133 +--------
 .../node/VisorNodeEventsCollectorTaskArg.java   | 163 ++++++++++
 .../internal/visor/node/VisorNodeGcTask.java    |  18 +-
 .../visor/node/VisorNodeGcTaskResult.java       |  85 ++++++
 .../internal/visor/node/VisorNodePingTask.java  |  15 +-
 .../visor/node/VisorNodePingTaskResult.java     |  99 +++++++
 .../visor/node/VisorNodeSuppressedErrors.java   |  89 ++++++
 .../node/VisorNodeSuppressedErrorsTask.java     |  23 +-
 .../node/VisorPeerToPeerConfiguration.java      |  57 ++--
 .../visor/node/VisorRestConfiguration.java      |  93 +++---
 .../node/VisorSegmentationConfiguration.java    |  67 +++--
 .../visor/node/VisorSpiDescription.java         |  89 ++++++
 .../visor/node/VisorSpisConfiguration.java      | 128 ++++----
 .../visor/node/VisorSuppressedError.java        | 147 ++++++++++
 .../node/VisorTransactionConfiguration.java     | 104 +++++--
 .../visor/query/VisorCancelQueriesTask.java     |  72 -----
 .../query/VisorCollectRunningQueriesTask.java   |  96 ------
 .../internal/visor/query/VisorQueryArg.java     |  65 +++-
 .../visor/query/VisorQueryCancelTask.java       |  72 +++++
 .../visor/query/VisorQueryCleanupTask.java      |   6 +-
 .../visor/query/VisorQueryConfiguration.java    | 142 +++++++++
 .../visor/query/VisorQueryDetailMetrics.java    | 205 +++++++++++++
 .../VisorQueryDetailMetricsCollectorTask.java   | 146 +++++++++
 .../internal/visor/query/VisorQueryEntity.java  | 188 ++++++++++++
 .../internal/visor/query/VisorQueryField.java   |  42 ++-
 .../internal/visor/query/VisorQueryIndex.java   | 105 +++++++
 .../visor/query/VisorQueryIndexField.java       | 106 +++++++
 .../internal/visor/query/VisorQueryJob.java     | 275 -----------------
 .../internal/visor/query/VisorQueryMetrics.java | 125 ++++++++
 .../visor/query/VisorQueryNextPageTask.java     |  33 ++-
 .../visor/query/VisorQueryNextPageTaskArg.java  |  86 ++++++
 .../query/VisorQueryResetDetailMetricsTask.java |  71 +++++
 .../visor/query/VisorQueryResetMetricsTask.java |  69 +++++
 .../internal/visor/query/VisorQueryResult.java  |  97 +++++-
 .../visor/query/VisorQueryResultEx.java         |  89 ------
 .../visor/query/VisorQueryScanRegexFilter.java  |  59 ++++
 .../query/VisorQueryScanSubstringFilter.java    |  64 ----
 .../internal/visor/query/VisorQueryTask.java    | 120 +++++++-
 .../internal/visor/query/VisorQueryUtils.java   |  43 ++-
 .../query/VisorRunningQueriesCollectorTask.java |  96 ++++++
 .../internal/visor/query/VisorRunningQuery.java |  47 ++-
 .../internal/visor/query/VisorScanQueryArg.java | 157 ++++++++++
 .../visor/query/VisorScanQueryTask.java         | 185 ++++++++++++
 .../visor/service/VisorServiceDescriptor.java   |  31 +-
 .../internal/visor/util/VisorTaskUtils.java     |  38 ++-
 .../plugin/security/SecurityPermissionSet.java  |   3 +-
 .../ignite/plugin/security/SecuritySubject.java |   3 +-
 .../plugin/segmentation/SegmentationPolicy.java |  18 +-
 .../resources/META-INF/classnames.properties    | 236 +++++++--------
 .../resources/META-INF/classnames.properties    |   8 -
 .../http/jetty/GridJettyObjectMapper.java       | 119 ++------
 .../commands/cache/VisorCacheClearCommand.scala |   2 +-
 .../commands/cache/VisorCacheCommand.scala      | 291 +++++++++---------
 .../commands/cache/VisorCacheScanCommand.scala  |  16 +-
 .../config/VisorConfigurationCommand.scala      | 183 ++++++------
 .../commands/disco/VisorDiscoveryCommand.scala  |  22 +-
 .../commands/events/VisorEventsCommand.scala    |  30 +-
 .../visor/commands/gc/VisorGcCommand.scala      |   4 +-
 .../commands/tasks/VisorTasksCommand.scala      |  61 ++--
 .../scala/org/apache/ignite/visor/visor.scala   |  34 +--
 modules/web-console/backend/app/agent.js        |  98 +++----
 modules/web-console/backend/app/browser.js      |  76 +++--
 modules/web-console/backend/app/mongo.js        |  21 +-
 .../frontend/app/modules/agent/agent.module.js  |  41 ++-
 .../generator/AbstractTransformer.js            |   5 -
 .../generator/ConfigurationGenerator.js         |  44 +--
 .../generator/JavaTransformer.service.js        |   3 +
 .../generator/PlatformGenerator.js              |  10 +-
 .../defaults/Cache.platform.service.js          |   5 -
 .../generator/defaults/Cache.service.js         |  10 +-
 .../generator/defaults/Cluster.service.js       |   1 -
 .../generator/defaults/IGFS.service.js          |   2 +-
 .../frontend/app/modules/sql/sql.controller.js  |  56 ++--
 .../states/configuration/caches/affinity.pug    |   2 +-
 .../states/configuration/caches/general.pug     |  25 ++
 .../states/configuration/caches/memory.pug      |  64 +---
 .../states/configuration/caches/query.pug       |   3 +
 .../states/configuration/clusters/events.pug    |   6 +-
 .../configuration/clusters/marshaller.pug       |   6 -
 .../states/configuration/clusters/swap.pug      |  72 -----
 .../modules/states/configuration/igfs/misc.pug  |   2 +-
 .../frontend/controllers/caches-controller.js   |  29 --
 .../frontend/controllers/clusters-controller.js |  38 ---
 .../views/configuration/clusters.tpl.pug        |   1 -
 .../ignite/console/demo/AgentClusterDemo.java   |   2 +
 .../src/main/resources/log4j.properties         |   1 -
 196 files changed, 9599 insertions(+), 4623 deletions(-)
----------------------------------------------------------------------



[43/50] [abbrv] ignite git commit: IGNITE-4988 Fixed tests.

Posted by sb...@apache.org.
IGNITE-4988 Fixed tests.


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

Branch: refs/heads/ignite-1561-1
Commit: 51ea6c2d9fc40085232bb0b68b7f6be53b6eec3e
Parents: 0a7e824
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sat Apr 15 10:08:18 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sat Apr 15 10:08:18 2017 +0700

----------------------------------------------------------------------
 .../ignite/internal/visor/igfs/VisorIgfsProfilerTask.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/51ea6c2d/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
index be48a1d..956458c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
@@ -139,6 +139,11 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, List<VisorIg
             }
         };
 
+    /** {@inheritDoc} */
+    @Override protected VisorIgfsProfilerJob job(String arg) {
+        return new VisorIgfsProfilerJob(arg, debug);
+    }
+
     /**
      * Job that do actual profiler work.
      */
@@ -535,9 +540,4 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, List<VisorIg
             return S.toString(VisorIgfsProfilerJob.class, this);
         }
     }
-
-    /** {@inheritDoc} */
-    @Override protected VisorIgfsProfilerJob job(String arg) {
-        return new VisorIgfsProfilerJob(arg, debug);
-    }
 }


[16/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0


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

Branch: refs/heads/ignite-1561-1
Commit: 12dfe9e8767020d9e9083f887717e5e63120880f
Parents: 8b56a43
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Apr 14 20:55:10 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 14 20:55:12 2017 +0700

----------------------------------------------------------------------
 .../examples/ScalarCacheAffinityExample.scala   |   2 +-
 .../ignite/ignite-cassandra-server-template.xml |   6 -
 .../tests/ignite-cassandra-client-template.xml  |   6 -
 .../JettyRestProcessorAbstractSelfTest.java     |  12 +-
 .../ignite/cache/PartitionLossPolicy.java       |  16 +-
 .../org/apache/ignite/cache/QueryIndexType.java |  17 +-
 .../apache/ignite/internal/LessNamingBean.java  |  28 --
 .../cache/query/GridCacheSqlIndexMetadata.java  |   3 +-
 .../cache/query/GridCacheSqlMetadata.java       |   3 +-
 .../internal/util/IgniteExceptionRegistry.java  |   3 +-
 .../internal/visor/VisorDataTransferObject.java |  87 ++++++
 .../visor/VisorDataTransferObjectInput.java     | 156 ++++++++++
 .../visor/VisorDataTransferObjectOutput.java    | 141 +++++++++
 .../ignite/internal/visor/VisorEither.java      | 103 +++++++
 .../internal/visor/VisorMultiNodeTask.java      |   6 +-
 .../ignite/internal/visor/VisorOneNodeTask.java |   5 +-
 .../internal/visor/VisorTaskArgument.java       |  51 +++-
 .../visor/binary/VisorBinaryMetadata.java       | 139 +++++++++
 .../VisorBinaryMetadataCollectorTask.java       |  70 +++++
 .../VisorBinaryMetadataCollectorTaskResult.java |  87 ++++++
 .../visor/binary/VisorBinaryMetadataField.java  | 101 +++++++
 .../ignite/internal/visor/cache/VisorCache.java | 124 +++++---
 .../cache/VisorCacheAffinityConfiguration.java  |  91 ++++--
 .../visor/cache/VisorCacheAffinityNodeTask.java |  13 +-
 .../cache/VisorCacheAffinityNodeTaskArg.java    |  86 ++++++
 .../cache/VisorCacheAggregatedMetrics.java      | 205 ++++++++-----
 .../visor/cache/VisorCacheClearTask.java        | 100 ++-----
 .../visor/cache/VisorCacheClearTaskResult.java  |  85 ++++++
 .../visor/cache/VisorCacheConfiguration.java    | 283 +++++++++++++-----
 .../VisorCacheConfigurationCollectorJob.java    |   4 +-
 .../cache/VisorCacheDefaultConfiguration.java   |  58 ----
 .../cache/VisorCacheEvictionConfiguration.java  |  52 +++-
 .../visor/cache/VisorCacheJdbcType.java         | 189 ++++++++++++
 .../visor/cache/VisorCacheJdbcTypeField.java    | 117 ++++++++
 .../visor/cache/VisorCacheLoadTask.java         |  20 +-
 .../visor/cache/VisorCacheLoadTaskArg.java      | 101 +++++++
 .../visor/cache/VisorCacheMetadataTask.java     |  18 +-
 .../internal/visor/cache/VisorCacheMetrics.java | 208 +++++++++----
 .../cache/VisorCacheMetricsCollectorTask.java   |  29 +-
 .../VisorCacheMetricsCollectorTaskArg.java      |  87 ++++++
 .../cache/VisorCacheNearConfiguration.java      |  59 ++--
 .../visor/cache/VisorCachePartition.java        |  57 ++--
 .../visor/cache/VisorCachePartitions.java       |  43 ++-
 .../visor/cache/VisorCachePartitionsTask.java   |   7 +-
 .../cache/VisorCacheQueryConfiguration.java     | 122 --------
 .../cache/VisorCacheQueryDetailMetrics.java     | 167 -----------
 ...sorCacheQueryDetailMetricsCollectorTask.java | 146 ---------
 .../visor/cache/VisorCacheQueryMetrics.java     | 102 -------
 .../cache/VisorCacheRebalanceConfiguration.java |  71 +++--
 .../VisorCacheResetQueryDetailMetricsTask.java  |  71 -----
 .../cache/VisorCacheResetQueryMetricsTask.java  |  69 -----
 .../visor/cache/VisorCacheSqlIndexMetadata.java | 115 ++++++++
 .../visor/cache/VisorCacheSqlMetadata.java      | 162 ++++++++++
 .../visor/cache/VisorCacheStartArg.java         | 100 +++++++
 .../visor/cache/VisorCacheStartTask.java        |  60 +---
 .../cache/VisorCacheStoreConfiguration.java     |  77 +++--
 .../cache/VisorCacheTypeFieldMetadata.java      |  92 ------
 .../visor/cache/VisorCacheTypeMetadata.java     | 294 -------------------
 .../internal/visor/cache/VisorPartitionMap.java |  90 ++++++
 .../compute/VisorComputeMonitoringHolder.java   |   8 +-
 .../VisorComputeToggleMonitoringTask.java       |  52 ++--
 .../VisorComputeToggleMonitoringTaskArg.java    |  86 ++++++
 .../visor/compute/VisorGatewayTask.java         |   4 +-
 .../visor/debug/VisorThreadDumpTask.java        |  13 +-
 .../visor/debug/VisorThreadDumpTaskResult.java  |  88 ++++++
 .../internal/visor/debug/VisorThreadInfo.java   | 234 ++++++++-------
 .../visor/debug/VisorThreadLockInfo.java        |  51 +++-
 .../visor/debug/VisorThreadMonitorInfo.java     |  76 +++--
 .../visor/event/VisorGridDeploymentEvent.java   |  43 ++-
 .../visor/event/VisorGridDiscoveryEvent.java    |  59 +++-
 .../internal/visor/event/VisorGridEvent.java    |  66 +++--
 .../visor/event/VisorGridEventsLost.java        |  15 +-
 .../internal/visor/event/VisorGridJobEvent.java |  61 +++-
 .../visor/event/VisorGridTaskEvent.java         |  61 +++-
 .../internal/visor/file/VisorFileBlock.java     |  60 +++-
 .../internal/visor/file/VisorFileBlockArg.java  | 114 +++++++
 .../internal/visor/file/VisorFileBlockTask.java |  64 +---
 .../visor/file/VisorLatestTextFilesTask.java    |  17 +-
 .../visor/file/VisorLatestTextFilesTaskArg.java |  86 ++++++
 .../ignite/internal/visor/igfs/VisorIgfs.java   |  76 +++--
 .../internal/visor/igfs/VisorIgfsEndpoint.java  |  72 +++--
 .../internal/visor/igfs/VisorIgfsMetrics.java   | 118 +++++---
 .../internal/visor/igfs/VisorIgfsProfiler.java  |  24 +-
 .../visor/igfs/VisorIgfsProfilerClearTask.java  |  11 +-
 .../igfs/VisorIgfsProfilerClearTaskResult.java  |  85 ++++++
 .../visor/igfs/VisorIgfsProfilerEntry.java      | 106 +++++--
 .../visor/igfs/VisorIgfsProfilerTask.java       |  31 +-
 .../VisorIgfsProfilerUniformityCounters.java    |  38 ++-
 .../visor/igfs/VisorIgfsSamplingStateTask.java  |  17 +-
 .../igfs/VisorIgfsSamplingStateTaskArg.java     |  86 ++++++
 .../ignite/internal/visor/log/VisorLogFile.java |  43 ++-
 .../internal/visor/log/VisorLogSearchArg.java   | 114 +++++++
 .../visor/log/VisorLogSearchResult.java         |  80 +++--
 .../internal/visor/log/VisorLogSearchTask.java  |  74 +----
 .../visor/log/VisorLogSearchTaskResult.java     |  92 ++++++
 .../visor/node/VisorAtomicConfiguration.java    |  49 +++-
 .../visor/node/VisorBasicConfiguration.java     | 163 ++++++----
 .../node/VisorExecutorServiceConfiguration.java |  81 +++--
 .../visor/node/VisorGridConfiguration.java      | 126 +++++---
 .../visor/node/VisorIgfsConfiguration.java      | 203 ++++++++-----
 .../visor/node/VisorLifecycleConfiguration.java |  39 ++-
 .../visor/node/VisorMemoryConfiguration.java    |  60 ++--
 .../node/VisorMemoryPolicyConfiguration.java    |  37 ++-
 .../visor/node/VisorMetricsConfiguration.java   |  50 +++-
 .../VisorNodeConfigurationCollectorJob.java     |   4 +-
 .../visor/node/VisorNodeDataCollectorJob.java   |  63 ++--
 .../node/VisorNodeDataCollectorJobResult.java   | 109 +++++--
 .../visor/node/VisorNodeDataCollectorTask.java  |  40 +--
 .../node/VisorNodeDataCollectorTaskArg.java     |  54 +++-
 .../node/VisorNodeDataCollectorTaskResult.java  | 110 +++++--
 .../node/VisorNodeEventsCollectorTask.java      | 133 +--------
 .../node/VisorNodeEventsCollectorTaskArg.java   | 163 ++++++++++
 .../internal/visor/node/VisorNodeGcTask.java    |  18 +-
 .../visor/node/VisorNodeGcTaskResult.java       |  85 ++++++
 .../internal/visor/node/VisorNodePingTask.java  |  15 +-
 .../visor/node/VisorNodePingTaskResult.java     |  99 +++++++
 .../visor/node/VisorNodeSuppressedErrors.java   |  89 ++++++
 .../node/VisorNodeSuppressedErrorsTask.java     |  23 +-
 .../node/VisorPeerToPeerConfiguration.java      |  57 ++--
 .../visor/node/VisorRestConfiguration.java      |  93 +++---
 .../node/VisorSegmentationConfiguration.java    |  67 +++--
 .../visor/node/VisorSpiDescription.java         |  89 ++++++
 .../visor/node/VisorSpisConfiguration.java      | 128 ++++----
 .../visor/node/VisorSuppressedError.java        | 147 ++++++++++
 .../node/VisorTransactionConfiguration.java     | 104 +++++--
 .../internal/visor/query/VisorQueryArg.java     |  65 +++-
 .../visor/query/VisorQueryCancelTask.java       |  72 +++++
 .../visor/query/VisorQueryCleanupTask.java      |   6 +-
 .../visor/query/VisorQueryConfiguration.java    | 142 +++++++++
 .../visor/query/VisorQueryDetailMetrics.java    | 205 +++++++++++++
 .../VisorQueryDetailMetricsCollectorTask.java   | 146 +++++++++
 .../internal/visor/query/VisorQueryEntity.java  | 188 ++++++++++++
 .../internal/visor/query/VisorQueryField.java   |  42 ++-
 .../internal/visor/query/VisorQueryIndex.java   | 105 +++++++
 .../visor/query/VisorQueryIndexField.java       | 106 +++++++
 .../internal/visor/query/VisorQueryJob.java     | 275 -----------------
 .../internal/visor/query/VisorQueryMetrics.java | 125 ++++++++
 .../visor/query/VisorQueryNextPageTask.java     |  33 ++-
 .../visor/query/VisorQueryNextPageTaskArg.java  |  86 ++++++
 .../query/VisorQueryResetDetailMetricsTask.java |  71 +++++
 .../visor/query/VisorQueryResetMetricsTask.java |  69 +++++
 .../internal/visor/query/VisorQueryResult.java  |  97 +++++-
 .../visor/query/VisorQueryResultEx.java         |  89 ------
 .../visor/query/VisorQueryScanRegexFilter.java  |  59 ++++
 .../internal/visor/query/VisorQueryTask.java    | 120 +++++++-
 .../internal/visor/query/VisorQueryUtils.java   |  43 ++-
 .../query/VisorRunningQueriesCollectorTask.java |  96 ++++++
 .../internal/visor/query/VisorRunningQuery.java |  47 ++-
 .../internal/visor/query/VisorScanQueryArg.java | 157 ++++++++++
 .../visor/query/VisorScanQueryTask.java         | 185 ++++++++++++
 .../visor/service/VisorServiceDescriptor.java   |  31 +-
 .../internal/visor/util/VisorTaskUtils.java     |  38 ++-
 .../plugin/security/SecurityPermissionSet.java  |   3 +-
 .../ignite/plugin/security/SecuritySubject.java |   3 +-
 .../plugin/segmentation/SegmentationPolicy.java |  18 +-
 .../resources/META-INF/classnames.properties    | 236 +++++++--------
 .../resources/META-INF/classnames.properties    |   8 -
 .../http/jetty/GridJettyObjectMapper.java       | 119 ++------
 .../commands/cache/VisorCacheClearCommand.scala |   2 +-
 .../commands/cache/VisorCacheCommand.scala      | 291 +++++++++---------
 .../commands/cache/VisorCacheScanCommand.scala  |  16 +-
 .../config/VisorConfigurationCommand.scala      | 183 ++++++------
 .../commands/disco/VisorDiscoveryCommand.scala  |  22 +-
 .../commands/events/VisorEventsCommand.scala    |  30 +-
 .../visor/commands/gc/VisorGcCommand.scala      |   4 +-
 .../commands/tasks/VisorTasksCommand.scala      |  61 ++--
 .../scala/org/apache/ignite/visor/visor.scala   |  34 +--
 modules/web-console/backend/app/agent.js        |  98 +++----
 modules/web-console/backend/app/browser.js      |  76 +++--
 modules/web-console/backend/app/mongo.js        |  21 +-
 .../frontend/app/modules/agent/agent.module.js  |  41 ++-
 .../generator/AbstractTransformer.js            |   5 -
 .../generator/ConfigurationGenerator.js         |  44 +--
 .../generator/JavaTransformer.service.js        |   3 +
 .../generator/PlatformGenerator.js              |  10 +-
 .../defaults/Cache.platform.service.js          |   5 -
 .../generator/defaults/Cache.service.js         |  10 +-
 .../generator/defaults/Cluster.service.js       |   1 -
 .../generator/defaults/IGFS.service.js          |   2 +-
 .../frontend/app/modules/sql/sql.controller.js  |  56 ++--
 .../states/configuration/caches/affinity.pug    |   2 +-
 .../states/configuration/caches/general.pug     |  25 ++
 .../states/configuration/caches/memory.pug      |  64 +---
 .../states/configuration/caches/query.pug       |   3 +
 .../states/configuration/clusters/events.pug    |   6 +-
 .../configuration/clusters/marshaller.pug       |   6 -
 .../states/configuration/clusters/swap.pug      |  72 -----
 .../modules/states/configuration/igfs/misc.pug  |   2 +-
 .../frontend/controllers/caches-controller.js   |  29 --
 .../frontend/controllers/clusters-controller.js |  38 ---
 .../views/configuration/clusters.tpl.pug        |   1 -
 .../ignite/console/demo/AgentClusterDemo.java   |   2 +
 .../src/main/resources/log4j.properties         |   1 -
 193 files changed, 9599 insertions(+), 4391 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
index 40b947d..fc06fbb 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
@@ -88,7 +88,7 @@ object ScalarCacheAffinityExample extends App {
         val keys = (0 until KEY_CNT).toSeq
 
         // Map all keys to nodes.
-        val mappings = ignite$.cluster().mapKeysToNodes(NAME, keys)
+        val mappings = ignite$.affinity(NAME).mapKeysToNodes(keys)
 
         mappings.foreach(mapping => {
             val node = mapping._1

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml b/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
index 03b3346..01000d2 100644
--- a/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
+++ b/modules/cassandra/store/src/test/bootstrap/aws/ignite/ignite-cassandra-server-template.xml
@@ -118,8 +118,6 @@
                     <property name="startSize" value="1000000"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="backups" value="0"/>
-                    <property name="offHeapMaxMemory" value="0"/>
-                    <property name="swapEnabled" value="false"/>
                     <property name="readThrough" value="true"/>
                     <property name="writeThrough" value="true"/>
                     <property name="writeBehindEnabled" value="true"/>
@@ -137,8 +135,6 @@
                     <property name="startSize" value="1000000"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="backups" value="0"/>
-                    <property name="offHeapMaxMemory" value="0"/>
-                    <property name="swapEnabled" value="false"/>
                     <property name="readThrough" value="true"/>
                     <property name="writeThrough" value="true"/>
                     <property name="writeBehindEnabled" value="true"/>
@@ -156,8 +152,6 @@
                     <property name="startSize" value="1000000"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="backups" value="0"/>
-                    <property name="offHeapMaxMemory" value="0"/>
-                    <property name="swapEnabled" value="false"/>
                     <property name="readThrough" value="true"/>
                     <property name="writeThrough" value="true"/>
                     <property name="writeBehindEnabled" value="true"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml b/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
index 77ffb9e..c5a9c9a 100644
--- a/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
+++ b/modules/cassandra/store/src/test/bootstrap/aws/tests/ignite-cassandra-client-template.xml
@@ -121,8 +121,6 @@
                     <property name="startSize" value="1000000"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="backups" value="0"/>
-                    <property name="offHeapMaxMemory" value="0"/>
-                    <property name="swapEnabled" value="false"/>
                     <property name="readThrough" value="true"/>
                     <property name="writeThrough" value="true"/>
                     <property name="writeBehindEnabled" value="true"/>
@@ -140,8 +138,6 @@
                     <property name="startSize" value="1000000"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="backups" value="0"/>
-                    <property name="offHeapMaxMemory" value="0"/>
-                    <property name="swapEnabled" value="false"/>
                     <property name="readThrough" value="true"/>
                     <property name="writeThrough" value="true"/>
                     <property name="writeBehindEnabled" value="true"/>
@@ -159,8 +155,6 @@
                     <property name="startSize" value="1000000"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="backups" value="0"/>
-                    <property name="offHeapMaxMemory" value="0"/>
-                    <property name="swapEnabled" value="false"/>
                     <property name="readThrough" value="true"/>
                     <property name="writeThrough" value="true"/>
                     <property name="writeBehindEnabled" value="true"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index a71737f..e2dddd1 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -70,6 +70,7 @@ import org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask;
 import org.apache.ignite.internal.visor.cache.VisorCacheNodesTask;
 import org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask;
 import org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask;
+import org.apache.ignite.internal.visor.cache.VisorCacheStartArg;
 import org.apache.ignite.internal.visor.cache.VisorCacheStartTask;
 import org.apache.ignite.internal.visor.cache.VisorCacheStopTask;
 import org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask;
@@ -77,6 +78,7 @@ import org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask;
 import org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask;
 import org.apache.ignite.internal.visor.compute.VisorGatewayTask;
 import org.apache.ignite.internal.visor.debug.VisorThreadDumpTask;
+import org.apache.ignite.internal.visor.file.VisorFileBlockArg;
 import org.apache.ignite.internal.visor.file.VisorFileBlockTask;
 import org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask;
 import org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask;
@@ -84,6 +86,7 @@ import org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask;
 import org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask;
 import org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask;
 import org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask;
+import org.apache.ignite.internal.visor.log.VisorLogSearchArg;
 import org.apache.ignite.internal.visor.log.VisorLogSearchTask;
 import org.apache.ignite.internal.visor.misc.VisorAckTask;
 import org.apache.ignite.internal.visor.misc.VisorLatestVersionTask;
@@ -92,6 +95,7 @@ import org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask
 import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTask;
 import org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskArg;
 import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask;
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg;
 import org.apache.ignite.internal.visor.node.VisorNodeGcTask;
 import org.apache.ignite.internal.visor.node.VisorNodePingTask;
 import org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask;
@@ -1373,7 +1377,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         ret = content(new VisorGatewayArgument(VisorFileBlockTask.class)
             .forNode(locNode)
-            .argument(VisorFileBlockTask.VisorFileBlockArg.class, "", 0L, 1, 0L));
+            .argument(VisorFileBlockArg.class, "", 0L, 1, 0L));
 
         info("VisorFileBlockTask result: " + ret);
 
@@ -1456,7 +1460,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorLogSearchTask.class)
-            .argument(VisorLogSearchTask.VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
+            .argument(VisorLogSearchArg.class, ".", ".", "abrakodabra.txt", 1));
 
         info("VisorLogSearchTask result: " + ret);
 
@@ -1476,7 +1480,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         jsonTaskResult(ret);
 
         ret = content(new VisorGatewayArgument(VisorNodeEventsCollectorTask.class)
-            .argument(VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg.class,
+            .argument(VisorNodeEventsCollectorTaskArg.class,
                 "null", "null", "null", "taskName", "null"));
 
         info("VisorNodeEventsCollectorTask result: " + ret);
@@ -1526,7 +1530,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
                     "</beans>";
 
         ret = content(new VisorGatewayArgument(VisorCacheStartTask.class)
-            .argument(VisorCacheStartTask.VisorCacheStartArg.class, false, "person2",
+            .argument(VisorCacheStartArg.class, false, "person2",
                 URLEncoder.encode(START_CACHE, CHARSET)));
 
         info("VisorCacheStartTask result: " + ret);

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
index 1391e70..16608a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/PartitionLossPolicy.java
@@ -19,6 +19,7 @@ package org.apache.ignite.cache;
 
 import java.util.Collection;
 import org.apache.ignite.Ignite;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Partition loss policy. Defines how cache will behave in a case when one or more partitions are lost
@@ -62,5 +63,18 @@ public enum PartitionLossPolicy {
      * a previously lost and not cleared partition is undefined and may be different on different nodes in the
      * cluster.
      */
-    IGNORE
+    IGNORE;
+
+    /** Enumerated values. */
+    private static final PartitionLossPolicy[] VALS = values();
+
+    /**
+     * Efficiently gets enumerated value from its ordinal.
+     *
+     * @param ord Ordinal value.
+     * @return Enumerated value or {@code null} if ordinal out of range.
+     */
+    @Nullable public static PartitionLossPolicy fromOrdinal(byte ord) {
+        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
index f9b544d..9d2851d 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndexType.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.cache;
 
+import org.jetbrains.annotations.Nullable;
+
 /**
  * Index type.
  */
@@ -34,5 +36,18 @@ public enum QueryIndexType {
     /**
      * Geo-spatial index.
      */
-    GEOSPATIAL
+    GEOSPATIAL;
+
+    /** Enum values. */
+    private static final QueryIndexType[] VALS = values();
+
+    /**
+     * Efficiently gets enumerated value from its ordinal.
+     *
+     * @param ord Ordinal value.
+     * @return Enumerated value.
+     */
+    @Nullable public static QueryIndexType fromOrdinal(int ord) {
+        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java b/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
deleted file mode 100644
index 3b885f9..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/LessNamingBean.java
+++ /dev/null
@@ -1,28 +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.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-
-/**
- * Marker interface for beans with less naming conventions i.e., without "get" and "set" prefixes.
- */
-@GridToStringExclude
-public interface LessNamingBean {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
index 94602f7..539a156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.query;
 
 import java.io.Externalizable;
 import java.util.Collection;
-import org.apache.ignite.internal.LessNamingBean;
 
 /**
  * Ignite index descriptor.
@@ -28,7 +27,7 @@ import org.apache.ignite.internal.LessNamingBean;
  * {@link GridCacheSqlMetadata#indexes(String)} method.
  * @see GridCacheSqlMetadata
  */
-public interface GridCacheSqlIndexMetadata extends Externalizable, LessNamingBean {
+public interface GridCacheSqlIndexMetadata extends Externalizable {
     /**
      * Gets name of the index.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
index c82d2cb..724962e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.query;
 import java.io.Externalizable;
 import java.util.Collection;
 import java.util.Map;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.spi.indexing.IndexingSpi;
 import org.jetbrains.annotations.Nullable;
 
@@ -31,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
  * can be used to gather information about what can
  * be queried using Ignite cache queries feature.
  */
-public interface GridCacheSqlMetadata extends Externalizable, LessNamingBean {
+public interface GridCacheSqlMetadata extends Externalizable {
     /**
      * Cache name.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index b7bb07e..03eaaea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -157,7 +156,7 @@ public class IgniteExceptionRegistry {
      * Detailed info about suppressed error.
      */
     @SuppressWarnings("PublicInnerClass")
-    public static class ExceptionInfo implements Serializable, LessNamingBean {
+    public static class ExceptionInfo implements Serializable {
         /** */
         private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
new file mode 100644
index 0000000..d8dcf4e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObject.java
@@ -0,0 +1,87 @@
+/*
+ * 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.internal.visor;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Base class for data transfer objects.
+ */
+public abstract class VisorDataTransferObject implements Externalizable {
+    /**
+     * @param col Source collection.
+     * @param <T> Collection type.
+     * @return List based on passed collection.
+     */
+    @Nullable protected static <T> List<T> toList(Collection<T> col) {
+        if (col != null)
+            return new ArrayList<>(col);
+
+        return null;
+    }
+
+    /**
+     * @return Transfer object version.
+     */
+    public byte getProtocolVersion() {
+        return 1;
+    }
+
+    /**
+     * Save object's specific data content.
+     *
+     * @param out Output object to write data content.
+     * @throws IOException If I/O errors occur.
+     */
+    protected abstract void writeExternalData(ObjectOutput out) throws IOException;
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeByte(getProtocolVersion());
+
+        try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+            writeExternalData(dtout);
+        }
+    }
+
+    /**
+     * Load object's specific data content.
+     *
+     * @param protoVer Input object version.
+     * @param in Input object to load data content.
+     * @throws IOException If I/O errors occur.
+     * @throws ClassNotFoundException If the class for an object being restored cannot be found.
+     */
+    protected abstract void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException;
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        byte ver = in.readByte();
+
+        try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+            readExternalData(ver, dtin);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java
new file mode 100644
index 0000000..16e9330
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectInput.java
@@ -0,0 +1,156 @@
+/*
+ * 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.internal.visor;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayInputStream;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Wrapper for object input.
+ */
+public class VisorDataTransferObjectInput implements ObjectInput {
+    /** */
+    private final ObjectInputStream ois;
+
+    /**
+     * @param in Target input.
+     * @throws IOException If an I/O error occurs.
+     */
+    public VisorDataTransferObjectInput(ObjectInput in) throws IOException {
+        byte[] buf = U.readByteArray(in);
+
+        /* */
+        GridByteArrayInputStream bis = new GridByteArrayInputStream(buf);
+        ois = new ObjectInputStream(bis);
+    }
+
+
+    /** {@inheritDoc} */
+    @Override public Object readObject() throws ClassNotFoundException, IOException {
+        return ois.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int read() throws IOException {
+        return ois.read();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int read(byte[] b) throws IOException {
+        return ois.read(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int read(byte[] b, int off, int len) throws IOException {
+        return ois.read(b, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long skip(long n) throws IOException {
+        return ois.skip(n);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int available() throws IOException {
+        return ois.available();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws IOException {
+        ois.close();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readFully(@NotNull byte[] b) throws IOException {
+        ois.readFully(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readFully(@NotNull byte[] b, int off, int len) throws IOException {
+        ois.readFully(b, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int skipBytes(int n) throws IOException {
+        return ois.skipBytes(n);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readBoolean() throws IOException {
+        return ois.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte readByte() throws IOException {
+        return ois.readByte();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int readUnsignedByte() throws IOException {
+        return ois.readUnsignedByte();
+    }
+
+    /** {@inheritDoc} */
+    @Override public short readShort() throws IOException {
+        return ois.readShort();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int readUnsignedShort() throws IOException {
+        return ois.readUnsignedShort();
+    }
+
+    /** {@inheritDoc} */
+    @Override public char readChar() throws IOException {
+        return ois.readChar();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int readInt() throws IOException {
+        return ois.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long readLong() throws IOException {
+        return ois.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float readFloat() throws IOException {
+        return ois.readFloat();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double readDouble() throws IOException {
+        return ois.readDouble();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String readLine() throws IOException {
+        return ois.readLine();
+    }
+
+    /** {@inheritDoc} */
+    @NotNull @Override public String readUTF() throws IOException {
+        return ois.readUTF();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java
new file mode 100644
index 0000000..7fa772e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorDataTransferObjectOutput.java
@@ -0,0 +1,141 @@
+/*
+ * 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.internal.visor;
+
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Wrapper for object output.
+ */
+public class VisorDataTransferObjectOutput implements ObjectOutput {
+    /** */
+    private final ObjectOutput out;
+
+    /** */
+    private final GridByteArrayOutputStream bos;
+
+    /** */
+    private final ObjectOutputStream oos;
+
+    /**
+     * Constructor.
+     *
+     * @param out Target stream.
+     * @throws IOException If an I/O error occurs.
+     */
+    public VisorDataTransferObjectOutput(ObjectOutput out) throws IOException {
+        this.out = out;
+
+        bos = new GridByteArrayOutputStream();
+        oos = new ObjectOutputStream(bos);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeObject(Object obj) throws IOException {
+        oos.writeObject(obj);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(int b) throws IOException {
+        oos.write(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(byte[] b) throws IOException {
+        oos.write(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(byte[] b, int off, int len) throws IOException {
+        oos.write(b, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBoolean(boolean v) throws IOException {
+        oos.writeBoolean(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeByte(int v) throws IOException {
+        oos.writeByte(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeShort(int v) throws IOException {
+        oos.writeShort(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeChar(int v) throws IOException {
+        oos.writeChar(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeInt(int v) throws IOException {
+        oos.writeInt(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeLong(long v) throws IOException {
+        oos.writeLong(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeFloat(float v) throws IOException {
+        oos.writeFloat(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeDouble(double v) throws IOException {
+        oos.writeDouble(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBytes(@NotNull String s) throws IOException {
+        oos.writeBytes(s);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeChars(@NotNull String s) throws IOException {
+        oos.writeChars(s);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeUTF(@NotNull String s) throws IOException {
+        oos.writeUTF(s);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void flush() throws IOException {
+        oos.flush();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws IOException {
+        oos.flush();
+
+        U.writeByteArray(out, bos.internalArray(), bos.size());
+
+        oos.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java
new file mode 100644
index 0000000..f426e8a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorEither.java
@@ -0,0 +1,103 @@
+/*
+ * 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.internal.visor;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Base class for Visor result with error.
+ *
+ * @param <T> Result type.
+ */
+public class VisorEither<T> implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Exception on execution. */
+    private Throwable error;
+
+    /** Result. */
+    private T res;
+
+    /**
+     * Default constructor.
+     */
+    public VisorEither() {
+        // No-op.
+    }
+
+    /**
+     * @param error Exception on execution.
+     */
+    public VisorEither(Throwable error) {
+        this.error = error;
+    }
+
+    /**
+     * @param res Result.
+     */
+    public VisorEither(T res) {
+        this.res = res;
+    }
+
+    /**
+     * @return {@code true} If failed on execution.
+     */
+    public boolean failed() {
+        return error != null;
+    }
+
+    /**
+     * @return Exception on execution.
+     */
+    public Throwable getError() {
+        return error;
+    }
+
+    /**
+     * @return Result.
+     */
+    public T getResult() {
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        boolean failed = failed();
+
+        out.writeBoolean(failed);
+        out.writeObject(failed ? error : res);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        if (in.readBoolean())
+            error = (Throwable)in.readObject();
+        else
+            res = (T)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorEither.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
index ece1a17..563a236 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
@@ -69,9 +69,9 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
 
         start = U.currentTimeMillis();
 
-        debug = arg.debug();
+        debug = arg.isDebug();
 
-        taskArg = arg.argument();
+        taskArg = arg.getArgument();
 
         if (debug)
             logStart(ignite.log(), getClass(), start);
@@ -88,7 +88,7 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
      * @throws IgniteException If mapping could not complete successfully.
      */
     protected Map<? extends ComputeJob, ClusterNode> map0(List<ClusterNode> subgrid, VisorTaskArgument<A> arg) {
-        Collection<UUID> nodeIds = arg.nodes();
+        Collection<UUID> nodeIds = arg.getNodes();
 
         Map<ComputeJob, ClusterNode> map = U.newHashMap(nodeIds.size());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
index e4880a8..e992875 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorOneNodeTask.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor;
 
 import java.util.List;
 import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.util.typedef.F;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -30,11 +29,11 @@ public abstract class VisorOneNodeTask<A, R> extends VisorMultiNodeTask<A, R, R>
     @Nullable @Override protected R reduce0(List<ComputeJobResult> results) {
         assert results.size() == 1;
 
-        ComputeJobResult res = F.first(results);
+        ComputeJobResult res = results.get(0);
 
         if (res.getException() == null)
             return res.getData();
 
         throw res.getException();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
index b28ebbe..05d999d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorTaskArgument.java
@@ -17,26 +17,38 @@
 
 package org.apache.ignite.internal.visor;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
  * Visor tasks argument.
  */
-public class VisorTaskArgument<A> implements Serializable {
+public class VisorTaskArgument<A> extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Node IDs task should be mapped to. */
-    private final Collection<UUID> nodes;
+    private List<UUID> nodes;
 
     /** Task argument. */
-    private final A arg;
+    private A arg;
 
     /** Debug flag. */
-    private final boolean debug;
+    private boolean debug;
+
+    /**
+     * Default constructor.
+     */
+    public VisorTaskArgument() {
+        // No-op.
+    }
 
     /**
      * Create Visor task argument.
@@ -49,7 +61,7 @@ public class VisorTaskArgument<A> implements Serializable {
         assert nodes != null;
         assert !nodes.isEmpty();
 
-        this.nodes = nodes;
+        this.nodes = toList(nodes);
         this.arg = arg;
         this.debug = debug;
     }
@@ -72,7 +84,7 @@ public class VisorTaskArgument<A> implements Serializable {
      * @param debug Debug flag.
      */
     public VisorTaskArgument(UUID node, A arg, boolean debug) {
-        this(Collections.singleton(node), arg, debug);
+        this(Collections.singletonList(node), arg, debug);
     }
 
     /**
@@ -88,21 +100,40 @@ public class VisorTaskArgument<A> implements Serializable {
     /**
      * @return Node IDs task should be mapped to.
      */
-    public Collection<UUID> nodes() {
+    public List<UUID> getNodes() {
         return nodes;
     }
 
     /**
      * @return Task argument.
      */
-    public A argument() {
+    public A getArgument() {
         return arg;
     }
 
     /**
      * @return Debug flag.
      */
-    public boolean debug() {
+    public boolean isDebug() {
         return debug;
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeCollection(out, nodes);
+        out.writeObject(arg);
+        out.writeBoolean(debug);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        nodes = U.readList(in);
+        arg = (A)in.readObject();
+        debug = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorTaskArgument.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
new file mode 100644
index 0000000..5e948c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadata.java
@@ -0,0 +1,139 @@
+/*
+ * 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.internal.visor.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary object metadata to show in Visor.
+ */
+public class VisorBinaryMetadata extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Type name */
+    private String typeName;
+
+    /** Type Id */
+    private Integer typeId;
+
+    /** Affinity key field name. */
+    private String affinityKeyFieldName;
+
+    /** Filed list */
+    private List<VisorBinaryMetadataField> fields;
+
+    /**
+     * @param binary Binary objects.
+     * @return List of data transfer objects for binary objects metadata.
+     */
+    public static List<VisorBinaryMetadata> list(IgniteBinary binary) {
+        List<VisorBinaryMetadata> res = new ArrayList<>();
+
+        if (binary != null) {
+            for (BinaryType binaryType : binary.types())
+                res.add(new VisorBinaryMetadata(binary, binaryType));
+        }
+
+        return res;
+    }
+
+    /**
+     * Default constructor.
+     */
+    public VisorBinaryMetadata() {
+        // No-op.
+    }
+
+    /**
+     * Default constructor.
+     */
+    public VisorBinaryMetadata(IgniteBinary binary, BinaryType binaryType) {
+        typeName = binaryType.typeName();
+        typeId = binary.typeId(typeName);
+        affinityKeyFieldName = binaryType.affinityKeyFieldName();
+
+        Collection<String> binaryTypeFields = binaryType.fieldNames();
+
+        fields = new ArrayList<>(binaryTypeFields.size());
+
+        for (String metaField : binaryTypeFields)
+            fields.add(new VisorBinaryMetadataField(metaField, binaryType.fieldTypeName(metaField), null));
+    }
+
+    /**
+     * @return Type name.
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * @return Type Id.
+     */
+    public Integer getTypeId() {
+        return typeId;
+    }
+
+    /**
+     * @return Fields list.
+     */
+    public Collection<VisorBinaryMetadataField> getFields() {
+        return fields;
+    }
+
+    /**
+     * @return Affinity key field name.
+     */
+    @Nullable public String getAffinityKeyFieldName() {
+        return affinityKeyFieldName;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, typeName);
+        out.writeObject(typeId);
+        U.writeString(out, affinityKeyFieldName);
+        U.writeCollection(out, fields);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer,
+        ObjectInput in) throws IOException, ClassNotFoundException {
+        typeName = U.readString(in);
+        typeId = (Integer)in.readObject();
+        affinityKeyFieldName = U.readString(in);
+        fields = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorBinaryMetadata.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
new file mode 100644
index 0000000..de67805
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTask.java
@@ -0,0 +1,70 @@
+/*
+ * 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.internal.visor.binary;
+
+import org.apache.ignite.IgniteBinary;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.marshaller.Marshaller;
+
+/**
+ * Task that collects binary metadata.
+ */
+@GridInternal
+public class VisorBinaryMetadataCollectorTask extends VisorOneNodeTask<Long, VisorBinaryMetadataCollectorTaskResult> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorBinaryCollectMetadataJob job(Long lastUpdate) {
+        return new VisorBinaryCollectMetadataJob(lastUpdate, debug);
+    }
+
+    /** Job that collect portables metadata on node. */
+    private static class VisorBinaryCollectMetadataJob extends VisorJob<Long, VisorBinaryMetadataCollectorTaskResult> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with given argument.
+         *
+         * @param lastUpdate Time data was collected last time.
+         * @param debug Debug flag.
+         */
+        private VisorBinaryCollectMetadataJob(Long lastUpdate, boolean debug) {
+            super(lastUpdate, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected VisorBinaryMetadataCollectorTaskResult run(Long lastUpdate) {
+            Marshaller marsh =  ignite.configuration().getMarshaller();
+
+            IgniteBinary binary = marsh == null || marsh instanceof BinaryMarshaller ? ignite.binary() : null;
+
+            return new VisorBinaryMetadataCollectorTaskResult(0L, VisorBinaryMetadata.list(binary));
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorBinaryCollectMetadataJob.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
new file mode 100644
index 0000000..e96b7ef
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataCollectorTaskResult.java
@@ -0,0 +1,87 @@
+/*
+ * 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.internal.visor.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for {@link VisorBinaryMetadataCollectorTask}
+ */
+public class VisorBinaryMetadataCollectorTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Last binary metadata update date. */
+    private Long lastUpdate;
+
+    /** Remote data center IDs for which full state transfer was requested. */
+    private List<VisorBinaryMetadata> binary;
+
+    /**
+     * Default constructor.
+     */
+    public VisorBinaryMetadataCollectorTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * @param lastUpdate Last binary metadata update date.
+     * @param binary Remote data center IDs for which full state transfer was requested.
+     */
+    public VisorBinaryMetadataCollectorTaskResult(Long lastUpdate, List<VisorBinaryMetadata> binary) {
+        this.lastUpdate = lastUpdate;
+        this.binary = binary;
+    }
+
+    /**
+     * @return Last binary metadata update date.
+     */
+    public Long getLastUpdate() {
+        return lastUpdate;
+    }
+
+    /**
+     * @return Remote data center IDs for which full state transfer was requested.
+     */
+    public List<VisorBinaryMetadata> getBinary() {
+        return binary;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(lastUpdate);
+        U.writeCollection(out, binary);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        lastUpdate = in.readLong();
+        binary = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorBinaryMetadataCollectorTaskResult.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
new file mode 100644
index 0000000..69c880c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/binary/VisorBinaryMetadataField.java
@@ -0,0 +1,101 @@
+/*
+ * 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.internal.visor.binary;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary object metadata field information.
+ */
+public class VisorBinaryMetadataField extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Field name. */
+    private String fieldName;
+
+    /** Field type name. */
+    private String fieldTypeName;
+
+    /** Field id. */
+    private Integer fieldId;
+
+    /**
+     * Default constructor.
+     */
+    public VisorBinaryMetadataField() {
+        // No-op.
+    }
+
+    /**
+     * @param fieldName Field name.
+     * @param fieldTypeName Field type name.
+     * @param fieldId Field id.
+     */
+    public VisorBinaryMetadataField(String fieldName, String fieldTypeName, Integer fieldId) {
+        this.fieldName = fieldName;
+        this.fieldTypeName = fieldTypeName;
+        this.fieldId = fieldId;
+    }
+
+    /**
+     * @return Field name.
+     */
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * @return Field type name.
+     */
+    @Nullable public String getFieldTypeName() {
+        return fieldTypeName;
+    }
+
+    /**
+     * @return Field id.
+     */
+    public Integer getFieldId() {
+        return fieldId;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, fieldName);
+        U.writeString(out, fieldTypeName);
+        out.writeObject(fieldId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        fieldName = U.readString(in);
+        fieldTypeName = U.readString(in);
+        fieldId = (Integer)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorBinaryMetadataField.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index f239ed9..4a35795 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -17,37 +17,36 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
-import java.util.Iterator;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Data transfer object for {@link IgniteCache}.
  */
-public class VisorCache implements Serializable, LessNamingBean {
+public class VisorCache extends VisorDataTransferObject {
     /** */
-    private static final CachePeekMode[] PEEK_NO_NEAR =
-        new CachePeekMode[] {CachePeekMode.PRIMARY, CachePeekMode.BACKUP};
+    private static final long serialVersionUID = 0L;
 
     /** */
-    private static final long serialVersionUID = 0L;
+    private static final CachePeekMode[] PEEK_NO_NEAR =
+        new CachePeekMode[] {CachePeekMode.PRIMARY, CachePeekMode.BACKUP};
 
     /** Default cache size sampling. */
     private static final int DFLT_CACHE_SIZE_SAMPLING = 10;
@@ -92,28 +91,29 @@ public class VisorCache implements Serializable, LessNamingBean {
     private VisorCacheMetrics metrics;
 
     /** Cache partitions states. */
-    private GridDhtPartitionMap partitionsMap;
+    private VisorPartitionMap parts;
+
+    /**
+     * Create data transfer object for given cache.
+     */
+    public VisorCache() {
+        // No-op.
+    }
 
     /**
-     * @param ignite Grid.
-     * @param cacheName Cache name.
+     * Create data transfer object for given cache.
+     *
+     * @param ca Internal cache.
      * @param sample Sample size.
-     * @return Data transfer object for given cache.
      * @throws IgniteCheckedException If failed to create data transfer object.
      */
-    public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
-        assert ignite != null;
-
-        GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
+    public VisorCache(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
+        assert ca != null;
 
-        // Cache was not started.
-        if (ca == null || !ca.context().started())
-            return null;
+        name = ca.name();
 
         GridCacheContext cctx = ca.context();
 
-        name = cacheName;
-
         CacheConfiguration cfg = ca.configuration();
 
         mode = cfg.getCacheMode();
@@ -133,7 +133,7 @@ public class VisorCache implements Serializable, LessNamingBean {
                 GridDhtPartitionTopology top = dca.topology();
 
                 if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() > 0)
-                    partitionsMap = top.localPartitionMap();
+                    parts = new VisorPartitionMap(top.localPartitionMap());
             }
         }
 
@@ -144,23 +144,19 @@ public class VisorCache implements Serializable, LessNamingBean {
         nearSize = ca.nearSize();
         onHeapEntriesCnt = 0; // TODO GG-11148 Need to rename on ON-heap entries count, see
         partitions = ca.affinity().partitions();
-        metrics = new VisorCacheMetrics().from(ignite, cacheName);
+        metrics = new VisorCacheMetrics(ignite, name);  // TODO: GG-11683 Move to separate thing
         near = cctx.isNear();
 
         estimateMemorySize(ignite, ca, sample);
-
-        return this;
     }
 
     /**
      * Estimate memory size used by cache.
      *
-     * @param ignite Ignite.
      * @param ca Cache adapter.
      * @param sample Sample size.
-     * @throws IgniteCheckedException If estimation failed.
      */
-    protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) throws IgniteCheckedException {
+    protected void estimateMemorySize(IgniteEx ignite, GridCacheAdapter ca, int sample) {
         /* TODO Fix after GG-11739 implemented.
         int size = ca.size();
 
@@ -215,7 +211,7 @@ public class VisorCache implements Serializable, LessNamingBean {
     /**
      * @return Cache name.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
@@ -224,102 +220,138 @@ public class VisorCache implements Serializable, LessNamingBean {
      *
      * @param name New cache name.
      */
-    public void name(String name) {
+    public void setName(String name) {
         this.name = name;
     }
 
     /**
      * @return Dynamic deployment ID.
      */
-    public IgniteUuid dynamicDeploymentId() {
+    public IgniteUuid getDynamicDeploymentId() {
         return dynamicDeploymentId;
     }
 
     /**
      * @return Cache mode.
      */
-    public CacheMode mode() {
+    public CacheMode getMode() {
         return mode;
     }
 
     /**
      * @return Cache size in bytes.
      */
-    public long memorySize() {
+    public long getMemorySize() {
         return memorySize;
     }
 
     /**
      * @return Indexes size in bytes.
      */
-    public long indexesSize() {
+    public long getIndexesSize() {
         return indexesSize;
     }
 
     /**
      * @return Number of all entries in cache.
      */
-    public long size() {
+    public long getSize() {
         return size;
     }
 
     /**
      * @return Number of all entries in near cache.
      */
-    public int nearSize() {
+    public int getNearSize() {
         return nearSize;
     }
 
     /**
      * @return Number of backup entries in cache.
      */
-    public long backupSize() {
+    public long getBackupSize() {
         return backupSize;
     }
 
     /**
      * @return Number of primary entries in cache.
      */
-    public long primarySize() {
+    public long getPrimarySize() {
         return primarySize;
     }
 
     /**
      * @return Number of cache entries stored in heap memory.
      */
-    public long onHeapEntriesCount() {
+    public long getOnHeapEntriesCount() {
         return onHeapEntriesCnt;
     }
 
     /**
      * @return Number of partitions.
      */
-    public int partitions() {
+    public int getPartitions() {
         return partitions;
     }
 
     /**
      * @return Cache metrics.
      */
-    public VisorCacheMetrics metrics() {
+    public VisorCacheMetrics getMetrics() {
         return metrics;
     }
 
     /**
      * @return Cache partitions states.
      */
-    @Nullable public GridDhtPartitionMap partitionMap() {
-        return partitionsMap;
+    @Nullable public VisorPartitionMap getPartitionMap() {
+        return parts;
     }
 
     /**
      * @return {@code true} if cache has near cache.
      */
-    public boolean near() {
+    public boolean isNear() {
         return near;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeGridUuid(out, dynamicDeploymentId);
+        U.writeEnum(out, mode);
+        out.writeLong(memorySize);
+        out.writeLong(indexesSize);
+        out.writeLong(size);
+        out.writeInt(nearSize);
+        out.writeLong(primarySize);
+        out.writeLong(backupSize);
+        out.writeLong(onHeapEntriesCnt);
+        out.writeInt(partitions);
+        out.writeBoolean(near);
+        out.writeObject(metrics);
+        out.writeObject(parts);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        dynamicDeploymentId = U.readGridUuid(in);
+        mode = CacheMode.fromOrdinal(in.readByte());
+        memorySize = in.readLong();
+        indexesSize = in.readLong();
+        size = in.readLong();
+        nearSize = in.readInt();
+        primarySize = in.readLong();
+        backupSize = in.readLong();
+        onHeapEntriesCnt = in.readLong();
+        partitions = in.readInt();
+        near = in.readBoolean();
+        metrics = (VisorCacheMetrics)in.readObject();
+        parts = (VisorPartitionMap)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCache.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
index 371a514..d8616d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityConfiguration.java
@@ -17,20 +17,25 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import org.apache.ignite.cache.affinity.AffinityFunction;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.internal.util.IgniteUtils.findNonPublicMethod;
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 
 /**
  * Data transfer object for affinity configuration properties.
  */
-public class VisorCacheAffinityConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheAffinityConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -40,74 +45,98 @@ public class VisorCacheAffinityConfiguration implements Serializable, LessNaming
     /** Cache affinity mapper. */
     private String mapper;
 
-    /** Count of key backups. */
+    /** Number of backup nodes for one partition. */
     private int partitionedBackups;
 
-    /** Cache affinity partitions. */
+    /** Total partition count. */
     private Integer partitions;
 
     /** Cache partitioned affinity exclude neighbors. */
-    private Boolean excludeNeighbors;
+    private Boolean exclNeighbors;
 
     /**
+     * Default constructor
+     */
+    public VisorCacheAffinityConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for affinity configuration properties.
+     *
      * @param ccfg Cache configuration.
-     * @return Data transfer object for affinity configuration properties.
      */
-    public static VisorCacheAffinityConfiguration from(CacheConfiguration ccfg) {
+    public VisorCacheAffinityConfiguration(CacheConfiguration ccfg) {
         AffinityFunction aff = ccfg.getAffinity();
 
-        Boolean excludeNeighbors = null;
+        function = compactClass(aff);
+        mapper = compactClass(ccfg.getAffinityMapper());
+        partitions = aff.partitions();
+        partitionedBackups = ccfg.getBackups();
 
-        if (aff instanceof RendezvousAffinityFunction) {
-            RendezvousAffinityFunction hashAffFunc = (RendezvousAffinityFunction)aff;
+        Method mthd = findNonPublicMethod(aff.getClass(), "isExcludeNeighbors");
 
-            excludeNeighbors = hashAffFunc.isExcludeNeighbors();
+        if (mthd != null) {
+            try {
+                exclNeighbors = (Boolean)mthd.invoke(aff);
+            }
+            catch (InvocationTargetException | IllegalAccessException ignored) {
+                //  No-op.
+            }
         }
-
-        VisorCacheAffinityConfiguration cfg = new VisorCacheAffinityConfiguration();
-
-        cfg.function = compactClass(aff);
-        cfg.mapper = compactClass(ccfg.getAffinityMapper());
-        cfg.partitions = aff.partitions();
-        cfg.partitionedBackups = ccfg.getBackups();
-        cfg.excludeNeighbors = excludeNeighbors;
-
-        return cfg;
     }
 
     /**
      * @return Cache affinity.
      */
-    public String function() {
+    public String getFunction() {
         return function;
     }
 
     /**
      * @return Cache affinity mapper.
      */
-    public String mapper() {
+    public String getMapper() {
         return mapper;
     }
 
     /**
-     * @return Count of key backups.
+     * @return Number of backup nodes for one partition.
      */
-    public int partitionedBackups() {
+    public int getPartitionedBackups() {
         return partitionedBackups;
     }
 
     /**
-     * @return Cache affinity partitions.
+     * @return Total partition count.
      */
-    public Integer partitions() {
+    public Integer getPartitions() {
         return partitions;
     }
 
     /**
      * @return Cache partitioned affinity exclude neighbors.
      */
-    @Nullable public Boolean excludeNeighbors() {
-        return excludeNeighbors;
+    @Nullable public Boolean isExcludeNeighbors() {
+        return exclNeighbors;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, function);
+        U.writeString(out, mapper);
+        out.writeInt(partitionedBackups);
+        out.writeObject(partitions);
+        out.writeObject(exclNeighbors);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        function = U.readString(in);
+        mapper = U.readString(in);
+        partitionedBackups = in.readInt();
+        partitions = (Integer)in.readObject();
+        exclNeighbors = (Boolean)in.readObject();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
index 83d421a..447cc11 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTask.java
@@ -24,24 +24,23 @@ import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Task that will find affinity node for key.
  */
 @GridInternal
-public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<IgniteBiTuple<String, Object>, UUID> {
+public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<VisorCacheAffinityNodeTaskArg, UUID> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Override protected VisorCacheAffinityNodeJob job(IgniteBiTuple<String, Object> arg) {
+    @Override protected VisorCacheAffinityNodeJob job(VisorCacheAffinityNodeTaskArg arg) {
         return new VisorCacheAffinityNodeJob(arg, debug);
     }
 
     /** Job that will find affinity node for key. */
-    private static class VisorCacheAffinityNodeJob extends VisorJob<IgniteBiTuple<String, Object>, UUID> {
+    private static class VisorCacheAffinityNodeJob extends VisorJob<VisorCacheAffinityNodeTaskArg, UUID> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -49,15 +48,15 @@ public class VisorCacheAffinityNodeTask extends VisorOneNodeTask<IgniteBiTuple<S
          * @param arg Cache name and key to find affinity node.
          * @param debug Debug flag.
          */
-        private VisorCacheAffinityNodeJob(IgniteBiTuple<String, Object> arg, boolean debug) {
+        private VisorCacheAffinityNodeJob(VisorCacheAffinityNodeTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected UUID run(@Nullable IgniteBiTuple<String, Object> arg) throws IgniteException {
+        @Override protected UUID run(@Nullable VisorCacheAffinityNodeTaskArg arg) throws IgniteException {
             assert arg != null;
 
-            ClusterNode node = ignite.affinity(arg.getKey()).mapKeyToNode(arg.getValue());
+            ClusterNode node = ignite.affinity(arg.getCacheName()).mapKeyToNode(arg.getKey());
 
             return node != null ? node.id() : null;
         }


[15/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java
new file mode 100644
index 0000000..ec05733
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAffinityNodeTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for {@link VisorCacheAffinityNodeTask}.
+ */
+public class VisorCacheAffinityNodeTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache name. */
+    private String cacheName;
+
+    /** Key to map to a node. */
+    private Object key;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheAffinityNodeTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param key Object.
+     */
+    public VisorCacheAffinityNodeTaskArg(String cacheName, Object key) {
+        this.cacheName = cacheName;
+        this.key = key;
+    }
+
+    /**
+     * @return Cache name.
+     */
+    public String getCacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @return Key to map to a node.
+     */
+    public Object getKey() {
+        return key;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, cacheName);
+        out.writeObject(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        cacheName = U.readString(in);
+        key = in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheAffinityNodeTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index 586fa87..21a2806 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -17,19 +17,22 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for aggregated cache metrics.
  */
-public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean {
+public class VisorCacheAggregatedMetrics extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -43,7 +46,7 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     private boolean sys;
 
     /** Node IDs with cache metrics. */
-    private final Map<UUID, VisorCacheMetrics> metrics = new HashMap<>();
+    private Map<UUID, VisorCacheMetrics> metrics = new HashMap<>();
 
     /** Minimum number of elements in heap. */
     private transient Long minHeapSize;
@@ -118,54 +121,56 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     private transient Integer failsQry;
 
     /**
+     * Default constructor.
+     */
+    public VisorCacheAggregatedMetrics() {
+        // No-op.
+    }
+
+    /**
      * Create data transfer object for aggregated cache metrics.
      *
      * @param cm Source cache metrics.
-     * @return Data transfer object for aggregated cache metrics.
      */
-    public static VisorCacheAggregatedMetrics from(VisorCacheMetrics cm) {
-        VisorCacheAggregatedMetrics acm = new VisorCacheAggregatedMetrics();
-
-        acm.name = cm.name();
-        acm.mode = cm.mode();
-        acm.sys = cm.system();
-
-        return acm;
+    public VisorCacheAggregatedMetrics(VisorCacheMetrics cm) {
+        name = cm.getName();
+        mode = cm.getMode();
+        sys = cm.isSystem();
     }
 
     /**
      * @return Cache name.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
     /** @return Cache mode. */
-    public CacheMode mode() {
+    public CacheMode getMode() {
         return mode;
     }
 
     /** @return Cache system state. */
-    public boolean system() {
+    public boolean isSystem() {
         return sys;
     }
 
     /**
      * @return Nodes.
      */
-    public Collection<UUID> nodes() {
+    public Collection<UUID> getNodes() {
         return metrics.keySet();
     }
 
     /**
      * @return Minimum number of elements in heap.
      */
-    public long minimumHeapSize() {
+    public long getMinimumHeapSize() {
         if (minHeapSize == null) {
             minHeapSize = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minHeapSize = Math.min(minHeapSize, metric.keySize());
+                minHeapSize = Math.min(minHeapSize, metric.getKeySize());
         }
 
         return minHeapSize;
@@ -174,12 +179,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average number of elements in heap.
      */
-    public double averageHeapSize() {
+    public double getAverageHeapSize() {
         if (avgHeapSize == null) {
             avgHeapSize = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgHeapSize += metric.keySize();
+                avgHeapSize += metric.getKeySize();
 
             avgHeapSize /= metrics.size();
         }
@@ -190,12 +195,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum number of elements in heap.
      */
-    public long maximumHeapSize() {
+    public long getMaximumHeapSize() {
         if (maxHeapSize == null) {
             maxHeapSize = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxHeapSize = Math.max(maxHeapSize, metric.keySize());
+                maxHeapSize = Math.max(maxHeapSize, metric.getKeySize());
         }
 
         return maxHeapSize;
@@ -205,19 +210,19 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
      * @param metric Metrics to process.
      * @return Off heap entries count.
      */
-    private long offHeapEntriesCount(VisorCacheMetrics metric) {
+    private long getOffHeapEntriesCount(VisorCacheMetrics metric) {
         return metric.offHeapEntriesCount();
     }
 
     /**
      * @return Minimum number of elements in off heap.
      */
-    public long minimumOffHeapSize() {
+    public long getMinimumOffHeapSize() {
         if (minOffHeapSize == null) {
             minOffHeapSize = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minOffHeapSize = Math.min(minOffHeapSize, offHeapEntriesCount(metric));
+                minOffHeapSize = Math.min(minOffHeapSize, getOffHeapEntriesCount(metric));
         }
 
         return minOffHeapSize;
@@ -226,12 +231,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average number of elements in off heap.
      */
-    public double averageOffHeapSize() {
+    public double getAverageOffHeapSize() {
         if (avgOffHeapSize == null) {
             avgOffHeapSize = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgOffHeapSize += offHeapEntriesCount(metric);
+                avgOffHeapSize += getOffHeapEntriesCount(metric);
 
             avgOffHeapSize /= metrics.size();
         }
@@ -242,12 +247,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum number of elements in off heap in the cache.
      */
-    public long maximumOffHeapSize() {
+    public long getMaximumOffHeapSize() {
         if (maxOffHeapSize == null) {
             maxOffHeapSize = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxOffHeapSize = Math.max(maxOffHeapSize, offHeapEntriesCount(metric));
+                maxOffHeapSize = Math.max(maxOffHeapSize, getOffHeapEntriesCount(metric));
         }
 
         return maxOffHeapSize;
@@ -256,12 +261,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Minimum hits of the owning cache.
      */
-    public long minimumHits() {
+    public long getMinimumHits() {
         if (minHits == null) {
             minHits = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minHits = Math.min(minHits, metric.hits());
+                minHits = Math.min(minHits, metric.getHits());
         }
 
         return minHits;
@@ -270,12 +275,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average hits of the owning cache.
      */
-    public double averageHits() {
+    public double getAverageHits() {
         if (avgHits == null) {
             avgHits = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgHits += metric.hits();
+                avgHits += metric.getHits();
 
             avgHits /= metrics.size();
         }
@@ -286,12 +291,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum hits of the owning cache.
      */
-    public long maximumHits() {
+    public long getMaximumHits() {
         if (maxHits == null) {
             maxHits = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxHits = Math.max(maxHits, metric.hits());
+                maxHits = Math.max(maxHits, metric.getHits());
         }
 
         return maxHits;
@@ -300,12 +305,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Minimum misses of the owning cache.
      */
-    public long minimumMisses() {
+    public long getMinimumMisses() {
         if (minMisses == null) {
             minMisses = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minMisses = Math.min(minMisses, metric.misses());
+                minMisses = Math.min(minMisses, metric.getMisses());
         }
 
         return minMisses;
@@ -314,12 +319,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average misses of the owning cache.
      */
-    public double averageMisses() {
+    public double getAverageMisses() {
         if (avgMisses == null) {
             avgMisses = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgMisses += metric.misses();
+                avgMisses += metric.getMisses();
 
             avgMisses /= metrics.size();
         }
@@ -330,12 +335,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum misses of the owning cache.
      */
-    public long maximumMisses() {
+    public long getMaximumMisses() {
         if (maxMisses == null) {
             maxMisses = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxMisses = Math.max(maxMisses, metric.misses());
+                maxMisses = Math.max(maxMisses, metric.getMisses());
         }
 
         return maxMisses;
@@ -344,12 +349,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Minimum total number of reads of the owning cache.
      */
-    public long minimumReads() {
+    public long getMinimumReads() {
         if (minReads == null) {
             minReads = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minReads = Math.min(minReads, metric.reads());
+                minReads = Math.min(minReads, metric.getReads());
         }
 
         return minReads;
@@ -358,12 +363,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average total number of reads of the owning cache.
      */
-    public double averageReads() {
+    public double getAverageReads() {
         if (avgReads == null) {
             avgReads = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgReads += metric.reads();
+                avgReads += metric.getReads();
 
             avgReads /= metrics.size();
         }
@@ -374,12 +379,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum total number of reads of the owning cache.
      */
-    public long maximumReads() {
+    public long getMaximumReads() {
         if (maxReads == null) {
             maxReads = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxReads = Math.max(maxReads, metric.reads());
+                maxReads = Math.max(maxReads, metric.getReads());
         }
 
         return maxReads;
@@ -388,12 +393,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Minimum total number of writes of the owning cache.
      */
-    public long minimumWrites() {
+    public long getMinimumWrites() {
         if (minWrites == null) {
             minWrites = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minWrites = Math.min(minWrites, metric.writes());
+                minWrites = Math.min(minWrites, metric.getWrites());
         }
 
         return minWrites;
@@ -402,12 +407,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average total number of writes of the owning cache.
      */
-    public double averageWrites() {
+    public double getAverageWrites() {
         if (avgWrites == null) {
             avgWrites = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgWrites += metric.writes();
+                avgWrites += metric.getWrites();
 
             avgWrites /= metrics.size();
         }
@@ -418,12 +423,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum total number of writes of the owning cache.
      */
-    public long maximumWrites() {
+    public long getMaximumWrites() {
         if (maxWrites == null) {
             maxWrites = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxWrites = Math.max(maxWrites, metric.writes());
+                maxWrites = Math.max(maxWrites, metric.getWrites());
         }
 
         return maxWrites;
@@ -432,12 +437,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Minimum execution time of query.
      */
-    public long minimumQueryTime() {
+    public long getMinimumQueryTime() {
         if (minQryTime == null) {
             minQryTime = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minQryTime = Math.min(minQryTime, metric.queryMetrics().minimumTime());
+                minQryTime = Math.min(minQryTime, metric.getQueryMetrics().getMinimumTime());
         }
 
         return minQryTime;
@@ -446,12 +451,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Average execution time of query.
      */
-    public double averageQueryTime() {
+    public double getAverageQueryTime() {
         if (avgQryTime == null) {
             avgQryTime = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgQryTime += metric.queryMetrics().averageTime();
+                avgQryTime += metric.getQueryMetrics().getAverageTime();
 
             avgQryTime /= metrics.size();
         }
@@ -462,12 +467,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Maximum execution time of query.
      */
-    public long maximumQueryTime() {
+    public long getMaximumQueryTime() {
         if (maxQryTime == null) {
             maxQryTime = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxQryTime = Math.max(maxQryTime, metric.queryMetrics().maximumTime());
+                maxQryTime = Math.max(maxQryTime, metric.getQueryMetrics().getMaximumTime());
         }
 
         return maxQryTime;
@@ -476,9 +481,9 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Total execution time of query.
      */
-    public long totalQueryTime() {
+    public long getTotalQueryTime() {
         if (totalQryTime == null)
-            totalQryTime = (long)(averageQueryTime() * execsQuery());
+            totalQryTime = (long)(getAverageQueryTime() * getQueryExecutions());
 
         return totalQryTime;
     }
@@ -486,12 +491,12 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Number of executions.
      */
-    public int execsQuery() {
+    public int getQueryExecutions() {
         if (execsQry == null) {
             execsQry = 0;
 
             for (VisorCacheMetrics metric : metrics.values())
-                execsQry += metric.queryMetrics().executions();
+                execsQry += metric.getQueryMetrics().getExecutions();
         }
 
         return execsQry;
@@ -500,25 +505,89 @@ public class VisorCacheAggregatedMetrics implements Serializable, LessNamingBean
     /**
      * @return Total number of times a query execution failed.
      */
-    public int failsQuery() {
+    public int getQueryFailures() {
         if (failsQry == null) {
             failsQry = 0;
 
             for (VisorCacheMetrics metric : metrics.values())
-                failsQry += metric.queryMetrics().fails();
+                failsQry += metric.getQueryMetrics().getFailures();
         }
 
         return failsQry;
     }
 
     /**
-     * @return Node IDs with cache metrics.
+     * @return Map of Node IDs to cache metrics.
      */
-    public Map<UUID, VisorCacheMetrics> metrics() {
+    public Map<UUID, VisorCacheMetrics> getMetrics() {
         return metrics;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeEnum(out, mode);
+        out.writeBoolean(sys);
+        U.writeMap(out, metrics);
+        out.writeObject(minHeapSize);
+        out.writeObject(avgHeapSize);
+        out.writeObject(maxHeapSize);
+        out.writeObject(minOffHeapSize);
+        out.writeObject(avgOffHeapSize);
+        out.writeObject(maxOffHeapSize);
+        out.writeObject(minHits);
+        out.writeObject(avgHits);
+        out.writeObject(maxHits);
+        out.writeObject(minMisses);
+        out.writeObject(avgMisses);
+        out.writeObject(maxMisses);
+        out.writeObject(minReads);
+        out.writeObject(avgReads);
+        out.writeObject(maxReads);
+        out.writeObject(minWrites);
+        out.writeObject(avgWrites);
+        out.writeObject(maxWrites);
+        out.writeObject(minQryTime);
+        out.writeObject(avgQryTime);
+        out.writeObject(maxQryTime);
+        out.writeObject(totalQryTime);
+        out.writeObject(execsQry);
+        out.writeObject(failsQry);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        mode = CacheMode.fromOrdinal(in.readByte());
+        sys = in.readBoolean();
+        metrics = U.readMap(in);
+        minHeapSize = (Long)in.readObject();
+        avgHeapSize = (Double)in.readObject();
+        maxHeapSize = (Long)in.readObject();
+        minOffHeapSize = (Long)in.readObject();
+        avgOffHeapSize = (Double)in.readObject();
+        maxOffHeapSize = (Long)in.readObject();
+        minHits = (Long)in.readObject();
+        avgHits = (Double)in.readObject();
+        maxHits = (Long)in.readObject();
+        minMisses = (Long)in.readObject();
+        avgMisses = (Double)in.readObject();
+        maxMisses = (Long)in.readObject();
+        minReads = (Long)in.readObject();
+        avgReads = (Double)in.readObject();
+        maxReads = (Long)in.readObject();
+        minWrites = (Long)in.readObject();
+        avgWrites = (Double)in.readObject();
+        maxWrites = (Long)in.readObject();
+        minQryTime = (Long)in.readObject();
+        avgQryTime = (Double)in.readObject();
+        maxQryTime = (Long)in.readObject();
+        totalQryTime = (Long)in.readObject();
+        execsQry = (Integer)in.readObject();
+        failsQry = (Integer)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheAggregatedMetrics.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
index 7556e7c..6d14939 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
@@ -24,8 +24,6 @@ import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.resources.JobContextResource;
@@ -34,7 +32,7 @@ import org.apache.ignite.resources.JobContextResource;
  * Task that clears specified caches on specified node.
  */
 @GridInternal
-public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<Integer, Integer>> {
+public class VisorCacheClearTask extends VisorOneNodeTask<String, VisorCacheClearTaskResult> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -46,18 +44,15 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
     /**
      * Job that clear specified caches.
      */
-    private static class VisorCacheClearJob extends VisorJob<String, IgniteBiTuple<Integer, Integer>> {
+    private static class VisorCacheClearJob extends VisorJob<String, VisorCacheClearTaskResult> {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        private final String cacheName;
+        private final IgniteInClosure<IgniteFuture> lsnr;
 
         /** */
-        private final IgniteInClosure<IgniteFuture<Integer>> lsnr;
-
-        /** */
-        private IgniteFuture<Integer>[] futs;
+        private IgniteFuture<Long>[] futs;
 
         /** */
         @JobContextResource
@@ -72,13 +67,11 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
         private VisorCacheClearJob(String cacheName, boolean debug) {
             super(cacheName, debug);
 
-            this.cacheName = cacheName;
-
-            lsnr = new IgniteInClosure<IgniteFuture<Integer>>() {
+            lsnr = new IgniteInClosure<IgniteFuture>() {
                 /** */
                 private static final long serialVersionUID = 0L;
 
-                @Override public void apply(IgniteFuture<Integer> f) {
+                @Override public void apply(IgniteFuture f) {
                     assert futs[0].isDone();
                     assert futs[1] == null || futs[1].isDone();
                     assert futs[2] == null || futs[2].isDone();
@@ -89,13 +82,10 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
         }
 
         /**
-         * @param fut Future for asynchronous cache operation.
-         * @param idx Index.
-         * @return {@code true} If subJob was not completed and this job should be suspended.
+         * @param fut Future to listen.
+         * @return {@code true} If future was not completed and this job should holdCC.
          */
-        private boolean callAsync(IgniteFuture<Integer> fut, int idx) {
-            futs[idx] = fut;
-
+        private boolean callAsync(IgniteFuture fut) {
             if (fut.isDone())
                 return false;
 
@@ -107,7 +97,7 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
         }
 
         /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<Integer, Integer> run(final String cacheName) {
+        @Override protected VisorCacheClearTaskResult run(final String cacheName) {
             if (futs == null)
                 futs = new IgniteFuture[3];
 
@@ -115,24 +105,30 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
                 IgniteCache cache = ignite.cache(cacheName);
 
                 if (futs[0] == null) {
-                    if (callAsync(cache.sizeAsync(CachePeekMode.PRIMARY), 0))
+                    futs[0] = cache.sizeLongAsync(CachePeekMode.PRIMARY);
+
+                    if (callAsync(futs[0]))
                         return null;
                 }
 
                 if (futs[1] == null) {
-                    if (callAsync(cache.clearAsync(), 1))
+                    futs[1] = cache.clearAsync();
+
+                    if (callAsync(futs[1]))
                         return null;
                 }
-                
+
                 if (futs[2] == null) {
-                    if (callAsync(cache.sizeAsync(CachePeekMode.PRIMARY), 2))
+                    futs[2] = cache.sizeLongAsync(CachePeekMode.PRIMARY);
+
+                    if (callAsync(futs[2]))
                         return null;
                 }
             }
 
             assert futs[0].isDone() && futs[1].isDone() && futs[2].isDone();
 
-            return new IgniteBiTuple<>(futs[0].get(), futs[2].get());
+            return new VisorCacheClearTaskResult(futs[0].get(), futs[2].get());
         }
 
         /** {@inheritDoc} */
@@ -140,58 +136,4 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
             return S.toString(VisorCacheClearJob.class, this);
         }
     }
-
-    /**
-     * Callable to get cache size.
-     *
-     * @deprecated This class needed only for compatibility.
-     */
-    @GridInternal @Deprecated
-    private static class VisorCacheSizeCallable implements IgniteCallable<Integer> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private final IgniteCache cache;
-
-        /**
-         * @param cache Cache to take size from.
-         */
-        private VisorCacheSizeCallable(IgniteCache cache) {
-            this.cache = cache;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer call() throws Exception {
-            return cache.size(CachePeekMode.PRIMARY);
-        }
-    }
-
-    /**
-     * Callable to clear cache.
-     *
-     * @deprecated This class needed only for compatibility.
-     */
-    @GridInternal @Deprecated
-    private static class VisorCacheClearCallable implements IgniteCallable<Integer> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private final IgniteCache cache;
-
-        /**
-         * @param cache Cache to clear.
-         */
-        private VisorCacheClearCallable(IgniteCache cache) {
-            this.cache = cache;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer call() throws Exception {
-            cache.clear();
-
-            return 0;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java
new file mode 100644
index 0000000..c7249f7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for {@link VisorCacheClearTask}.
+ */
+public class VisorCacheClearTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache size before clearing. */
+    private long sizeBefore;
+
+    /** Cache size after clearing. */
+    private long sizeAfter;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheClearTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * @param sizeBefore Cache size before clearing.
+     * @param sizeAfter Cache size after clearing.
+     */
+    public VisorCacheClearTaskResult(long sizeBefore, long sizeAfter) {
+        this.sizeBefore = sizeBefore;
+        this.sizeAfter = sizeAfter;
+    }
+
+    /**
+     * @return Cache size before clearing.
+     */
+    public long getSizeBefore() {
+        return sizeBefore;
+    }
+
+    /**
+     * @return Cache size after clearing.
+     */
+    public long getSizeAfter() {
+        return sizeAfter;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(sizeBefore);
+        out.writeLong(sizeAfter);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        sizeBefore = in.readLong();
+        sizeAfter = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheClearTaskResult.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index e087881..91a501c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -17,16 +17,22 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
-import java.util.Collection;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
 import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.PartitionLossPolicy;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.internal.visor.query.VisorQueryConfiguration;
+import org.apache.ignite.internal.visor.query.VisorQueryEntity;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -34,7 +40,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for cache configuration properties.
  */
-public class VisorCacheConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -62,16 +68,16 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
     /** Start size. */
     private int startSize;
 
-    /** Off-heap max memory. */
-    private long offHeapMaxMemory;
-
     /** Max concurrent async operations. */
     private int maxConcurrentAsyncOps;
 
     /** Cache interceptor. */
     private String interceptor;
 
-    /** Cache affinityCfg config. */
+    /** Default lock acquisition timeout. */
+    private long dfltLockTimeout;
+
+    /** Cache affinity config. */
     private VisorCacheAffinityConfiguration affinityCfg;
 
     /** Preload config. */
@@ -83,14 +89,14 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
     /** Near cache config. */
     private VisorCacheNearConfiguration nearCfg;
 
-    /** Default config. */
-    private VisorCacheDefaultConfiguration dfltCfg;
-
     /** Store config. */
     private VisorCacheStoreConfiguration storeCfg;
 
+    /** Collection of query entities. */
+    private List<VisorQueryEntity> qryEntities;
+
     /** Collection of type metadata. */
-    private Collection<VisorCacheTypeMetadata> typeMeta;
+    private List<VisorCacheJdbcType> jdbcTypes;
 
     /** Whether statistics collection is enabled. */
     private boolean statisticsEnabled;
@@ -108,17 +114,37 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
     private String expiryPlcFactory;
 
     /** Query configuration. */
-    private VisorCacheQueryConfiguration qryCfg;
+    private VisorQueryConfiguration qryCfg;
 
     /** System cache flag. */
     private boolean sys;
 
+    /** Keep binary in store flag. */
+    private boolean storeKeepBinary;
+
+    /** On-heap cache enabled flag. */
+    private boolean onheapCache;
+
+    /** Partition loss policy. */
+    private PartitionLossPolicy partLossPlc;
+
+    /** Query parallelism. */
+    private int qryParallelism;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheConfiguration() {
+        // No-op.
+    }
+
     /**
+     * Create data transfer object for cache configuration properties.
+     *
      * @param ignite Grid.
      * @param ccfg Cache configuration.
-     * @return Data transfer object for cache configuration properties.
      */
-    public VisorCacheConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
+    public VisorCacheConfiguration(IgniteEx ignite, CacheConfiguration ccfg) {
         name = ccfg.getName();
         mode = ccfg.getCacheMode();
         atomicityMode = ccfg.getAtomicityMode();
@@ -129,200 +155,305 @@ public class VisorCacheConfiguration implements Serializable, LessNamingBean {
         startSize = ccfg.getStartSize();
         maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
         interceptor = compactClass(ccfg.getInterceptor());
-        typeMeta = VisorCacheTypeMetadata.list(ccfg.getQueryEntities(), ccfg.getCacheStoreFactory());
+        dfltLockTimeout = ccfg.getDefaultLockTimeout();
+        qryEntities = VisorQueryEntity.list(ccfg.getQueryEntities());
+        jdbcTypes = VisorCacheJdbcType.list(ccfg.getCacheStoreFactory());
         statisticsEnabled = ccfg.isStatisticsEnabled();
         mgmtEnabled = ccfg.isManagementEnabled();
         ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
         writerFactory = compactClass(ccfg.getCacheWriterFactory());
         expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
-        sys = ignite.context().cache().systemCache(ccfg.getName());
 
-        affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
-        rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
-        evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
-        nearCfg = VisorCacheNearConfiguration.from(ccfg);
-        dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
+        sys = ignite.context().cache().systemCache(ccfg.getName());
+        storeKeepBinary = ccfg.isStoreKeepBinary();
+        onheapCache = ccfg.isOnheapCacheEnabled();
+        partLossPlc = ccfg.getPartitionLossPolicy();
+        qryParallelism = ccfg.getQueryParallelism();
 
-        storeCfg = new VisorCacheStoreConfiguration().from(ignite, ccfg);
+        affinityCfg = new VisorCacheAffinityConfiguration(ccfg);
+        rebalanceCfg = new VisorCacheRebalanceConfiguration(ccfg);
+        evictCfg = new VisorCacheEvictionConfiguration(ccfg);
+        nearCfg = new VisorCacheNearConfiguration(ccfg);
 
-        qryCfg = new VisorCacheQueryConfiguration().from(ccfg);
+        storeCfg = new VisorCacheStoreConfiguration(ignite, ccfg);
 
-        return this;
+        qryCfg = new VisorQueryConfiguration(ccfg);
     }
 
     /**
      * @return Cache name.
      */
-    @Nullable public String name() {
+    @Nullable public String getName() {
         return name;
     }
 
     /**
      * @return Cache mode.
      */
-    public CacheMode mode() {
+    public CacheMode getMode() {
         return mode;
     }
 
     /**
-     * @return Cache atomicity mode
+     * @return Cache atomicity mode.
      */
-    public CacheAtomicityMode atomicityMode() {
+    public CacheAtomicityMode getAtomicityMode() {
         return atomicityMode;
     }
 
     /**
      * @return Cache atomicity write ordering mode.
      */
-    public CacheAtomicWriteOrderMode atomicWriteOrderMode() {
+    public CacheAtomicWriteOrderMode getAtomicWriteOrderMode() {
         return atomicWriteOrderMode;
     }
 
     /**
-     * @return Eager ttl flag
-     */
-    public boolean eagerTtl() {
-        return eagerTtl;
-    }
-
-    /**
      * @return Write synchronization mode.
      */
-    public CacheWriteSynchronizationMode writeSynchronizationMode() {
+    public CacheWriteSynchronizationMode getWriteSynchronizationMode() {
         return writeSynchronizationMode;
     }
 
     /**
      * @return Invalidate.
      */
-    public boolean invalidate() {
+    public boolean isInvalidate() {
         return invalidate;
     }
 
     /**
      * @return Start size.
      */
-    public int startSize() {
+    public int getStartSize() {
         return startSize;
     }
 
     /**
-     * @return Off-heap max memory.
-     */
-    public long offsetHeapMaxMemory() {
-        return offHeapMaxMemory;
-    }
-
-    /**
      * @return Max concurrent async operations
      */
-    public int maxConcurrentAsyncOperations() {
+    public int getMaxConcurrentAsyncOperations() {
         return maxConcurrentAsyncOps;
     }
 
     /**
      * @return Cache interceptor.
      */
-    @Nullable public String interceptor() {
+    @Nullable public String getInterceptor() {
         return interceptor;
     }
 
     /**
+     * @return Gets default lock acquisition timeout.
+     */
+    public long getDefaultLockTimeout() {
+        return dfltLockTimeout;
+    }
+
+    /**
      * @return Collection of type metadata.
      */
-    public Collection<VisorCacheTypeMetadata> typeMeta() {
-        return typeMeta;
+    public List<VisorCacheJdbcType> getJdbcTypes() {
+        return jdbcTypes;
+    }
+
+    /**
+     * @return Near cache config.
+     */
+    public VisorCacheNearConfiguration getNearConfiguration() {
+        return nearCfg;
+    }
+
+    /**
+     * @return Eager ttl flag.
+     */
+    public boolean isEagerTtl() {
+        return eagerTtl;
     }
 
     /**
-     * @return {@code true} if cache statistics enabled.
+     * @return Default lock acquisition timeout.
      */
-    public boolean statisticsEnabled() {
+    public long getDfltLockTimeout() {
+        return dfltLockTimeout;
+    }
+
+    /**
+     * @return {@code true} if cache statistics collection enabled.
+     */
+    public boolean isStatisticsEnabled() {
         return statisticsEnabled;
     }
 
     /**
      * @return Whether management is enabled.
      */
-    public boolean managementEnabled() {
+    public boolean isManagementEnabled() {
         return mgmtEnabled;
     }
 
     /**
      * @return Class name of cache loader factory.
      */
-    public String loaderFactory() {
+    public String getLoaderFactory() {
         return ldrFactory;
     }
 
     /**
      * @return Class name of cache writer factory.
      */
-    public String writerFactory() {
+    public String getWriterFactory() {
         return writerFactory;
     }
 
     /**
      * @return Class name of expiry policy factory.
      */
-    public String expiryPolicyFactory() {
+    public String getExpiryPolicyFactory() {
         return expiryPlcFactory;
     }
 
     /**
-     * @return Cache affinityCfg config.
+     * @return Cache affinity config.
      */
-    public VisorCacheAffinityConfiguration affinityConfiguration() {
+    public VisorCacheAffinityConfiguration getAffinityConfiguration() {
         return affinityCfg;
     }
 
     /**
      * @return Preload config.
      */
-    public VisorCacheRebalanceConfiguration rebalanceConfiguration() {
+    public VisorCacheRebalanceConfiguration getRebalanceConfiguration() {
         return rebalanceCfg;
     }
 
     /**
      * @return Eviction config.
      */
-    public VisorCacheEvictionConfiguration evictConfiguration() {
+    public VisorCacheEvictionConfiguration getEvictionConfiguration() {
         return evictCfg;
     }
 
     /**
-     * @return Near cache config.
+     * @return Store config
      */
-    public VisorCacheNearConfiguration nearConfiguration() {
-        return nearCfg;
+    public VisorCacheStoreConfiguration getStoreConfiguration() {
+        return storeCfg;
     }
 
     /**
-     * @return Dgc config
+     * @return Collection of query entities.
      */
-    public VisorCacheDefaultConfiguration defaultConfiguration() {
-        return dfltCfg;
+    public List<VisorQueryEntity> getQueryEntities() {
+        return qryEntities;
     }
 
     /**
-     * @return Store config
+     * @return Collection of query entities.
      */
-    public VisorCacheStoreConfiguration storeConfiguration() {
-        return storeCfg;
+    public VisorQueryConfiguration getQueryConfiguration() {
+        return qryCfg;
     }
 
     /**
-     * @return Cache query configuration.
+     * @return System cache flag.
      */
-    public VisorCacheQueryConfiguration queryConfiguration() {
-        return qryCfg;
+    public boolean isSystem() {
+        return sys;
     }
 
     /**
-     * @return System cache state.
+     * @return Keep binary in store flag.
      */
-    public boolean system() {
-        return sys;
+    public Boolean isStoreKeepBinary() {
+        return storeKeepBinary;
+    }
+
+    /**
+     * @return On-heap cache enabled flag.
+     */
+    public boolean isOnheapCacheEnabled() {
+        return onheapCache;
+    }
+
+    /**
+     * @return Partition loss policy.
+     */
+    public PartitionLossPolicy getPartitionLossPolicy() {
+        return partLossPlc;
+    }
+
+    /**
+     * @return Query parallelism.
+     */
+    public int getQueryParallelism() {
+        return qryParallelism;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeEnum(out, mode);
+        U.writeEnum(out, atomicityMode);
+        U.writeEnum(out, atomicWriteOrderMode);
+        out.writeBoolean(eagerTtl);
+        U.writeEnum(out, writeSynchronizationMode);
+        out.writeBoolean(invalidate);
+        out.writeInt(startSize);
+        out.writeInt(maxConcurrentAsyncOps);
+        U.writeString(out, interceptor);
+        out.writeLong(dfltLockTimeout);
+        out.writeObject(affinityCfg);
+        out.writeObject(rebalanceCfg);
+        out.writeObject(evictCfg);
+        out.writeObject(nearCfg);
+        out.writeObject(storeCfg);
+        U.writeCollection(out, qryEntities);
+        U.writeCollection(out, jdbcTypes);
+        out.writeBoolean(statisticsEnabled);
+        out.writeBoolean(mgmtEnabled);
+        U.writeString(out, ldrFactory);
+        U.writeString(out, writerFactory);
+        U.writeString(out, expiryPlcFactory);
+        out.writeObject(qryCfg);
+        out.writeBoolean(sys);
+        out.writeBoolean(storeKeepBinary);
+        out.writeBoolean(onheapCache);
+        U.writeEnum(out, partLossPlc);
+        out.writeInt(qryParallelism);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer,
+        ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        mode = CacheMode.fromOrdinal(in.readByte());
+        atomicityMode = CacheAtomicityMode.fromOrdinal(in.readByte());
+        atomicWriteOrderMode = CacheAtomicWriteOrderMode.fromOrdinal(in.readByte());
+        eagerTtl = in.readBoolean();
+        writeSynchronizationMode = CacheWriteSynchronizationMode.fromOrdinal(in.readByte());
+        invalidate = in.readBoolean();
+        startSize = in.readInt();
+        maxConcurrentAsyncOps = in.readInt();
+        interceptor = U.readString(in);
+        dfltLockTimeout = in.readLong();
+        affinityCfg = (VisorCacheAffinityConfiguration)in.readObject();
+        rebalanceCfg = (VisorCacheRebalanceConfiguration)in.readObject();
+        evictCfg = (VisorCacheEvictionConfiguration)in.readObject();
+        nearCfg = (VisorCacheNearConfiguration)in.readObject();
+        storeCfg = (VisorCacheStoreConfiguration)in.readObject();
+        qryEntities = U.readList(in);
+        jdbcTypes = U.readList(in);
+        statisticsEnabled = in.readBoolean();
+        mgmtEnabled = in.readBoolean();
+        ldrFactory = U.readString(in);
+        writerFactory = U.readString(in);
+        expiryPlcFactory = U.readString(in);
+        qryCfg = (VisorQueryConfiguration)in.readObject();
+        sys = in.readBoolean();
+        onheapCache = in.readBoolean();
+        partLossPlc = PartitionLossPolicy.fromOrdinal(in.readByte());
+        qryParallelism = in.readInt();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
index c872d98..c2a3c02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
@@ -67,11 +67,11 @@ public class VisorCacheConfigurationCollectorJob
      * @return Data transfer object to send it to Visor.
      */
     protected VisorCacheConfiguration config(CacheConfiguration ccfg) {
-        return new VisorCacheConfiguration().from(ignite, ccfg);
+        return new VisorCacheConfiguration(ignite, ccfg);
     }
 
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheConfigurationCollectorJob.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
deleted file mode 100644
index 03b5020..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheDefaultConfiguration.java
+++ /dev/null
@@ -1,58 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for default cache configuration properties.
- */
-public class VisorCacheDefaultConfiguration implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Default transaction timeout. */
-    private long txLockTimeout;
-
-    /**
-     * @param ccfg Cache configuration.
-     * @return Data transfer object for default cache configuration properties.
-     */
-    public static VisorCacheDefaultConfiguration from(CacheConfiguration ccfg) {
-        VisorCacheDefaultConfiguration cfg = new VisorCacheDefaultConfiguration();
-
-        cfg.txLockTimeout = ccfg.getDefaultLockTimeout();
-
-        return cfg;
-    }
-
-    /**
-     * @return Default transaction timeout.
-     */
-    public long txLockTimeout() {
-        return txLockTimeout;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorCacheDefaultConfiguration.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
index b6f72c4..7792d8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheEvictionConfiguration.java
@@ -17,11 +17,14 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.cache.eviction.EvictionPolicy;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -30,7 +33,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
 /**
  * Data transfer object for eviction configuration properties.
  */
-public class VisorCacheEvictionConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheEvictionConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -44,43 +47,60 @@ public class VisorCacheEvictionConfiguration implements Serializable, LessNaming
     private String filter;
 
     /**
-     * @param ccfg Cache configuration.
-     * @return Data transfer object for eviction configuration properties.
+     * Default constructor.
      */
-    public static VisorCacheEvictionConfiguration from(CacheConfiguration ccfg) {
-        VisorCacheEvictionConfiguration cfg = new VisorCacheEvictionConfiguration();
-
-        final EvictionPolicy plc = ccfg.getEvictionPolicy();
+    public VisorCacheEvictionConfiguration() {
+        // No-op.
+    }
 
-        cfg.plc = compactClass(plc);
-        cfg.plcMaxSize = evictionPolicyMaxSize(plc);
-        cfg.filter = compactClass(ccfg.getEvictionFilter());
+    /**
+     * Create data transfer object for eviction configuration properties.
+     * @param ccfg Cache configuration.
+     */
+    public VisorCacheEvictionConfiguration(CacheConfiguration ccfg) {
+        final EvictionPolicy evictionPlc = ccfg.getEvictionPolicy();
 
-        return cfg;
+        plc = compactClass(evictionPlc);
+        plcMaxSize = evictionPolicyMaxSize(evictionPlc);
+        filter = compactClass(ccfg.getEvictionFilter());
     }
 
     /**
      * @return Eviction policy.
      */
-    @Nullable public String policy() {
+    @Nullable public String getPolicy() {
         return plc;
     }
 
     /**
      * @return Cache eviction policy max size.
      */
-    @Nullable public Integer policyMaxSize() {
+    @Nullable public Integer getPolicyMaxSize() {
         return plcMaxSize;
     }
 
     /**
      * @return Eviction filter to specify which entries should not be evicted.
      */
-    @Nullable public String filter() {
+    @Nullable public String getFilter() {
         return filter;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, plc);
+        out.writeObject(plcMaxSize);
+        U.writeString(out, filter);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        plc = U.readString(in);
+        plcMaxSize = (Integer)in.readObject();
+        filter = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheEvictionConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcType.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcType.java
new file mode 100644
index 0000000..e50402c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcType.java
@@ -0,0 +1,189 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
+import org.apache.ignite.cache.store.jdbc.JdbcType;
+import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
+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.internal.visor.VisorDataTransferObject;
+
+import javax.cache.configuration.Factory;
+
+/**
+ * Data transfer object for {@link JdbcType}.
+ */
+public class VisorCacheJdbcType extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Schema name in database. */
+    private String dbSchema;
+
+    /** Table name in database. */
+    private String dbTbl;
+
+    /** Key class used to store key in cache. */
+    private String keyType;
+
+    /** Value class used to store value in cache. */
+    private String valType;
+
+    /** Key fields. */
+    private List<VisorCacheJdbcTypeField> keyFields;
+
+    /** Value fields. */
+    private List<VisorCacheJdbcTypeField> valFields;
+
+    /**
+     * @param factory Store factory to extract JDBC types info.
+     * @return Data transfer object for cache type metadata configurations.
+     */
+    public static List<VisorCacheJdbcType> list(Factory factory) {
+        List<VisorCacheJdbcType> res = new ArrayList<>();
+
+        if (factory != null || factory instanceof CacheJdbcPojoStoreFactory) {
+            CacheJdbcPojoStoreFactory jdbcFactory = (CacheJdbcPojoStoreFactory) factory;
+
+            JdbcType[] jdbcTypes = jdbcFactory.getTypes();
+
+            if (!F.isEmpty(jdbcTypes)) {
+                for (JdbcType jdbcType : jdbcTypes)
+                    res.add(new VisorCacheJdbcType(jdbcType));
+            }
+        }
+
+        return res;
+    }
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     */
+    public VisorCacheJdbcType() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     *
+     * @param jdbcType JDBC type.
+     */
+    public VisorCacheJdbcType(JdbcType jdbcType) {
+        keyType = jdbcType.getKeyType();
+        valType = jdbcType.getValueType();
+
+        dbSchema = jdbcType.getDatabaseSchema();
+        dbTbl = jdbcType.getDatabaseTable();
+
+        JdbcTypeField[] kFields = jdbcType.getKeyFields();
+
+        if (kFields != null) {
+            keyFields = new ArrayList<>(kFields.length);
+
+            for (JdbcTypeField fld : kFields)
+                keyFields.add(new VisorCacheJdbcTypeField(
+                    fld.getDatabaseFieldName(), fld.getDatabaseFieldType(),
+                    fld.getDatabaseFieldName(), U.compact(fld.getJavaFieldType().getName())));
+        }
+
+        JdbcTypeField[] vFields = jdbcType.getValueFields();
+
+        if (vFields != null) {
+            valFields = new ArrayList<>(vFields.length);
+
+            for (JdbcTypeField fld : vFields)
+                valFields.add(new VisorCacheJdbcTypeField(
+                    fld.getDatabaseFieldName(), fld.getDatabaseFieldType(),
+                    fld.getDatabaseFieldName(), U.compact(fld.getJavaFieldType().getName())));
+        }
+    }
+
+    /**
+     * @return Schema name in database.
+     */
+    public String getDatabaseSchema() {
+        return dbSchema;
+    }
+
+    /**
+     * @return Table name in database.
+     */
+    public String getDatabaseTable() {
+        return dbTbl;
+    }
+
+    /**
+     * @return Key class used to store key in cache.
+     */
+    public String getKeyType() {
+        return keyType;
+    }
+
+    /**
+     * @return Value class used to store value in cache.
+     */
+    public String getValueType() {
+        return valType;
+    }
+
+    /**
+     * @return Key fields.
+     */
+    public List<VisorCacheJdbcTypeField> getKeyFields() {
+        return keyFields;
+    }
+
+    /**
+     * @return Value fields.
+     */
+    public List<VisorCacheJdbcTypeField> getValueFields() {
+        return valFields;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, dbSchema);
+        U.writeString(out, dbTbl);
+        U.writeString(out, keyType);
+        U.writeString(out, valType);
+        U.writeCollection(out, keyFields);
+        U.writeCollection(out, valFields);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        dbSchema = U.readString(in);
+        dbTbl = U.readString(in);
+        keyType = U.readString(in);
+        valType = U.readString(in);
+        keyFields = U.readList(in);
+        valFields = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheJdbcType.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcTypeField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcTypeField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcTypeField.java
new file mode 100644
index 0000000..5486aaf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheJdbcTypeField.java
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for {@link JdbcTypeField}.
+ */
+public class VisorCacheJdbcTypeField extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Column name in database. */
+    private String dbName;
+
+    /** Column JDBC type in database. */
+    private int dbType;
+
+    /** Field name in java object. */
+    private String javaName;
+
+    /** Corresponding java type. */
+    private String javaType;
+
+    /**
+     * Empty constructor.
+     */
+    public VisorCacheJdbcTypeField() {
+        // No-op.
+    }
+
+    /**
+     * Full constructor.
+     *
+     * @param dbName Column name in database.
+     * @param dbType Column JDBC type in database.
+     * @param javaName Field name in java object.
+     * @param javaType Corresponding java type.
+     */
+    public VisorCacheJdbcTypeField(String dbName, int dbType, String javaName, String javaType) {
+        this.dbName = dbName;
+        this.dbType = dbType;
+        this.javaName = javaName;
+        this.javaType = javaType;
+    }
+
+    /**
+     * @return Column name in database.
+     */
+    public String getDatabaseName() {
+        return dbName;
+    }
+
+    /**
+     * @return Column JDBC type in database.
+     */
+    public int getDatabaseType() {
+        return dbType;
+    }
+
+    /**
+     * @return Field name in java object.
+     */
+    public String getJavaName() {
+        return javaName;
+    }
+
+    /**
+     * @return Corresponding java type.
+     */
+    public String getJavaType() {
+        return javaType;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, dbName);
+        out.writeInt(dbType);
+        U.writeString(out, javaName);
+        U.writeString(out, javaType);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        dbName = U.readString(in);
+        dbType = in.readInt();
+        javaName = U.readString(in);
+        javaType = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheJdbcTypeField.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
index 212aaa9..34ae12c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTask.java
@@ -26,7 +26,6 @@ import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.lang.GridTuple3;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
@@ -37,18 +36,18 @@ import org.apache.ignite.internal.visor.VisorOneNodeTask;
  */
 @GridInternal
 public class VisorCacheLoadTask extends
-    VisorOneNodeTask<GridTuple3<Set<String>, Long, Object[]>, Map<String, Integer>> {
+    VisorOneNodeTask<VisorCacheLoadTaskArg, Map<String, Integer>> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Override protected VisorCachesLoadJob job(GridTuple3<Set<String>, Long, Object[]> arg) {
+    @Override protected VisorCachesLoadJob job(VisorCacheLoadTaskArg arg) {
         return new VisorCachesLoadJob(arg, debug);
     }
 
     /** Job that load caches. */
     private static class VisorCachesLoadJob extends
-        VisorJob<GridTuple3<Set<String>, Long, Object[]>, Map<String, Integer>> {
+        VisorJob<VisorCacheLoadTaskArg, Map<String, Integer>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -56,18 +55,17 @@ public class VisorCacheLoadTask extends
          * @param arg Cache names, ttl and loader arguments.
          * @param debug Debug flag.
          */
-        private VisorCachesLoadJob(GridTuple3<Set<String>, Long, Object[]> arg, boolean debug) {
+        private VisorCachesLoadJob(VisorCacheLoadTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected Map<String, Integer> run(GridTuple3<Set<String>, Long, Object[]> arg) {
-            Set<String> cacheNames = arg.get1();
-            Long ttl = arg.get2();
-            Object[] ldrArgs = arg.get3();
+        @Override protected Map<String, Integer> run(VisorCacheLoadTaskArg arg) {
+            Set<String> cacheNames = arg.getCacheNames();
+            long ttl = arg.getTtl();
+            Object[] ldrArgs = arg.getLdrArgs();
 
             assert cacheNames != null && !cacheNames.isEmpty();
-            assert ttl != null;
 
             Map<String, Integer> res = U.newHashMap(cacheNames.size());
 
@@ -96,4 +94,4 @@ public class VisorCacheLoadTask extends
             return S.toString(VisorCachesLoadJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java
new file mode 100644
index 0000000..831446a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheLoadTaskArg.java
@@ -0,0 +1,101 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Set;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for task returns cache load results.
+ */
+public class VisorCacheLoadTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache names to load data. */
+    private Set<String> cacheNames;
+
+    /** Duration a Cache Entry should exist be before it expires after being modified. */
+    private long ttl;
+
+    /** Optional user arguments to be passed into CacheStore.loadCache(IgniteBiInClosure, Object...) method. */
+    private Object[] ldrArgs;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheLoadTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheNames Cache names to load data.
+     * @param ttl Duration a Cache Entry should exist be before it expires after being modified.
+     * @param ldrArgs Optional user arguments to be passed into CacheStore.loadCache(IgniteBiInClosure, Object...) method.
+     */
+    public VisorCacheLoadTaskArg(Set<String> cacheNames, long ttl, Object[] ldrArgs) {
+        this.cacheNames = cacheNames;
+        this.ttl = ttl;
+        this.ldrArgs = ldrArgs;
+    }
+
+    /**
+     * @return Cache names to load data.
+     */
+    public Set<String> getCacheNames() {
+        return cacheNames;
+    }
+
+    /**
+     * @return Duration a Cache Entry should exist be before it expires after being modified.
+     */
+    public long getTtl() {
+        return ttl;
+    }
+
+    /**
+     * @return Optional user arguments to be passed into CacheStore.loadCache(IgniteBiInClosure, Object...) method.
+     */
+    public Object[] getLdrArgs() {
+        return ldrArgs;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeCollection(out, cacheNames);
+        out.writeLong(ttl);
+        U.writeArray(out, ldrArgs);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        cacheNames = U.readSet(in);
+        ttl = in.readLong();
+        ldrArgs = U.readArray(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheLoadTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java
index 6ba783c..598c8cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetadataTask.java
@@ -34,7 +34,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName;
  * Task to get cache SQL metadata.
  */
 @GridInternal
-public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSqlMetadata> {
+public class VisorCacheMetadataTask extends VisorOneNodeTask<String, VisorCacheSqlMetadata> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -46,7 +46,7 @@ public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSq
     /**
      * Job to get cache SQL metadata.
      */
-    private static class VisorCacheMetadataJob extends VisorJob<String, GridCacheSqlMetadata> {
+    private static class VisorCacheMetadataJob extends VisorJob<String, VisorCacheSqlMetadata> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -59,12 +59,18 @@ public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSq
         }
 
         /** {@inheritDoc} */
-        @Override protected GridCacheSqlMetadata run(String cacheName) {
+        @Override protected VisorCacheSqlMetadata run(String cacheName) {
             try {
                 IgniteInternalCache<Object, Object> cache = ignite.cachex(cacheName);
 
-                if (cache != null)
-                    return F.first(cache.context().queries().sqlMetadata());
+                if (cache != null) {
+                    GridCacheSqlMetadata meta = F.first(cache.context().queries().sqlMetadata());
+
+                    if (meta != null)
+                        return new VisorCacheSqlMetadata(meta);
+
+                    return null;
+                }
 
                 throw new IgniteException("Cache not found: " + escapeName(cacheName));
             }
@@ -78,4 +84,4 @@ public class VisorCacheMetadataTask extends VisorOneNodeTask<String, GridCacheSq
             return S.toString(VisorCacheMetadataJob.class, this);
         }
     }
-}
\ No newline at end of file
+}


[32/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorCustomStorageExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorCustomStorageExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorCustomStorageExample.java
new file mode 100644
index 0000000..b2778c5
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorCustomStorageExample.java
@@ -0,0 +1,124 @@
+/*
+ * 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.examples.java8.math.vector;
+
+import java.util.Arrays;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.vector.AbstractVector;
+
+/**
+ * This example shows how to use {@link Vector} based on custom {@link VectorStorage}.
+ */
+public final class VectorCustomStorageExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Vector custom storage API usage example started.");
+
+        System.out.println("\n>>> Creating perpendicular vectors.");
+        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
+        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
+
+        Vector v1 = new VectorCustomStorage(data1);
+        Vector v2 = new VectorCustomStorage(data2);
+
+        System.out.println(">>> First vector: " + Arrays.toString(data1));
+        System.out.println(">>> Second vector: " + Arrays.toString(data2));
+
+        double dotProduct = v1.dot(v2);
+        boolean dotProductIsAsExp = dotProduct == 0;
+
+        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
+            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
+
+        assert dotProductIsAsExp : "Expect dot product of perpendicular vectors to be 0.";
+
+        Vector hypotenuse = v1.plus(v2);
+
+        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
+
+        double lenSquared1 = v1.getLengthSquared();
+        double lenSquared2 = v2.getLengthSquared();
+        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
+
+        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
+
+        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
+        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
+        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
+            + "], equals sum of squared lengths of two original vectors as expected: ["
+            + lenSquaredHypotenuseIsAsExp + "].");
+
+        assert lenSquaredHypotenuseIsAsExp : "Expect squared length of hypotenuse to be as per Pythagorean theorem.";
+
+        System.out.println("\n>>> Vector custom storage API usage example completed.");
+    }
+
+    /**
+     * Example of vector with custom storage, modeled after
+     * {@link org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector}.
+     */
+    static class VectorCustomStorage extends AbstractVector {
+        /**
+         * @param arr Source array.
+         * @param cp {@code true} to clone array, reuse it otherwise.
+         */
+        private VectorStorage mkStorage(double[] arr, boolean cp) {
+            assert arr != null;
+
+            return new ExampleVectorStorage(cp ? arr.clone() : arr);
+        }
+
+        /** */
+        public VectorCustomStorage() {
+            // No-op.
+        }
+
+        /**
+         * @param arr Source array.
+         * @param shallowCp {@code true} to use shallow copy.
+         */
+        VectorCustomStorage(double[] arr, boolean shallowCp) {
+            setStorage(mkStorage(arr, shallowCp));
+        }
+
+        /**
+         * @param arr Source array.
+         */
+        VectorCustomStorage(double[] arr) {
+            this(arr, false);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Matrix likeMatrix(int rows, int cols) {
+            return new DenseLocalOnHeapMatrix(rows, cols);
+        }
+
+        /** {@inheritDoc */
+        @Override public Vector like(int crd) {
+            return new org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector(crd);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorExample.java
new file mode 100644
index 0000000..f852f0a
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/VectorExample.java
@@ -0,0 +1,75 @@
+/*
+ * 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.examples.java8.math.vector;
+
+import java.util.Arrays;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+
+/**
+ * This example shows how to use {@link Vector} API.
+ */
+public final class VectorExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Basic Vector API usage example started.");
+
+        System.out.println("\n>>> Creating perpendicular vectors.");
+        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
+        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
+
+        Vector v1 = new DenseLocalOnHeapVector(data1);
+        Vector v2 = new DenseLocalOnHeapVector(data2);
+
+        System.out.println(">>> First vector: " + Arrays.toString(data1));
+        System.out.println(">>> Second vector: " + Arrays.toString(data2));
+
+        double dotProduct = v1.dot(v2);
+        boolean dotProductIsAsExp = dotProduct == 0;
+
+        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
+            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
+
+        assert dotProductIsAsExp : "Expect dot product of perpendicular vectors to be 0.";
+
+        Vector hypotenuse = v1.plus(v2);
+
+        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
+
+        double lenSquared1 = v1.getLengthSquared();
+        double lenSquared2 = v2.getLengthSquared();
+        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
+
+        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
+
+        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
+        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
+        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
+            + "], equals sum of squared lengths of two original vectors as expected: ["
+            + lenSquaredHypotenuseIsAsExp + "].");
+
+        assert lenSquaredHypotenuseIsAsExp : "Expect squared length of hypotenuse to be as per Pythagorean theorem.";
+
+        System.out.println("\n>>> Basic Vector API usage example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/package-info.java
new file mode 100644
index 0000000..ff09e4e
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Core algebra vector examples.
+ */
+package org.apache.ignite.examples.java8.math.vector;

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/README.txt
----------------------------------------------------------------------
diff --git a/modules/math/README.txt b/modules/math/README.txt
new file mode 100644
index 0000000..a48da21
--- /dev/null
+++ b/modules/math/README.txt
@@ -0,0 +1,15 @@
+Apache Ignite Math Module
+------------------------------
+
+Apache Ignite Math module provides several implementations of vector and matrices.
+
+Module includes on heap and off heap, dense and sparse, local and distributed implementations.
+
+Based on ideas from Apache Mahout.
+
+# Local build with javadoc
+
+Run from project root:
+mvn clean package -Pmath -DskipTests -pl modules/math -am
+
+Find generated jars in target folder.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/math/licenses/apache-2.0.txt b/modules/math/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/math/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/licenses/mit.txt
----------------------------------------------------------------------
diff --git a/modules/math/licenses/mit.txt b/modules/math/licenses/mit.txt
new file mode 100644
index 0000000..00217dc
--- /dev/null
+++ b/modules/math/licenses/mit.txt
@@ -0,0 +1,7 @@
+Copyright <YEAR> <COPYRIGHT HOLDER>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/pom.xml
----------------------------------------------------------------------
diff --git a/modules/math/pom.xml b/modules/math/pom.xml
new file mode 100644
index 0000000..d3b284e
--- /dev/null
+++ b/modules/math/pom.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>ignite-parent</artifactId>
+        <groupId>org.apache.ignite</groupId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-math</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>it.unimi.dsi</groupId>
+            <artifactId>fastutil</artifactId>
+            <version>7.0.12</version>
+        </dependency>
+
+        <dependency>
+            <!-- IMPL NOTE this is to write math benchmarks results, IGN-6530 -->
+            <groupId>com.dropbox.core</groupId>
+            <artifactId>dropbox-core-sdk</artifactId>
+            <version>2.1.1</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>math</id>
+        </profile>
+    </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/Algebra.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/Algebra.java b/modules/math/src/main/java/org/apache/ignite/math/Algebra.java
new file mode 100644
index 0000000..6bfd608
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/Algebra.java
@@ -0,0 +1,571 @@
+/*
+ * 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.
+ */
+
+/*
+Copyright 1999 CERN - European Organization for Nuclear Research.
+Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose
+is hereby granted without fee, provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear in supporting documentation.
+CERN makes no representations about the suitability of this software for any purpose.
+It is provided "as is" without expressed or implied warranty.
+*/
+
+package org.apache.ignite.math;
+
+/**
+ * Miscellaneous arithmetic and algebra functions.
+ * Lifted from Apache Mahout.
+ */
+public class Algebra extends Constants {
+    /** */ private static final double[] STIRLING_CORRECTION = {
+        0.0,
+        8.106146679532726e-02, 4.134069595540929e-02,
+        2.767792568499834e-02, 2.079067210376509e-02,
+        1.664469118982119e-02, 1.387612882307075e-02,
+        1.189670994589177e-02, 1.041126526197209e-02,
+        9.255462182712733e-03, 8.330563433362871e-03,
+        7.573675487951841e-03, 6.942840107209530e-03,
+        6.408994188004207e-03, 5.951370112758848e-03,
+        5.554733551962801e-03, 5.207655919609640e-03,
+        4.901395948434738e-03, 4.629153749334029e-03,
+        4.385560249232324e-03, 4.166319691996922e-03,
+        3.967954218640860e-03, 3.787618068444430e-03,
+        3.622960224683090e-03, 3.472021382978770e-03,
+        3.333155636728090e-03, 3.204970228055040e-03,
+        3.086278682608780e-03, 2.976063983550410e-03,
+        2.873449362352470e-03, 2.777674929752690e-03,
+    };
+
+    /** */ private static final double[] LOG_FACTORIALS = {
+        0.00000000000000000, 0.00000000000000000, 0.69314718055994531,
+        1.79175946922805500, 3.17805383034794562, 4.78749174278204599,
+        6.57925121201010100, 8.52516136106541430, 10.60460290274525023,
+        12.80182748008146961, 15.10441257307551530, 17.50230784587388584,
+        19.98721449566188615, 22.55216385312342289, 25.19122118273868150,
+        27.89927138384089157, 30.67186010608067280, 33.50507345013688888,
+        36.39544520803305358, 39.33988418719949404, 42.33561646075348503,
+        45.38013889847690803, 48.47118135183522388, 51.60667556776437357,
+        54.78472939811231919, 58.00360522298051994, 61.26170176100200198,
+        64.55753862700633106, 67.88974313718153498, 71.25703896716800901
+    };
+
+    /** */ private static final long[] LONG_FACTORIALS = {
+        1L,
+        1L,
+        2L,
+        6L,
+        24L,
+        120L,
+        720L,
+        5040L,
+        40320L,
+        362880L,
+        3628800L,
+        39916800L,
+        479001600L,
+        6227020800L,
+        87178291200L,
+        1307674368000L,
+        20922789888000L,
+        355687428096000L,
+        6402373705728000L,
+        121645100408832000L,
+        2432902008176640000L
+    };
+
+    /** */ private static final double[] DOUBLE_FACTORIALS = {
+        5.109094217170944E19,
+        1.1240007277776077E21,
+        2.585201673888498E22,
+        6.204484017332394E23,
+        1.5511210043330984E25,
+        4.032914611266057E26,
+        1.0888869450418352E28,
+        3.048883446117138E29,
+        8.841761993739701E30,
+        2.652528598121911E32,
+        8.222838654177924E33,
+        2.6313083693369355E35,
+        8.68331761881189E36,
+        2.952327990396041E38,
+        1.0333147966386144E40,
+        3.719933267899013E41,
+        1.3763753091226346E43,
+        5.23022617466601E44,
+        2.0397882081197447E46,
+        8.15915283247898E47,
+        3.34525266131638E49,
+        1.4050061177528801E51,
+        6.041526306337384E52,
+        2.6582715747884495E54,
+        1.196222208654802E56,
+        5.502622159812089E57,
+        2.5862324151116827E59,
+        1.2413915592536068E61,
+        6.082818640342679E62,
+        3.0414093201713376E64,
+        1.5511187532873816E66,
+        8.06581751709439E67,
+        4.274883284060024E69,
+        2.308436973392413E71,
+        1.2696403353658264E73,
+        7.109985878048632E74,
+        4.052691950487723E76,
+        2.350561331282879E78,
+        1.386831185456898E80,
+        8.32098711274139E81,
+        5.075802138772246E83,
+        3.146997326038794E85,
+        1.9826083154044396E87,
+        1.2688693218588414E89,
+        8.247650592082472E90,
+        5.443449390774432E92,
+        3.6471110918188705E94,
+        2.48003554243683E96,
+        1.7112245242814127E98,
+        1.1978571669969892E100,
+        8.504785885678624E101,
+        6.123445837688612E103,
+        4.470115461512686E105,
+        3.307885441519387E107,
+        2.4809140811395404E109,
+        1.8854947016660506E111,
+        1.451830920282859E113,
+        1.1324281178206295E115,
+        8.94618213078298E116,
+        7.15694570462638E118,
+        5.797126020747369E120,
+        4.7536433370128435E122,
+        3.94552396972066E124,
+        3.314240134565354E126,
+        2.8171041143805494E128,
+        2.4227095383672744E130,
+        2.107757298379527E132,
+        1.854826422573984E134,
+        1.6507955160908465E136,
+        1.4857159644817605E138,
+        1.3520015276784033E140,
+        1.2438414054641305E142,
+        1.156772507081641E144,
+        1.0873661566567426E146,
+        1.0329978488239061E148,
+        9.916779348709491E149,
+        9.619275968248216E151,
+        9.426890448883248E153,
+        9.332621544394415E155,
+        9.332621544394418E157,
+        9.42594775983836E159,
+        9.614466715035125E161,
+        9.902900716486178E163,
+        1.0299016745145631E166,
+        1.0813967582402912E168,
+        1.1462805637347086E170,
+        1.2265202031961373E172,
+        1.324641819451829E174,
+        1.4438595832024942E176,
+        1.5882455415227423E178,
+        1.7629525510902457E180,
+        1.974506857221075E182,
+        2.2311927486598138E184,
+        2.543559733472186E186,
+        2.925093693493014E188,
+        3.393108684451899E190,
+        3.96993716080872E192,
+        4.6845258497542896E194,
+        5.574585761207606E196,
+        6.689502913449135E198,
+        8.094298525273444E200,
+        9.875044200833601E202,
+        1.2146304367025332E205,
+        1.506141741511141E207,
+        1.882677176888926E209,
+        2.3721732428800483E211,
+        3.0126600184576624E213,
+        3.856204823625808E215,
+        4.974504222477287E217,
+        6.466855489220473E219,
+        8.471580690878813E221,
+        1.1182486511960037E224,
+        1.4872707060906847E226,
+        1.99294274616152E228,
+        2.690472707318049E230,
+        3.6590428819525483E232,
+        5.0128887482749884E234,
+        6.917786472619482E236,
+        9.615723196941089E238,
+        1.3462012475717523E241,
+        1.8981437590761713E243,
+        2.6953641378881633E245,
+        3.8543707171800694E247,
+        5.550293832739308E249,
+        8.047926057471989E251,
+        1.1749972043909107E254,
+        1.72724589045464E256,
+        2.5563239178728637E258,
+        3.8089226376305687E260,
+        5.7133839564458575E262,
+        8.627209774233244E264,
+        1.3113358856834527E267,
+        2.0063439050956838E269,
+        3.0897696138473515E271,
+        4.789142901463393E273,
+        7.471062926282892E275,
+        1.1729568794264134E278,
+        1.8532718694937346E280,
+        2.946702272495036E282,
+        4.714723635992061E284,
+        7.590705053947223E286,
+        1.2296942187394494E289,
+        2.0044015765453032E291,
+        3.287218585534299E293,
+        5.423910666131583E295,
+        9.003691705778434E297,
+        1.5036165148649983E300,
+        2.5260757449731988E302,
+        4.2690680090047056E304,
+        7.257415615308004E306
+    };
+
+    /**
+     * Efficiently returns the binomial coefficient, often also referred to as
+     * "n over k" or "n choose k". The binomial coefficient is defined as
+     * {@code (n * n-1 * ... * n-k+1 ) / ( 1 * 2 * ... * k )}.
+     * <ul> <li>{@code k&lt;0}: {@code 0}.</li>
+     * <li>{@code k==0}: {@code 1}.</li>
+     * <li>{@code k==1}: {@code n}.</li>
+     * <li>else: {@code (n * n-1 * ... * n-k+1 ) / ( 1 * 2 * ... * k)}.</li>
+     * </ul>
+     *
+     * @param n
+     * @param k
+     * @return Binomial coefficient.
+     */
+    public static double binomial(double n, long k) {
+        if (k < 0)
+            return 0;
+
+        if (k == 0)
+            return 1;
+
+        if (k == 1)
+            return n;
+
+        // binomial(n,k) = (n * n-1 * ... * n-k+1 ) / ( 1 * 2 * ... * k )
+        double a = n - k + 1;
+        double b = 1;
+        double binomial = 1;
+
+        for (long i = k; i-- > 0; )
+            binomial *= (a++) / (b++);
+
+        return binomial;
+    }
+
+    /**
+     * Efficiently returns the binomial coefficient, often also referred to as "n over k" or "n choose k".
+     * The binomial coefficient is defined as
+     * <ul> <li>{@code k&lt;0}: {@code 0}. <li>{@code k==0 || k==n}: {@code 1}. <li>{@code k==1 || k==n-1}:
+     * {@code n}. <li>else: {@code (n * n-1 * ... * n-k+1 ) / ( 1 * 2 * ... * k )}. </ul>
+     *
+     * @param n
+     * @param k
+     * @return Binomial coefficient.
+     */
+    public static double binomial(long n, long k) {
+        if (k < 0)
+            return 0;
+
+        if (k == 0 || k == n)
+            return 1;
+
+        if (k == 1 || k == n - 1)
+            return n;
+
+        if (n > k) {
+            int max = LONG_FACTORIALS.length + DOUBLE_FACTORIALS.length;
+
+            if (n < max) {
+                double nFac = factorial((int)n);
+                double kFac = factorial((int)k);
+                double nMinusKFac = factorial((int)(n - k));
+                double nk = nMinusKFac * kFac;
+
+                if (nk != Double.POSITIVE_INFINITY) // No numeric overflow?
+                    return nFac / nk;
+            }
+
+            if (k > n / 2)
+                k = n - k;
+        }
+
+        // binomial(n,k) = (n * n-1 * ... * n-k+1 ) / ( 1 * 2 * ... * k )
+        long a = n - k + 1;
+        long b = 1;
+        double binomial = 1;
+
+        for (long i = k; i-- > 0; )
+            binomial *= (double)a++ / (b++);
+
+        return binomial;
+    }
+
+    /**
+     * Returns the smallest <code>long &gt;= value</code>.
+     * <dl><dt>Examples: {@code 1.0 -> 1, 1.2 -> 2, 1.9 -> 2}. This
+     * method is safer than using (long) Math.ceil(value), because of possible rounding error.</dt></dl>
+     *
+     * @param val
+     */
+    public static long ceil(double val) {
+        return Math.round(Math.ceil(val));
+    }
+
+    /**
+     * Evaluates the series of Chebyshev polynomials Ti at argument x/2. The series is given by
+     * <pre>
+     *        N-1
+     *         - '
+     *  y  =   &gt;   coef[i] T (x/2)
+     *         -            i
+     *        i=0
+     * </pre>
+     * Coefficients are stored in reverse order, i.e. the zero order term is last in the array.  Note N is the number of
+     * coefficients, not the order. <p> If coefficients are for the interval a to b, x must have been transformed to x
+     * -&lt; 2(2x - b - a)/(b-a) before entering the routine.  This maps x from (a, b) to (-1, 1), over which the
+     * Chebyshev polynomials are defined. <p> If the coefficients are for the inverted interval, in which (a, b) is
+     * mapped to (1/b, 1/a), the transformation required is {@code x -> 2(2ab/x - b - a)/(b-a)}.  If b is infinity, this
+     * becomes {@code x -> 4a/x - 1}. <p> SPEED: <p> Taking advantage of the recurrence properties of the Chebyshev
+     * polynomials, the routine requires one more addition per loop than evaluating a nested polynomial of the same
+     * degree.
+     *
+     * @param x Argument to the polynomial.
+     * @param coef Coefficients of the polynomial.
+     * @param N Number of coefficients.
+     */
+    public static double chbevl(double x, double[] coef, int N) {
+        int p = 0;
+
+        double b0 = coef[p++];
+        double b1 = 0.0;
+        int i = N - 1;
+
+        double b2;
+
+        do {
+            b2 = b1;
+            b1 = b0;
+            b0 = x * b1 - b2 + coef[p++];
+        }
+        while (--i > 0);
+
+        return 0.5 * (b0 - b2);
+    }
+
+    /**
+     * Instantly returns the factorial {@code k!}.
+     *
+     * @param k must hold {@code k &gt;= 0}.
+     */
+    private static double factorial(int k) {
+        if (k < 0)
+            throw new IllegalArgumentException();
+
+        int len1 = LONG_FACTORIALS.length;
+
+        if (k < len1)
+            return LONG_FACTORIALS[k];
+
+        int len2 = DOUBLE_FACTORIALS.length;
+
+        return (k < len1 + len2) ? DOUBLE_FACTORIALS[k - len1] : Double.POSITIVE_INFINITY;
+    }
+
+    /**
+     * Returns the largest <code>long &lt;= value</code>.
+     * <dl><dt>Examples: {@code 1.0 -> 1, 1.2 -> 1, 1.9 -> 1 <dt> 2.0 -> 2, 2.2 -> 2, 2.9 -> 2}</dt></dl>
+     * This method is safer than using (long) Math.floor(value), because of possible rounding error.
+     */
+    public static long floor(double val) {
+        return Math.round(Math.floor(val));
+    }
+
+    /**
+     * Returns {@code log<sub>base</sub>value}.
+     */
+    public static double log(double base, double val) {
+        return Math.log(val) / Math.log(base);
+    }
+
+    /**
+     * Returns {@code log<sub>10</sub>value}.
+     */
+    public static double log10(double val) {
+        // 1.0 / Math.log(10) == 0.43429448190325176
+        return Math.log(val) * 0.43429448190325176;
+    }
+
+    /**
+     * Returns {@code log<sub>2</sub>value}.
+     */
+    public static double log2(double val) {
+        // 1.0 / Math.log(2) == 1.4426950408889634
+        return Math.log(val) * 1.4426950408889634;
+    }
+
+    /**
+     * Returns {@code log(k!)}. Tries to avoid overflows. For {@code k&lt;30} simply looks up a table in O(1).
+     * For {@code k&gt;=30} uses stirlings approximation.
+     *
+     * @param k must hold {@code k &gt;= 0}.
+     */
+    public static double logFactorial(int k) {
+        if (k >= 30) {
+            double r = 1.0 / k;
+            double rr = r * r;
+            double C7 = -5.95238095238095238e-04;
+            double C5 = 7.93650793650793651e-04;
+            double C3 = -2.77777777777777778e-03;
+            double C1 = 8.33333333333333333e-02;
+            double C0 = 9.18938533204672742e-01;
+
+            return (k + 0.5) * Math.log(k) - k + C0 + r * (C1 + rr * (C3 + rr * (C5 + rr * C7)));
+        }
+        else
+            return LOG_FACTORIALS[k];
+    }
+
+    /**
+     * Instantly returns the factorial {@code k!}.
+     *
+     * @param k must hold {@code k >= 0 && k < 21}
+     */
+    public static long longFactorial(int k) {
+        if (k < 0)
+            throw new IllegalArgumentException("Negative k");
+
+        if (k < LONG_FACTORIALS.length)
+            return LONG_FACTORIALS[k];
+
+        throw new IllegalArgumentException("Overflow");
+    }
+
+    /**
+     * Returns the StirlingCorrection.
+     *
+     * Correction term of the Stirling approximation for {@code log(k!)} (series in
+     * 1/k, or table values for small k) with int parameter k. </p> {@code  log k! = (k + 1/2)log(k + 1) - (k + 1) +
+     * (1/2)log(2Pi) + STIRLING_CORRECTION(k + 1) log k! = (k + 1/2)log(k)     -  k      + (1/2)log(2Pi) +
+     * STIRLING_CORRECTION(k) }
+     */
+    public static double stirlingCorrection(int k) {
+        if (k > 30) {
+            double r = 1.0 / k;
+            double rr = r * r;
+            double C7 = -5.95238095238095238e-04;
+            double C5 = 7.93650793650793651e-04;
+            double C3 = -2.77777777777777778e-03;
+            double C1 = 8.33333333333333333e-02;
+
+            return r * (C1 + rr * (C3 + rr * (C5 + rr * C7)));
+        }
+        else
+            return STIRLING_CORRECTION[k];
+    }
+
+    /**
+     * Evaluates the given polynomial of degree {@code N} at {@code x}, assuming coefficient of N is 1.0. Otherwise same
+     * as {@link #evalPoly(double, double[], int)}.
+     * <pre>
+     *                     2          N
+     * y  =  C  + C x + C x  +...+ C x
+     *        0    1     2          N
+     *
+     * where C  = 1 and hence is omitted from the array.
+     *        N
+     *
+     * Coefficients are stored in reverse order:
+     *
+     * coef[0] = C  , ..., coef[N-1] = C  .
+     *            N-1                   0
+     *
+     * Calling arguments are otherwise the same as {@link #evalPoly(double, double[], int)}.
+     * </pre>
+     * In the interest of speed, there are no checks for out of bounds arithmetic.
+     *
+     * @param x Argument to the polynomial.
+     * @param coef Coefficients of the polynomial.
+     * @param n Degree of the polynomial.
+     */
+    public static double evalPoly1(double x, double[] coef, int n) {
+        double res = x + coef[0];
+
+        for (int i = 1; i < n; i++)
+            res = res * x + coef[i];
+
+        return res;
+    }
+
+    /**
+     * Evaluates the given polynomial of degree {@code N} at {@code x}.
+     * <pre>
+     *                     2          N
+     * y  =  C  + C x + C x  +...+ C x
+     *        0    1     2          N
+     *
+     * Coefficients are stored in reverse order:
+     *
+     * coef[0] = C  , ..., coef[N] = C  .
+     *            N                   0
+     * </pre>
+     * In the interest of speed, there are no checks for out of bounds arithmetic.
+     *
+     * @param x Argument to the polynomial.
+     * @param coef Coefficients of the polynomial.
+     * @param n Degree of the polynomial.
+     */
+    public static double evalPoly(double x, double[] coef, int n) {
+        double res = coef[0];
+
+        for (int i = 1; i <= n; i++)
+            res = res * x + coef[i];
+
+        return res;
+    }
+
+    /**
+     * Gets <code>sqrt(a^2 + b^2)</code> without under/overflow.
+     *
+     * @param a
+     * @param b
+     */
+    public static double hypot(double a, double b) {
+        double r;
+
+        if (Math.abs(a) > Math.abs(b)) {
+            r = b / a;
+            r = Math.abs(a) * Math.sqrt(1 + r * r);
+        }
+        else if (b != 0) {
+            r = a / b;
+            r = Math.abs(b) * Math.sqrt(1 + r * r);
+        }
+        else
+            r = 0.0;
+
+        return r;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/Constants.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/Constants.java b/modules/math/src/main/java/org/apache/ignite/math/Constants.java
new file mode 100644
index 0000000..02756b6
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/Constants.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+/*
+Copyright 1999 CERN - European Organization for Nuclear Research.
+Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose
+is hereby granted without fee, provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear in supporting documentation.
+CERN makes no representations about the suitability of this software for any purpose.
+It is provided "as is" without expressed or implied warranty.
+*/
+
+package org.apache.ignite.math;
+
+/**
+ * Math constants. Lifted from Apache Mahout.
+ */
+public class Constants {
+    /** */ public static final double MACHEP = 1.11022302462515654042E-16;
+    /** */ public static final double MAXLOG = 7.09782712893383996732E2;
+    /** */ public static final double MINLOG = -7.451332191019412076235E2;
+    /** */ public static final double MAXGAM = 171.624376956302725;
+    /** */ public static final double SQTPI = 2.50662827463100050242E0;
+    /** */ public static final double SQRTH = 7.07106781186547524401E-1;
+    /** */ public static final double LOGPI = 1.14472988584940017414;
+    /** */ public static final double BIG = 4.503599627370496e15;
+    /** */ public static final double BIGINV = 2.22044604925031308085e-16;
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/Destroyable.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/Destroyable.java b/modules/math/src/main/java/org/apache/ignite/math/Destroyable.java
new file mode 100644
index 0000000..f3b467c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/Destroyable.java
@@ -0,0 +1,30 @@
+/*
+ * 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.math;
+
+/**
+ * Support for destroying objects that are managed outside of JVM.
+ */
+public interface Destroyable {
+    /**
+     * Destroys object if managed outside of JVM. It's a no-op in all other cases.
+     */
+    public default void destroy() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/IdentityValueMapper.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/IdentityValueMapper.java b/modules/math/src/main/java/org/apache/ignite/math/IdentityValueMapper.java
new file mode 100644
index 0000000..65c7024
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/IdentityValueMapper.java
@@ -0,0 +1,53 @@
+/*
+ * 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.math;
+
+/**
+ * Identity value mapper.
+ */
+public class IdentityValueMapper implements ValueMapper<Double> {
+    /** */ private static final long serialVersionUID = -8010078306142216389L;
+
+    /** {@inheritDoc} */
+    @Override public Double fromDouble(double v) {
+        return v;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double toDouble(Double v) {
+        assert v != null;
+
+        return v;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return Long.hashCode(serialVersionUID);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/KeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/KeyMapper.java b/modules/math/src/main/java/org/apache/ignite/math/KeyMapper.java
new file mode 100644
index 0000000..f4f9a39
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/KeyMapper.java
@@ -0,0 +1,33 @@
+/*
+ * 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.math;
+
+import java.io.Serializable;
+
+/**
+ * Maps key objects to index in {@link Vector} or {@link Matrix}.
+ */
+public interface KeyMapper<K> extends Serializable {
+    /**
+     * Checks given cache key corresponds to a valid index in vector or matrix.
+     *
+     * @param k Key to check.
+     * @return {@code true} if there is a valid index, {@code false} otherwise.
+     */
+    public boolean isValid(K k);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/Matrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/Matrix.java b/modules/math/src/main/java/org/apache/ignite/math/Matrix.java
new file mode 100644
index 0000000..ee7a807
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/Matrix.java
@@ -0,0 +1,518 @@
+/*
+ * 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.math;
+
+import java.io.Externalizable;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.functions.IntIntToDoubleFunction;
+
+/**
+ * A matrix interface.
+ *
+ * Based on its flavor it can have vastly different implementations tailored for
+ * for different types of data (e.g. dense vs. sparse), different sizes of data or different operation
+ * optimizations.
+ *
+ * Note also that not all operations can be supported by all underlying implementations. If an operation is not
+ * supported a {@link UnsupportedOperationException} is thrown. This exception can also be thrown in partial cases
+ * where an operation is unsupported only in special cases, e.g. where a given operation cannot be deterministically
+ * completed in polynomial time.
+ *
+ * Based on ideas from <a href="http://mahout.apache.org/">Apache Mahout</a>.
+ */
+public interface Matrix extends MetaAttributes, Externalizable, StorageOpsMetrics, Destroyable {
+    /**
+     * Holder for matrix's element.
+     */
+    interface Element {
+        /**
+         * Gets element's value.
+         *
+         * @return The value of this matrix element.
+         */
+        double get();
+
+        /**
+         * Gets element's row index.
+         *
+         * @return The row index of this element.
+         */
+        int row();
+
+        /**
+         * Gets element's column index.
+         *
+         * @return The column index of this element.
+         */
+        int column();
+
+        /**
+         * Sets element's value.
+         *
+         * @param val Value to set.
+         */
+        void set(double val);
+    }
+
+    /**
+     * Gets the maximum value in this matrix.
+     *
+     * @return Maximum value in this matrix.
+     */
+    public double maxValue();
+
+    /**
+     * Gets the minimum value in this matrix.
+     *
+     * @return Minimum value in this matrix.
+     */
+    public double minValue();
+
+    /**
+     * Gets the maximum element in this matrix.
+     *
+     * @return Maximum element in this matrix.
+     */
+    public Element maxElement();
+
+    /**
+     * Gets the minimum element in this matrix.
+     *
+     * @return Minimum element in this matrix.
+     */
+    public Element minElement();
+
+    /**
+     * Gets the matrix's element at the given coordinates.
+     *
+     * @param row Row index.
+     * @param col Column index.
+     * @return Element at the given coordinates.
+     */
+    public Element getElement(int row, int col);
+
+    /**
+     * Swaps two rows in this matrix.
+     *
+     * @param row1 Row #1.
+     * @param row2 Row #2.
+     * @return This matrix.
+     */
+    public Matrix swapRows(int row1, int row2);
+
+    /**
+     * Swaps two columns in this matrix.
+     *
+     * @param col1 Column #1.
+     * @param col2 Column #2.
+     * @return This matrix.
+     */
+    public Matrix swapColumns(int col1, int col2);
+
+    /**
+     * Assigns given value to all elements of this matrix.
+     *
+     * @param val Value to assign to all elements.
+     * @return This matrix.
+     */
+    public Matrix assign(double val);
+
+    /**
+     * Assigns given values to this matrix.
+     *
+     * @param vals Values to assign.
+     * @return This matrix.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix assign(double[][] vals);
+
+    /**
+     * Assigns values from given matrix to this matrix.
+     *
+     * @param mtx Matrix to assign to this matrix.
+     * @return This matrix.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix assign(Matrix mtx);
+
+    /**
+     * Assigns each matrix element to the value generated by given function.
+     *
+     * @param fun Function that takes the row and column and returns the value to assign.
+     * @return This matrix.
+     */
+    public Matrix assign(IntIntToDoubleFunction fun);
+
+    /**
+     * Maps all values in this matrix through a given function.
+     *
+     * @param fun Mapping function.
+     * @return This matrix.
+     */
+    public Matrix map(IgniteDoubleFunction<Double> fun);
+
+    /**
+     * Maps all values in this matrix through a given function.
+     *
+     * For this matrix <code>A</code>, argument matrix <code>B</code> and the
+     * function <code>F</code> this method maps every cell <code>x, y</code> as:
+     * <code>A(x,y) = fun(A(x,y), B(x,y))</code>
+     *
+     * @param mtx Argument matrix.
+     * @param fun Mapping function.
+     * @return This function.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix map(Matrix mtx, IgniteBiFunction<Double, Double, Double> fun);
+
+    /**
+     * Assigns values from given vector to the specified column in this matrix.
+     *
+     * @param col Column index.
+     * @param vec Vector to get values from.
+     * @return This matrix.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix assignColumn(int col, Vector vec);
+
+    /**
+     * Assigns values from given vector to the specified row in this matrix.
+     *
+     * @param row Row index.
+     * @param vec Vector to get values from.
+     * @return This matrix.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix assignRow(int row, Vector vec);
+
+    /**
+     * Collects the results of applying a given function to all rows in this matrix.
+     *
+     * @param fun Aggregating function.
+     * @return Vector of row aggregates.
+     */
+    public Vector foldRows(IgniteFunction<Vector, Double> fun);
+
+    /**
+     * Collects the results of applying a given function to all columns in this matrix.
+     *
+     * @param fun Aggregating function.
+     * @return Vector of column aggregates.
+     */
+    public Vector foldColumns(IgniteFunction<Vector, Double> fun);
+
+    /**
+     * Folds this matrix into a single value.
+     *
+     * @param foldFun Folding function that takes two parameters: accumulator and the current value.
+     * @param mapFun Mapping function that is called on each matrix cell before its passed to the accumulator (as its
+     * second parameter).
+     * @param <T> Type of the folded value.
+     * @param zeroVal Zero value for fold function.
+     * @return Folded value of this matrix.
+     */
+    public <T> T foldMap(IgniteBiFunction<T, Double, T> foldFun, IgniteDoubleFunction<Double> mapFun, T zeroVal);
+
+    /**
+     * Calculates the density of the matrix based on supplied criteria.
+     * Returns {@code true} if this matrix is denser than threshold with at least 80% confidence.
+     *
+     * @param threshold the threshold value [0, 1] of non-zero elements above which the matrix is considered dense.
+     */
+    public boolean density(double threshold);
+
+    /**
+     * Gets number of columns in this matrix.
+     *
+     * @return The number of columns in this matrix.
+     */
+    public int columnSize();
+
+    /**
+     * Gets number of rows in this matrix.
+     *
+     * @return The number of rows in this matrix.
+     */
+    public int rowSize();
+
+    /**
+     * Returns matrix determinant using Laplace theorem.
+     *
+     * @return A determinant for this matrix.
+     * @throws CardinalityException Thrown if matrix is not square.
+     */
+    public double determinant();
+
+    /**
+     * Returns the inverse matrix of this matrix
+     *
+     * @return Inverse of this matrix
+     */
+    public Matrix inverse();
+
+    /**
+     * Divides each value in this matrix by the argument.
+     *
+     * @param x Divider value.
+     * @return This matrix.
+     */
+    public Matrix divide(double x);
+
+    /**
+     * Gets the matrix value at the provided location.
+     *
+     * @param row Row index.
+     * @param col Column index.
+     * @return Matrix value.
+     * @throws IndexException Thrown in case of index is out of bound.
+     */
+    public double get(int row, int col);
+
+    /**
+     * Gets the matrix value at the provided location without checking boundaries.
+     * This method is marginally quicker than its {@link #get(int, int)} sibling.
+     *
+     * @param row Row index.
+     * @param col Column index.
+     * @return Matrix value.
+     */
+    public double getX(int row, int col);
+
+    /**
+     * Gets matrix storage model.
+     */
+    public MatrixStorage getStorage();
+
+    /**
+     * Clones this matrix.
+     *
+     * NOTE: new matrix will have the same flavor as the this matrix but a different ID.
+     *
+     * @return New matrix of the same underlying class, the same size and the same values.
+     */
+    public Matrix copy();
+
+    /**
+     * Creates new empty matrix of the same underlying class but of different size.
+     *
+     * NOTE: new matrix will have the same flavor as the this matrix but a different ID.
+     *
+     * @param rows Number of rows for new matrix.
+     * @param cols Number of columns for new matrix.
+     * @return New matrix of the same underlying class and size.
+     */
+    public Matrix like(int rows, int cols);
+
+    /**
+     * Creates new empty vector of compatible properties (similar or the same flavor) to this matrix.
+     *
+     * @param crd Cardinality of the vector.
+     * @return Newly created empty vector "compatible" to this matrix.
+     */
+    public Vector likeVector(int crd);
+
+    /**
+     * Creates new matrix where each value is a difference between corresponding value of this matrix and
+     * passed in argument matrix.
+     *
+     * @param mtx Argument matrix.
+     * @return New matrix of the same underlying class and size.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix minus(Matrix mtx);
+
+    /**
+     * Creates new matrix where each value is a sum of the corresponding value of this matrix and
+     * argument value.
+     *
+     * @param x Value to add.
+     * @return New matrix of the same underlying class and size.
+     */
+    public Matrix plus(double x);
+
+    /**
+     * Creates new matrix where each value is a sum of corresponding values of this matrix and
+     * passed in argument matrix.
+     *
+     * @param mtx Argument matrix.
+     * @return New matrix of the same underlying class and size.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix plus(Matrix mtx);
+
+    /**
+     * Auto-generated globally unique matrix ID.
+     *
+     * @return Matrix GUID.
+     */
+    public IgniteUuid guid();
+
+    /**
+     * Sets given value.
+     *
+     * @param row Row index.
+     * @param col Column index.
+     * @param val Value to set.
+     * @return This matrix.
+     * @throws IndexException Thrown in case of either index is out of bound.
+     */
+    public Matrix set(int row, int col, double val);
+
+    /**
+     * Sets values for given row.
+     *
+     * @param row Row index.
+     * @param data Row data to set.
+     * @return This matrix.
+     * @throws IndexException Thrown in case of index is out of bound.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix setRow(int row, double[] data);
+
+    /**
+     * Sets values for given column.
+     *
+     * @param col Column index.
+     * @param data Column data to set.
+     * @return This matrix.
+     * @throws IndexException Thrown in case of index is out of bound.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix setColumn(int col, double[] data);
+
+    /**
+     * Sets given value without checking for index bounds. This method is marginally faster
+     * than its {@link #set(int, int, double)} sibling.
+     *
+     * @param row Row index.
+     * @param col Column index.
+     * @param val Value to set.
+     * @return This matrix.
+     */
+    public Matrix setX(int row, int col, double val);
+
+    /**
+     * Creates new matrix containing the product of given value and values in this matrix.
+     *
+     * @param x Value to multiply.
+     * @return New matrix.
+     */
+    public Matrix times(double x);
+
+    /**
+     * Creates new matrix that is the product of multiplying this matrix and the argument matrix.
+     *
+     * @param mtx Argument matrix.
+     * @return New matrix.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Matrix times(Matrix mtx);
+
+    /**
+     * Creates new matrix that is the product of multiplying this matrix and the argument vector.
+     *
+     * @param vec Argument vector.
+     * @return New matrix.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     */
+    public Vector times(Vector vec);
+
+    /**
+     * Gets maximum absolute row sum norm of this matrix.
+     * See http://mathworld.wolfram.com/MaximumAbsoluteRowSumNorm.html
+     *
+     * @return Maximum absolute row sum norm of this matrix.
+     */
+    public double maxAbsRowSumNorm();
+
+    /**
+     * Gets sum of all elements in the matrix.
+     *
+     * @return Sum of all elements in this matrix.
+     */
+    public double sum();
+
+    /**
+     * Creates new matrix that is transpose of this matrix.
+     *
+     * @return New transposed matrix.
+     */
+    public Matrix transpose();
+
+    /**
+     * Creates new view into this matrix. Changes to the view will be propagated to this matrix.
+     *
+     * @param off View offset as <code>int[x,y]</code>.
+     * @param size View size as <code>int[rows, cols]</code>
+     * @return New view.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     * @throws IndexException Thrown in case of offset is out of bound.
+     */
+    public Matrix viewPart(int[] off, int[] size);
+
+    /**
+     * Creates new view into this matrix. Changes to the view will be propagated to this matrix.
+     *
+     * @param rowOff
+     * @param rows
+     * @param colOff
+     * @param cols
+     * @return New view.
+     * @throws CardinalityException Thrown if cardinalities mismatch.
+     * @throws IndexException Thrown in case of offset is out of bound.
+     */
+    public Matrix viewPart(int rowOff, int rows, int colOff, int cols);
+
+    /**
+     * Creates new view into matrix row. Changes to the view will be propagated to this matrix.
+     *
+     * @param row Row index.
+     * @return New view.
+     * @throws IndexException Thrown in case of index is out of bound.
+     */
+    public Vector viewRow(int row);
+
+    /**
+     * Creates new view into matrix column . Changes to the view will be propagated to this matrix.
+     *
+     * @param col Column index.
+     * @return New view.
+     * @throws IndexException Thrown in case of index is out of bound.
+     */
+    public Vector viewColumn(int col);
+
+    /**
+     * Creates new view into matrix diagonal. Changes to the view will be propagated to this matrix.
+     *
+     * @return New view.
+     */
+    public Vector viewDiagonal();
+
+    /**
+     * Destroys matrix if managed outside of JVM. It's a no-op in all other cases.
+     */
+    public default void destroy() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/MatrixKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/MatrixKeyMapper.java b/modules/math/src/main/java/org/apache/ignite/math/MatrixKeyMapper.java
new file mode 100644
index 0000000..d6ae06f
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/MatrixKeyMapper.java
@@ -0,0 +1,30 @@
+/*
+ * 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.math;
+
+/**
+ * Maps {@link Matrix} row and column index to cache key.
+ */
+public interface MatrixKeyMapper<K> extends KeyMapper<K> {
+    /**
+     * @param x Matrix row index.
+     * @param y Matrix column index.
+     * @return Cache key for given row and column.
+     */
+    public K apply(int x, int y);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/MatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/MatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/MatrixStorage.java
new file mode 100644
index 0000000..11eced7
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/MatrixStorage.java
@@ -0,0 +1,58 @@
+/*
+ * 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.math;
+
+import java.io.Externalizable;
+
+/**
+ * Data storage support for {@link Matrix}.
+ */
+public interface MatrixStorage extends Externalizable, StorageOpsMetrics, Destroyable {
+    /**
+     * @param x Matrix row index.
+     * @param y Matrix column index.
+     * @return Value corresponding to given row and column.
+     */
+    public double get(int x, int y);
+
+    /**
+     * @param x Matrix row index.
+     * @param y Matrix column index.
+     * @param v Value to set at given row and column.
+     */
+    public void set(int x, int y, double v);
+
+    /**
+     *
+     */
+    public int columnSize();
+
+    /**
+     *
+     */
+    public int rowSize();
+
+    /**
+     * Gets underlying array if {@link StorageOpsMetrics#isArrayBased()} returns {@code true}.
+     *
+     * @see StorageOpsMetrics#isArrayBased()
+     */
+    default public double[][] data() {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/MetaAttributes.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/MetaAttributes.java b/modules/math/src/main/java/org/apache/ignite/math/MetaAttributes.java
new file mode 100644
index 0000000..8973b55
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/MetaAttributes.java
@@ -0,0 +1,76 @@
+/*
+ * 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.math;
+
+import java.util.Map;
+
+/**
+ * Interface provides support for meta attributes on vectors and matrices.
+ */
+public interface MetaAttributes {
+    /**
+     * Implementation should return an instance of the map to store meta attributes.
+     */
+    public Map<String, Object> getMetaStorage();
+
+    /**
+     * Gets meta attribute with given name.
+     *
+     * @param name Name of the vector meta attribute to get.
+     * @param <T> Attribute's type.
+     */
+    @SuppressWarnings("unchecked")
+    public default <T> T getAttribute(String name) {
+        return (T)getMetaStorage().get(name);
+    }
+
+    /**
+     * Sets meta attribute with given name and value.
+     *
+     * @param name Name of the meta attribute.
+     * @param val Attribute value.
+     * @param <T> Attribute's type.
+     */
+    public default <T> void setAttribute(String name, T val) {
+        getMetaStorage().put(name, val);
+    }
+
+    /**
+     * Removes meta attribute with given name.
+     *
+     * @param name Name of the meta attribute.
+     * @return {@code true} if attribute was present and was removed, {@code false} otherwise.
+     */
+    public default boolean removeAttribute(String name) {
+        boolean is = getMetaStorage().containsKey(name);
+
+        if (is)
+            getMetaStorage().remove(name);
+
+        return is;
+    }
+
+    /**
+     * Checks if given meta attribute is present.
+     *
+     * @param name Attribute name to check.
+     */
+    public default boolean hasAttribute(String name) {
+        return getMetaStorage().containsKey(name);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/MurmurHash.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/MurmurHash.java b/modules/math/src/main/java/org/apache/ignite/math/MurmurHash.java
new file mode 100644
index 0000000..3d1252e
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/MurmurHash.java
@@ -0,0 +1,246 @@
+/*
+ * 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.math;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * This is a very fast, non-cryptographic hash suitable for general hash-based lookup.
+ *
+ * See http://murmurhash.googlepages.com/ for mre details.
+ */
+public class MurmurHash {
+    /** Hide it. */
+    private MurmurHash() {
+    }
+
+    /**
+     * This produces exactly the same hash values as the final C+ version of MurmurHash3 and is
+     * thus suitable for producing the same hash values across platforms.
+     *
+     * The 32 bit x86 version of this hash should be the fastest variant for relatively short keys like IDs.
+     *
+     * Note - The x86 and x64 versions do _not_ produce the same results, as the algorithms are
+     * optimized for their respective platforms.
+     *
+     * See also http://github.com/yonik/java_util for future updates to this method.
+     *
+     * @param data
+     * @param off
+     * @param len
+     * @param seed
+     * @return 32 bit hash platform compatible with C++ MurmurHash3 implementation on x86.
+     */
+    public static int hash3X86(byte[] data, int off, int len, int seed) {
+        int c1 = 0xcc9e2d51;
+        int c2 = 0x1b873593;
+
+        int h1 = seed;
+        int roundedEnd = off + (len & 0xfffffffc);  // Round down to 4 byte block.
+
+        for (int i = off; i < roundedEnd; i += 4) {
+            int k1 = (data[i] & 0xff) | ((data[i + 1] & 0xff) << 8) | ((data[i + 2] & 0xff) << 16) | (data[i + 3] << 24);
+
+            k1 *= c1;
+            k1 = (k1 << 15) | (k1 >>> 17);
+            k1 *= c2;
+
+            h1 ^= k1;
+            h1 = (h1 << 13) | (h1 >>> 19);
+            h1 = h1 * 5 + 0xe6546b64;
+        }
+
+        // Tail.
+        int k1 = 0;
+
+        switch (len & 0x03) {
+            case 3:
+                k1 = (data[roundedEnd + 2] & 0xff) << 16;
+                // Fallthrough - WTF?
+            case 2:
+                k1 |= (data[roundedEnd + 1] & 0xff) << 8;
+                // Fallthrough - WTF?
+            case 1:
+                k1 |= data[roundedEnd] & 0xff;
+                k1 *= c1;
+                k1 = (k1 << 15) | (k1 >>> 17);
+                k1 *= c2;
+                h1 ^= k1;
+            default:
+        }
+
+        // Finalization.
+        h1 ^= len;
+
+        h1 ^= h1 >>> 16;
+        h1 *= 0x85ebca6b;
+        h1 ^= h1 >>> 13;
+        h1 *= 0xc2b2ae35;
+        h1 ^= h1 >>> 16;
+
+        return h1;
+    }
+
+    /**
+     * Hashes an int.
+     *
+     * @param data The int to hash.
+     * @param seed The seed for the hash.
+     * @return The 32 bit hash of the bytes in question.
+     */
+    public static int hash(int data, int seed) {
+        byte[] arr = new byte[] {
+            (byte)(data >>> 24),
+            (byte)(data >>> 16),
+            (byte)(data >>> 8),
+            (byte)data
+        };
+
+        return hash(ByteBuffer.wrap(arr), seed);
+    }
+
+    /**
+     * Hashes bytes in an array.
+     *
+     * @param data The bytes to hash.
+     * @param seed The seed for the hash.
+     * @return The 32 bit hash of the bytes in question.
+     */
+    public static int hash(byte[] data, int seed) {
+        return hash(ByteBuffer.wrap(data), seed);
+    }
+
+    /**
+     * Hashes bytes in part of an array.
+     *
+     * @param data The data to hash.
+     * @param off Where to start munging.
+     * @param len How many bytes to process.
+     * @param seed The seed to start with.
+     * @return The 32-bit hash of the data in question.
+     */
+    public static int hash(byte[] data, int off, int len, int seed) {
+        return hash(ByteBuffer.wrap(data, off, len), seed);
+    }
+
+    /**
+     * Hashes the bytes in a buffer from the current position to the limit.
+     *
+     * @param buf The bytes to hash.
+     * @param seed The seed for the hash.
+     * @return The 32 bit murmur hash of the bytes in the buffer.
+     */
+    public static int hash(ByteBuffer buf, int seed) {
+        ByteOrder byteOrder = buf.order();
+        buf.order(ByteOrder.LITTLE_ENDIAN);
+
+        int m = 0x5bd1e995;
+        int r = 24;
+
+        int h = seed ^ buf.remaining();
+
+        while (buf.remaining() >= 4) {
+            int k = buf.getInt();
+
+            k *= m;
+            k ^= k >>> r;
+            k *= m;
+
+            h *= m;
+            h ^= k;
+        }
+
+        if (buf.remaining() > 0) {
+            ByteBuffer finish = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN);
+
+            finish.put(buf).rewind();
+
+            h ^= finish.getInt();
+            h *= m;
+        }
+
+        h ^= h >>> 13;
+        h *= m;
+        h ^= h >>> 15;
+
+        buf.order(byteOrder);
+
+        return h;
+    }
+
+    /**
+     * @param data
+     * @param seed
+     */
+    public static long hash64A(byte[] data, int seed) {
+        return hash64A(ByteBuffer.wrap(data), seed);
+    }
+
+    /**
+     * @param data
+     * @param off
+     * @param len
+     * @param seed
+     */
+    public static long hash64A(byte[] data, int off, int len, int seed) {
+        return hash64A(ByteBuffer.wrap(data, off, len), seed);
+    }
+
+    /**
+     * @param buf
+     * @param seed
+     */
+    public static long hash64A(ByteBuffer buf, int seed) {
+        ByteOrder byteOrder = buf.order();
+        buf.order(ByteOrder.LITTLE_ENDIAN);
+
+        long m = 0xc6a4a7935bd1e995L;
+        int r = 47;
+
+        long h = seed ^ (buf.remaining() * m);
+
+        while (buf.remaining() >= 8) {
+            long k = buf.getLong();
+
+            k *= m;
+            k ^= k >>> r;
+            k *= m;
+
+            h ^= k;
+            h *= m;
+        }
+
+        if (buf.remaining() > 0) {
+            ByteBuffer finish = ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN);
+
+            finish.put(buf).rewind();
+
+            h ^= finish.getLong();
+            h *= m;
+        }
+
+        h ^= h >>> r;
+        h *= m;
+        h ^= h >>> r;
+
+        buf.order(byteOrder);
+
+        return h;
+    }
+}


[44/50] [abbrv] ignite git commit: Updated Ignite DOAP

Posted by sb...@apache.org.
Updated Ignite DOAP


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

Branch: refs/heads/ignite-1561-1
Commit: 0db4cebea76ad15990dfbad2d152e79168048514
Parents: 51ea6c2
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Apr 14 22:04:43 2017 -0700
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Apr 14 22:04:43 2017 -0700

----------------------------------------------------------------------
 doap_Ignite.rdf | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0db4cebe/doap_Ignite.rdf
----------------------------------------------------------------------
diff --git a/doap_Ignite.rdf b/doap_Ignite.rdf
index afe4035..3dc641b 100644
--- a/doap_Ignite.rdf
+++ b/doap_Ignite.rdf
@@ -41,8 +41,15 @@
     <programming-language>ODBC</programming-language>
 
     <category rdf:resource="http://projects.apache.org/category/big-data" />
+    <category rdf:resource="http://projects.apache.org/category/sql" />
+    <category rdf:resource="http://projects.apache.org/category/cloud" />
+    <category rdf:resource="http://projects.apache.org/category/database" />
+    <category rdf:resource="http://projects.apache.org/category/hadoop" />
     <category rdf:resource="http://projects.apache.org/category/network-server" />
     <category rdf:resource="http://projects.apache.org/category/network-client" />
+    <category rdf:resource="http://projects.apache.org/category/osgi" />
+    <category rdf:resource="http://projects.apache.org/category/IoT" />
+
 
     <repository>
       <GitRepository>
@@ -52,8 +59,8 @@
     </repository>
     <maintainer>
       <foaf:Person>
-        <foaf:name>Dmitriy Setrakyan</foaf:name>
-          <foaf:mbox rdf:resource="mailto:dsetrakyan@apache.org"/>
+        <foaf:name>Denis Magda</foaf:name>
+          <foaf:mbox rdf:resource="mailto:dmagda@apache.org"/>
       </foaf:Person>
     </maintainer>
     <asfext:implements><asfext:Standard>


[49/50] [abbrv] ignite git commit: ignite-4955 - Correctly execute SQL queries started on replicated cache. - Fixes #1806.

Posted by sb...@apache.org.
ignite-4955 - Correctly execute SQL queries started on replicated cache. - Fixes #1806.

Signed-off-by: Sergi Vladykin <se...@gmail.com>


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

Branch: refs/heads/ignite-1561-1
Commit: ded599aed95501d7553dcf326590d9440a5e9ef7
Parents: 86c4058
Author: Sergi Vladykin <se...@gmail.com>
Authored: Mon Apr 17 10:03:20 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Mon Apr 17 10:03:20 2017 +0300

----------------------------------------------------------------------
 .../ignite/cache/query/SqlFieldsQuery.java      |  25 +++
 .../org/apache/ignite/cache/query/SqlQuery.java |  31 +++-
 .../processors/cache/IgniteCacheProxy.java      |   4 +-
 .../cache/query/GridCacheSqlQuery.java          | 114 ++++----------
 .../cache/query/GridCacheTwoStepQuery.java      |  26 +++-
 .../processors/query/h2/IgniteH2Indexing.java   |  34 ++--
 .../query/h2/sql/GridSqlQuerySplitter.java      |  85 ++++------
 .../query/h2/twostep/GridMapQueryExecutor.java  |  68 +++++---
 .../h2/twostep/GridReduceQueryExecutor.java     | 154 ++++++++++---------
 .../h2/twostep/msg/GridH2QueryRequest.java      | 109 ++++++++++---
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |  51 +++---
 ...teCacheJoinPartitionedAndReplicatedTest.java |  10 ++
 ...iteCacheReplicatedFieldsQueryROSelfTest.java |  27 ++++
 .../query/IgniteSqlSplitterSelfTest.java        | 125 +++++++++++++--
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +-
 15 files changed, 563 insertions(+), 304 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
index 1f10ca8..8c3a4fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
@@ -67,6 +67,9 @@ public class SqlFieldsQuery extends Query<List<?>> {
     /** */
     private boolean distributedJoins;
 
+    /** */
+    private boolean replicatedOnly;
+
     /**
      * Constructs SQL fields query.
      *
@@ -236,6 +239,28 @@ public class SqlFieldsQuery extends Query<List<?>> {
         return (SqlFieldsQuery)super.setLocal(loc);
     }
 
+    /**
+     * Specify if the query contains only replicated tables.
+     * This is a hint for potentially more effective execution.
+     *
+     * @param replicatedOnly The query contains only replicated tables.
+     * @return {@code this} For chaining.
+     */
+    public SqlFieldsQuery setReplicatedOnly(boolean replicatedOnly) {
+        this.replicatedOnly = replicatedOnly;
+
+        return this;
+    }
+
+    /**
+     * Check is the query contains only replicated tables.
+     *
+     * @return {@code true} If the query contains only replicated tables.
+     */
+    public boolean isReplicatedOnly() {
+        return replicatedOnly;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(SqlFieldsQuery.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
index d77e5ce..944c70e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
@@ -53,6 +53,9 @@ public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
     /** */
     private boolean distributedJoins;
 
+    /** */
+    private boolean replicatedOnly;
+
     /**
      * Constructs query for the given type name and SQL query.
      *
@@ -197,7 +200,7 @@ public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
      * @param type Type.
      * @return {@code this} For chaining.
      */
-    public SqlQuery setType(Class<?> type) {
+    public SqlQuery<K, V> setType(Class<?> type) {
         return setType(QueryUtils.typeName(type));
     }
 
@@ -210,7 +213,7 @@ public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
      * @param distributedJoins Distributed joins enabled.
      * @return {@code this} For chaining.
      */
-    public SqlQuery setDistributedJoins(boolean distributedJoins) {
+    public SqlQuery<K, V> setDistributedJoins(boolean distributedJoins) {
         this.distributedJoins = distributedJoins;
 
         return this;
@@ -219,12 +222,34 @@ public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
     /**
      * Check if distributed joins are enabled for this query.
      *
-     * @return {@code true} If distributed joind enabled.
+     * @return {@code true} If distributed joins enabled.
      */
     public boolean isDistributedJoins() {
         return distributedJoins;
     }
 
+    /**
+     * Specify if the query contains only replicated tables.
+     * This is a hint for potentially more effective execution.
+     *
+     * @param replicatedOnly The query contains only replicated tables.
+     * @return {@code this} For chaining.
+     */
+    public SqlQuery<K, V> setReplicatedOnly(boolean replicatedOnly) {
+        this.replicatedOnly = replicatedOnly;
+
+        return this;
+    }
+
+    /**
+     * Check is the query contains only replicated tables.
+     *
+     * @return {@code true} If the query contains only replicated tables.
+     */
+    public boolean isReplicatedOnly() {
+        return replicatedOnly;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(SqlQuery.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 14edcac..98f2f93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -780,7 +780,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
 
                 final SqlQuery p = (SqlQuery)qry;
 
-                if (isReplicatedDataNode() || ctx.isLocal() || qry.isLocal())
+                if ((p.isReplicatedOnly() && isReplicatedDataNode()) || ctx.isLocal() || qry.isLocal())
                      return (QueryCursor<R>)ctx.kernalContext().query().queryLocal(ctx, p,
                                 opCtxCall != null && opCtxCall.isKeepBinary());
 
@@ -794,7 +794,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
 
                 SqlFieldsQuery p = (SqlFieldsQuery)qry;
 
-                if (isReplicatedDataNode() || ctx.isLocal() || qry.isLocal())
+                if ((p.isReplicatedOnly() && isReplicatedDataNode()) || ctx.isLocal() || qry.isLocal())
                     return (QueryCursor<R>)ctx.kernalContext().query().queryLocalFields(ctx, p);
 
                 return (QueryCursor<R>)ctx.kernalContext().query().queryTwoStep(ctx, p);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index ea07fb7..780e462 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -21,17 +21,11 @@ import java.nio.ByteBuffer;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -39,7 +33,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 /**
  * Query.
  */
-public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
+public class GridCacheSqlQuery implements Message {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -51,26 +45,12 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
     private String qry;
 
     /** */
-    @GridToStringInclude(sensitive = true)
-    @GridDirectTransient
-    private Object[] params;
-
-    /** */
-    private byte[] paramsBytes;
-
-    /** */
     @GridToStringInclude
-    @GridDirectTransient
     private int[] paramIdxs;
 
     /** */
     @GridToStringInclude
     @GridDirectTransient
-    private int paramsSize;
-
-    /** */
-    @GridToStringInclude
-    @GridDirectTransient
     private LinkedHashMap<String, ?> cols;
 
     /** Field kept for backward compatibility. */
@@ -140,13 +120,6 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
     }
 
     /**
-     * @return Parameters.
-     */
-    public Object[] parameters() {
-        return params;
-    }
-
-    /**
      * @return Parameter indexes.
      */
     public int[] parameterIndexes() {
@@ -154,57 +127,16 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
     }
 
     /**
-     * @param params Parameters.
      * @param paramIdxs Parameter indexes.
-     * @return {@code this} For chaining.
+     * @return {@code this}.
      */
-    public GridCacheSqlQuery parameters(Object[] params, int[] paramIdxs) {
-        this.params = F.isEmpty(params) ? EMPTY_PARAMS : params;
-
-        paramsSize = this.params.length;
-
+    public GridCacheSqlQuery parameterIndexes(int[] paramIdxs) {
         this.paramIdxs = paramIdxs;
 
         return this;
     }
 
     /** {@inheritDoc} */
-    @Override public void marshall(Marshaller m) {
-        if (paramsBytes != null)
-            return;
-
-        assert params != null;
-
-        try {
-            paramsBytes = U.marshal(m, params);
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unmarshall(Marshaller m, GridKernalContext ctx) {
-        if (params != null)
-            return;
-
-        assert paramsBytes != null;
-
-        try {
-            final ClassLoader ldr = U.resolveClassLoader(ctx.config());
-
-            if (m instanceof BinaryMarshaller)
-                // To avoid deserializing of enum types.
-                params = ((BinaryMarshaller)m).binaryMarshaller().unmarshal(paramsBytes, ldr);
-            else
-                params = U.unmarshal(m, paramsBytes, ldr);
-        }
-        catch (IgniteCheckedException e) {
-            throw new IgniteException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
     @Override public void onAckReceived() {
         // No-op.
     }
@@ -239,7 +171,7 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
                 writer.incrementState();
 
             case 2:
-                if (!writer.writeByteArray("paramsBytes", paramsBytes))
+                if (!writer.writeIntArray("paramIdxs", paramIdxs))
                     return false;
 
                 writer.incrementState();
@@ -280,7 +212,7 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
                 reader.incrementState();
 
             case 2:
-                paramsBytes = reader.readByteArray("paramsBytes");
+                paramIdxs = reader.readIntArray("paramIdxs");
 
                 if (!reader.isLastRead())
                     return false;
@@ -311,28 +243,17 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
     }
 
     /**
-     * @param args Arguments.
      * @return Copy.
      */
-    public GridCacheSqlQuery copy(Object[] args) {
+    public GridCacheSqlQuery copy() {
         GridCacheSqlQuery cp = new GridCacheSqlQuery();
 
         cp.qry = qry;
         cp.cols = cols;
         cp.paramIdxs = paramIdxs;
-        cp.paramsSize = paramsSize;
         cp.sort = sort;
         cp.partitioned = partitioned;
 
-        if (F.isEmpty(args))
-            cp.params = EMPTY_PARAMS;
-        else {
-            cp.params = new Object[paramsSize];
-
-            for (int paramIdx : paramIdxs)
-                cp.params[paramIdx] = args[paramIdx];
-        }
-
         return cp;
     }
 
@@ -380,4 +301,27 @@ public class GridCacheSqlQuery implements Message, GridCacheQueryMarshallable {
 
         return this;
     }
+
+    /**
+     * @param allParams All parameters.
+     * @return Parameters only for this query.
+     */
+    public Object[] parameters(Object[] allParams) {
+        if (F.isEmpty(paramIdxs))
+            return EMPTY_PARAMS;
+
+        assert !F.isEmpty(allParams);
+
+        int maxIdx = paramIdxs[paramIdxs.length - 1];
+
+        Object[] res = new Object[maxIdx + 1];
+
+        for (int i = 0; i < paramIdxs.length; i++) {
+            int idx = paramIdxs[i];
+
+            res[idx] = allParams[idx];
+        }
+
+        return res;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index c127eeb..0e31dc0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -95,7 +95,7 @@ public class GridCacheTwoStepQuery {
     /**
      * Check if distributed joins are enabled for this query.
      *
-     * @return {@code true} If distributed joind enabled.
+     * @return {@code true} If distributed joins enabled.
      */
     public boolean distributedJoins() {
         return distributedJoins;
@@ -146,12 +146,23 @@ public class GridCacheTwoStepQuery {
 
     /**
      * @param qry SQL Query.
-     * @return {@code this}.
      */
-    public GridCacheTwoStepQuery addMapQuery(GridCacheSqlQuery qry) {
+    public void addMapQuery(GridCacheSqlQuery qry) {
         mapQrys.add(qry);
+    }
+
+    /**
+     * @return {@code true} If all the map queries contain only replicated tables.
+     */
+    public boolean isReplicatedOnly() {
+        assert !mapQrys.isEmpty();
+
+        for (int i = 0; i < mapQrys.size(); i++) {
+            if (mapQrys.get(i).isPartitioned())
+                return false;
+        }
 
-        return this;
+        return true;
     }
 
     /**
@@ -246,10 +257,9 @@ public class GridCacheTwoStepQuery {
     }
 
     /**
-     * @param args New arguments to copy with.
      * @return Copy.
      */
-    public GridCacheTwoStepQuery copy(Object[] args) {
+    public GridCacheTwoStepQuery copy() {
         assert !explain;
 
         GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, schemas, tbls);
@@ -257,13 +267,13 @@ public class GridCacheTwoStepQuery {
         cp.caches = caches;
         cp.extraCaches = extraCaches;
         cp.spaces = spaces;
-        cp.rdc = rdc.copy(args);
+        cp.rdc = rdc.copy();
         cp.skipMergeTbl = skipMergeTbl;
         cp.pageSize = pageSize;
         cp.distributedJoins = distributedJoins;
 
         for (int i = 0; i < mapQrys.size(); i++)
-            cp.mapQrys.add(mapQrys.get(i).copy(args));
+            cp.mapQrys.add(mapQrys.get(i).copy());
 
         return cp;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 5f2d8c0..531b760 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -78,7 +78,6 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -91,8 +90,6 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
 import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
-import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
-import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
 import org.apache.ignite.internal.processors.query.GridQueryCancel;
 import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
 import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
@@ -101,8 +98,8 @@ import org.apache.ignite.internal.processors.query.GridQueryIndexDescriptor;
 import org.apache.ignite.internal.processors.query.GridQueryIndexing;
 import org.apache.ignite.internal.processors.query.GridQueryProperty;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
 import org.apache.ignite.internal.processors.query.h2.database.H2PkHashIndex;
 import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
 import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
@@ -110,6 +107,7 @@ import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasInnerI
 import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasLeafIO;
 import org.apache.ignite.internal.processors.query.h2.database.io.H2InnerIO;
 import org.apache.ignite.internal.processors.query.h2.database.io.H2LeafIO;
+import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2DefaultTableEngine;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOffheap;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap;
@@ -1299,13 +1297,18 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @param enforceJoinOrder Enforce join order of tables.
      * @return Iterable result.
      */
-    private Iterable<List<?>> runQueryTwoStep(final GridCacheContext<?,?> cctx, final GridCacheTwoStepQuery qry,
-        final boolean keepCacheObj, final boolean enforceJoinOrder,
+    private Iterable<List<?>> runQueryTwoStep(
+        final GridCacheContext<?,?> cctx,
+        final GridCacheTwoStepQuery qry,
+        final boolean keepCacheObj,
+        final boolean enforceJoinOrder,
         final int timeoutMillis,
-        final GridQueryCancel cancel) {
+        final GridQueryCancel cancel,
+        final Object[] params
+    ) {
         return new Iterable<List<?>>() {
             @Override public Iterator<List<?>> iterator() {
-                return rdcQryExec.query(cctx, qry, keepCacheObj, enforceJoinOrder, timeoutMillis, cancel);
+                return rdcQryExec.query(cctx, qry, keepCacheObj, enforceJoinOrder, timeoutMillis, cancel, params);
             }
         };
     }
@@ -1403,7 +1406,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         TwoStepCachedQuery cachedQry = twoStepCache.get(cachedQryKey);
 
         if (cachedQry != null) {
-            twoStepQry = cachedQry.twoStepQry.copy(qry.getArgs());
+            twoStepQry = cachedQry.twoStepQry.copy();
             meta = cachedQry.meta;
         }
         else {
@@ -1539,12 +1542,13 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             cancel = new GridQueryCancel();
 
         QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(
-            runQueryTwoStep(cctx, twoStepQry, cctx.keepBinary(), enforceJoinOrder, qry.getTimeout(), cancel), cancel);
+            runQueryTwoStep(cctx, twoStepQry, cctx.keepBinary(), enforceJoinOrder, qry.getTimeout(), cancel, qry.getArgs()),
+            cancel);
 
         cursor.fieldsMeta(meta);
 
         if (cachedQry == null && !twoStepQry.explain()) {
-            cachedQry = new TwoStepCachedQuery(meta, twoStepQry.copy(null));
+            cachedQry = new TwoStepCachedQuery(meta, twoStepQry.copy());
             twoStepCache.putIfAbsent(cachedQryKey, cachedQry);
         }
 
@@ -1556,7 +1560,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      */
     private void checkCacheIndexSegmentation(List<Integer> caches) {
         if (caches.isEmpty())
-            return; //Nnothing to check
+            return; // Nothing to check
 
         GridCacheSharedContext sharedContext = ctx.cache().context();
 
@@ -1567,12 +1571,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
             assert cctx != null;
 
-            if(!cctx.isPartitioned())
+            if (!cctx.isPartitioned())
                 continue;
 
-            if(expectedParallelism == 0)
+            if (expectedParallelism == 0)
                 expectedParallelism = cctx.config().getQueryParallelism();
-            else if (expectedParallelism != 0 && cctx.config().getQueryParallelism() != expectedParallelism)
+            else if (cctx.config().getQueryParallelism() != expectedParallelism)
                 throw new IllegalStateException("Using indexes with different parallelism levels in same query is forbidden.");
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index aec0b36..b3d54e1 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -30,6 +30,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 import javax.cache.CacheException;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -43,7 +44,6 @@ import org.h2.command.Prepared;
 import org.h2.command.dml.Query;
 import org.h2.command.dml.SelectUnion;
 import org.h2.jdbc.JdbcPreparedStatement;
-import org.h2.util.IntArray;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.setupConnection;
@@ -67,7 +67,6 @@ import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlSelect.W
 import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlSelect.childIndexForColumn;
 import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlUnion.LEFT_CHILD;
 import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlUnion.RIGHT_CHILD;
-import static org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.toArray;
 
 /**
  * Splits a single SQL query into two step map-reduce query.
@@ -211,7 +210,7 @@ public class GridSqlQuerySplitter {
             boolean allCollocated = true;
 
             for (GridCacheSqlQuery mapSqlQry : splitter.mapSqlQrys) {
-                Prepared prepared = optimize(h2, conn, mapSqlQry.query(), mapSqlQry.parameters(),
+                Prepared prepared = optimize(h2, conn, mapSqlQry.query(), mapSqlQry.parameters(params),
                     true, enforceJoinOrder);
 
                 allCollocated &= isCollocated((Query)prepared);
@@ -1344,11 +1343,18 @@ public class GridSqlQuerySplitter {
      * @param params All parameters.
      */
     private static void setupParameters(GridCacheSqlQuery sqlQry, GridSqlQuery qryAst, Object[] params) {
-        IntArray paramIdxs = new IntArray(params.length);
+        TreeSet<Integer> paramIdxs = new TreeSet<>();
 
-        params = findParams(qryAst, params, new ArrayList<>(params.length), paramIdxs).toArray();
+        findParamsQuery(qryAst, params, paramIdxs);
 
-        sqlQry.parameters(params, toArray(paramIdxs));
+        int[] paramIdxsArr = new int[paramIdxs.size()];
+
+        int i = 0;
+
+        for (Integer paramIdx : paramIdxs)
+            paramIdxsArr[i++] = paramIdx;
+
+        sqlQry.parameterIndexes(paramIdxsArr);
     }
 
     /**
@@ -1451,9 +1457,8 @@ public class GridSqlQuerySplitter {
     /**
      * @param prnt Table parent element.
      * @param childIdx Child index for the table or alias containing the table.
-     * @return Generated alias.
      */
-    private GridSqlAlias generateUniqueAlias(GridSqlAst prnt, int childIdx) {
+    private void generateUniqueAlias(GridSqlAst prnt, int childIdx) {
         GridSqlAst child = prnt.child(childIdx);
         GridSqlAst tbl = GridSqlAlias.unwrap(child);
 
@@ -1468,8 +1473,6 @@ public class GridSqlQuerySplitter {
 
         // Replace the child in the parent.
         prnt.child(childIdx, uniqueAliasAst);
-
-        return uniqueAliasAst;
     }
 
     /**
@@ -1586,64 +1589,54 @@ public class GridSqlQuerySplitter {
     /**
      * @param qry Select.
      * @param params Parameters.
-     * @param target Extracted parameters.
      * @param paramIdxs Parameter indexes.
-     * @return Extracted parameters list.
      */
-    private static List<Object> findParams(GridSqlQuery qry, Object[] params, ArrayList<Object> target,
-        IntArray paramIdxs) {
+    private static void findParamsQuery(GridSqlQuery qry, Object[] params, TreeSet<Integer> paramIdxs) {
         if (qry instanceof GridSqlSelect)
-            return findParams((GridSqlSelect)qry, params, target, paramIdxs);
-
-        GridSqlUnion union = (GridSqlUnion)qry;
-
-        findParams(union.left(), params, target, paramIdxs);
-        findParams(union.right(), params, target, paramIdxs);
+            findParamsSelect((GridSqlSelect)qry, params, paramIdxs);
+        else {
+            GridSqlUnion union = (GridSqlUnion)qry;
 
-        findParams(qry.limit(), params, target, paramIdxs);
-        findParams(qry.offset(), params, target, paramIdxs);
+            findParamsQuery(union.left(), params, paramIdxs);
+            findParamsQuery(union.right(), params, paramIdxs);
 
-        return target;
+            findParams(qry.limit(), params, paramIdxs);
+            findParams(qry.offset(), params, paramIdxs);
+        }
     }
 
     /**
      * @param select Select.
      * @param params Parameters.
-     * @param target Extracted parameters.
      * @param paramIdxs Parameter indexes.
-     * @return Extracted parameters list.
      */
-    private static List<Object> findParams(
+    private static void findParamsSelect(
         GridSqlSelect select,
         Object[] params,
-        ArrayList<Object> target,
-        IntArray paramIdxs
+        TreeSet<Integer> paramIdxs
     ) {
         if (params.length == 0)
-            return target;
+            return;
 
         for (GridSqlAst el : select.columns(false))
-            findParams(el, params, target, paramIdxs);
+            findParams(el, params, paramIdxs);
 
-        findParams(select.from(), params, target, paramIdxs);
-        findParams(select.where(), params, target, paramIdxs);
+        findParams(select.from(), params, paramIdxs);
+        findParams(select.where(), params, paramIdxs);
 
         // Don't search in GROUP BY and HAVING since they expected to be in select list.
 
-        findParams(select.limit(), params, target, paramIdxs);
-        findParams(select.offset(), params, target, paramIdxs);
-
-        return target;
+        findParams(select.limit(), params, paramIdxs);
+        findParams(select.offset(), params, paramIdxs);
     }
 
     /**
      * @param el Element.
      * @param params Parameters.
-     * @param target Extracted parameters.
      * @param paramIdxs Parameter indexes.
      */
-    private static void findParams(@Nullable GridSqlAst el, Object[] params, ArrayList<Object> target,
-        IntArray paramIdxs) {
+    private static void findParams(@Nullable GridSqlAst el, Object[] params,
+        TreeSet<Integer> paramIdxs) {
         if (el == null)
             return;
 
@@ -1652,27 +1645,17 @@ public class GridSqlQuerySplitter {
             // Here we will set them to NULL.
             final int idx = ((GridSqlParameter)el).index();
 
-            while (target.size() < idx)
-                target.add(null);
-
             if (params.length <= idx)
                 throw new IgniteException("Invalid number of query parameters. " +
                     "Cannot find " + idx + " parameter.");
 
-            Object param = params[idx];
-
-            if (idx == target.size())
-                target.add(param);
-            else
-                target.set(idx, param);
-
             paramIdxs.add(idx);
         }
         else if (el instanceof GridSqlSubquery)
-            findParams(((GridSqlSubquery)el).subquery(), params, target, paramIdxs);
+            findParamsQuery(((GridSqlSubquery)el).subquery(), params, paramIdxs);
         else {
             for (int i = 0; i < el.size(); i++)
-                findParams((GridSqlAst)el.child(i), params, target, paramIdxs);
+                findParams(el.child(i), params, paramIdxs);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 7cd9f17..e4347b5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.managers.communication.GridMessageListener;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionsReservation;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable;
@@ -401,6 +402,26 @@ public class GridMapQueryExecutor {
     }
 
     /**
+     * @param caches Cache IDs.
+     * @return The first found partitioned cache.
+     */
+    private GridCacheContext<?,?> findFirstPartitioned(List<Integer> caches) {
+        GridCacheSharedContext<?,?> sctx = ctx.cache().context();
+
+        for (int i = 0; i < caches.size(); i++) {
+            GridCacheContext<?,?> mainCctx = sctx.cacheContext(caches.get(i));
+
+            if (mainCctx == null)
+                throw new CacheException("Failed to find cache.");
+
+            if (!mainCctx.isLocal() && !mainCctx.isReplicated())
+                return mainCctx;
+        }
+
+        throw new IllegalStateException("Failed to find a partitioned cache.");
+    }
+
+    /**
      * @param node Node.
      * @param req Query request.
      */
@@ -408,12 +429,7 @@ public class GridMapQueryExecutor {
         final Map<UUID,int[]> partsMap = req.partitions();
         final int[] parts = partsMap == null ? null : partsMap.get(ctx.localNodeId());
 
-        assert req.caches() != null && !req.caches().isEmpty();
-
-        GridCacheContext<?, ?> mainCctx = ctx.cache().context().cacheContext( req.caches().get(0));
-
-        if (mainCctx == null)
-            throw new CacheException("Failed to find cache.");
+        assert !F.isEmpty(req.caches());
 
         final DistributedJoinMode joinMode = distributedJoinMode(
             req.isFlagSet(GridH2QueryRequest.FLAG_IS_LOCAL),
@@ -421,8 +437,12 @@ public class GridMapQueryExecutor {
 
         final boolean enforceJoinOrder = req.isFlagSet(GridH2QueryRequest.FLAG_ENFORCE_JOIN_ORDER);
         final boolean explain = req.isFlagSet(GridH2QueryRequest.FLAG_EXPLAIN);
+        final boolean replicated = req.isFlagSet(GridH2QueryRequest.FLAG_REPLICATED);
+
+        int segments = explain || replicated ? 1 :
+            findFirstPartitioned(req.caches()).config().getQueryParallelism();
 
-        int segments = explain ? 1 : mainCctx.config().getQueryParallelism();
+        final Object[] params = req.parameters();
 
         for (int i = 1; i < segments; i++) {
             final int segment = i;
@@ -442,7 +462,9 @@ public class GridMapQueryExecutor {
                             req.pageSize(),
                             joinMode,
                             enforceJoinOrder,
-                            req.timeout());
+                            replicated,
+                            req.timeout(),
+                            params);
 
                         return null;
                     }
@@ -462,7 +484,9 @@ public class GridMapQueryExecutor {
             req.pageSize(),
             joinMode,
             enforceJoinOrder,
-            req.timeout());
+            replicated,
+            req.timeout(),
+            params);
     }
 
     /**
@@ -491,7 +515,9 @@ public class GridMapQueryExecutor {
         int pageSize,
         DistributedJoinMode distributedJoinMode,
         boolean enforceJoinOrder,
-        int timeout
+        boolean replicated,
+        int timeout,
+        Object[] params
     ) {
         // Prepare to run queries.
         GridCacheContext<?, ?> mainCctx = ctx.cache().context().cacheContext(cacheIds.get(0));
@@ -525,7 +551,7 @@ public class GridMapQueryExecutor {
                 node.id(),
                 reqId,
                 segmentId,
-                mainCctx.isReplicated() ? REPLICATED : MAP)
+                replicated ? REPLICATED : MAP)
                 .filter(h2.backupFilter(topVer, parts))
                 .partitionsMap(partsMap)
                 .distributedJoinMode(distributedJoinMode)
@@ -579,7 +605,7 @@ public class GridMapQueryExecutor {
                     if (qry.node() == null ||
                         (segmentId == 0 && qry.node().equals(ctx.localNodeId()))) {
                         rs = h2.executeSqlQueryWithTimer(mainCctx.name(), conn, qry.query(),
-                            F.asList(qry.parameters()), true,
+                            F.asList(qry.parameters(params)), true,
                             timeout,
                             qr.cancels[qryIdx]);
 
@@ -594,7 +620,7 @@ public class GridMapQueryExecutor {
                                 qry.query(),
                                 null,
                                 null,
-                                qry.parameters(),
+                                params,
                                 node.id(),
                                 null));
                         }
@@ -602,7 +628,7 @@ public class GridMapQueryExecutor {
                         assert rs instanceof JdbcResultSet : rs.getClass();
                     }
 
-                    qr.addResult(qryIdx, qry, node.id(), rs);
+                    qr.addResult(qryIdx, qry, node.id(), rs, params);
 
                     if (qr.canceled) {
                         qr.result(qryIdx).close();
@@ -965,8 +991,8 @@ public class GridMapQueryExecutor {
          * @param qrySrcNodeId Query source node.
          * @param rs Result set.
          */
-        void addResult(int qry, GridCacheSqlQuery q, UUID qrySrcNodeId, ResultSet rs) {
-            if (!results.compareAndSet(qry, null, new QueryResult(rs, cctx, qrySrcNodeId, q)))
+        void addResult(int qry, GridCacheSqlQuery q, UUID qrySrcNodeId, ResultSet rs, Object[] params) {
+            if (!results.compareAndSet(qry, null, new QueryResult(rs, cctx, qrySrcNodeId, q, params)))
                 throw new IllegalStateException();
         }
 
@@ -1046,15 +1072,21 @@ public class GridMapQueryExecutor {
         /** */
         private volatile boolean closed;
 
+        /** */
+        private final Object[] params;
+
         /**
          * @param rs Result set.
          * @param cctx Cache context.
          * @param qrySrcNodeId Query source node.
          * @param qry Query.
+         * @param params Query params.
          */
-        private QueryResult(ResultSet rs, GridCacheContext<?, ?> cctx, UUID qrySrcNodeId, GridCacheSqlQuery qry) {
+        private QueryResult(ResultSet rs, GridCacheContext<?, ?> cctx, UUID qrySrcNodeId, GridCacheSqlQuery qry,
+            Object[] params) {
             this.cctx = cctx;
             this.qry = qry;
+            this.params = params;
             this.qrySrcNodeId = qrySrcNodeId;
             this.cpNeeded = cctx.isLocalNode(qrySrcNodeId);
 
@@ -1139,7 +1171,7 @@ public class GridMapQueryExecutor {
                         qry.query(),
                         null,
                         null,
-                        qry.parameters(),
+                        params,
                         qrySrcNodeId,
                         null,
                         null,

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 7d255b1..0421ca0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -62,10 +62,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
 import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
-import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
 import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
 import org.apache.ignite.internal.processors.query.GridQueryCancel;
-import org.apache.ignite.internal.processors.query.h2.GridH2ResultSetIterator;
 import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
 import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
@@ -102,6 +100,7 @@ import org.jsr166.ConcurrentHashMap8;
 import static java.util.Collections.singletonList;
 import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
 import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery.EMPTY_PARAMS;
 import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.setupConnection;
 import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.OFF;
 import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.REDUCE;
@@ -406,12 +405,14 @@ public class GridReduceQueryExecutor {
     }
 
     /**
+     * @param isReplicatedOnly If we must only have replicated caches.
      * @param topVer Topology version.
      * @param cctx Cache context for main space.
      * @param extraSpaces Extra spaces.
      * @return Data nodes or {@code null} if repartitioning started and we need to retry.
      */
     private Collection<ClusterNode> stableDataNodes(
+        boolean isReplicatedOnly,
         AffinityTopologyVersion topVer,
         final GridCacheContext<?, ?> cctx,
         List<Integer> extraSpaces
@@ -430,7 +431,7 @@ public class GridReduceQueryExecutor {
                 if (extraCctx.isLocal())
                     continue; // No consistency guaranties for local caches.
 
-                if (cctx.isReplicated() && !extraCctx.isReplicated())
+                if (isReplicatedOnly && !extraCctx.isReplicated())
                     throw new CacheException("Queries running on replicated cache should not contain JOINs " +
                         "with partitioned tables [rCache=" + cctx.name() + ", pCache=" + extraSpace + "]");
 
@@ -439,7 +440,7 @@ public class GridReduceQueryExecutor {
                 if (F.isEmpty(extraNodes))
                     throw new CacheException("Failed to find data nodes for cache: " + extraSpace);
 
-                if (cctx.isReplicated() && extraCctx.isReplicated()) {
+                if (isReplicatedOnly && extraCctx.isReplicated()) {
                     nodes.retainAll(extraNodes);
 
                     if (nodes.isEmpty()) {
@@ -450,7 +451,7 @@ public class GridReduceQueryExecutor {
                                 ", cache2=" + extraSpace + "]");
                     }
                 }
-                else if (!cctx.isReplicated() && extraCctx.isReplicated()) {
+                else if (!isReplicatedOnly && extraCctx.isReplicated()) {
                     if (!extraNodes.containsAll(nodes))
                         if (isPreloadingActive(cctx, extraSpaces))
                             return null; // Retry.
@@ -458,7 +459,7 @@ public class GridReduceQueryExecutor {
                             throw new CacheException("Caches have distinct sets of data nodes [cache1=" + cctx.name() +
                                 ", cache2=" + extraSpace + "]");
                 }
-                else if (!cctx.isReplicated() && !extraCctx.isReplicated()) {
+                else if (!isReplicatedOnly && !extraCctx.isReplicated()) {
                     if (extraNodes.size() != nodes.size() || !nodes.containsAll(extraNodes))
                         if (isPreloadingActive(cctx, extraSpaces))
                             return null; // Retry.
@@ -481,6 +482,7 @@ public class GridReduceQueryExecutor {
      * @param enforceJoinOrder Enforce join order of tables.
      * @param timeoutMillis Timeout in milliseconds.
      * @param cancel Query cancel.
+     * @param params Query parameters.
      * @return Rows iterator.
      */
     public Iterator<List<?>> query(
@@ -489,8 +491,14 @@ public class GridReduceQueryExecutor {
         boolean keepPortable,
         boolean enforceJoinOrder,
         int timeoutMillis,
-        GridQueryCancel cancel
+        GridQueryCancel cancel,
+        Object[] params
     ) {
+        if (F.isEmpty(params))
+            params = EMPTY_PARAMS;
+
+        final boolean isReplicatedOnly = qry.isReplicatedOnly();
+
         for (int attempt = 0;; attempt++) {
             if (attempt != 0) {
                 try {
@@ -524,7 +532,7 @@ public class GridReduceQueryExecutor {
                 nodes = singletonList(ctx.discovery().localNode());
             else {
                 if (isPreloadingActive(cctx, extraSpaces)) {
-                    if (cctx.isReplicated())
+                    if (isReplicatedOnly)
                         nodes = replicatedUnstableDataNodes(cctx, extraSpaces);
                     else {
                         partsMap = partitionedUnstableDataNodes(cctx, extraSpaces);
@@ -533,19 +541,24 @@ public class GridReduceQueryExecutor {
                     }
                 }
                 else
-                    nodes = stableDataNodes(topVer, cctx, extraSpaces);
+                    nodes = stableDataNodes(isReplicatedOnly, topVer, cctx, extraSpaces);
 
                 if (nodes == null)
                     continue; // Retry.
 
                 assert !nodes.isEmpty();
 
-                if (cctx.isReplicated() || qry.explain()) {
-                    assert qry.explain() || !nodes.contains(ctx.discovery().localNode()) :
-                        "We must be on a client node.";
+                if (isReplicatedOnly || qry.explain()) {
+                    ClusterNode locNode = ctx.discovery().localNode();
 
-                    // Select random data node to run query on a replicated data or get EXPLAIN PLAN from a single node.
-                    nodes = singletonList(F.rand(nodes));
+                    // Always prefer local node if possible.
+                    if (nodes.contains(locNode))
+                        nodes = singletonList(locNode);
+                    else {
+                        // Select random data node to run query on a replicated data or
+                        // get EXPLAIN PLAN from a single node.
+                        nodes = singletonList(F.rand(nodes));
+                    }
                 }
             }
 
@@ -553,7 +566,8 @@ public class GridReduceQueryExecutor {
 
             final boolean skipMergeTbl = !qry.explain() && qry.skipMergeTable();
 
-            final int segmentsPerIndex = qry.explain() ? 1 : cctx.config().getQueryParallelism();
+            final int segmentsPerIndex = qry.explain() || isReplicatedOnly ? 1 :
+                findFirstPartitioned(cctx, extraSpaces).config().getQueryParallelism();
 
             int replicatedQrysCnt = 0;
 
@@ -595,7 +609,7 @@ public class GridReduceQueryExecutor {
                 r.idxs.add(idx);
             }
 
-            r.latch = new CountDownLatch(
+            r.latch = new CountDownLatch(isReplicatedOnly ? 1 :
                 (r.idxs.size() - replicatedQrysCnt) * nodes.size() * segmentsPerIndex + replicatedQrysCnt);
 
             runs.put(qryReqId, r);
@@ -616,7 +630,7 @@ public class GridReduceQueryExecutor {
 
                     for (GridCacheSqlQuery mapQry : qry.mapQueries())
                         mapQrys.add(new GridCacheSqlQuery("EXPLAIN " + mapQry.query())
-                            .parameters(mapQry.parameters(), mapQry.parameterIndexes()));
+                            .parameterIndexes(mapQry.parameterIndexes()));
                 }
 
                 final boolean distributedJoins = qry.distributedJoins();
@@ -643,6 +657,9 @@ public class GridReduceQueryExecutor {
                 if (qry.explain())
                     flags |= GridH2QueryRequest.FLAG_EXPLAIN;
 
+                if (isReplicatedOnly)
+                    flags |= GridH2QueryRequest.FLAG_REPLICATED;
+
                 if (send(nodes,
                         new GridH2QueryRequest()
                             .requestId(qryReqId)
@@ -652,6 +669,7 @@ public class GridReduceQueryExecutor {
                             .tables(distributedJoins ? qry.tables() : null)
                             .partitions(convert(partsMap))
                             .queries(mapQrys)
+                            .parameters(params)
                             .flags(flags)
                             .timeout(timeoutMillis),
                     null,
@@ -723,14 +741,14 @@ public class GridReduceQueryExecutor {
 
                         try {
                             if (qry.explain())
-                                return explainPlan(r.conn, space, qry);
+                                return explainPlan(r.conn, space, qry, params);
 
                             GridCacheSqlQuery rdc = qry.reduceQuery();
 
                             ResultSet res = h2.executeSqlQueryWithTimer(space,
                                 r.conn,
                                 rdc.query(),
-                                F.asList(rdc.parameters()),
+                                F.asList(rdc.parameters(params)),
                                 false, // The statement will cache some extra thread local objects.
                                 timeoutMillis,
                                 cancel);
@@ -790,6 +808,28 @@ public class GridReduceQueryExecutor {
     }
 
     /**
+     * @param cctx Cache context for main space.
+     * @param extraSpaces Extra spaces.
+     * @return The first partitioned cache context.
+     */
+    private GridCacheContext<?,?> findFirstPartitioned(GridCacheContext<?,?> cctx, List<Integer> extraSpaces) {
+        if (cctx.isLocal())
+            throw new CacheException("Cache is LOCAL: " + cctx.name());
+
+        if (!cctx.isReplicated())
+            return cctx;
+
+        for (int i = 0 ; i < extraSpaces.size(); i++) {
+            GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
+
+            if (!extraCctx.isReplicated() && !extraCctx.isLocal())
+                return extraCctx;
+        }
+
+        throw new IllegalStateException("Failed to find partitioned cache.");
+    }
+
+    /**
      * Returns true if the exception is triggered by query cancel.
      *
      * @param e Exception.
@@ -896,9 +936,19 @@ public class GridReduceQueryExecutor {
      * @param extraSpaces Extra spaces.
      * @return Collection of all data nodes owning all the caches or {@code null} for retry.
      */
-    private Collection<ClusterNode> replicatedUnstableDataNodes(final GridCacheContext<?, ?> cctx,
+    private Collection<ClusterNode> replicatedUnstableDataNodes(GridCacheContext<?, ?> cctx,
         List<Integer> extraSpaces) {
-        assert cctx.isReplicated() : cctx.name() + " must be replicated";
+        int i = 0;
+
+        // The main cache is allowed to be partitioned.
+        if (!cctx.isReplicated()) {
+            assert !F.isEmpty(extraSpaces): "no extra replicated caches with partitioned main cache";
+
+            // Just replace the main cache with the first one extra.
+            cctx = cacheContext(extraSpaces.get(i++));
+
+            assert cctx.isReplicated(): "all the extra caches must be replicated here";
+        }
 
         Set<ClusterNode> nodes = replicatedUnstableDataNodes(cctx);
 
@@ -906,7 +956,7 @@ public class GridReduceQueryExecutor {
             return null; // Retry.
 
         if (!F.isEmpty(extraSpaces)) {
-            for (int i = 0; i < extraSpaces.size(); i++) {
+            for (;i < extraSpaces.size(); i++) {
                 GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
 
                 if (extraCctx.isLocal())
@@ -982,9 +1032,12 @@ public class GridReduceQueryExecutor {
      * @return Partition mapping or {@code null} if we can't calculate it due to repartitioning and we need to retry.
      */
     @SuppressWarnings("unchecked")
-    private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(final GridCacheContext<?,?> cctx,
+    private Map<ClusterNode, IntArray> partitionedUnstableDataNodes(GridCacheContext<?,?> cctx,
         List<Integer> extraSpaces) {
-        assert !cctx.isReplicated() && !cctx.isLocal() : cctx.name() + " must be partitioned";
+        assert !cctx.isLocal() : cctx.name() + " must not be LOCAL";
+
+        // If the main cache is replicated, just replace it with the first partitioned.
+        cctx = findFirstPartitioned(cctx, extraSpaces);
 
         final int partsCnt = cctx.affinity().partitions();
 
@@ -1025,6 +1078,10 @@ public class GridReduceQueryExecutor {
             for (int i = 0; i < extraSpaces.size(); i++) {
                 GridCacheContext<?, ?> extraCctx = cacheContext(extraSpaces.get(i));
 
+                // This is possible if we have replaced a replicated cache with a partitioned one earlier.
+                if (cctx == extraCctx)
+                    continue;
+
                 if (extraCctx.isReplicated() || extraCctx.isLocal())
                     continue;
 
@@ -1093,32 +1150,14 @@ public class GridReduceQueryExecutor {
     }
 
     /**
-     * @param mainSpace Main space.
-     * @param allSpaces All spaces.
-     * @return List of all extra spaces or {@code null} if none.
-     */
-    private List<String> extraSpaces(String mainSpace, Collection<String> allSpaces) {
-        if (F.isEmpty(allSpaces) || (allSpaces.size() == 1 && allSpaces.contains(mainSpace)))
-            return null;
-
-        ArrayList<String> res = new ArrayList<>(allSpaces.size());
-
-        for (String space : allSpaces) {
-            if (!F.eq(space, mainSpace))
-                res.add(space);
-        }
-
-        return res;
-    }
-
-    /**
      * @param c Connection.
      * @param space Space.
      * @param qry Query.
+     * @param params Query parameters.
      * @return Cursor for plans.
      * @throws IgniteCheckedException if failed.
      */
-    private Iterator<List<?>> explainPlan(JdbcConnection c, String space, GridCacheTwoStepQuery qry)
+    private Iterator<List<?>> explainPlan(JdbcConnection c, String space, GridCacheTwoStepQuery qry, Object[] params)
         throws IgniteCheckedException {
         List<List<?>> lists = new ArrayList<>();
 
@@ -1142,7 +1181,7 @@ public class GridReduceQueryExecutor {
         ResultSet rs = h2.executeSqlQueryWithTimer(space,
             c,
             "EXPLAIN " + rdc.query(),
-            F.asList(rdc.parameters()),
+            F.asList(rdc.parameters(params)),
             false,
             0,
             null);
@@ -1419,29 +1458,4 @@ public class GridReduceQueryExecutor {
             state(e, null);
         }
     }
-
-    /**
-     *
-     */
-    private static class Iter extends GridH2ResultSetIterator<List<?>> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * @param data Data array.
-         * @throws IgniteCheckedException If failed.
-         */
-        protected Iter(ResultSet data) throws IgniteCheckedException {
-            super(data, true, false);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected List<?> createRow() {
-            ArrayList<Object> res = new ArrayList<>(row.length);
-
-            Collections.addAll(res, row);
-
-            return res;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
index f2f9a31..9e7dcbf 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
@@ -22,21 +22,27 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectMap;
+import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-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.marshaller.Marshaller;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 
+import static org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery.EMPTY_PARAMS;
+
 /**
  * Query request.
  */
@@ -65,6 +71,11 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
      */
     public static final int FLAG_EXPLAIN = 1 << 3;
 
+    /**
+     * If it is a REPLICATED query.
+     */
+    public static final int FLAG_REPLICATED = 1 << 4;
+
     /** */
     private long reqId;
 
@@ -100,6 +111,34 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
     /** */
     private int timeout;
 
+    /** */
+    @GridToStringInclude(sensitive = true)
+    @GridDirectTransient
+    private Object[] params;
+
+    /** */
+    private byte[] paramsBytes;
+
+    /**
+     * @return Parameters.
+     */
+    public Object[] parameters() {
+        return params;
+    }
+
+    /**
+     * @param params Parameters.
+     * @return {@code this}.
+     */
+    public GridH2QueryRequest parameters(Object[] params) {
+        if (params == null)
+            params = EMPTY_PARAMS;
+
+        this.params = params;
+
+        return this;
+    }
+
     /**
      * @param tbls Tables.
      * @return {@code this}.
@@ -258,20 +297,38 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
 
     /** {@inheritDoc} */
     @Override public void marshall(Marshaller m) {
-        if (F.isEmpty(qrys))
+        if (paramsBytes != null)
             return;
 
-        for (GridCacheSqlQuery qry : qrys)
-            qry.marshall(m);
+        assert params != null;
+
+        try {
+            paramsBytes = U.marshal(m, params);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
     }
 
     /** {@inheritDoc} */
     @Override public void unmarshall(Marshaller m, GridKernalContext ctx) {
-        if (F.isEmpty(qrys))
+        if (params != null)
             return;
 
-        for (GridCacheSqlQuery qry : qrys)
-            qry.unmarshall(m, ctx);
+        assert paramsBytes != null;
+
+        try {
+            final ClassLoader ldr = U.resolveClassLoader(ctx.config());
+
+            if (m instanceof BinaryMarshaller)
+                // To avoid deserializing of enum types.
+                params = ((BinaryMarshaller)m).binaryMarshaller().unmarshal(paramsBytes, ldr);
+            else
+                params = U.unmarshal(m, paramsBytes, ldr);
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
     }
 
     /** {@inheritDoc} */
@@ -305,31 +362,31 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                 writer.incrementState();
 
             case 3:
-                if (!writer.writeMap("parts", parts, MessageCollectionItemType.UUID, MessageCollectionItemType.INT_ARR))
+                if (!writer.writeByteArray("paramsBytes", paramsBytes))
                     return false;
 
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeCollection("qrys", qrys, MessageCollectionItemType.MSG))
+                if (!writer.writeMap("parts", parts, MessageCollectionItemType.UUID, MessageCollectionItemType.INT_ARR))
                     return false;
 
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeLong("reqId", reqId))
+                if (!writer.writeCollection("qrys", qrys, MessageCollectionItemType.MSG))
                     return false;
 
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeCollection("tbls", tbls, MessageCollectionItemType.STRING))
+                if (!writer.writeLong("reqId", reqId))
                     return false;
 
                 writer.incrementState();
 
             case 7:
-                if (!writer.writeMessage("topVer", topVer))
+                if (!writer.writeCollection("tbls", tbls, MessageCollectionItemType.STRING))
                     return false;
 
                 writer.incrementState();
@@ -339,6 +396,13 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                     return false;
 
                 writer.incrementState();
+
+            case 9:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
         }
 
         return true;
@@ -377,7 +441,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                 reader.incrementState();
 
             case 3:
-                parts = reader.readMap("parts", MessageCollectionItemType.UUID, MessageCollectionItemType.INT_ARR, false);
+                paramsBytes = reader.readByteArray("paramsBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -385,7 +449,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                 reader.incrementState();
 
             case 4:
-                qrys = reader.readCollection("qrys", MessageCollectionItemType.MSG);
+                parts = reader.readMap("parts", MessageCollectionItemType.UUID, MessageCollectionItemType.INT_ARR, false);
 
                 if (!reader.isLastRead())
                     return false;
@@ -393,7 +457,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                 reader.incrementState();
 
             case 5:
-                reqId = reader.readLong("reqId");
+                qrys = reader.readCollection("qrys", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
                     return false;
@@ -401,7 +465,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                 reader.incrementState();
 
             case 6:
-                tbls = reader.readCollection("tbls", MessageCollectionItemType.STRING);
+                reqId = reader.readLong("reqId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -409,7 +473,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                 reader.incrementState();
 
             case 7:
-                topVer = reader.readMessage("topVer");
+                tbls = reader.readCollection("tbls", MessageCollectionItemType.STRING);
 
                 if (!reader.isLastRead())
                     return false;
@@ -423,6 +487,15 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
                     return false;
 
                 reader.incrementState();
+
+            case 9:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
         }
 
         return reader.afterMessageRead(GridH2QueryRequest.class);
@@ -435,7 +508,7 @@ public class GridH2QueryRequest implements Message, GridCacheQueryMarshallable {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 9;
+        return 10;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index 1740fe9..5cb86b1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -361,7 +361,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
      *
      */
     public void testExplain() {
-        List<List<?>> res = grid(0).cache(personCache.getName()).query(new SqlFieldsQuery(
+        List<List<?>> res = grid(0).cache(personCache.getName()).query(sqlFieldsQuery(
             String.format("explain select p.age, p.name, o.name " +
                     "from \"%s\".Person p, \"%s\".Organization o where p.orgId = o.id",
                 personCache.getName(), orgCache.getName()))).getAll();
@@ -369,7 +369,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
         for (List<?> row : res)
             X.println("____ : " + row);
 
-        if (cacheMode() == PARTITIONED) {
+        if (cacheMode() == PARTITIONED || !isReplicatedOnly()) {
             assertEquals(2, res.size());
 
             assertTrue(((String)res.get(1).get(0)).contains(GridSqlQuerySplitter.mergeTableIdentifier(0)));
@@ -380,7 +380,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
     /** @throws Exception If failed. */
     public void testExecuteWithMetaData() throws Exception {
-        QueryCursorImpl<List<?>> cursor = (QueryCursorImpl<List<?>>)personCache.query(new SqlFieldsQuery(
+        QueryCursorImpl<List<?>> cursor = (QueryCursorImpl<List<?>>)personCache.query(sqlFieldsQuery(
             String.format("select p._KEY, p.name, p.age, o.name " +
                     "from \"%s\".Person p, \"%s\".Organization o where p.orgId = o.id",
                 personCache.getName(), orgCache.getName())));
@@ -480,7 +480,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
     /** @throws Exception If failed. */
     public void testExecute() throws Exception {
-        QueryCursor<List<?>> qry = personCache.query(new SqlFieldsQuery("select _KEY, name, age from Person"));
+        QueryCursor<List<?>> qry = personCache.query(sqlFieldsQuery("select _KEY, name, age from Person"));
 
         List<List<?>> res = new ArrayList<>(qry.getAll());
 
@@ -526,7 +526,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     /** @throws Exception If failed. */
     public void testExecuteWithArguments() throws Exception {
         QueryCursor<List<?>> qry = personCache
-            .query(new SqlFieldsQuery("select _KEY, name, age from Person where age > ?").setArgs(30));
+            .query(sqlFieldsQuery("select _KEY, name, age from Person where age > ?").setArgs(30));
 
         List<List<?>> res = new ArrayList<>(qry.getAll());
 
@@ -564,10 +564,23 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
         assert cnt == 2;
     }
 
+    protected boolean isReplicatedOnly() {
+        return false;
+    }
+
+    private SqlFieldsQuery sqlFieldsQuery(String sql) {
+        SqlFieldsQuery qry = new SqlFieldsQuery(sql);
+
+        if (isReplicatedOnly())
+            qry.setReplicatedOnly(true);
+
+        return qry;
+    }
+
     /** @throws Exception If failed. */
     public void testSelectAllJoined() throws Exception {
         QueryCursor<List<?>> qry =
-            personCache.query(new SqlFieldsQuery(
+            personCache.query(sqlFieldsQuery(
                 String.format("select * from \"%s\".Person p, \"%s\".Organization o where p.orgId = o.id",
                     personCache.getName(), orgCache.getName())));
 
@@ -631,7 +644,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     /** @throws Exception If failed. */
     public void testEmptyResult() throws Exception {
         QueryCursor<List<?>> qry =
-            personCache.query(new SqlFieldsQuery("select name from Person where age = 0"));
+            personCache.query(sqlFieldsQuery("select name from Person where age = 0"));
 
         Collection<List<?>> res = qry.getAll();
 
@@ -641,7 +654,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
     /** @throws Exception If failed. */
     public void testQueryString() throws Exception {
-        QueryCursor<List<?>> qry = strCache.query(new SqlFieldsQuery("select * from String"));
+        QueryCursor<List<?>> qry = strCache.query(sqlFieldsQuery("select * from String"));
 
         Collection<List<?>> res = qry.getAll();
 
@@ -658,7 +671,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
     /** @throws Exception If failed. */
     public void testQueryIntegersWithJoin() throws Exception {
-        QueryCursor<List<?>> qry = intCache.query(new SqlFieldsQuery(
+        QueryCursor<List<?>> qry = intCache.query(sqlFieldsQuery(
             "select i._KEY, i._VAL, j._KEY, j._VAL from Integer i join Integer j where i._VAL >= 100"));
 
         Collection<List<?>> res = qry.getAll();
@@ -682,7 +695,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     public void testPagination() throws Exception {
         // Query with page size 20.
         QueryCursor<List<?>> qry =
-            intCache.query(new SqlFieldsQuery("select * from Integer").setPageSize(20));
+            intCache.query(sqlFieldsQuery("select * from Integer").setPageSize(20));
 
         List<List<?>> res = new ArrayList<>(qry.getAll());
 
@@ -708,7 +721,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
             for (int i = 0; i < 200; i++)
                 cache.put(i, i);
 
-            QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("select * from Integer"));
+            QueryCursor<List<?>> qry = cache.query(sqlFieldsQuery("select * from Integer"));
 
             Collection<List<?>> res = qry.getAll();
 
@@ -729,7 +742,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    return cache.query(new SqlFieldsQuery("select * from String"));
+                    return cache.query(sqlFieldsQuery("select * from String"));
                 }
             }, CacheException.class, null);
         }
@@ -749,7 +762,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
         cache.put(key, val);
 
-        Collection<List<?>> res = cache.query(new SqlFieldsQuery("select * from Person")).getAll();
+        Collection<List<?>> res = cache.query(sqlFieldsQuery("select * from Person")).getAll();
 
         assertEquals(1, res.size());
 
@@ -782,7 +795,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
      */
     public void testPaginationIterator() throws Exception {
         QueryCursor<List<?>> qry =
-            intCache.query(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
+            intCache.query(sqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
 
         int cnt = 0;
 
@@ -802,7 +815,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     /** @throws Exception If failed. */
     public void testPaginationIteratorKeepAll() throws Exception {
         QueryCursor<List<?>> qry =
-            intCache.query(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
+            intCache.query(sqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
 
         int cnt = 0;
 
@@ -818,7 +831,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
         assertEquals(size, cnt);
 
-        qry = intCache.query(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
+        qry = intCache.query(sqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
 
         List<List<?>> list = new ArrayList<>(qry.getAll());
 
@@ -844,7 +857,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     public void testMethodAnnotationWithoutGet() throws Exception {
         if (!binaryMarshaller) {
             QueryCursor<List<?>> qry =
-                orgCache.query(new SqlFieldsQuery("select methodField from Organization where methodField='name-A'")
+                orgCache.query(sqlFieldsQuery("select methodField from Organization where methodField='name-A'")
                     .setPageSize(10));
 
             List<List<?>> flds = qry.getAll();
@@ -860,7 +873,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
      */
     public void testPaginationGet() throws Exception {
         QueryCursor<List<?>> qry =
-            intCache.query(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
+            intCache.query(sqlFieldsQuery("select _key, _val from Integer").setPageSize(10));
 
         List<List<?>> list = new ArrayList<>(qry.getAll());
 
@@ -883,7 +896,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     /** @throws Exception If failed. */
     public void testEmptyGrid() throws Exception {
         QueryCursor<List<?>> qry = personCache
-            .query(new SqlFieldsQuery("select name, age from Person where age = 25"));
+            .query(sqlFieldsQuery("select name, age from Person where age = 25"));
 
         List<?> res = F.first(qry.getAll());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
index aa31f33..d4772c1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
@@ -208,6 +208,16 @@ public class IgniteCacheJoinPartitionedAndReplicatedTest extends GridCommonAbstr
             "from \"orgRepl\".Organization o left join \"person\".Person p " +
             "on (p.orgId = o.id)", orgCacheRepl, 2);
 
+        // Left join from replicated to partitioned cache is not supported:
+        // returns duplicates in result and must fail.
+        checkQueryFails("select o.name, p._key, p.name " +
+            "from \"person\".Person p left join \"org\".Organization o " +
+            "on (p.orgId = o.id)", orgCache);
+
+        checkQueryFails("select o.name, p._key, p.name " +
+            "from \"org\".Organization o right join \"person\".Person p " +
+            "on (p.orgId = o.id)", orgCache);
+
         checkQueryFails("select o.name, p._key, p.name " +
                 "from \"person\".Person p left join \"org\".Organization o " +
                 "on (p.orgId = o.id)", personCache);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryROSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryROSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryROSelfTest.java
new file mode 100644
index 0000000..44a68e2
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQueryROSelfTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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.internal.processors.cache.distributed.replicated;
+
+/**
+ */
+public class IgniteCacheReplicatedFieldsQueryROSelfTest extends IgniteCacheReplicatedFieldsQuerySelfTest {
+    /** */
+    @Override protected boolean isReplicatedOnly() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index f093ac7..b180eba 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import javax.cache.CacheException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheKeyConfiguration;
 import org.apache.ignite.cache.CacheMode;
@@ -61,6 +62,9 @@ import org.springframework.util.StringUtils;
 @SuppressWarnings("unchecked")
 public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
     /** */
+    private static final int CLIENT = 7;
+
+    /** */
     private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** {@inheritDoc} */
@@ -82,14 +86,16 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
         return cfg;
     }
 
-    @Override
-    protected long getTestTimeout() {
-        return 100_000_000;
-    }
-
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3, false);
+        Ignition.setClientMode(true);
+        try {
+            startGrid(CLIENT);
+        }
+        finally {
+            Ignition.setClientMode(false);
+        }
     }
 
     /** {@inheritDoc} */
@@ -156,22 +162,69 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
 
     /**
      */
-    public void testReplicatedOnlyTables() {
-        doTestReplicatedOnlyTables(1);
+    public void testReplicatedTablesUsingPartitionedCache() {
+        doTestReplicatedTablesUsingPartitionedCache(1, false, false);
+    }
+
+    /**
+     */
+    public void testReplicatedTablesUsingPartitionedCacheSegmented() {
+        doTestReplicatedTablesUsingPartitionedCache(5, false, false);
+    }
+
+    /**
+     */
+    public void testReplicatedTablesUsingPartitionedCacheClient() {
+        doTestReplicatedTablesUsingPartitionedCache(1, true, false);
+    }
+
+    /**
+     */
+    public void testReplicatedTablesUsingPartitionedCacheSegmentedClient() {
+        doTestReplicatedTablesUsingPartitionedCache(5, true, false);
     }
 
     /**
      */
-    public void testReplicatedOnlyTablesSegmented() {
-        doTestReplicatedOnlyTables(5);
+    public void testReplicatedTablesUsingPartitionedCacheRO() {
+        doTestReplicatedTablesUsingPartitionedCache(1, false, true);
     }
 
     /**
      */
-    private void doTestReplicatedOnlyTables(int segments) {
-        IgniteCache<Integer,Value> p = ignite(0).getOrCreateCache(cacheConfig("p", true,
+    public void testReplicatedTablesUsingPartitionedCacheSegmentedRO() {
+        doTestReplicatedTablesUsingPartitionedCache(5, false, true);
+    }
+
+    /**
+     */
+    public void testReplicatedTablesUsingPartitionedCacheClientRO() {
+        doTestReplicatedTablesUsingPartitionedCache(1, true, true);
+    }
+
+    /**
+     */
+    public void testReplicatedTablesUsingPartitionedCacheSegmentedClientRO() {
+        doTestReplicatedTablesUsingPartitionedCache(5, true, true);
+    }
+
+    /**
+     */
+    private SqlFieldsQuery query(String sql, boolean replicatedOnly) {
+        SqlFieldsQuery qry = new SqlFieldsQuery(sql);
+
+        if (replicatedOnly)
+            qry.setReplicatedOnly(true);
+
+        return qry;
+    }
+
+    /**
+     */
+    private void doTestReplicatedTablesUsingPartitionedCache(int segments, boolean client, boolean replicatedOnlyFlag) {
+        IgniteCache<Integer,Value> p = ignite(client ? CLIENT : 0).getOrCreateCache(cacheConfig("p", true,
             Integer.class, Value.class).setQueryParallelism(segments));
-        IgniteCache<Integer,Value> r = ignite(0).getOrCreateCache(cacheConfig("r", false,
+        IgniteCache<Integer,Value> r = ignite(client ? CLIENT : 0).getOrCreateCache(cacheConfig("r", false,
             Integer.class, Value.class));
 
         try {
@@ -181,9 +234,53 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
                 r.put(i, new Value(i, -i));
 
             // Query data from replicated table using partitioned cache.
-            assertEquals(cnt, p.query(new SqlFieldsQuery("select 1 from \"r\".Value")).getAll().size());
+            assertEquals(cnt, p.query(query("select 1 from \"r\".Value", replicatedOnlyFlag))
+                .getAll().size());
+
+            List<List<?>> res = p.query(query("select count(1) from \"r\".Value", replicatedOnlyFlag)).getAll();
+            assertEquals(1, res.size());
+            assertEquals(cnt, ((Number)res.get(0).get(0)).intValue());
+        }
+        finally {
+            p.destroy();
+            r.destroy();
+        }
+    }
+
+    public void testPartitionedTablesUsingReplicatedCache() {
+        doTestPartitionedTablesUsingReplicatedCache(1, false);
+    }
+
+    public void testPartitionedTablesUsingReplicatedCacheSegmented() {
+        doTestPartitionedTablesUsingReplicatedCache(7, false);
+    }
+
+    public void testPartitionedTablesUsingReplicatedCacheClient() {
+        doTestPartitionedTablesUsingReplicatedCache(1, true);
+    }
+
+    public void testPartitionedTablesUsingReplicatedCacheSegmentedClient() {
+        doTestPartitionedTablesUsingReplicatedCache(7, true);
+    }
+
+    /**
+     */
+    private void doTestPartitionedTablesUsingReplicatedCache(int segments, boolean client) {
+        IgniteCache<Integer,Value> p = ignite(client ? CLIENT : 0).getOrCreateCache(cacheConfig("p", true,
+            Integer.class, Value.class).setQueryParallelism(segments));
+        IgniteCache<Integer,Value> r = ignite(client ? CLIENT : 0).getOrCreateCache(cacheConfig("r", false,
+            Integer.class, Value.class));
+
+        try {
+            int cnt = 1000;
+
+            for (int i = 0; i < cnt; i++)
+                p.put(i, new Value(i, -i));
+
+            // Query data from replicated table using partitioned cache.
+            assertEquals(cnt, r.query(new SqlFieldsQuery("select 1 from \"p\".Value")).getAll().size());
 
-            List<List<?>> res = p.query(new SqlFieldsQuery("select count(1) from \"r\".Value")).getAll();
+            List<List<?>> res = r.query(new SqlFieldsQuery("select count(1) from \"p\".Value")).getAll();
             assertEquals(1, res.size());
             assertEquals(cnt, ((Number)res.get(0).get(0)).intValue());
         }


[40/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed


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

Branch: refs/heads/ignite-1561-1
Commit: 247282f392f68a45a122015a7b7c752c0f73fb5b
Parents: acd21fb
Author: Max Kozlov <dr...@gmail.com>
Authored: Fri Apr 14 18:20:20 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Fri Apr 14 19:06:43 2017 +0300

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |   4 +
 .../ignite/cache/CacheAtomicWriteOrderMode.java |  64 ---
 .../org/apache/ignite/cache/CacheEntry.java     |  11 -
 .../configuration/CacheConfiguration.java       |  28 --
 .../configuration/IgniteConfiguration.java      |  60 ---
 .../ignite/internal/GridKernalContext.java      |  16 -
 .../ignite/internal/GridKernalContextImpl.java  |  31 --
 .../apache/ignite/internal/IgniteKernal.java    |  44 +-
 .../communication/GridIoMessageFactory.java     |  12 -
 .../processors/cache/CacheEntryImplEx.java      |   8 +-
 .../cache/GridCacheAtomicVersionComparator.java |  24 +-
 .../processors/cache/GridCacheMapEntry.java     |  21 +-
 .../processors/cache/GridCacheMvcc.java         |  23 +-
 .../processors/cache/GridCacheProcessor.java    |  17 -
 .../cache/GridCacheSwapEntryImpl.java           |   4 +-
 .../processors/cache/GridCacheUtils.java        |   7 +-
 .../cache/database/tree/io/CacheVersionIO.java  |  12 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  19 +-
 ...idNearAtomicAbstractSingleUpdateRequest.java |   1 -
 .../atomic/GridNearAtomicFullUpdateRequest.java |   3 +-
 ...GridNearAtomicSingleUpdateFilterRequest.java |   3 +-
 ...GridNearAtomicSingleUpdateInvokeRequest.java |   3 +-
 .../cache/transactions/IgniteTxEntry.java       |   8 +-
 .../cache/transactions/IgniteTxManager.java     |   2 +-
 .../version/GridCachePlainVersionedEntry.java   |   5 -
 .../version/GridCacheRawVersionedEntry.java     |   5 -
 .../cache/version/GridCacheVersion.java         |  47 +-
 .../cache/version/GridCacheVersionEx.java       |  19 +-
 .../cache/version/GridCacheVersionManager.java  |   9 +-
 .../cache/version/GridCacheVersionedEntry.java  |   7 -
 .../clock/GridClockDeltaSnapshot.java           | 235 ---------
 .../clock/GridClockDeltaSnapshotMessage.java    | 154 ------
 .../processors/clock/GridClockDeltaVersion.java | 194 --------
 .../processors/clock/GridClockMessage.java      | 171 -------
 .../processors/clock/GridClockServer.java       | 222 ---------
 .../processors/clock/GridClockSource.java       |  30 --
 .../clock/GridClockSyncProcessor.java           | 481 -------------------
 .../processors/clock/GridJvmClockSource.java    |  28 --
 .../datastructures/DataStructuresProcessor.java |   2 -
 .../internal/processors/igfs/IgfsUtils.java     |   2 -
 .../utils/PlatformConfigurationUtils.java       |   3 -
 .../ignite/internal/util/IgniteUtils.java       |  26 +-
 .../visor/cache/VisorCacheConfiguration.java    |  13 +-
 .../ignite/startup/BasicWarmupClosure.java      |   3 +-
 .../resources/META-INF/classnames.properties    |   5 +-
 .../config/websession/example-cache-base.xml    |   1 -
 .../test/config/websession/spring-cache-1.xml   |   6 -
 .../test/config/websession/spring-cache-2.xml   |   6 -
 .../test/config/websession/spring-cache-3.xml   |   6 -
 .../IgniteClientReconnectCacheTest.java         |  87 ++--
 .../CacheAtomicSingleMessageCountSelfTest.java  |   2 -
 .../cache/CacheEnumOperationsAbstractTest.java  |   2 -
 ...torPartitionCounterRandomOperationsTest.java |   2 -
 .../CacheStoreUsageMultinodeAbstractTest.java   |   2 -
 .../EntryVersionConsistencyReadThroughTest.java |   2 -
 ...idAbstractCacheInterceptorRebalanceTest.java |   2 -
 .../cache/GridCacheAbstractFullApiSelfTest.java |  15 +-
 .../GridCacheAbstractLocalStoreSelfTest.java    |  16 +-
 .../GridCacheAbstractRemoveFailureTest.java     |   9 -
 .../GridCacheAtomicMessageCountSelfTest.java    |  54 +--
 .../cache/GridCacheEntryVersionSelfTest.java    |   2 -
 .../cache/GridCacheIncrementTransformTest.java  |   2 -
 .../GridCacheInterceptorAbstractSelfTest.java   |  24 +-
 ...erceptorAtomicPrimaryWriteOrderSelfTest.java |  47 --
 ...omicReplicatedPrimaryWriteOrderSelfTest.java |  48 --
 ...acheInterceptorAtomicReplicatedSelfTest.java |   8 -
 .../GridCacheInterceptorAtomicSelfTest.java     |   8 -
 ...GridCacheInterceptorLocalAtomicSelfTest.java |   8 -
 .../cache/GridCacheMvccFlagsTest.java           |   4 +-
 .../cache/GridCacheMvccPartitionedSelfTest.java |  24 +-
 .../processors/cache/GridCacheMvccSelfTest.java |   8 +-
 ...HeapMultiThreadedUpdateAbstractSelfTest.java |   2 -
 .../GridCacheOffHeapTieredAbstractSelfTest.java |   0
 ...heOffHeapTieredEvictionAbstractSelfTest.java |   0
 .../GridCacheReturnValueTransferSelfTest.java   |  15 +-
 ...ridCacheStoreManagerDeserializationTest.java |  10 -
 .../processors/cache/GridCacheTestEntryEx.java  |   2 +-
 ...idCacheValueConsistencyAbstractSelfTest.java |  10 -
 .../cache/GridCacheVersionMultinodeTest.java    |  40 --
 .../cache/GridCacheVersionSelfTest.java         |   4 +-
 .../GridCacheVersionTopologyChangeTest.java     |   2 -
 .../cache/IgniteCacheAbstractTest.java          |  14 -
 .../cache/IgniteCacheAtomicInvokeTest.java      |   7 -
 .../cache/IgniteCacheAtomicPeekModesTest.java   |   7 -
 ...eCacheAtomicPrimaryWriteOrderInvokeTest.java |  57 ---
 ...maryWriteOrderNearEnabledStoreValueTest.java |  31 --
 ...heAtomicPrimaryWriteOrderStoreValueTest.java |  32 --
 ...micPrimaryWriteOrderWithStoreInvokeTest.java |  32 --
 .../cache/IgniteCacheAtomicStoreValueTest.java  |   7 -
 .../IgniteCacheAtomicWithStoreInvokeTest.java   |  32 ++
 .../IgniteCacheConfigVariationsFullApiTest.java |   6 -
 .../IgniteCacheEntryListenerAtomicTest.java     |   7 -
 ...niteCacheEntryListenerExpiredEventsTest.java |   2 -
 .../IgniteCacheEntryProcessorCallTest.java      |   3 -
 .../IgniteCacheInterceptorSelfTestSuite.java    |   2 -
 ...gniteCacheInvokeReadThroughAbstractTest.java |   2 -
 .../IgniteCacheP2pUnmarshallingErrorTest.java   |   6 -
 .../IgniteCacheReadThroughStoreCallTest.java    |   2 -
 .../IgniteCacheStoreValueAbstractTest.java      |   4 -
 .../cache/IgniteCacheTxPeekModesTest.java       |   7 -
 .../cache/IgniteExchangeFutureHistoryTest.java  |   6 -
 ...logyValidatorPartitionedAtomicCacheTest.java |   7 -
 ...ologyValidatorReplicatedAtomicCacheTest.java |   7 -
 ...sExchangeOnDiscoveryHistoryOverflowTest.java |   7 -
 .../IgniteCacheAtomicExecutionContextTest.java  |   7 -
 ...iteCachePartitionedExecutionContextTest.java |   7 -
 ...niteCacheReplicatedExecutionContextTest.java |   7 -
 .../IgniteCacheTxExecutionContextTest.java      |   7 -
 ...CacheAtomicNearUpdateTopologyChangeTest.java |   7 -
 .../CacheLateAffinityAssignmentTest.java        |   2 -
 ...NearDisabledAtomicInvokeRestartSelfTest.java |   6 -
 ...dCacheMultithreadedFailoverAbstractTest.java |  18 +-
 ...chePartitionedReloadAllAbstractSelfTest.java |  11 -
 .../GridCacheTransformEventSelfTest.java        |   2 -
 .../IgniteCacheAtomicNodeJoinTest.java          |   6 -
 ...niteCacheClientNodeChangingTopologyTest.java |  92 +---
 .../IgniteCacheMessageRecoveryAbstractTest.java |   2 -
 ...tPartitionedOnlyByteArrayValuesSelfTest.java |   2 -
 .../dht/GridCacheAtomicFullApiSelfTest.java     |  19 -
 .../dht/GridCacheAtomicNearCacheSelfTest.java   |  52 +-
 ...EnabledPrimaryWriteOrderFullApiSelfTest.java |  31 --
 ...eAtomicPrimaryWriteOrderFullApiSelfTest.java |  32 --
 ...tomicPrimaryWriteOrderReloadAllSelfTest.java |  32 --
 .../GridCacheDhtAtomicRemoveFailureTest.java    |   7 -
 .../dht/IgniteCacheConcurrentPutGetRemove.java  |   2 -
 ...artitionedBackupNodeFailureRecoveryTest.java |   7 -
 .../IgniteCachePutRetryAbstractSelfTest.java    |  16 -
 .../atomic/GridCacheAtomicFailoverSelfTest.java |   3 -
 ...eAtomicInvalidPartitionHandlingSelfTest.java |  39 +-
 ...AtomicPrimaryWriteOrderFailoverSelfTest.java |  36 --
 ...tomicPrimaryWriteOrderRemoveFailureTest.java |  53 --
 .../GridCacheAtomicRemoveFailureTest.java       |   7 -
 ...micPrimaryWriteOrderNearEnabledSelfTest.java |  39 --
 ...sistencyAtomicPrimaryWriteOrderSelfTest.java |  32 --
 ...PutRetryAtomicPrimaryWriteOrderSelfTest.java |  32 --
 ...LateAffDisabledMultiNodeFullApiSelfTest.java |  35 ++
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |  35 --
 ...GridCacheAtomicMultiNodeFullApiSelfTest.java |  10 -
 ...omicMultiNodeP2PDisabledFullApiSelfTest.java |  19 -
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |  31 --
 .../GridCacheAtomicNearRemoveFailureTest.java   |   7 -
 ...icNoStripedPoolMultiNodeFullApiSelfTest.java |   0
 .../GridCacheAtomicOffHeapFullApiSelfTest.java  |   0
 ...heAtomicOffHeapMultiNodeFullApiSelfTest.java |   0
 ...idCacheAtomicPartitionedMetricsSelfTest.java |   2 -
 ...derFairAffinityMultiNodeFullApiSelfTest.java |   0
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |  32 --
 ...rderMultiNodeP2PDisabledFullApiSelfTest.java |  33 --
 ...cPrimaryWriteOrderNearRemoveFailureTest.java |  52 --
 ...cPrimaryWriteOrderOnheapFullApiSelfTest.java |  28 --
 ...riteOrderOnheapMultiNodeFullApiSelfTest.java |  29 --
 .../near/GridCacheNearEvictionSelfTest.java     |   2 -
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   2 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |   4 -
 .../near/NearCacheSyncUpdateTest.java           |  27 +-
 .../GridCacheRebalancingOrderingTest.java       |   2 -
 ...cheRebalancingPartitionDistributionTest.java |   2 -
 ...ridCacheAtomicReplicatedMetricsSelfTest.java |   2 -
 ...eplicatedAtomicMultiNodeFullApiSelfTest.java |  19 -
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |  33 --
 .../IgniteCacheAtomicExpiryPolicyTest.java      |   7 -
 ...iteCacheAtomicExpiryPolicyWithStoreTest.java |   7 -
 ...AtomicPrimaryWriteOrderExpiryPolicyTest.java |  32 --
 ...maryWriteOrderWithStoreExpiryPolicyTest.java |  32 --
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  13 +-
 .../IgniteCacheExpiryPolicyTestSuite.java       |   2 -
 .../IgniteCacheAtomicLoadAllTest.java           |   7 -
 .../IgniteCacheAtomicLoaderWriterTest.java      |   7 -
 ...gniteCacheAtomicNoLoadPreviousValueTest.java |   7 -
 .../IgniteCacheAtomicNoReadThroughTest.java     |   7 -
 .../IgniteCacheAtomicNoWriteThroughTest.java    |   7 -
 .../IgniteCacheAtomicStoreSessionTest.java      |   7 -
 ...eCacheAtomicStoreSessionWriteBehindTest.java |   7 -
 ...IgniteCacheJdbcBlobStoreNodeRestartTest.java |   8 -
 .../GridCacheAtomicLocalMetricsSelfTest.java    |   2 -
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |  31 --
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |  31 --
 ...OrderMultiJvmP2PDisabledFullApiSelfTest.java |  31 --
 ...WriteOrderOnheapMultiJvmFullApiSelfTest.java |  29 --
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |  31 --
 .../GridCacheSwapScanQueryAbstractSelfTest.java |   0
 ...FailoverAtomicPrimaryWriteOrderSelfTest.java |  50 --
 ...tinuousQueryAsyncFailoverAtomicSelfTest.java |  43 ++
 ...eContinuousQueryAsyncFilterListenerTest.java |   2 -
 ...acheContinuousQueryExecuteInPrimaryTest.java |   2 -
 ...ContinuousQueryFailoverAbstractSelfTest.java |  10 -
 ...ryFailoverAtomicNearEnabledSelfSelfTest.java |   9 +-
 ...ousQueryFailoverAtomicOffheapTieredTest.java |   0
 ...FailoverAtomicPrimaryWriteOrderSelfTest.java |  44 --
 ...usQueryFailoverAtomicReplicatedSelfTest.java |   9 +-
 ...heContinuousQueryFailoverAtomicSelfTest.java |  36 ++
 ...ontinuousQueryOperationFromCallbackTest.java |   2 -
 .../CacheContinuousQueryOperationP2PTest.java   |   2 -
 .../CacheContinuousQueryOrderingEventTest.java  |   2 -
 ...acheContinuousQueryRandomOperationsTest.java |   2 -
 .../CacheKeepBinaryIterationTest.java           |   2 -
 ...teCacheClientWriteBehindStoreAtomicTest.java |   7 -
 .../transactions/DepthFirstSearchTest.java      |  18 +-
 .../CacheVersionedEntryAbstractTest.java        |   2 -
 .../clock/GridTimeSyncProcessorSelfTest.java    | 224 ---------
 .../database/FreeListImplSelfTest.java          |   2 +-
 .../DataStreamerUpdateAfterLoadTest.java        |  18 +-
 .../ServicePredicateAccessCacheTest.java        |   4 +-
 .../tcp/TcpCommunicationSpiDropNodesTest.java   |   1 -
 .../TcpCommunicationSpiFaultyClientTest.java    |   1 -
 .../configvariations/ConfigVariations.java      |   3 -
 .../testframework/junits/GridAbstractTest.java  |   2 -
 .../junits/common/GridCommonAbstractTest.java   |  18 -
 .../IgniteCacheFailoverTestSuite.java           |   4 -
 .../IgniteCacheFailoverTestSuite2.java          |   2 -
 .../IgniteCacheFailoverTestSuite3.java          |   2 -
 ...IgniteCacheFullApiMultiJvmSelfTestSuite.java |  10 -
 .../IgniteCacheFullApiSelfTestSuite.java        |  24 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |   6 +-
 .../testsuites/IgniteCacheTestSuite3.java       |   4 -
 .../CacheHibernateBlobStoreNodeRestartTest.java |   8 -
 .../CacheOperationsWithExpirationTest.java      |   2 -
 .../CacheRandomOperationsMultithreadedTest.java |   2 -
 .../IgniteCacheCrossCacheJoinRandomTest.java    |   2 -
 ...acheDistributedJoinCollocatedAndNotTest.java |   2 -
 ...acheDistributedJoinCustomAffinityMapper.java |   2 -
 .../IgniteCacheDistributedJoinNoIndexTest.java  |   2 -
 ...ributedJoinPartitionedAndReplicatedTest.java |   2 -
 ...CacheDistributedJoinQueryConditionsTest.java |   2 -
 ...PartitionedAndReplicatedCollocationTest.java |   2 -
 ...teCacheJoinPartitionedAndReplicatedTest.java |   2 -
 .../IgniteCacheQuerySelfTestSuite4.java         |   8 +-
 .../Config/native-client-test-cache.xml         |   3 -
 .../IgniteConfigurationSerializerTest.cs        |   1 -
 .../Apache.Ignite.Core.csproj                   |   1 -
 .../Configuration/CacheAtomicWriteOrderMode.cs  |  43 --
 .../Cache/Configuration/CacheConfiguration.cs   |   7 -
 .../IgniteConfigurationSection.xsd              |  12 -
 .../commands/cache/VisorCacheCommand.scala      |   1 -
 modules/web-console/backend/app/mongo.js        |   3 -
 .../generator/ConfigurationGenerator.js         |   5 +-
 .../generator/PlatformGenerator.js              |   1 -
 .../defaults/Cache.platform.service.js          |   4 -
 .../generator/defaults/Cache.service.js         |   3 -
 .../generator/defaults/Cluster.service.js       |   2 -
 .../states/configuration/caches/concurrency.pug |  11 -
 .../states/configuration/clusters/time.pug      |  10 +-
 modules/yardstick/README.txt                    |   1 -
 .../yardstick/IgniteBenchmarkArguments.java     |  15 +-
 .../org/apache/ignite/yardstick/IgniteNode.java |   3 -
 245 files changed, 398 insertions(+), 4510 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index 62c8ed2..99ec08a 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -44,6 +44,8 @@ import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectMap;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.IgniteCodeGeneratingFail;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
@@ -231,6 +233,8 @@ public class MessageCodeGenerator {
 //        gen.generateAndWrite(GridH2RowRangeBounds.class);
 //        gen.generateAndWrite(GridH2QueryRequest.class);
 //        gen.generateAndWrite(GridH2RowMessage.class);
+//        gen.generateAndWrite(GridCacheVersion.class);
+//        gen.generateAndWrite(GridCacheVersionEx.class);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicWriteOrderMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicWriteOrderMode.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicWriteOrderMode.java
deleted file mode 100644
index 38b4556..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicWriteOrderMode.java
+++ /dev/null
@@ -1,64 +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.
- */
-
-package org.apache.ignite.cache;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Cache write ordering mode. This enumeration is taken into account only in {@link CacheAtomicityMode#ATOMIC}
- * atomicity mode. Write ordering mode determines which node assigns the write version, sender or the primary node.
- * <p>
- * For example, {@link #CLOCK} mode assigns write versions on a sender node which generally leads to better
- * performance in {@link CacheWriteSynchronizationMode#FULL_SYNC} synchronization mode, since in this case
- * sender can send write requests to primary and backups at the same time. Otherwise, if ordering mode is
- * {@link #PRIMARY}, it would only send request to primary node, which in turn will assign write version
- * and forward it to backups.
- * <p>
- * {@link #CLOCK} mode will be automatically configured only with {@link CacheWriteSynchronizationMode#FULL_SYNC}
- * write synchronization mode, as for other synchronization modes it does not render better performance.
- */
-public enum CacheAtomicWriteOrderMode {
-    /**
-     * In this mode, write versions are assigned on a sender node which generally leads to better
-     * performance in {@link CacheWriteSynchronizationMode#FULL_SYNC} synchronization mode, since in this case
-     * sender can send write requests to primary and backups at the same time.
-     * <p>
-     * This mode will be automatically configured only with {@link CacheWriteSynchronizationMode#FULL_SYNC}
-     * write synchronization mode, as for other synchronization modes it does not render better performance.
-     */
-    CLOCK,
-
-    /**
-     * Cache version is assigned only on primary node. This means that sender will only send write request
-     * to primary node, which in turn will assign write version and forward it to backups.
-     */
-    PRIMARY;
-
-    /** Enumerated values. */
-    private static final CacheAtomicWriteOrderMode[] VALS = values();
-
-    /**
-     * Efficiently gets enumerated value from its ordinal.
-     *
-     * @param ord Ordinal value.
-     * @return Enumerated value or {@code null} if ordinal out of range.
-     */
-    @Nullable public static CacheAtomicWriteOrderMode fromOrdinal(byte ord) {
-        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
index 6284f5b..7b995cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
@@ -81,15 +81,4 @@ public interface CacheEntry<K, V> extends Cache.Entry<K, V> {
      * @return Version of this cache entry.
      */
     public Comparable version();
-
-    /**
-     * Returns the time when the cache entry for the given key has been updated or initially created.
-     * <p>
-     * It is valid to compare cache entries' update time for the same key. In this case the latter update will
-     * be represented by higher update time. The result of update time comparison of cache entries of different keys is
-     * undefined.
-     *
-     * @return Time in milliseconds.
-     */
-    public long updateTime();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/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 cfdfed8..34b3951 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
@@ -44,7 +44,6 @@ 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;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheEntryProcessor;
 import org.apache.ignite.cache.CacheInterceptor;
@@ -269,9 +268,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Cache atomicity mode. */
     private CacheAtomicityMode atomicityMode;
 
-    /** Write ordering mode. */
-    private CacheAtomicWriteOrderMode atomicWriteOrderMode;
-
     /** Number of backups for cache. */
     private int backups = DFLT_BACKUPS;
 
@@ -409,7 +405,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         aff = cc.getAffinity();
         affMapper = cc.getAffinityMapper();
         atomicityMode = cc.getAtomicityMode();
-        atomicWriteOrderMode = cc.getAtomicWriteOrderMode();
         backups = cc.getBackups();
         cacheLoaderFactory = cc.getCacheLoaderFactory();
         cacheMode = cc.getCacheMode();
@@ -901,29 +896,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
-     * Gets cache write ordering mode. This property can be enabled only for {@link CacheAtomicityMode#ATOMIC}
-     * cache (for other atomicity modes it will be ignored).
-     *
-     * @return Cache write ordering mode.
-     */
-    public CacheAtomicWriteOrderMode getAtomicWriteOrderMode() {
-        return atomicWriteOrderMode;
-    }
-
-    /**
-     * Sets cache write ordering mode. This property can be enabled only for {@link CacheAtomicityMode#ATOMIC}
-     * cache (for other atomicity modes it will be ignored).
-     *
-     * @param atomicWriteOrderMode Cache write ordering mode.
-     * @return {@code this} for chaining.
-     */
-    public CacheConfiguration<K, V> setAtomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode) {
-        this.atomicWriteOrderMode = atomicWriteOrderMode;
-
-        return this;
-    }
-
-    /**
      * Gets number of nodes used to back up single partition for {@link CacheMode#PARTITIONED} cache.
      * <p>
      * If not set, default value is {@link #DFLT_BACKUPS}.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 44fb311..5d29e0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -120,12 +120,6 @@ public class IgniteConfiguration {
     /** Default message send retries count. */
     public static final int DFLT_SEND_RETRY_CNT = 3;
 
-    /** Default number of clock sync samples. */
-    public static final int DFLT_CLOCK_SYNC_SAMPLES = 8;
-
-    /** Default clock synchronization frequency. */
-    public static final int DFLT_CLOCK_SYNC_FREQUENCY = 120000;
-
     /** Default discovery startup delay in milliseconds (value is {@code 60,000ms}). */
     public static final long DFLT_DISCOVERY_STARTUP_DELAY = 60000;
 
@@ -292,12 +286,6 @@ public class IgniteConfiguration {
     /** Message send retries delay. */
     private int sndRetryCnt = DFLT_SEND_RETRY_CNT;
 
-    /** Number of samples for clock synchronization. */
-    private int clockSyncSamples = DFLT_CLOCK_SYNC_SAMPLES;
-
-    /** Clock synchronization frequency. */
-    private long clockSyncFreq = DFLT_CLOCK_SYNC_FREQUENCY;
-
     /** Metrics history time. */
     private int metricsHistSize = DFLT_METRICS_HISTORY_SIZE;
 
@@ -500,8 +488,6 @@ public class IgniteConfiguration {
         callbackPoolSize = cfg.getAsyncCallbackPoolSize();
         classLdr = cfg.getClassLoader();
         clientMode = cfg.isClientMode();
-        clockSyncFreq = cfg.getClockSyncFrequency();
-        clockSyncSamples = cfg.getClockSyncSamples();
         connectorCfg = cfg.getConnectorConfiguration();
         consistentId = cfg.getConsistentId();
         daemon = cfg.isDaemon();
@@ -1449,52 +1435,6 @@ public class IgniteConfiguration {
     }
 
     /**
-     * Gets number of samples used to synchronize clocks between different nodes.
-     * <p>
-     * Clock synchronization is used for cache version assignment in {@code CLOCK} order mode.
-     *
-     * @return Number of samples for one synchronization round.
-     */
-    public int getClockSyncSamples() {
-        return clockSyncSamples;
-    }
-
-    /**
-     * Sets number of samples used for clock synchronization.
-     *
-     * @param clockSyncSamples Number of samples.
-     * @return {@code this} for chaining.
-     */
-    public IgniteConfiguration setClockSyncSamples(int clockSyncSamples) {
-        this.clockSyncSamples = clockSyncSamples;
-
-        return this;
-    }
-
-    /**
-     * Gets frequency at which clock is synchronized between nodes, in milliseconds.
-     * <p>
-     * Clock synchronization is used for cache version assignment in {@code CLOCK} order mode.
-     *
-     * @return Clock synchronization frequency, in milliseconds.
-     */
-    public long getClockSyncFrequency() {
-        return clockSyncFreq;
-    }
-
-    /**
-     * Sets clock synchronization frequency in milliseconds.
-     *
-     * @param clockSyncFreq Clock synchronization frequency.
-     * @return {@code this} for chaining.
-     */
-    public IgniteConfiguration setClockSyncFrequency(long clockSyncFreq) {
-        this.clockSyncFreq = clockSyncFreq;
-
-        return this;
-    }
-
-    /**
      * Gets Max count of threads can be used at rebalancing.
      * Minimum is 1.
      * @return count.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 99570b2..6fefb68 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@ -35,8 +35,6 @@ import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.internal.processors.clock.GridClockSource;
-import org.apache.ignite.internal.processors.clock.GridClockSyncProcessor;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.cluster.ClusterProcessor;
 import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
@@ -171,13 +169,6 @@ public interface GridKernalContext extends Iterable<GridComponent> {
     public GridTimeoutProcessor timeout();
 
     /**
-     * Gets time processor.
-     *
-     * @return Time processor.
-     */
-    public GridClockSyncProcessor clockSync();
-
-    /**
      * Gets resource processor.
      *
      * @return Resource processor.
@@ -421,13 +412,6 @@ public interface GridKernalContext extends Iterable<GridComponent> {
     public GridIndexingManager indexing();
 
     /**
-     * Gets grid time source.
-     *
-     * @return Time source.
-     */
-    public GridClockSource timeSource();
-
-    /**
      * Gets data structures processor.
      *
      * @return Data structures processor.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index b681027..664e47c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -50,9 +50,6 @@ import org.apache.ignite.internal.processors.cache.CacheConflictResolutionManage
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.internal.processors.clock.GridClockSource;
-import org.apache.ignite.internal.processors.clock.GridClockSyncProcessor;
-import org.apache.ignite.internal.processors.clock.GridJvmClockSource;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.cluster.ClusterProcessor;
 import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
@@ -183,10 +180,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
 
     /** */
     @GridToStringInclude
-    private GridClockSyncProcessor clockSyncProc;
-
-    /** */
-    @GridToStringInclude
     private GridResourceProcessor rsrcProc;
 
     /** */
@@ -364,9 +357,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
     /** Network segmented flag. */
     private volatile boolean segFlag;
 
-    /** Time source. */
-    private GridClockSource clockSrc = new GridJvmClockSource();
-
     /** Performance suggestions. */
     private final GridPerformanceSuggestions perf = new GridPerformanceSuggestions();
 
@@ -526,8 +516,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
             jobProc = (GridJobProcessor)comp;
         else if (comp instanceof GridTimeoutProcessor)
             timeProc = (GridTimeoutProcessor)comp;
-        else if (comp instanceof GridClockSyncProcessor)
-            clockSyncProc = (GridClockSyncProcessor)comp;
         else if (comp instanceof GridResourceProcessor)
             rsrcProc = (GridResourceProcessor)comp;
         else if (comp instanceof GridJobMetricsProcessor)
@@ -652,11 +640,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
     }
 
     /** {@inheritDoc} */
-    @Override public GridClockSyncProcessor clockSync() {
-        return clockSyncProc;
-    }
-
-    /** {@inheritDoc} */
     @Override public GridResourceProcessor resource() {
         return rsrcProc;
     }
@@ -858,20 +841,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
     }
 
     /** {@inheritDoc} */
-    @Override public GridClockSource timeSource() {
-        return clockSrc;
-    }
-
-    /**
-     * Sets time source. For test purposes only.
-     *
-     * @param clockSrc Time source.
-     */
-    public void timeSource(GridClockSource clockSrc) {
-        this.clockSrc = clockSrc;
-    }
-
-    /** {@inheritDoc} */
     @Override public GridPerformanceSuggestions performance() {
         return perf;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index c991319..b35f9bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -111,7 +111,6 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
 import org.apache.ignite.internal.processors.cache.database.MemoryPolicy;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.internal.processors.clock.GridClockSyncProcessor;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.cluster.ClusterProcessor;
 import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
@@ -909,29 +908,26 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
             // Start processors before discovery manager, so they will
             // be able to start receiving messages once discovery completes.
-            try {
-                startProcessor(createComponent(DiscoveryNodeValidationProcessor.class, ctx));
-                startProcessor(new GridClockSyncProcessor(ctx));
-                startProcessor(new GridAffinityProcessor(ctx));
-                startProcessor(createComponent(GridSegmentationProcessor.class, ctx));
-                startProcessor(createComponent(IgniteCacheObjectProcessor.class, ctx));
-                startProcessor(new GridCacheProcessor(ctx));
-                startProcessor(new GridClusterStateProcessor(ctx));
-                startProcessor(new GridQueryProcessor(ctx));
-                startProcessor(new OdbcProcessor(ctx));
-                startProcessor(new GridServiceProcessor(ctx));
-                startProcessor(new GridTaskSessionProcessor(ctx));
-                startProcessor(new GridJobProcessor(ctx));
-                startProcessor(new GridTaskProcessor(ctx));
-                startProcessor((GridProcessor)SCHEDULE.createOptional(ctx));
-                startProcessor(new GridRestProcessor(ctx));
-                startProcessor(new DataStreamProcessor(ctx));
-                startProcessor((GridProcessor)IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration())));
-                startProcessor(new GridContinuousProcessor(ctx));
-                startProcessor(createHadoopComponent());
-                startProcessor(new DataStructuresProcessor(ctx));
-                startProcessor(createComponent(PlatformProcessor.class, ctx));
-                startProcessor(new GridMarshallerMappingProcessor(ctx));
+            try {startProcessor(createComponent(DiscoveryNodeValidationProcessor.class, ctx));
+            startProcessor(new  GridAffinityProcessor(ctx));
+            startProcessor(createComponent(GridSegmentationProcessor.class, ctx));
+            startProcessor(createComponent(IgniteCacheObjectProcessor.class, ctx));
+            startProcessor(new GridCacheProcessor(ctx));startProcessor(new GridClusterStateProcessor(ctx));
+            startProcessor(new GridQueryProcessor(ctx));
+            startProcessor(new OdbcProcessor(ctx));
+            startProcessor(new GridServiceProcessor(ctx));
+            startProcessor(new GridTaskSessionProcessor(ctx));
+            startProcessor(new GridJobProcessor(ctx));
+            startProcessor(new GridTaskProcessor(ctx));
+            startProcessor((GridProcessor)SCHEDULE.createOptional(ctx));
+            startProcessor(new GridRestProcessor(ctx));
+            startProcessor(new DataStreamProcessor(ctx));
+            startProcessor((GridProcessor)IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration())));
+            startProcessor(new GridContinuousProcessor(ctx));
+            startProcessor(createHadoopComponent());
+            startProcessor(new DataStructuresProcessor(ctx));
+            startProcessor(createComponent(PlatformProcessor.class, ctx));
+            startProcessor(new GridMarshallerMappingProcessor(ctx));
 
                 // Start plugins.
                 for (PluginProvider provider : ctx.plugins().allProviders()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 2891bc5..e1c9511 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -117,8 +117,6 @@ import org.apache.ignite.internal.processors.cache.transactions.TxLocksResponse;
 import org.apache.ignite.internal.processors.cache.version.GridCacheRawVersionedEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
-import org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage;
-import org.apache.ignite.internal.processors.clock.GridClockDeltaVersion;
 import org.apache.ignite.internal.processors.continuous.GridContinuousMessage;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamerEntry;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamerRequest;
@@ -573,11 +571,6 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
-            case 60:
-                msg = new GridClockDeltaSnapshotMessage();
-
-                break;
-
             case 61:
                 msg = new GridContinuousMessage();
 
@@ -668,11 +661,6 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
-            case 83:
-                msg = new GridClockDeltaVersion();
-
-                break;
-
             case 84:
                 msg = new GridByteArrayList();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
index af926c6..664b216 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
@@ -70,11 +70,6 @@ public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V> implements Cach
     }
 
     /** {@inheritDoc} */
-    @Override public long updateTime() {
-        return ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         super.writeExternal(out);
 
@@ -96,8 +91,7 @@ public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V> implements Cach
         if (ver != null && ver != GET_ENTRY_INVALID_VER_AFTER_GET && ver != GET_ENTRY_INVALID_VER_UPDATED) {
             res += ", topVer=" + ver.topologyVersion() +
                 ", nodeOrder=" + ver.nodeOrder() +
-                ", order=" + ver.order() +
-                ", updateTime=" + ver.globalTime();
+                ", order=" + ver.order();
         }
         else
             res += ", ver=n/a";

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
index 08a5b28..95e36bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
@@ -28,32 +28,24 @@ public class GridCacheAtomicVersionComparator {
      *
      * @param one First version.
      * @param other Second version.
-     * @param ignoreTime {@code True} if global time should be ignored.
      * @return Comparison value.
      */
-    public int compare(GridCacheVersion one, GridCacheVersion other, boolean ignoreTime) {
+    public int compare(GridCacheVersion one, GridCacheVersion other) {
         int topVer = one.topologyVersion();
         int otherTopVer = other.topologyVersion();
 
         if (topVer == otherTopVer) {
-            long globalTime = one.globalTime();
-            long otherGlobalTime = other.globalTime();
+            long locOrder = one.order();
+            long otherLocOrder = other.order();
 
-            if (globalTime == otherGlobalTime || ignoreTime) {
-                long locOrder = one.order();
-                long otherLocOrder = other.order();
+            if (locOrder == otherLocOrder) {
+                int nodeOrder = one.nodeOrder();
+                int otherNodeOrder = other.nodeOrder();
 
-                if (locOrder == otherLocOrder) {
-                    int nodeOrder = one.nodeOrder();
-                    int otherNodeOrder = other.nodeOrder();
-
-                    return nodeOrder == otherNodeOrder ? 0 : nodeOrder < otherNodeOrder ? -1 : 1;
-                }
-                else
-                    return locOrder > otherLocOrder ? 1 : -1;
+                return nodeOrder == otherNodeOrder ? 0 : nodeOrder < otherNodeOrder ? -1 : 1;
             }
             else
-                return globalTime > otherGlobalTime ? 1 : -1;
+                return locOrder > otherLocOrder ? 1 : -1;
         }
         else
             return topVer > otherTopVer ? 1 : -1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 9e2cd70..f4d4258 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -34,7 +34,6 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.eviction.EvictableEntry;
 import org.apache.ignite.internal.pagemem.wal.StorageException;
 import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
@@ -2588,11 +2587,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
                 unswap(false);
 
                 if (!isNew()) {
-                    if (cctx.atomic()) {
-                        boolean ignoreTime = cctx.config().getAtomicWriteOrderMode() == CacheAtomicWriteOrderMode.PRIMARY;
-
-                        update = ATOMIC_VER_COMPARATOR.compare(this.ver, ver, ignoreTime) < 0;
-                    }
+                    if (cctx.atomic())
+                        update = ATOMIC_VER_COMPARATOR.compare(this.ver, ver) < 0;
                     else
                         update = this.ver.compareTo(ver) < 0;
                 }
@@ -4274,7 +4270,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
             // Incorporate conflict version into new version if needed.
             if (conflictVer != null && conflictVer != newVer) {
                 newVer = new GridCacheVersionEx(newVer.topologyVersion(),
-                    newVer.globalTime(),
                     newVer.order(),
                     newVer.nodeOrder(),
                     newVer.dataCenterId(),
@@ -4651,8 +4646,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 assert conflictCtx != null;
 
-                boolean ignoreTime = cctx.config().getAtomicWriteOrderMode() == CacheAtomicWriteOrderMode.PRIMARY;
-
                 // Use old value?
                 if (conflictCtx.isUseOld()) {
                     GridCacheVersion newConflictVer = conflictVer != null ? conflictVer : newVer;
@@ -4661,7 +4654,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
                     if (!entry.isStartVersion() &&                                                        // Not initial value,
                         verCheck &&                                                                       // and atomic version check,
                         oldConflictVer.dataCenterId() == newConflictVer.dataCenterId() &&                 // and data centers are equal,
-                        ATOMIC_VER_COMPARATOR.compare(oldConflictVer, newConflictVer, ignoreTime) == 0 && // and both versions are equal,
+                        ATOMIC_VER_COMPARATOR.compare(oldConflictVer, newConflictVer) == 0 && // and both versions are equal,
                         cctx.writeThrough() &&                                                            // and store is enabled,
                         primary)                                                                          // and we are primary.
                     {
@@ -4719,11 +4712,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
         private void versionCheck(@Nullable IgniteBiTuple<Object, Exception> invokeRes) throws IgniteCheckedException {
             GridCacheContext cctx = entry.context();
 
-            boolean ignoreTime = cctx.config().getAtomicWriteOrderMode() == CacheAtomicWriteOrderMode.PRIMARY;
-
             if (verCheck) {
-                if (!entry.isStartVersion() && ATOMIC_VER_COMPARATOR.compare(entry.ver, newVer, ignoreTime) >= 0) {
-                    if (ATOMIC_VER_COMPARATOR.compare(entry.ver, newVer, ignoreTime) == 0 && cctx.writeThrough() && primary) {
+                if (!entry.isStartVersion() && ATOMIC_VER_COMPARATOR.compare(entry.ver, newVer) >= 0) {
+                    if (ATOMIC_VER_COMPARATOR.compare(entry.ver, newVer) == 0 && cctx.writeThrough() && primary) {
                         if (log.isDebugEnabled())
                             log.debug("Received entry update with same version as current (will update store) " +
                                 "[entry=" + this + ", newVer=" + newVer + ']');
@@ -4758,7 +4749,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
                 }
             }
             else
-                assert entry.isStartVersion() || ATOMIC_VER_COMPARATOR.compare(entry.ver, newVer, ignoreTime) <= 0 :
+                assert entry.isStartVersion() || ATOMIC_VER_COMPARATOR.compare(entry.ver, newVer) <= 0 :
                     "Invalid version for inner update [isNew=" + entry.isStartVersion() + ", entry=" + this + ", newVer=" + newVer + ']';
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
index 498584c..28cc8fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
@@ -57,26 +57,19 @@ public final class GridCacheMvcc {
     /** */
     private static final Comparator<GridCacheVersion> SER_VER_COMPARATOR = new Comparator<GridCacheVersion>() {
         @Override public int compare(GridCacheVersion ver1, GridCacheVersion ver2) {
-            long time1 = ver1.globalTime();
-            long time2 = ver2.globalTime();
+            int nodeOrder1 = ver1.nodeOrder();
+            int nodeOrder2 = ver2.nodeOrder();
 
-            if (time1 == time2) {
-                int nodeOrder1 = ver1.nodeOrder();
-                int nodeOrder2 = ver2.nodeOrder();
+            if (nodeOrder1 == nodeOrder2) {
+                long order1 = ver1.order();
+                long order2 = ver2.order();
 
-                if (nodeOrder1 == nodeOrder2) {
-                    long order1 = ver1.order();
-                    long order2 = ver2.order();
+                assert order1 != order2;
 
-                    assert order1 != order2;
-
-                    return order1 > order2 ? 1 : -1;
-                }
-                else
-                    return nodeOrder1 > nodeOrder2 ? 1 : -1;
+                return order1 > order2 ? 1 : -1;
             }
             else
-                return time1 > time2 ? 1 : -1;
+                return nodeOrder1 > nodeOrder2 ? 1 : -1;
         }
     };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/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 8799fbb..3f7184e 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
@@ -43,7 +43,6 @@ import javax.management.JMException;
 import javax.management.MBeanServer;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheExistsException;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheRebalanceMode;
@@ -285,22 +284,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         assert cfg.getWriteSynchronizationMode() != null;
 
-        if (cfg.getAtomicityMode() == ATOMIC) {
-            if (cfg.getAtomicWriteOrderMode() == null) {
-                cfg.setAtomicWriteOrderMode(cfg.getWriteSynchronizationMode() == FULL_SYNC ?
-                    CacheAtomicWriteOrderMode.CLOCK :
-                    CacheAtomicWriteOrderMode.PRIMARY);
-            }
-            else if (cfg.getWriteSynchronizationMode() != FULL_SYNC &&
-                cfg.getAtomicWriteOrderMode() == CacheAtomicWriteOrderMode.CLOCK) {
-                cfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.PRIMARY);
-
-                U.warn(log, "Automatically set write order mode to PRIMARY for better performance " +
-                    "[writeSynchronizationMode=" + cfg.getWriteSynchronizationMode() + ", " +
-                    "cacheName=" + U.maskName(cfg.getName()) + ']');
-            }
-        }
-
         if (cfg.getCacheStoreFactory() == null) {
             Factory<CacheLoader> ldrFactory = cfg.getCacheLoaderFactory();
             Factory<CacheWriter> writerFactory = cfg.isWriteThrough() ? cfg.getCacheWriterFactory() : null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
index 02f74e4..410a6ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
@@ -38,10 +38,10 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
     static final int VERSION_OFFSET = 16;
 
     /** */
-    static final int VERSION_SIZE = 24;
+    static final int VERSION_SIZE = 16;
 
     /** */
-    static final int VERSION_EX_SIZE = 48;
+    static final int VERSION_EX_SIZE = 32;
 
     /** */
     static final int GUID_SIZE = 24;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 457c895..d20a782 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -961,12 +961,11 @@ public class GridCacheUtils {
     public static byte[] versionToBytes(GridCacheVersion ver) {
         assert ver != null;
 
-        byte[] bytes = new byte[28];
+        byte[] bytes = new byte[20];
 
         U.intToBytes(ver.topologyVersion(), bytes, 0);
-        U.longToBytes(ver.globalTime(), bytes, 4);
-        U.longToBytes(ver.order(), bytes, 12);
-        U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 20);
+        U.longToBytes(ver.order(), bytes, 4);
+        U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 12);
 
         return bytes;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/CacheVersionIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/CacheVersionIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/CacheVersionIO.java
index 8a630cc..fe5ca04 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/CacheVersionIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/CacheVersionIO.java
@@ -72,7 +72,6 @@ public class CacheVersionIO {
             buf.put(protoVer);
             buf.putInt(ver.topologyVersion());
             buf.putInt(ver.nodeOrderAndDrIdRaw());
-            buf.putLong(ver.globalTime());
             buf.putLong(ver.order());
         }
     }
@@ -95,8 +94,7 @@ public class CacheVersionIO {
             PageUtils.putByte(addr, 0, protoVer);
             PageUtils.putInt(addr, 1, ver.topologyVersion());
             PageUtils.putInt(addr, 5, ver.nodeOrderAndDrIdRaw());
-            PageUtils.putLong(addr, 9, ver.globalTime());
-            PageUtils.putLong(addr, 17, ver.order());
+            PageUtils.putLong(addr, 9, ver.order());
         }
     }
 
@@ -158,10 +156,9 @@ public class CacheVersionIO {
 
         int topVer = buf.getInt();
         int nodeOrderDrId = buf.getInt();
-        long globalTime = buf.getLong();
         long order = buf.getLong();
 
-        return new GridCacheVersion(topVer, nodeOrderDrId, globalTime, order);
+        return new GridCacheVersion(topVer, nodeOrderDrId, order);
     }
 
     /**
@@ -180,9 +177,8 @@ public class CacheVersionIO {
 
         int topVer = PageUtils.getInt(pageAddr, 1);
         int nodeOrderDrId = PageUtils.getInt(pageAddr, 5);
-        long globalTime = PageUtils.getLong(pageAddr, 9);
-        long order = PageUtils.getLong(pageAddr, 17);
+        long order = PageUtils.getLong(pageAddr, 9);
 
-        return new GridCacheVersion(topVer, nodeOrderDrId, globalTime, order);
+        return new GridCacheVersion(topVer, nodeOrderDrId, order);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 2810327..87a5536 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -698,7 +698,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     @Override public V tryGetAndPut(K key, V val) throws IgniteCheckedException {
         A.notNull(key, "key", val, "val");
 
-        return (V) update0(
+        return (V)update0(
             key,
             val,
             null,
@@ -884,8 +884,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /** {@inheritDoc} */
     @Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
         EntryProcessor<K, V, T> entryProcessor,
-        Object... args) throws IgniteCheckedException
-    {
+        Object... args) throws IgniteCheckedException {
         return invokeAll0(false, keys, entryProcessor, args).get();
     }
 
@@ -1830,7 +1829,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                         if (req.size() > 1 &&                    // Several keys ...
                             writeThrough() && !req.skipStore() && // and store is enabled ...
                             !ctx.store().isLocal() &&             // and this is not local store ...
-                                                                  // (conflict resolver should be used for local store)
+                            // (conflict resolver should be used for local store)
                             !ctx.dr().receiveEnabled()            // and no DR.
                             ) {
                             // This method can only be used when there are no replicated entries in the batch.
@@ -2224,7 +2223,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     if (intercept) {
                         CacheObject old = entry.innerGet(
                             null,
-                             null,
+                            null,
                             /*read through*/ctx.loadPreviousValue(),
                             /*metrics*/true,
                             /*event*/true,
@@ -2836,8 +2835,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
      * @param req Request with keys to lock.
      * @param topVer Topology version to lock on.
      * @return Collection of locked entries.
-     * @throws GridDhtInvalidPartitionException If entry does not belong to local node. If exception is thrown,
-     *      locks are released.
+     * @throws GridDhtInvalidPartitionException If entry does not belong to local node. If exception is thrown, locks
+     * are released.
      */
     @SuppressWarnings("ForLoopReplaceableByForEach")
     private List<GridDhtCacheEntry> lockEntries(GridNearAtomicAbstractUpdateRequest req, AffinityTopologyVersion topVer)
@@ -2964,8 +2963,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
     /**
      * @param entry Entry to check.
      * @param req Update request.
-     * @param res Update response. If filter evaluation failed, key will be added to failed keys and method
-     *      will return false.
+     * @param res Update response. If filter evaluation failed, key will be added to failed keys and method will return
+     * false.
      * @return {@code True} if filter evaluation succeeded.
      */
     private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicAbstractUpdateRequest req,
@@ -3401,7 +3400,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
             }
         }
         catch (IgniteCheckedException e) {
-            U.error(log, "Failed to send deferred DHT update response to remote node [" +
+            U.error(log, "Failed to send deferredDHT  update response to remote node [" +
                 "futIds=" + msg.futureIds() + ", node=" + primaryId + ']', e);
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
index 9887f55..9a6909a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
@@ -47,7 +47,6 @@ public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNear
 
     /**
      * Constructor.
-     *
      * @param cacheId Cache ID.
      * @param nodeId Node ID.
      * @param futId Future ID.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index 0a9c564..f175ab3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -117,8 +117,7 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
 
     /**
      * Constructor.
-     *
-     * @param cacheId Cache ID.
+     *  @param cacheId Cache ID.
      * @param nodeId Node ID.
      * @param futId Future ID.
      * @param topVer Topology version.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
index 0307009..f5bd889 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -55,8 +55,7 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
 
     /**
      * Constructor.
-     *
-     * @param cacheId Cache ID.
+     *  @param cacheId Cache ID.
      * @param nodeId Node ID.
      * @param futId Future ID.
      * @param topVer Topology version.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
index 7ceab3c..850a0f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -73,8 +73,7 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
 
     /**
      * Constructor.
-     *
-     * @param cacheId Cache ID.
+     *  @param cacheId Cache ID.
      * @param nodeId Node ID.
      * @param futId Future ID.
      * @param topVer Topology version.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 2e6fc1d..1f8a107 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -72,16 +72,16 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
     private static final long serialVersionUID = 0L;
 
     /** Dummy version for non-existing entry read in SERIALIZABLE transaction. */
-    public static final GridCacheVersion SER_READ_EMPTY_ENTRY_VER = new GridCacheVersion(0, 0, 0, 0);
+    public static final GridCacheVersion SER_READ_EMPTY_ENTRY_VER = new GridCacheVersion(0, 0, 0);
 
     /** Dummy version for any existing entry read in SERIALIZABLE transaction. */
-    public static final GridCacheVersion SER_READ_NOT_EMPTY_VER = new GridCacheVersion(0, 0, 0, 1);
+    public static final GridCacheVersion SER_READ_NOT_EMPTY_VER = new GridCacheVersion(0, 0, 1);
 
     /** */
-    public static final GridCacheVersion GET_ENTRY_INVALID_VER_UPDATED = new GridCacheVersion(0, 0, 0, 2);
+    public static final GridCacheVersion GET_ENTRY_INVALID_VER_UPDATED = new GridCacheVersion(0, 0, 2);
 
     /** */
-    public static final GridCacheVersion GET_ENTRY_INVALID_VER_AFTER_GET = new GridCacheVersion(0, 0, 0, 3);
+    public static final GridCacheVersion GET_ENTRY_INVALID_VER_AFTER_GET = new GridCacheVersion(0, 0, 3);
 
     /** Prepared flag updater. */
     private static final AtomicIntegerFieldUpdater<IgniteTxEntry> PREPARED_UPD =

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index a8f841f..da49c06 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -2356,7 +2356,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
          * @param nearVer Near transaction version.
          */
         private CommittedVersion(GridCacheVersion ver, GridCacheVersion nearVer) {
-            super(ver.topologyVersion(), ver.globalTime(), ver.order(), ver.nodeOrder(), ver.dataCenterId());
+            super(ver.topologyVersion(), ver.order(), ver.nodeOrder(), ver.dataCenterId());
 
             assert nearVer != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
index c175e5a..f4d7e08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
@@ -110,11 +110,6 @@ public class GridCachePlainVersionedEntry<K, V> implements GridCacheVersionedEnt
     }
 
     /** {@inheritDoc} */
-    @Override public long globalTime() {
-        return isStartVer ? 0L : ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
     @Override public GridCacheVersion version() {
         return ver;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
index 57b69d4..1146496 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
@@ -170,11 +170,6 @@ public class GridCacheRawVersionedEntry<K, V> extends DataStreamerEntry implemen
     }
 
     /** {@inheritDoc} */
-    @Override public long globalTime() {
-        return ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
     @Override public GridCacheVersion version() {
         return ver;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
index d84e4da..67bd49e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
@@ -50,9 +50,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** Node order (used as global order) and DR ID. */
     private int nodeOrderDrId;
 
-    /** Globally adjusted time. */
-    private long globalTime;
-
     /** Order. */
     private long order;
 
@@ -65,12 +62,11 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
     /**
      * @param topVer Topology version plus number of seconds from the start time of the first grid node.
-     * @param globalTime Globally adjusted time.
      * @param order Version order.
      * @param nodeOrder Node order.
      * @param dataCenterId Replication data center ID.
      */
-    public GridCacheVersion(int topVer, long globalTime, long order, int nodeOrder, int dataCenterId) {
+    public GridCacheVersion(int topVer, long order, int nodeOrder, int dataCenterId) {
         assert topVer >= 0 : topVer;
         assert order >= 0 : order;
         assert nodeOrder >= 0 : nodeOrder;
@@ -80,7 +76,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
             throw new IllegalArgumentException("Node order overflow: " + nodeOrder);
 
         this.topVer = topVer;
-        this.globalTime = globalTime;
         this.order = order;
 
         nodeOrderDrId = nodeOrder | (dataCenterId << DR_ID_SHIFT);
@@ -90,13 +85,11 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /**
      * @param topVer Topology version plus number of seconds from the start time of the first grid node.
      * @param nodeOrderDrId Node order and DR ID.
-     * @param globalTime Globally adjusted time.
      * @param order Version order.
      */
-    public GridCacheVersion(int topVer, int nodeOrderDrId, long globalTime, long order) {
+    public GridCacheVersion(int topVer, int nodeOrderDrId, long order) {
         this.topVer = topVer;
         this.nodeOrderDrId = nodeOrderDrId;
-        this.globalTime = globalTime;
         this.order = order;
     }
 
@@ -117,13 +110,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     }
 
     /**
-     * @return Adjusted time.
-     */
-    public long globalTime() {
-        return globalTime;
-    }
-
-    /**
      * @return Version order.
      */
     public long order() {
@@ -187,7 +173,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
      * @return Version represented as {@code GridUuid}
      */
     public IgniteUuid asGridUuid() {
-        return new IgniteUuid(new UUID(((long)topVer << 32) | nodeOrderDrId, globalTime), order);
+        return new IgniteUuid(new UUID(topVer, nodeOrderDrId), order);
     }
 
     /** {@inheritDoc} */
@@ -198,7 +184,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeInt(topVer);
-        out.writeLong(globalTime);
         out.writeLong(order);
         out.writeInt(nodeOrderDrId);
     }
@@ -206,7 +191,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException {
         topVer = in.readInt();
-        globalTime = in.readLong();
         order = in.readLong();
         nodeOrderDrId = in.readInt();
     }
@@ -264,24 +248,18 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
         switch (writer.state()) {
             case 0:
-                if (!writer.writeLong("globalTime", globalTime))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
                 if (!writer.writeInt("nodeOrderDrId", nodeOrderDrId))
                     return false;
 
                 writer.incrementState();
 
-            case 2:
+            case 1:
                 if (!writer.writeLong("order", order))
                     return false;
 
                 writer.incrementState();
 
-            case 3:
+            case 2:
                 if (!writer.writeInt("topVer", topVer))
                     return false;
 
@@ -301,14 +279,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
         switch (reader.state()) {
             case 0:
-                globalTime = reader.readLong("globalTime");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
                 nodeOrderDrId = reader.readInt("nodeOrderDrId");
 
                 if (!reader.isLastRead())
@@ -316,7 +286,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
                 reader.incrementState();
 
-            case 2:
+            case 1:
                 order = reader.readLong("order");
 
                 if (!reader.isLastRead())
@@ -324,7 +294,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
                 reader.incrementState();
 
-            case 3:
+            case 2:
                 topVer = reader.readInt("topVer");
 
                 if (!reader.isLastRead())
@@ -344,13 +314,12 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 4;
+        return 3;
     }
 
     /** {@inheritDoc} */
     @Override public String toString() {
         return "GridCacheVersion [topVer=" + topologyVersion() +
-            ", time=" + globalTime() +
             ", order=" + order() +
             ", nodeOrder=" + nodeOrder() + ']';
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
index f15a545..5eb8c7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
@@ -46,15 +46,14 @@ public class GridCacheVersionEx extends GridCacheVersion {
      * Constructor.
      *
      * @param topVer Topology version.
-     * @param globalTime Global time.
      * @param order Order.
      * @param nodeOrder Node order.
      * @param dataCenterId Data center ID.
      * @param drVer DR version.
      */
-    public GridCacheVersionEx(int topVer, long globalTime, long order, int nodeOrder, byte dataCenterId,
+    public GridCacheVersionEx(int topVer, long order, int nodeOrder, byte dataCenterId,
         GridCacheVersion drVer) {
-        super(topVer, globalTime, order, nodeOrder, dataCenterId);
+        super(topVer, order, nodeOrder, dataCenterId);
 
         assert drVer != null && !(drVer instanceof GridCacheVersionEx); // DR version can only be plain here.
 
@@ -66,12 +65,11 @@ public class GridCacheVersionEx extends GridCacheVersion {
      *
      * @param topVer Topology version.
      * @param nodeOrderDrId Node order and DR ID.
-     * @param globalTime Globally adjusted time.
      * @param order Version order.
      * @param drVer DR version.
      */
-    public GridCacheVersionEx(int topVer, int nodeOrderDrId, long globalTime, long order, GridCacheVersion drVer) {
-        super(topVer, nodeOrderDrId, globalTime, order);
+    public GridCacheVersionEx(int topVer, int nodeOrderDrId, long order, GridCacheVersion drVer) {
+        super(topVer, nodeOrderDrId, order);
 
         assert drVer != null && !(drVer instanceof GridCacheVersionEx); // DR version can only be plain here.
 
@@ -90,7 +88,7 @@ public class GridCacheVersionEx extends GridCacheVersion {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 5;
+        return 4;
     }
 
     /** {@inheritDoc} */
@@ -108,7 +106,7 @@ public class GridCacheVersionEx extends GridCacheVersion {
         }
 
         switch (writer.state()) {
-            case 4:
+            case 3:
                 if (!writer.writeMessage("drVer", drVer))
                     return false;
 
@@ -130,7 +128,7 @@ public class GridCacheVersionEx extends GridCacheVersion {
             return false;
 
         switch (reader.state()) {
-            case 4:
+            case 3:
                 drVer = reader.readMessage("drVer");
 
                 if (!reader.isLastRead())
@@ -162,9 +160,8 @@ public class GridCacheVersionEx extends GridCacheVersion {
     /** {@inheritDoc} */
     @Override public String toString() {
         return "GridCacheVersionEx [topVer=" + topologyVersion() +
-            ", time=" + globalTime() +
             ", order=" + order() +
             ", nodeOrder=" + nodeOrder() +
             ", drVer=" + drVer + ']';
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
index fe5f562..bc2e49a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
@@ -82,7 +82,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
 
     /** {@inheritDoc} */
     @Override public void start0() throws IgniteCheckedException {
-        last = new GridCacheVersion(0, 0, order.get(), 0, dataCenterId);
+        last = new GridCacheVersion(0, order.get(), 0, dataCenterId);
 
         cctx.gridEvents().addLocalEventListener(discoLsnr, EVT_NODE_METRICS_UPDATED);
     }
@@ -106,7 +106,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
     public void dataCenterId(byte dataCenterId) {
         this.dataCenterId = dataCenterId;
 
-        last = new GridCacheVersion(0, 0, order.get(), 0, dataCenterId);
+        last = new GridCacheVersion(0, order.get(), 0, dataCenterId);
     }
 
     /**
@@ -188,7 +188,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
 
             topVer += (gridStartTime - TOP_VER_BASE_TIME) / 1000;
 
-            ISOLATED_STREAMER_VER = new GridCacheVersion((int)topVer, 0, 0, 1, dataCenterId);
+            ISOLATED_STREAMER_VER = new GridCacheVersion((int)topVer, 0, 1, dataCenterId);
         }
 
         return ISOLATED_STREAMER_VER;
@@ -274,8 +274,6 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
         if (topVer == -1)
             topVer = cctx.kernalContext().discovery().topologyVersion();
 
-        long globalTime = cctx.kernalContext().clockSync().adjustedTime(topVer);
-
         if (addTime) {
             if (gridStartTime == 0)
                 gridStartTime = cctx.kernalContext().discovery().gridStartTime();
@@ -289,7 +287,6 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
 
         GridCacheVersion next = new GridCacheVersion(
             (int)topVer,
-            globalTime,
             ord,
             locNodeOrder,
             dataCenterId);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
index 06e7999..e685d79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
@@ -71,11 +71,4 @@ public interface GridCacheVersionedEntry<K, V> {
      * @return Entry's order in initiator data center
      */
     public long order();
-
-    /**
-     * Gets entry's global time in initiator data center.
-     *
-     * @return Entry's global time in initiator data center
-     */
-    public long globalTime();
 }
\ No newline at end of file


[04/50] [abbrv] ignite git commit: IGNITE-4942: Removed deprecated JdbcQueryTask and replaced it with JdbcQueryTaskV2. This closes #1772.

Posted by sb...@apache.org.
IGNITE-4942: Removed deprecated JdbcQueryTask and replaced it with JdbcQueryTaskV2. This closes #1772.


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

Branch: refs/heads/ignite-1561-1
Commit: d57ef07dfb815b2510d62843b556425f19f54f5f
Parents: 3784756
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 16:16:23 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 16:16:23 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/jdbc2/JdbcQueryTask.java    |  41 +-
 .../ignite/internal/jdbc2/JdbcQueryTaskV2.java  | 406 -------------------
 .../ignite/internal/jdbc2/JdbcResultSet.java    |  64 +--
 .../ignite/internal/jdbc2/JdbcStatement.java    |  12 +-
 .../resources/META-INF/classnames.properties    |   3 -
 5 files changed, 38 insertions(+), 488 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d57ef07d/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
index bd6b0f2..68ea4c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
@@ -49,10 +49,7 @@ import org.apache.ignite.resources.IgniteInstanceResource;
  * Not closed cursors will be removed after {@link #RMV_DELAY} milliseconds.
  * This parameter can be configured via {@link IgniteSystemProperties#IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY}
  * system property.
- *
- * Deprecated due to introduction of DML features - see {@link JdbcQueryTaskV2}.
  */
-@Deprecated
 class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
     /** Serial version uid. */
     private static final long serialVersionUID = 0L;
@@ -80,6 +77,9 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
     /** Sql. */
     private final String sql;
 
+    /** Operation type flag - query or not. */
+    private Boolean isQry;
+
     /** Args. */
     private final Object[] args;
 
@@ -102,6 +102,7 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
      * @param ignite Ignite.
      * @param cacheName Cache name.
      * @param sql Sql query.
+     * @param isQry Operation type flag - query or not - to enforce query type check.
      * @param loc Local execution flag.
      * @param args Args.
      * @param fetchSize Fetch size.
@@ -111,13 +112,14 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
      * @param distributedJoins Distributed joins flag.
      */
     public JdbcQueryTask(Ignite ignite, String cacheName, String sql,
-        boolean loc, Object[] args, int fetchSize, UUID uuid,
-        boolean locQry, boolean collocatedQry, boolean distributedJoins) {
+                           Boolean isQry, boolean loc, Object[] args, int fetchSize, UUID uuid,
+                           boolean locQry, boolean collocatedQry, boolean distributedJoins) {
         this.ignite = ignite;
         this.args = args;
         this.uuid = uuid;
         this.cacheName = cacheName;
         this.sql = sql;
+        this.isQry = isQry;
         this.fetchSize = fetchSize;
         this.loc = loc;
         this.locQry = locQry;
@@ -151,16 +153,20 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
                     throw new SQLException("Cache not found [cacheName=" + cacheName + ']');
             }
 
-            SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(args);
+            SqlFieldsQuery qry = (isQry != null ? new JdbcSqlFieldsQuery(sql, isQry) : new SqlFieldsQuery(sql))
+                .setArgs(args);
 
             qry.setPageSize(fetchSize);
             qry.setLocal(locQry);
             qry.setCollocated(collocatedQry);
             qry.setDistributedJoins(distributedJoins);
 
-            QueryCursor<List<?>> qryCursor = cache.withKeepBinary().query(qry);
+            QueryCursorImpl<List<?>> qryCursor = (QueryCursorImpl<List<?>>)cache.withKeepBinary().query(qry);
+
+            if (isQry == null)
+                isQry = qryCursor.isQuery();
 
-            Collection<GridQueryFieldMetadata> meta = ((QueryCursorImpl<List<?>>)qryCursor).fieldsMeta();
+            Collection<GridQueryFieldMetadata> meta = qryCursor.fieldsMeta();
 
             tbls = new ArrayList<>(meta.size());
             cols = new ArrayList<>(meta.size());
@@ -200,7 +206,9 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
         else if (!loc && !CURSORS.replace(uuid, cursor, new Cursor(cursor.cursor, cursor.iter)))
             assert !CURSORS.containsKey(uuid) : "Concurrent cursor modification.";
 
-        return new QueryResult(uuid, finished, rows, cols, tbls, types);
+        assert isQry != null : "Query flag must be set prior to returning result";
+
+        return new QueryResult(uuid, finished, isQry, rows, cols, tbls, types);
     }
 
     /**
@@ -261,7 +269,6 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
             c.cursor.close();
     }
 
-
     /**
      * Result of query execution.
      */
@@ -275,6 +282,9 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
         /** Finished. */
         private final boolean finished;
 
+        /** Result type - query or update. */
+        private final boolean isQry;
+
         /** Rows. */
         private final List<List<?>> rows;
 
@@ -290,13 +300,15 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
         /**
          * @param uuid UUID..
          * @param finished Finished.
+         * @param isQry
          * @param rows Rows.
          * @param cols Columns.
          * @param tbls Tables.
          * @param types Types.
          */
-        public QueryResult(UUID uuid, boolean finished, List<List<?>> rows, List<String> cols,
+        public QueryResult(UUID uuid, boolean finished, boolean isQry, List<List<?>> rows, List<String> cols,
             List<String> tbls, List<String> types) {
+            this.isQry = isQry;
             this.cols = cols;
             this.uuid = uuid;
             this.finished = finished;
@@ -346,6 +358,13 @@ class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
         public boolean isFinished() {
             return finished;
         }
+
+        /**
+         * @return {@code true} if it is result of a query operation, not update; {@code false} otherwise.
+         */
+        public boolean isQuery() {
+            return isQry;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/d57ef07d/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTaskV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTaskV2.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTaskV2.java
deleted file mode 100644
index 61f152d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTaskV2.java
+++ /dev/null
@@ -1,406 +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.
- */
-
-package org.apache.ignite.internal.jdbc2;
-
-import java.io.Serializable;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteJdbcDriver;
-import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
-import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-import org.apache.ignite.internal.util.typedef.CAX;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.resources.IgniteInstanceResource;
-
-/**
- * Task for SQL queries execution through {@link IgniteJdbcDriver}.
- * <p>
- * Not closed cursors will be removed after {@link #RMV_DELAY} milliseconds.
- * This parameter can be configured via {@link IgniteSystemProperties#IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY}
- * system property.
- */
-class JdbcQueryTaskV2 implements IgniteCallable<JdbcQueryTaskV2.QueryResult> {
-    /** Serial version uid. */
-    private static final long serialVersionUID = 0L;
-
-    /** How long to store open cursor. */
-    private static final long RMV_DELAY = IgniteSystemProperties.getLong(
-        IgniteSystemProperties.IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY, 600000);
-
-    /** Scheduler. */
-    private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1);
-
-    /** Open cursors. */
-    private static final ConcurrentMap<UUID, Cursor> CURSORS = new ConcurrentHashMap<>();
-
-    /** Ignite. */
-    @IgniteInstanceResource
-    private Ignite ignite;
-
-    /** Uuid. */
-    private final UUID uuid;
-
-    /** Cache name. */
-    private final String cacheName;
-
-    /** Sql. */
-    private final String sql;
-
-    /** Operation type flag - query or not. */
-    private Boolean isQry;
-
-    /** Args. */
-    private final Object[] args;
-
-    /** Fetch size. */
-    private final int fetchSize;
-
-    /** Local execution flag. */
-    private final boolean loc;
-
-    /** Local query flag. */
-    private final boolean locQry;
-
-    /** Collocated query flag. */
-    private final boolean collocatedQry;
-
-    /** Distributed joins flag. */
-    private final boolean distributedJoins;
-
-    /**
-     * @param ignite Ignite.
-     * @param cacheName Cache name.
-     * @param sql Sql query.
-     * @param isQry Operation type flag - query or not - to enforce query type check.
-     * @param loc Local execution flag.
-     * @param args Args.
-     * @param fetchSize Fetch size.
-     * @param uuid UUID.
-     * @param locQry Local query flag.
-     * @param collocatedQry Collocated query flag.
-     * @param distributedJoins Distributed joins flag.
-     */
-    public JdbcQueryTaskV2(Ignite ignite, String cacheName, String sql,
-                           Boolean isQry, boolean loc, Object[] args, int fetchSize, UUID uuid,
-                           boolean locQry, boolean collocatedQry, boolean distributedJoins) {
-        this.ignite = ignite;
-        this.args = args;
-        this.uuid = uuid;
-        this.cacheName = cacheName;
-        this.sql = sql;
-        this.isQry = isQry;
-        this.fetchSize = fetchSize;
-        this.loc = loc;
-        this.locQry = locQry;
-        this.collocatedQry = collocatedQry;
-        this.distributedJoins = distributedJoins;
-    }
-
-    /** {@inheritDoc} */
-    @Override public JdbcQueryTaskV2.QueryResult call() throws Exception {
-        Cursor cursor = CURSORS.get(uuid);
-
-        List<String> tbls = null;
-        List<String> cols = null;
-        List<String> types = null;
-
-        boolean first;
-
-        if (first = (cursor == null)) {
-            IgniteCache<?, ?> cache = ignite.cache(cacheName);
-
-            // Don't create caches on server nodes in order to avoid of data rebalancing.
-            boolean start = ignite.configuration().isClientMode();
-
-            if (cache == null && cacheName == null)
-                cache = ((IgniteKernal)ignite).context().cache().getOrStartPublicCache(start, !loc && locQry);
-
-            if (cache == null) {
-                if (cacheName == null)
-                    throw new SQLException("Failed to execute query. No suitable caches found.");
-                else
-                    throw new SQLException("Cache not found [cacheName=" + cacheName + ']');
-            }
-
-            SqlFieldsQuery qry = (isQry != null ? new JdbcSqlFieldsQuery(sql, isQry) : new SqlFieldsQuery(sql))
-                .setArgs(args);
-
-            qry.setPageSize(fetchSize);
-            qry.setLocal(locQry);
-            qry.setCollocated(collocatedQry);
-            qry.setDistributedJoins(distributedJoins);
-
-            QueryCursorImpl<List<?>> qryCursor = (QueryCursorImpl<List<?>>)cache.withKeepBinary().query(qry);
-
-            if (isQry == null)
-                isQry = qryCursor.isQuery();
-
-            Collection<GridQueryFieldMetadata> meta = qryCursor.fieldsMeta();
-
-            tbls = new ArrayList<>(meta.size());
-            cols = new ArrayList<>(meta.size());
-            types = new ArrayList<>(meta.size());
-
-            for (GridQueryFieldMetadata desc : meta) {
-                tbls.add(desc.typeName());
-                cols.add(desc.fieldName().toUpperCase());
-                types.add(desc.fieldTypeName());
-            }
-
-            CURSORS.put(uuid, cursor = new Cursor(qryCursor, qryCursor.iterator()));
-        }
-
-        List<List<?>> rows = new ArrayList<>();
-
-        for (List<?> row : cursor) {
-            List<Object> row0 = new ArrayList<>(row.size());
-
-            for (Object val : row)
-                row0.add(val == null || JdbcUtils.isSqlType(val.getClass()) ? val : val.toString());
-
-            rows.add(row0);
-
-            if (rows.size() == fetchSize) // If fetchSize is 0 then unlimited
-                break;
-        }
-
-        boolean finished = !cursor.hasNext();
-
-        if (finished)
-            remove(uuid, cursor);
-        else if (first) {
-            if (!loc)
-                scheduleRemoval(uuid, RMV_DELAY);
-        }
-        else if (!loc && !CURSORS.replace(uuid, cursor, new Cursor(cursor.cursor, cursor.iter)))
-            assert !CURSORS.containsKey(uuid) : "Concurrent cursor modification.";
-
-        assert isQry != null : "Query flag must be set prior to returning result";
-
-        return new QueryResult(uuid, finished, isQry, rows, cols, tbls, types);
-    }
-
-    /**
-     * Schedules removal of stored cursor in case of remote query execution.
-     *
-     * @param uuid Cursor UUID.
-     * @param delay Delay in milliseconds.
-     */
-    private void scheduleRemoval(final UUID uuid, long delay) {
-        assert !loc;
-
-        SCHEDULER.schedule(new CAX() {
-            @Override public void applyx() {
-                while (true) {
-                    Cursor c = CURSORS.get(uuid);
-
-                    if (c == null)
-                        break;
-
-                    // If the cursor was accessed since last scheduling then reschedule.
-                    long untouchedTime = U.currentTimeMillis() - c.lastAccessTime;
-
-                    if (untouchedTime < RMV_DELAY) {
-                        scheduleRemoval(uuid, RMV_DELAY - untouchedTime);
-
-                        break;
-                    }
-                    else if (remove(uuid, c))
-                        break;
-                }
-            }
-        }, delay, TimeUnit.MILLISECONDS);
-    }
-
-    /**
-     * @param uuid Cursor UUID.
-     * @param c Cursor.
-     * @return {@code true} If succeeded.
-     */
-    private static boolean remove(UUID uuid, Cursor c) {
-        boolean rmv = CURSORS.remove(uuid, c);
-
-        if (rmv)
-            c.cursor.close();
-
-        return rmv;
-    }
-
-    /**
-     * Closes and removes cursor.
-     *
-     * @param uuid Cursor UUID.
-     */
-    static void remove(UUID uuid) {
-        Cursor c = CURSORS.remove(uuid);
-
-        if (c != null)
-            c.cursor.close();
-    }
-
-
-    /**
-     * Result of query execution.
-     */
-    static class QueryResult implements Serializable {
-        /** Serial version uid. */
-        private static final long serialVersionUID = 0L;
-
-        /** Uuid. */
-        private final UUID uuid;
-
-        /** Finished. */
-        private final boolean finished;
-
-        /** Result type - query or update. */
-        private final boolean isQry;
-
-        /** Rows. */
-        private final List<List<?>> rows;
-
-        /** Tables. */
-        private final List<String> tbls;
-
-        /** Columns. */
-        private final List<String> cols;
-
-        /** Types. */
-        private final List<String> types;
-
-        /**
-         * @param uuid UUID..
-         * @param finished Finished.
-         * @param isQry
-         * @param rows Rows.
-         * @param cols Columns.
-         * @param tbls Tables.
-         * @param types Types.
-         */
-        public QueryResult(UUID uuid, boolean finished, boolean isQry, List<List<?>> rows, List<String> cols,
-            List<String> tbls, List<String> types) {
-            this.isQry = isQry;
-            this.cols = cols;
-            this.uuid = uuid;
-            this.finished = finished;
-            this.rows = rows;
-            this.tbls = tbls;
-            this.types = types;
-        }
-
-        /**
-         * @return Query result rows.
-         */
-        public List<List<?>> getRows() {
-            return rows;
-        }
-
-        /**
-         * @return Tables metadata.
-         */
-        public List<String> getTbls() {
-            return tbls;
-        }
-
-        /**
-         * @return Columns metadata.
-         */
-        public List<String> getCols() {
-            return cols;
-        }
-
-        /**
-         * @return Types metadata.
-         */
-        public List<String> getTypes() {
-            return types;
-        }
-
-        /**
-         * @return Query UUID.
-         */
-        public UUID getUuid() {
-            return uuid;
-        }
-
-        /**
-         * @return {@code True} if it is finished query.
-         */
-        public boolean isFinished() {
-            return finished;
-        }
-
-        /**
-         * @return {@code true} if it is result of a query operation, not update; {@code false} otherwise.
-         */
-        public boolean isQuery() {
-            return isQry;
-        }
-    }
-
-    /**
-     * Cursor.
-     */
-    private static final class Cursor implements Iterable<List<?>> {
-        /** Cursor. */
-        final QueryCursor<List<?>> cursor;
-
-        /** Iterator. */
-        final Iterator<List<?>> iter;
-
-        /** Last access time. */
-        final long lastAccessTime;
-
-        /**
-         * @param cursor Cursor.
-         * @param iter Iterator.
-         */
-        private Cursor(QueryCursor<List<?>> cursor, Iterator<List<?>> iter) {
-            this.cursor = cursor;
-            this.iter = iter;
-            this.lastAccessTime = U.currentTimeMillis();
-        }
-
-        /** {@inheritDoc} */
-        @Override public Iterator<List<?>> iterator() {
-            return iter;
-        }
-
-        /**
-         * @return {@code True} if cursor has next element.
-         */
-        public boolean hasNext() {
-            return iter.hasNext();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/d57ef07d/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
index b53521e..0f91bd8 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
@@ -88,9 +88,6 @@ public class JdbcResultSet implements ResultSet {
     /** Fetch size. */
     private int fetchSize;
 
-    /** Which query task to use under the hood - {@link JdbcQueryTaskV2} if {@code true}, {@link JdbcQueryTask} otherwise. */
-    private final boolean useNewQryTask;
-
     /**
      * Creates new result set.
      *
@@ -103,39 +100,6 @@ public class JdbcResultSet implements ResultSet {
      */
     JdbcResultSet(@Nullable UUID uuid, JdbcStatement stmt, List<String> tbls, List<String> cols,
         List<String> types, Collection<List<?>> fields, boolean finished) {
-        this(uuid, stmt, tbls, cols, types, fields, finished, false);
-    }
-
-    /**
-     * Creates new result set that will be based on {@link JdbcQueryTaskV2}. This method is intended for use inside
-     *     {@link JdbcStatement} only.
-     *
-     * @param uuid Query UUID.
-     * @param stmt Statement.
-     * @param tbls Table names.
-     * @param cols Column names.
-     * @param types Types.
-     * @param fields Fields.
-     */
-    static JdbcResultSet resultSetForQueryTaskV2(@Nullable UUID uuid, JdbcStatement stmt, List<String> tbls,
-            List<String> cols, List<String> types, Collection<List<?>> fields, boolean finished) {
-        return new JdbcResultSet(uuid, stmt, tbls, cols, types, fields, finished, true);
-    }
-
-    /**
-     * Creates new result set.
-     *
-     * @param uuid Query UUID.
-     * @param stmt Statement.
-     * @param tbls Table names.
-     * @param cols Column names.
-     * @param types Types.
-     * @param fields Fields.
-     * @param useNewQryTask Which query task to use under the hood - {@link JdbcQueryTaskV2} if {@code true},
-     *     {@link JdbcQueryTask} otherwise.
-     */
-    private JdbcResultSet(@Nullable UUID uuid, JdbcStatement stmt, List<String> tbls, List<String> cols,
-        List<String> types, Collection<List<?>> fields, boolean finished, boolean useNewQryTask) {
         assert stmt != null;
         assert tbls != null;
         assert cols != null;
@@ -150,8 +114,6 @@ public class JdbcResultSet implements ResultSet {
         this.finished = finished;
 
         this.it = fields.iterator();
-
-        this.useNewQryTask = useNewQryTask;
     }
 
     /** {@inheritDoc} */
@@ -183,30 +145,8 @@ public class JdbcResultSet implements ResultSet {
 
             boolean loc = nodeId == null;
 
-            if (useNewQryTask) {
-                // Connections from new clients send queries with new tasks, so we have to continue in the same manner
-                JdbcQueryTaskV2 qryTask = new JdbcQueryTaskV2(loc ? ignite : null, conn.cacheName(), null, true, loc, null,
-                    fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
-
-                try {
-                    JdbcQueryTaskV2.QueryResult res =
-                        loc ? qryTask.call() : ignite.compute(ignite.cluster().forNodeId(nodeId)).call(qryTask);
-
-                    finished = res.isFinished();
-
-                    it = res.getRows().iterator();
-
-                    return next();
-                }
-                catch (IgniteSQLException e) {
-                    throw e.toJdbcException();
-                }
-                catch (Exception e) {
-                    throw new SQLException("Failed to query Ignite.", e);
-                }
-            }
-
-            JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), null, loc, null,
+            // Connections from new clients send queries with new tasks, so we have to continue in the same manner
+            JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), null, true, loc, null,
                 fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
 
             try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d57ef07d/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
index 44db375..81045b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
@@ -108,7 +108,7 @@ public class JdbcStatement implements Statement {
 
         boolean loc = nodeId == null;
 
-        JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, loc, getArgs(),
+        JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, true, loc, getArgs(),
             fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
 
         try {
@@ -165,11 +165,11 @@ public class JdbcStatement implements Statement {
         if (!conn.isDmlSupported())
             throw new SQLException("Failed to query Ignite: DML operations are supported in versions 1.8.0 and newer");
 
-        JdbcQueryTaskV2 qryTask = new JdbcQueryTaskV2(loc ? ignite : null, conn.cacheName(), sql, false, loc, args,
+        JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, false, loc, args,
             fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
 
         try {
-            JdbcQueryTaskV2.QueryResult qryRes =
+            JdbcQueryTask.QueryResult qryRes =
                 loc ? qryTask.call() : ignite.compute(ignite.cluster().forNodeId(nodeId)).call(qryTask);
 
             return updateCnt = updateCounterFromQueryResult(qryRes.getRows());
@@ -332,15 +332,15 @@ public class JdbcStatement implements Statement {
 
         boolean loc = nodeId == null;
 
-        JdbcQueryTaskV2 qryTask = new JdbcQueryTaskV2(loc ? ignite : null, conn.cacheName(), sql, null, loc, getArgs(),
+        JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(), sql, null, loc, getArgs(),
             fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery(), conn.isDistributedJoins());
 
         try {
-            JdbcQueryTaskV2.QueryResult res =
+            JdbcQueryTask.QueryResult res =
                 loc ? qryTask.call() : ignite.compute(ignite.cluster().forNodeId(nodeId)).call(qryTask);
 
             if (res.isQuery()) {
-                JdbcResultSet rs = JdbcResultSet.resultSetForQueryTaskV2(uuid, this, res.getTbls(), res.getCols(),
+                JdbcResultSet rs = new JdbcResultSet(uuid, this, res.getTbls(), res.getCols(),
                     res.getTypes(), res.getRows(), res.isFinished());
 
                 rs.setFetchSize(fetchSize);

http://git-wip-us.apache.org/repos/asf/ignite/blob/d57ef07d/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 93e5a8e..53550ff 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -303,9 +303,6 @@ org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask
 org.apache.ignite.internal.jdbc2.JdbcQueryTask
 org.apache.ignite.internal.jdbc2.JdbcQueryTask$1
 org.apache.ignite.internal.jdbc2.JdbcQueryTask$QueryResult
-org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2
-org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2$1
-org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2$QueryResult
 org.apache.ignite.internal.jdbc2.JdbcSqlFieldsQuery
 org.apache.ignite.internal.managers.GridManagerAdapter$1$1
 org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet


[34/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
index 8882686..c1f6989 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
@@ -38,7 +38,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -141,7 +140,6 @@ public class IgniteCacheDistributedJoinCustomAffinityMapper extends GridCommonAb
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setBackups(0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
index 9a11c3d..5acd801 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
@@ -40,7 +40,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -113,7 +112,6 @@ public class IgniteCacheDistributedJoinNoIndexTest extends GridCommonAbstractTes
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setBackups(0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
index 7c3750a..5ef53eb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
@@ -39,7 +39,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -87,7 +86,6 @@ public class IgniteCacheDistributedJoinPartitionedAndReplicatedTest extends Grid
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setCacheMode(cacheMode);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
index 200ca87..f11bcd1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
@@ -37,7 +37,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -564,7 +563,6 @@ public class IgniteCacheDistributedJoinQueryConditionsTest extends GridCommonAbs
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setBackups(0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
index bb530b3..2d0e588 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
@@ -38,7 +38,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -138,7 +137,6 @@ public class IgniteCacheJoinPartitionedAndReplicatedCollocationTest extends Abst
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setBackups(backups);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
index 1d27d22..aa31f33 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
@@ -38,7 +38,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -134,7 +133,6 @@ public class IgniteCacheJoinPartitionedAndReplicatedTest extends GridCommonAbstr
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setBackups(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java
index 052174e..2aa3419 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java
@@ -18,11 +18,11 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest;
+import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverAtomicSelfTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverTxReplicatedSelfTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverTxSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverAtomicReplicatedSelfTest;
+import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverAtomicSelfTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverTxReplicatedSelfTest;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverTxSelfTest;
 
@@ -38,12 +38,12 @@ public class IgniteCacheQuerySelfTestSuite4 extends TestSuite {
         TestSuite suite = new TestSuite("Ignite Cache Queries Test Suite 4");
 
         // Continuous queries failover tests.
-        suite.addTestSuite(CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest.class);
+        suite.addTestSuite(CacheContinuousQueryFailoverAtomicSelfTest.class);
         suite.addTestSuite(CacheContinuousQueryFailoverAtomicReplicatedSelfTest.class);
         suite.addTestSuite(CacheContinuousQueryFailoverTxSelfTest.class);
         suite.addTestSuite(CacheContinuousQueryFailoverTxReplicatedSelfTest.class);
 
-        suite.addTestSuite(CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest.class);
+        suite.addTestSuite(CacheContinuousQueryAsyncFailoverAtomicSelfTest.class);
         suite.addTestSuite(CacheContinuousQueryAsyncFailoverTxReplicatedSelfTest.class);
         suite.addTestSuite(CacheContinuousQueryAsyncFailoverTxSelfTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
index 9f2e5d6..db07ad5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
@@ -60,7 +60,6 @@
                     <property name="name" value="partitioned_atomic"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
                     <property name="startSize" value="10"/>
                 </bean>
 
@@ -78,7 +77,6 @@
                     <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>
@@ -96,7 +94,6 @@
                     <property name="name" value="replicated_atomic"/>
                     <property name="cacheMode" value="REPLICATED"/>
                     <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
                     <property name="startSize" value="10"/>
                 </bean>
                 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index d649637..8e10539 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -609,7 +609,6 @@ namespace Apache.Ignite.Core.Tests
                 {
                     new CacheConfiguration("cacheName")
                     {
-                        AtomicWriteOrderMode = CacheAtomicWriteOrderMode.Primary,
                         AtomicityMode = CacheAtomicityMode.Transactional,
                         Backups = 15,
                         CacheMode = CacheMode.Replicated,

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/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 3ee705d..a1307e7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -222,7 +222,6 @@
     <Compile Include="Compute\IComputeReducer.cs" />
     <Compile Include="Compute\IComputeTask.cs" />
     <Compile Include="Cache\Configuration\CacheAtomicityMode.cs" />
-    <Compile Include="Cache\Configuration\CacheAtomicWriteOrderMode.cs" />
     <Compile Include="Cache\Configuration\CacheConfiguration.cs" />
     <Compile Include="Cache\Configuration\CacheMode.cs" />
     <Compile Include="Cache\Configuration\CacheRebalanceMode.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs
deleted file mode 100644
index c9a41e8..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs
+++ /dev/null
@@ -1,43 +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.Cache.Configuration
-{
-    /// <summary>
-    /// Cache write ordering mode. This enumeration is taken into account only in 
-    /// <see cref="CacheAtomicityMode.Atomic"/> atomicity mode.
-    /// Write ordering mode determines which node assigns the write version, sender or the primary node.
-    /// </summary>
-    public enum CacheAtomicWriteOrderMode
-    {
-        /// <summary>
-        /// In this mode, write versions are assigned on a sender node which generally leads to better
-        /// performance in <see cref="CacheWriteSynchronizationMode.FullSync"/> synchronization mode, 
-        /// since in this case sender can send write requests to primary and backups at the same time.
-        /// <para/>
-        /// This mode will be automatically configured only with <see cref="CacheWriteSynchronizationMode.FullSync"/>
-        /// write synchronization mode, as for other synchronization modes it does not render better performance.
-        /// </summary>
-        Clock,
-
-        /// <summary>
-        /// Cache version is assigned only on primary node. This means that sender will only send write request
-        /// to primary node, which in turn will assign write version and forward it to backups.
-        /// </summary>
-        Primary
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/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 cff054d..a16edfb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -205,7 +205,6 @@ namespace Apache.Ignite.Core.Cache.Configuration
             Debug.Assert(((BinaryReader) reader).Marshaller == BinaryUtils.Marshaller);
 
             AtomicityMode = (CacheAtomicityMode) reader.ReadInt();
-            AtomicWriteOrderMode = (CacheAtomicWriteOrderMode) reader.ReadInt();
             Backups = reader.ReadInt();
             CacheMode = (CacheMode) reader.ReadInt();
             CopyOnRead = reader.ReadBoolean();
@@ -261,7 +260,6 @@ namespace Apache.Ignite.Core.Cache.Configuration
             Debug.Assert(((BinaryWriter) writer).Marshaller == BinaryUtils.Marshaller);
 
             writer.WriteInt((int) AtomicityMode);
-            writer.WriteInt((int) AtomicWriteOrderMode);
             writer.WriteInt(Backups);
             writer.WriteInt((int) CacheMode);
             writer.WriteBoolean(CopyOnRead);
@@ -424,11 +422,6 @@ namespace Apache.Ignite.Core.Cache.Configuration
         public CacheAtomicityMode AtomicityMode { get; set; }
 
         /// <summary>
-        /// Gets or sets cache write ordering mode.
-        /// </summary>
-        public CacheAtomicWriteOrderMode AtomicWriteOrderMode { get; set; }
-
-        /// <summary>
         /// Gets or sets number of nodes used to back up single partition for 
         /// <see cref="Configuration.CacheMode.Partitioned"/> cache.
         /// </summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 9859b2d..b503338 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -39,13 +39,6 @@
         </xs:restriction>
     </xs:simpleType>
 
-    <xs:simpleType name="cacheAtomicWriteOrderMode" final="restriction">
-        <xs:restriction base="xs:string">
-            <xs:enumeration value="Clock" />
-            <xs:enumeration value="Primary" />
-        </xs:restriction>
-    </xs:simpleType>
-
     <xs:simpleType name="cacheRebalanceMode" final="restriction">
         <xs:restriction base="xs:string">
             <xs:enumeration value="Sync" />
@@ -571,11 +564,6 @@
                                             <xs:documentation>Cache atomicity mode.</xs:documentation>
                                         </xs:annotation>
                                     </xs:attribute>
-                                    <xs:attribute name="atomicWriteOrderMode" type="cacheAtomicWriteOrderMode">
-                                        <xs:annotation>
-                                            <xs:documentation>Cache write ordering mode.</xs:documentation>
-                                        </xs:annotation>
-                                    </xs:attribute>
                                     <xs:attribute name="backups" type="xs:int">
                                         <xs:annotation>
                                             <xs:documentation>

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/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 3fd9555..1fb78b8 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
@@ -839,7 +839,6 @@ object VisorCacheCommand {
 
         cacheT += ("Mode", cfg.getMode)
         cacheT += ("Atomicity Mode", safe(cfg.getAtomicityMode))
-        cacheT += ("Atomic Write Ordering Mode", safe(cfg.getAtomicWriteOrderMode))
         cacheT += ("Statistic Enabled", bool2Str(cfg.isStatisticsEnabled))
         cacheT += ("Management Enabled", bool2Str(cfg.isManagementEnabled))
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 0da9aa9..0e1aad7 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -262,7 +262,6 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
 
         invalidate: Boolean,
         defaultLockTimeout: Number,
-        atomicWriteOrderMode: {type: String, enum: ['CLOCK', 'PRIMARY']},
         writeSynchronizationMode: {type: String, enum: ['FULL_SYNC', 'FULL_ASYNC', 'PRIMARY_SYNC']},
 
         sqlEscapeAll: Boolean,
@@ -556,8 +555,6 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
             compactFooter: Boolean
         },
         caches: [{type: ObjectId, ref: 'Cache'}],
-        clockSyncSamples: Number,
-        clockSyncFrequency: Number,
         deploymentMode: {type: String, enum: ['PRIVATE', 'ISOLATED', 'SHARED', 'CONTINUOUS']},
         discoveryStartupDelay: Number,
         igfsThreadPoolSize: Number,

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index f88736a..f928459 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1276,9 +1276,7 @@ export default class IgniteConfigurationGenerator {
 
     // Generate time group.
     static clusterTime(cluster, cfg = this.igniteConfigurationBean(cluster)) {
-        cfg.intProperty('clockSyncSamples')
-            .intProperty('clockSyncFrequency')
-            .intProperty('timeServerPortBase')
+        cfg.intProperty('timeServerPortBase')
             .intProperty('timeServerPortRange');
 
         return cfg;
@@ -1627,7 +1625,6 @@ export default class IgniteConfigurationGenerator {
     static cacheConcurrency(cache, ccfg = this.cacheConfigurationBean(cache)) {
         ccfg.intProperty('maxConcurrentAsyncOperations')
             .intProperty('defaultLockTimeout')
-            .enumProperty('atomicWriteOrderMode')
             .enumProperty('writeSynchronizationMode');
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
index a78f078..807303d 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
@@ -410,7 +410,6 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo
         static cacheConcurrency(cache, ccfg = this.cacheConfigurationBean(cache)) {
             ccfg.intProperty('maxConcurrentAsyncOperations')
                 .intProperty('defaultLockTimeout')
-                .enumProperty('atomicWriteOrderMode')
                 .enumProperty('writeSynchronizationMode');
 
             return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
index 3253ba9..c9720cd 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
@@ -28,10 +28,6 @@ const DFLT_CACHE = {
         clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheAtomicityMode',
         mapper: enumValueMapper
     },
-    atomicWriteOrderMode: {
-        clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode',
-        mapper: enumValueMapper
-    },
     writeSynchronizationMode: {
         clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode',
         value: 'PRIMARY_SYNC',

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
index 1a4c7c9..4efc892 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
@@ -50,9 +50,6 @@ const DFLT_CACHE = {
     writeBehindFlushThreadCount: 1,
     maxConcurrentAsyncOperations: 500,
     defaultLockTimeout: 0,
-    atomicWriteOrderMode: {
-        clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode'
-    },
     writeSynchronizationMode: {
         clsName: 'org.apache.ignite.cache.CacheWriteSynchronizationMode',
         value: 'PRIMARY_SYNC'

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
index 8dcd6bc..60f52a6 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
@@ -186,8 +186,6 @@ const DFLT_CLUSTER = {
     metricsHistorySize: 10000,
     metricsLogFrequency: 60000,
     metricsUpdateFrequency: 2000,
-    clockSyncSamples: 8,
-    clockSyncFrequency: 120000,
     timeServerPortBase: 31100,
     timeServerPortRange: 100,
     transactionConfiguration: {

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug
index 6458fbb..92bc8ab 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/concurrency.pug
@@ -37,17 +37,6 @@ include /app/helpers/jade/mixins
                     +number('Default lock timeout:', `${model}.defaultLockTimeout`, '"defaultLockTimeout"', 'true', '0', '0',
                         'Default lock acquisition timeout in milliseconds<br/>\
                         If <b>0</b> then lock acquisition will never timeout')
-                .settings-row(ng-hide=`${model}.atomicityMode === 'TRANSACTIONAL'`)
-                    +dropdown('Entry versioning:', `${model}.atomicWriteOrderMode`, '"atomicWriteOrderMode"', 'true', 'Choose versioning',
-                        '[\
-                            {value: "CLOCK", label: "CLOCK"},\
-                            {value: "PRIMARY", label: "PRIMARY"}\
-                        ]',
-                        'Write ordering mode determines which node assigns the write version, sender or the primary node\
-                        <ul>\
-                            <li>CLOCK - in this mode write versions are assigned on a sender node which generally leads to better performance</li>\
-                            <li>PRIMARY - in this mode version is assigned only on primary node. This means that sender will only send write request to primary node, which in turn will assign write version and forward it to backups</li>\
-                        </ul>')
                 .settings-row
                     +dropdown('Write synchronization mode:', `${model}.writeSynchronizationMode`, '"writeSynchronizationMode"', 'true', 'PRIMARY_SYNC',
                         '[\

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/web-console/frontend/app/modules/states/configuration/clusters/time.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/time.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/time.pug
index da781ba..1645a60 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/time.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/time.pug
@@ -30,15 +30,7 @@ include /app/helpers/jade/mixins
         .panel-body(ng-if=`ui.isPanelLoaded('${form}')`)
             .col-sm-6
                 .settings-row
-                    +number('Samples size:', `${model}.clockSyncSamples`, '"clockSyncSamples"', 'true', '8', '0',
-                        'Number of samples used to synchronize clocks between different nodes<br/>\
-                        Clock synchronization is used for cache version assignment in CLOCK order mode')
-                .settings-row
-                    +number('Frequency:', `${model}.clockSyncFrequency`, '"clockSyncFrequency"', 'true', '120000', '0',
-                        'Frequency at which clock is synchronized between nodes, in milliseconds<br/>\
-                        Clock synchronization is used for cache version assignment in CLOCK order mode')
-                .settings-row
-                    +number-min-max('Port base:', `${model}.timeServerPortBase`, '"timeServerPortBase"', 'true', '31100', '0', '65535',
+                    +number-min-max('Port base:', model + '.timeServerPortBase', '"timeServerPortBase"', 'true', '31100', '0', '65535',
                         'Time server provides clock synchronization between nodes<br/>\
                         Base UPD port number for grid time server. Time server will be started on one of free ports in range')
                 .settings-row

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/yardstick/README.txt
----------------------------------------------------------------------
diff --git a/modules/yardstick/README.txt b/modules/yardstick/README.txt
index c21ed2a..b54bf27 100644
--- a/modules/yardstick/README.txt
+++ b/modules/yardstick/README.txt
@@ -130,7 +130,6 @@ would behave like a `servers`.
     `PESSIMISTIC` (defined in `CacheTxConcurrency`)
 * `-txi <value>` or `--txIsolation <value>` - Cache transaction isolation (defined in `CacheTxIsolation`)
 * `-wb` or `--writeBehind` - Enable or disable writeBehind for cache store
-* `-wom <mode>` or `--writeOrderMode <mode>` - Write order mode for ATOMIC caches (defined in `CacheAtomicWriteOrderMode`)
 
 For example if we need to run 2 `IgniteNode` servers on localhost with `PutBenchmark` benchmark on localhost,
 with number of backups set to 1, synchronization mode set to `PRIMARY_SYNC`, then the following configuration

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index e096caf..ea48bf3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.yardstick;
 
 import com.beust.jcommander.Parameter;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
@@ -66,10 +65,6 @@ public class IgniteBenchmarkArguments {
     private int nearCacheSize;
 
     /** */
-    @Parameter(names = {"-wom", "--writeOrderMode"}, description = "Write ordering mode")
-    private CacheAtomicWriteOrderMode orderMode;
-
-    /** */
     @Parameter(names = {"-txc", "--txConcurrency"}, description = "Transaction concurrency")
     private TransactionConcurrency txConcurrency = TransactionConcurrency.PESSIMISTIC;
 
@@ -273,13 +268,6 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
-     * @return Cache write ordering mode.
-     */
-    public CacheAtomicWriteOrderMode orderMode() {
-        return orderMode;
-    }
-
-    /**
      * @return Backups.
      */
     public int backups() {
@@ -438,8 +426,7 @@ public class IgniteBenchmarkArguments {
      */
     public String description() {
         return "-nn=" + nodes + "-b=" + backups + "-sm=" + syncMode + "-cl=" + clientOnly + "-nc=" + nearCacheFlag +
-            (orderMode == null ? "" : "-wom=" + orderMode) + "-txc=" + txConcurrency + "-rd=" + restartDelay +
-            "-rs=" + restartSleep;
+            "-txc=" + txConcurrency + "-rd=" + restartDelay + "-rs=" + restartSleep;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index 59b31f9..029c0fd 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -109,9 +109,6 @@ public class IgniteNode implements BenchmarkServer {
 
                 cc.setWriteSynchronizationMode(args.syncMode());
 
-                if (args.orderMode() != null)
-                    cc.setAtomicWriteOrderMode(args.orderMode());
-
                 cc.setBackups(args.backups());
 
                 if (args.restTcpPort() != 0) {


[46/50] [abbrv] ignite git commit: IGNITE-4992: Fix Segmented SQL Index self tests. - Fixes #1801.

Posted by sb...@apache.org.
IGNITE-4992: Fix Segmented SQL Index self tests. - Fixes #1801.

Signed-off-by: Sergi Vladykin <se...@gmail.com>


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

Branch: refs/heads/ignite-1561-1
Commit: 0c0cf2c00355ae2aec340473ed19dc5f0e0ddef0
Parents: 8fa438c
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Sun Apr 16 15:28:20 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Sun Apr 16 15:28:20 2017 +0300

----------------------------------------------------------------------
 .../query/h2/opt/GridH2TreeIndex.java           |   2 +-
 ...gniteSqlSegmentedIndexMultiNodeSelfTest.java |  28 ++++
 .../query/IgniteSqlSegmentedIndexSelfTest.java  | 154 +++++++++++--------
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 4 files changed, 118 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0c0cf2c0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 4a12c78..cf75395 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -290,7 +290,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
      * @return Row.
      */
     @Override public GridH2Row findOne(GridH2Row row) {
-        int seg = threadLocalSegment();
+        int seg = segmentForRow(row);
 
         return segments[seg].findOne(row);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0c0cf2c0/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexMultiNodeSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexMultiNodeSelfTest.java
new file mode 100644
index 0000000..549ea5e
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexMultiNodeSelfTest.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.internal.processors.query;
+
+/**
+ * Tests for correct distributed queries with index consisted of many segments running on multi-node grid.
+ */
+public class IgniteSqlSegmentedIndexMultiNodeSelfTest extends IgniteSqlSegmentedIndexSelfTest {
+    /** {@inheritDoc} */
+    @Override protected int nodesCount() {
+        return 4;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0c0cf2c0/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
index 8408ad0..1715a56 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
@@ -18,11 +18,13 @@
 package org.apache.ignite.internal.processors.query;
 
 import java.io.Serializable;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
 import java.util.Set;
 import javax.cache.Cache;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheKeyConfiguration;
@@ -45,8 +47,22 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** */
-    private static int QRY_PARALLELISM_LVL = 97;
+    private static final String ORG_CACHE_NAME = "org";
+
+    /** */
+    private static final String PERSON_CAHE_NAME = "pers";
+
+    /** */
+    private static final int ORG_CACHE_SIZE = 500;
+
+    /** */
+    private static final int PERSON_CACHE_SIZE = 1000;
+
+    /** */
+    private static final int ORPHAN_ROWS = 10;
 
+    /** */
+    private static int QRY_PARALLELISM_LVL = 97;
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -67,9 +83,26 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
         return cfg;
     }
 
+    /** @return number of nodes to be prestarted. */
+    protected int nodesCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(nodesCount(), false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        stopAllGrids(true);
+        super.afterTest();
+
+        grid(0).destroyCaches(Arrays.asList(PERSON_CAHE_NAME, ORG_CACHE_NAME));
     }
 
     /**
@@ -88,14 +121,11 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * Run tests on single-node grid
      * @throws Exception If failed.
      */
-    public void testSingleNodeIndexSegmentation() throws Exception {
-        startGridsMultiThreaded(1, true);
-
-        ignite(0).createCache(cacheConfig("pers", true, Integer.class, Person.class));
-        ignite(0).createCache(cacheConfig("org", true, Integer.class, Organization.class));
+    public void testSegmentedIndex() throws Exception {
+        ignite(0).createCache(cacheConfig(PERSON_CAHE_NAME, true, Integer.class, Person.class));
+        ignite(0).createCache(cacheConfig(ORG_CACHE_NAME, true, Integer.class, Organization.class));
 
         fillCache();
 
@@ -106,13 +136,14 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
 
     /**
      * Run tests on single-node grid
+     *
      * @throws Exception If failed.
      */
-    public void testSingleNodeIndexSegmentationWithSwapEnabled() throws Exception {
-        startGridsMultiThreaded(1, true);
-
-        final IgniteCache<Object, Object> cache = ignite(0).createCache(cacheConfig("org", true, Integer.class, Organization.class)
-            .setEvictionPolicy(new FifoEvictionPolicy(10)).setOnheapCacheEnabled(true));
+    public void testSegmentedIndexWithEvictionPolicy() throws Exception {
+        final IgniteCache<Object, Object> cache = ignite(0).createCache(
+            cacheConfig(ORG_CACHE_NAME, true, Integer.class, Organization.class)
+                .setEvictionPolicy(new FifoEvictionPolicy(10))
+                .setOnheapCacheEnabled(true));
 
         for (int i = 0; i < 20; i++)
             cache.put(i, new Organization("org-" + i));
@@ -126,30 +157,12 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
 
     /**
      * Run tests on multi-node grid
+     *
      * @throws Exception If failed.
      */
-    public void testMultiNodeIndexSegmentation() throws Exception {
-        startGridsMultiThreaded(4, true);
-
-        ignite(0).createCache(cacheConfig("pers", true, Integer.class, Person.class));
-        ignite(0).createCache(cacheConfig("org", true, Integer.class, Organization.class));
-
-        fillCache();
-
-        checkDistributedQueryWithSegmentedIndex();
-
-        checkLocalQueryWithSegmentedIndex();
-    }
-
-    /**
-     * Run tests on multi-node grid
-     * @throws Exception If failed.
-     */
-    public void testMultiNodeSegmentedPartitionedWithReplicated() throws Exception {
-        startGridsMultiThreaded(4, true);
-
-        ignite(0).createCache(cacheConfig("pers", true, Integer.class, Person.class));
-        ignite(0).createCache(cacheConfig("org", false, Integer.class, Organization.class));
+    public void testSegmentedPartitionedWithReplicated() throws Exception {
+        ignite(0).createCache(cacheConfig(PERSON_CAHE_NAME, true, Integer.class, Person.class));
+        ignite(0).createCache(cacheConfig(ORG_CACHE_NAME, false, Integer.class, Organization.class));
 
         fillCache();
 
@@ -160,71 +173,78 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
 
     /**
      * Check distributed joins.
+     *
      * @throws Exception If failed.
      */
     public void checkDistributedQueryWithSegmentedIndex() throws Exception {
-        IgniteCache<Integer, Person> c1 = ignite(0).cache("pers");
+        for (int i = 0; i < nodesCount(); i++) {
+            IgniteCache<Integer, Person> c1 = ignite(i).cache(PERSON_CAHE_NAME);
 
-        int expectedPersons = 0;
+            int expectedPersons = 0;
 
-        for (Cache.Entry<Integer, Person> e : c1) {
-            final Integer orgId = e.getValue().orgId;
+            for (Cache.Entry<Integer, Person> e : c1) {
+                final Integer orgId = e.getValue().orgId;
 
-            if (10 <= orgId && orgId < 500)
-                expectedPersons++;
-        }
+                // We have as orphan ORG rows as orphan PERSON rows.
+                if (ORPHAN_ROWS <= orgId && orgId < 500)
+                    expectedPersons++;
+            }
 
-        String select0 = "select o.name n1, p.name n2 from \"pers\".Person p, \"org\".Organization o where p.orgId = o._key";
+            String select0 = "select o.name n1, p.name n2 from \"pers\".Person p, \"org\".Organization o where p.orgId = o._key";
 
-        List<List<?>> result = c1.query(new SqlFieldsQuery(select0).setDistributedJoins(true)).getAll();
+            List<List<?>> result = c1.query(new SqlFieldsQuery(select0).setDistributedJoins(true)).getAll();
 
-        assertEquals(expectedPersons, result.size());
+            assertEquals(expectedPersons, result.size());
+        }
     }
 
     /**
      * Test local query.
+     *
      * @throws Exception If failed.
      */
     public void checkLocalQueryWithSegmentedIndex() throws Exception {
-        IgniteCache<Integer, Person> c1 = ignite(0).cache("pers");
-        IgniteCache<Integer, Organization> c2 = ignite(0).cache("org");
+        for (int i = 0; i < nodesCount(); i++) {
+            final Ignite node = ignite(i);
 
-        Set<Integer> localOrgIds = new HashSet<>();
+            IgniteCache<Integer, Person> c1 = node.cache(PERSON_CAHE_NAME);
+            IgniteCache<Integer, Organization> c2 = node.cache(ORG_CACHE_NAME);
 
-        for (Cache.Entry<Integer, Organization> e : c2.localEntries())
-            localOrgIds.add(e.getKey());
+            Set<Integer> localOrgIds = new HashSet<>();
 
-        int expectedPersons = 0;
+            for (Cache.Entry<Integer, Organization> e : c2.localEntries())
+                localOrgIds.add(e.getKey());
 
-        for (Cache.Entry<Integer, Person> e : c1.localEntries()) {
-            final Integer orgId = e.getValue().orgId;
+            int expectedPersons = 0;
 
-            if (localOrgIds.contains(orgId))
-                expectedPersons++;
-        }
+            for (Cache.Entry<Integer, Person> e : c1.localEntries()) {
+                final Integer orgId = e.getValue().orgId;
+
+                if (localOrgIds.contains(orgId))
+                    expectedPersons++;
+            }
 
-        String select0 = "select o.name n1, p.name n2 from \"pers\".Person p, \"org\".Organization o where p.orgId = o._key";
+            String select0 = "select o.name n1, p.name n2 from \"pers\".Person p, \"org\".Organization o where p.orgId = o._key";
 
-        List<List<?>> result = c1.query(new SqlFieldsQuery(select0).setLocal(true)).getAll();
+            List<List<?>> result = c1.query(new SqlFieldsQuery(select0).setLocal(true)).getAll();
 
-        assertEquals(expectedPersons, result.size());
+            assertEquals(expectedPersons, result.size());
+        }
     }
 
     /** */
     private void fillCache() {
-        IgniteCache<Object, Object> c1 = ignite(0).cache("pers");
-
-        IgniteCache<Object, Object> c2 = ignite(0).cache("org");
-
-        final int orgCount = 500;
+        IgniteCache<Object, Object> c1 = ignite(0).cache(PERSON_CAHE_NAME);
+        IgniteCache<Object, Object> c2 = ignite(0).cache(ORG_CACHE_NAME);
 
-        for (int i = 0; i < orgCount; i++)
+        for (int i = 0; i < ORG_CACHE_SIZE; i++)
             c2.put(i, new Organization("org-" + i));
 
         final Random random = new Random();
 
-        for (int i = 0; i < 1000; i++) {
-            int orgID = 10 + random.nextInt(orgCount + 10);
+        for (int i = 0; i < PERSON_CACHE_SIZE; i++) {
+            // We have as orphan ORG rows as orphan PERSON rows.
+            int orgID = ORPHAN_ROWS + random.nextInt(ORG_CACHE_SIZE + ORPHAN_ROWS);
 
             c1.put(i, new Person(orgID, "pers-" + i));
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0c0cf2c0/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 2d3ee0d..43083a8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -91,6 +91,7 @@ import org.apache.ignite.internal.processors.cache.query.IndexingSpiQueryTxSelfT
 import org.apache.ignite.internal.processors.query.IgniteQueryDedicatedPoolTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlEntryCacheModeAgnosticTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSchemaIndexingTest;
+import org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexMultiNodeSelfTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexSelfTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSplitterSelfTest;
 import org.apache.ignite.internal.processors.query.h2.GridH2IndexingInMemSelfTest;
@@ -130,6 +131,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         // Queries tests.
         suite.addTestSuite(IgniteSqlSplitterSelfTest.class);
         suite.addTestSuite(IgniteSqlSegmentedIndexSelfTest.class);
+        suite.addTestSuite(IgniteSqlSegmentedIndexMultiNodeSelfTest.class);
         suite.addTestSuite(IgniteSqlSchemaIndexingTest.class);
         suite.addTestSuite(GridCacheQueryIndexDisabledSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryLoadSelfTest.class);


[22/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/MatrixVectorViewTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/MatrixVectorViewTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/MatrixVectorViewTest.java
new file mode 100644
index 0000000..b7e390e
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/MatrixVectorViewTest.java
@@ -0,0 +1,209 @@
+package org.apache.ignite.math.impls.vector;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link MatrixVectorView}.
+ */
+public class MatrixVectorViewTest {
+    /** */
+    private static final String UNEXPECTED_VALUE = "Unexpected value";
+    /** */
+    private static final int SMALL_SIZE = 3;
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    private Matrix parent;
+
+    /** */
+    @Before
+    public void setup() {
+        parent = newMatrix(SMALL_SIZE, SMALL_SIZE);
+    }
+
+    /** */
+    @Test
+    public void testDiagonal() {
+        Vector vector = parent.viewDiagonal();
+
+        for (int i = 0; i < SMALL_SIZE; i++)
+            assertView(i, i, vector, i);
+    }
+
+    /** */
+    @Test
+    public void testRow() {
+        for (int i = 0; i < SMALL_SIZE; i++) {
+            Vector viewRow = parent.viewRow(i);
+
+            for (int j = 0; j < SMALL_SIZE; j++)
+                assertView(i, j, viewRow, j);
+        }
+    }
+
+    /** */
+    @Test
+    public void testCols() {
+        for (int i = 0; i < SMALL_SIZE; i++) {
+            Vector viewCol = parent.viewColumn(i);
+
+            for (int j = 0; j < SMALL_SIZE; j++)
+                assertView(j, i, viewCol, j);
+        }
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        for (int rowSize : new int[] {1, 2, 3, 4})
+            for (int colSize : new int[] {1, 2, 3, 4})
+                for (int row = 0; row < rowSize; row++)
+                    for (int col = 0; col < colSize; col++)
+                        for (int rowStride = 0; rowStride < rowSize; rowStride++)
+                            for (int colStride = 0; colStride < colSize; colStride++)
+                                if (rowStride != 0 || colStride != 0)
+                                    assertMatrixVectorView(newMatrix(rowSize, colSize), row, col, rowStride, colStride);
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void parentNullTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(null, 1, 1, 1, 1).size());
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void rowNegativeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, -1, 1, 1, 1).size());
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void colNegativeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, -1, 1, 1).size());
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void rowTooLargeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, parent.rowSize() + 1, 1, 1, 1).size());
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void colTooLargeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, parent.columnSize() + 1, 1, 1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void rowStrideNegativeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, 1, -1, 1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void colStrideNegativeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, 1, 1, -1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void rowStrideTooLargeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, 1, parent.rowSize() + 1, 1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void colStrideTooLargeTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, 1, 1, parent.columnSize() + 1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void bothStridesZeroTest() {
+        //noinspection ConstantConditions
+        assertEquals(IMPOSSIBLE_SIZE,
+            new MatrixVectorView(parent, 1, 1, 0, 0).size());
+    }
+
+    /** */
+    private void assertMatrixVectorView(Matrix parent, int row, int col, int rowStride, int colStride) {
+        MatrixVectorView view = new MatrixVectorView(parent, row, col, rowStride, colStride);
+
+        String desc = "parent [" + parent.rowSize() + "x" + parent.columnSize() + "], view ["
+            + row + "x" + col + "], strides [" + rowStride + ", " + colStride + "]";
+
+        final int size = view.size();
+
+        final int sizeByRows = rowStride == 0 ? IMPOSSIBLE_SIZE : (parent.rowSize() - row) / rowStride;
+        final int sizeByCols = colStride == 0 ? IMPOSSIBLE_SIZE : (parent.columnSize() - col) / colStride;
+
+        assertTrue("Size " + size + " differs from expected for " + desc,
+            size == sizeByRows || size == sizeByCols);
+
+        for (int idx = 0; idx < size; idx++) {
+            final int rowIdx = row + idx * rowStride;
+            final int colIdx = col + idx * colStride;
+
+            assertEquals(UNEXPECTED_VALUE + " at view index " + idx + desc,
+                parent.get(rowIdx, colIdx), view.get(idx), 0d);
+        }
+    }
+
+    /** */
+    private Matrix newMatrix(int rowSize, int colSize) {
+        Matrix res = new DenseLocalOnHeapMatrix(rowSize, colSize);
+
+        for (int i = 0; i < res.rowSize(); i++)
+            for (int j = 0; j < res.columnSize(); j++)
+                res.set(i, j, i * res.rowSize() + j);
+
+        return res;
+    }
+
+    /** */
+    private void assertView(int row, int col, Vector view, int viewIdx) {
+        assertValue(row, col, view, viewIdx);
+
+        parent.set(row, col, parent.get(row, col) + 1);
+
+        assertValue(row, col, view, viewIdx);
+
+        view.set(viewIdx, view.get(viewIdx) + 2);
+
+        assertValue(row, col, view, viewIdx);
+    }
+
+    /** */
+    private void assertValue(int row, int col, Vector view, int viewIdx) {
+        assertEquals(UNEXPECTED_VALUE + " at row " + row + " col " + col, parent.get(row, col), view.get(viewIdx), 0d);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/PivotedVectorViewConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/PivotedVectorViewConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/PivotedVectorViewConstructorTest.java
new file mode 100644
index 0000000..91650dc
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/PivotedVectorViewConstructorTest.java
@@ -0,0 +1,211 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class PivotedVectorViewConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    private static final SampleParams sampleParams = new SampleParams();
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void nullVecParamTest() {
+        assertEquals("Expect exception due to null vector param.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(null, sampleParams.pivot).size());
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void nullVecParam2Test() {
+        assertEquals("Expect exception due to null vector param, with unpivot.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(null, sampleParams.pivot, sampleParams.unpivot).size());
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void nullPivotParamTest() {
+        assertEquals("Expect exception due to null pivot param.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, null).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullPivotParam2Test() {
+        assertEquals("Expect exception due to null pivot param, with unpivot.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, null, sampleParams.unpivot).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullUnpivotParam2Test() {
+        assertEquals("Expect exception due to null unpivot param.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, sampleParams.pivot, null).size());
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void emptyPivotTest() {
+        assertEquals("Expect exception due to empty pivot param.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, new int[] {}).size());
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void emptyPivot2Test() {
+        assertEquals("Expect exception due to empty pivot param, with unpivot.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, new int[] {}, sampleParams.unpivot).size());
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void wrongPivotTest() {
+        assertEquals("Expect exception due to wrong pivot param.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, new int[] {0}).size());
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void wrongPivot2Test() {
+        assertEquals("Expect exception due to wrong pivot param, with unpivot.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, new int[] {0}, sampleParams.unpivot).size());
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void emptyUnpivotTest() {
+        assertEquals("Expect exception due to empty unpivot param.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, sampleParams.pivot, new int[] {}).size());
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void wrongUnpivotTest() {
+        assertEquals("Expect exception due to wrong unpivot param, with unpivot.", IMPOSSIBLE_SIZE,
+            new PivotedVectorView(sampleParams.vec, sampleParams.pivot, new int[] {0}).size());
+    }
+
+    /** */
+    @Test
+    public void basicPivotTest() {
+        final PivotedVectorView pvv = new PivotedVectorView(sampleParams.vec, sampleParams.pivot);
+
+        final int size = sampleParams.vec.size();
+
+        assertEquals("View size differs from expected.", size, pvv.size());
+
+        assertSame("Base vector differs from expected.", sampleParams.vec, pvv.getBaseVector());
+
+        for (int idx = 0; idx < size; idx++) {
+            assertEquals("Sample pivot and unpivot differ from expected",
+                idx, sampleParams.unpivot[sampleParams.pivot[idx]]);
+
+            assertEquals("Pivot differs from expected at index " + idx,
+                sampleParams.pivot[idx], pvv.pivot(idx));
+
+            assertEquals("Default unpivot differs from expected at index " + idx,
+                sampleParams.unpivot[idx], pvv.unpivot(idx));
+
+            final Metric metric = new Metric(sampleParams.vec.get(idx), pvv.get(pvv.pivot(idx)));
+
+            assertTrue("Not close enough at index " + idx + ", " + metric, metric.closeEnough());
+        }
+
+        for (int idx = 0; idx < size; idx++) {
+            sampleParams.vec.set(idx, sampleParams.vec.get(idx) + idx + 1);
+
+            final Metric metric = new Metric(sampleParams.vec.get(idx), pvv.get(pvv.pivot(idx)));
+
+            assertTrue("Modified value not close enough at index " + idx + ", " + metric, metric.closeEnough());
+        }
+    }
+
+    /** */
+    @Test
+    public void basicUnpivotTest() {
+        final PivotedVectorView pvv = new PivotedVectorView(sampleParams.vec, sampleParams.pivot, sampleParams.unpivot);
+
+        final int size = sampleParams.vec.size();
+
+        assertEquals("View size differs from expected.", size, pvv.size());
+
+        for (int idx = 0; idx < size; idx++) {
+            assertEquals("Unpivot differs from expected at index " + idx,
+                sampleParams.unpivot[idx], pvv.unpivot(idx));
+
+            final Metric metric = new Metric(sampleParams.vec.get(idx), pvv.get(pvv.unpivot(idx)));
+
+            assertTrue("Not close enough at index " + idx + ", " + metric, metric.closeEnough());
+        }
+    }
+
+    /** */
+    private static class SampleParams {
+        /** */
+        final double[] data = new double[] {0, 1};
+        /** */
+        final Vector vec = new DenseLocalOnHeapVector(data);
+        /** */
+        final int[] pivot = new int[] {1, 0};
+        /** */
+        final int[] unpivot = new int[] {1, 0};
+    }
+
+    /** */
+    private static class Metric { // todo consider if softer tolerance (like say 0.1 or 0.01) would make sense here
+        /** */
+        private final double exp;
+
+        /** */
+        private final double obtained;
+
+        /** **/
+        Metric(double exp, double obtained) {
+            this.exp = exp;
+            this.obtained = obtained;
+        }
+
+        /** */
+        boolean closeEnough() {
+            return new Double(exp).equals(obtained) || closeEnoughToZero();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "Metric{" + "expected=" + exp +
+                ", obtained=" + obtained +
+                '}';
+        }
+
+        /** */
+        private boolean closeEnoughToZero() {
+            return (new Double(exp).equals(0.0) && new Double(obtained).equals(-0.0))
+                || (new Double(exp).equals(-0.0) && new Double(obtained).equals(0.0));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/RandomVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/RandomVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/RandomVectorConstructorTest.java
new file mode 100644
index 0000000..6d4e4f1
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/RandomVectorConstructorTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class RandomVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = org.apache.ignite.math.exceptions.UnsupportedOperationException.class)
+    public void mapInvalidArgsTest() {
+        assertEquals("Expect exception due to invalid args.", IMPOSSIBLE_SIZE,
+            new RandomVector(new HashMap<String, Object>() {{
+                put("invalid", 99);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void mapMissingArgsTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("paramMissing", "whatever");
+        }};
+
+        assertEquals("Expect exception due to missing args.",
+            -1, new RandomVector(test).size());
+    }
+
+    /** */
+    @Test(expected = ClassCastException.class)
+    public void mapInvalidParamTypeTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("size", "whatever");
+            put("fastHash", true);
+        }};
+
+        assertEquals("Expect exception due to invalid param type.", IMPOSSIBLE_SIZE,
+            new RandomVector(test).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void mapNullTest() {
+        //noinspection ConstantConditions
+        assertEquals("Null map args.", IMPOSSIBLE_SIZE,
+            new RandomVector(null).size());
+    }
+
+    /** */
+    @Test
+    public void mapTest() {
+        assertEquals("Size from args.", 99,
+            new RandomVector(new HashMap<String, Object>() {{
+                put("size", 99);
+            }}).size());
+
+        final int test = 99;
+
+        assertEquals("Size from args with fastHash false.", test,
+            new RandomVector(new HashMap<String, Object>() {{
+                put("size", test);
+                put("fastHash", false);
+            }}).size());
+
+        assertEquals("Size from args with fastHash true.", test,
+            new RandomVector(new HashMap<String, Object>() {{
+                put("size", test);
+                put("fastHash", true);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new RandomVector(-1).size());
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        final int basicSize = 3;
+
+        Vector v1 = new RandomVector(basicSize);
+
+        //noinspection EqualsWithItself
+        assertTrue("Expect vector to be equal to self", v1.equals(v1));
+
+        //noinspection ObjectEqualsNull
+        assertFalse("Expect vector to be not equal to null", v1.equals(null));
+
+        assertEquals("Size differs from expected", basicSize, v1.size());
+
+        verifyValues(v1);
+
+        Vector v2 = new RandomVector(basicSize, true);
+
+        assertEquals("Size differs from expected", basicSize, v2.size());
+
+        verifyValues(v2);
+
+        Vector v3 = new RandomVector(basicSize, false);
+
+        assertEquals("Size differs from expected", basicSize, v3.size());
+
+        verifyValues(v3);
+    }
+
+    /** */
+    private void verifyValues(Vector v) {
+        for (Vector.Element e : v.all()) {
+            double val = e.get();
+
+            assertTrue("Value too small: " + val + " at index " + e.index(), -1d <= val);
+
+            assertTrue("Value too large: " + val + " at index " + e.index(), val <= 1d);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorConstructorTest.java
new file mode 100644
index 0000000..69e22e0
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorConstructorTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class SingleElementVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void mapInvalidArgsTest() {
+        assertEquals("Expect exception due to invalid args.", IMPOSSIBLE_SIZE,
+            new SingleElementVector(new HashMap<String, Object>() {{
+                put("invalid", 99);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void mapMissingArgsTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("size", 1);
+
+            put("paramMissing", "whatever");
+        }};
+
+        assertEquals("Expect exception due to missing args.",
+            -1, new SingleElementVector(test).size());
+    }
+
+    /** */
+    @Test(expected = ClassCastException.class)
+    public void mapInvalidParamTypeTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("size", "whatever");
+
+            put("index", 0);
+            put("value", 1.0);
+        }};
+
+        assertEquals("Expect exception due to invalid param type.", IMPOSSIBLE_SIZE,
+            new SingleElementVector(test).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void mapNullTest() {
+        //noinspection ConstantConditions
+        assertEquals("Null map args.", IMPOSSIBLE_SIZE,
+            new SingleElementVector(null).size());
+    }
+
+    /** */
+    @Test
+    public void mapTest() {
+        assertEquals("Size from array in args.", 99,
+            new SingleElementVector(new HashMap<String, Object>() {{
+                put("size", 99);
+                put("index", 0);
+                put("value", 1.0);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new SingleElementVector(-1, 0, 1.0).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void zeroSizeTest() {
+        assertEquals("Zero size.", IMPOSSIBLE_SIZE,
+            new SingleElementVector(0, 0, 1.0).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void wrongIndexTest() {
+        //noinspection ConstantConditions
+        assertEquals("Wrong index.", IMPOSSIBLE_SIZE,
+            new SingleElementVector(1, 2, 1.0).size());
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        final int[] sizes = new int[] {1, 4, 8};
+
+        for (int size : sizes)
+            for (int idx = 0; idx < size; idx++)
+                basicTest(size, idx);
+    }
+
+    /** */
+    private void basicTest(int size, int idx) {
+        final Double expVal = (double)(size - idx);
+
+        Vector v = new SingleElementVector(size, idx, expVal);
+
+        assertTrue("Expect value " + expVal + " at index " + idx + " for size " + size,
+            expVal.equals(v.get(idx)));
+
+        final double delta = 1.0;
+
+        v.set(idx, expVal - delta);
+
+        assertTrue("Expect value " + expVal + " at index " + idx + " for size " + size,
+            expVal.equals(v.get(idx) + delta));
+
+        final Double zero = 0.0;
+
+        for (int i = 0; i < size; i++) {
+            if (i == idx)
+                continue;
+
+            assertTrue("Expect zero at index " + i + " for size " + size,
+                zero.equals(v.get(i)));
+
+            boolean eCaught = false;
+
+            try {
+                v.set(i, 1.0);
+            }
+            catch (UnsupportedOperationException uoe) {
+                eCaught = true;
+            }
+
+            assertTrue("Expect " + java.lang.UnsupportedOperationException.class.getSimpleName()
+                + " at index " + i + " for size " + size, eCaught);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorViewConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorViewConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorViewConstructorTest.java
new file mode 100644
index 0000000..957f3b7
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SingleElementVectorViewConstructorTest.java
@@ -0,0 +1,137 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class SingleElementVectorViewConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    private static final SampleHelper helper = new SampleHelper();
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullVecParamTest() {
+        assertEquals("Expect exception due to null vector param.", IMPOSSIBLE_SIZE,
+            new SingleElementVectorView(null, helper.idx).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeIdxParamTest() {
+        assertEquals("Expect exception due to negative index param.", IMPOSSIBLE_SIZE,
+            new SingleElementVectorView(helper.vec, -1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void tooLargeIdxParamTest() {
+        assertEquals("Expect exception due to too large index param.", IMPOSSIBLE_SIZE,
+            new SingleElementVectorView(helper.vec, helper.vec.size()).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void emptyVecParamTest() {
+        assertEquals("Expect exception due to empty vector param.", IMPOSSIBLE_SIZE,
+            new SingleElementVectorView(helper.vecEmpty, 0).size());
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        final int[] sizes = new int[] {1, 4, 8};
+
+        for (int size : sizes)
+            for (int idx = 0; idx < size; idx++)
+                basicTest(size, idx);
+    }
+
+    /** */
+    private void basicTest(int size, int idx) {
+        final Double expVal = (double)(size - idx);
+
+        Vector orig = helper.newSample(size, idx, expVal);
+
+        SingleElementVectorView svv = new SingleElementVectorView(orig, idx);
+
+        assertEquals("Size differs from expected", size, svv.size());
+
+        assertTrue("Expect value " + expVal + " at index " + idx + " for size " + size,
+            expVal.equals(svv.get(idx)));
+
+        final double delta = 1.0;
+
+        svv.set(idx, expVal - delta);
+
+        assertTrue("Expect value " + expVal + " at index " + idx + " for size " + size,
+            expVal.equals(orig.get(idx) + delta));
+
+        final Double zero = 0.0;
+
+        for (int i = 0; i < size; i++) {
+            if (i == idx)
+                continue;
+
+            assertTrue("Expect zero at index " + i + " for size " + size,
+                zero.equals(svv.get(i)));
+
+            boolean eCaught = false;
+
+            try {
+                svv.set(i, 1.0);
+            }
+            catch (UnsupportedOperationException uoe) {
+                eCaught = true;
+            }
+
+            assertTrue("Expect " + UnsupportedOperationException.class.getSimpleName()
+                + " at index " + i + " for size " + size, eCaught);
+        }
+    }
+
+    /** */
+    private static class SampleHelper {
+        /** */
+        final double[] data = new double[] {0, 1};
+        /** */
+        final Vector vec = new DenseLocalOnHeapVector(data);
+        /** */
+        final Vector vecEmpty = new DenseLocalOnHeapVector(new double[] {});
+        /** */
+        final int idx = 0;
+
+        /** */
+        Vector newSample(int size, int idx, double expVal) {
+            final Vector v = new DenseLocalOnHeapVector(size);
+
+            for (int i = 0; i < size; i++)
+                v.set(i, i == idx ? expVal : i);
+
+            return v;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SparseLocalVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SparseLocalVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SparseLocalVectorConstructorTest.java
new file mode 100644
index 0000000..2be4a10
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/SparseLocalVectorConstructorTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.StorageConstants;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class SparseLocalVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new SparseLocalVector(-1, 1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void zeroSizeTest() {
+        assertEquals("0 size.", IMPOSSIBLE_SIZE,
+            new SparseLocalVector(0, 1).size());
+    }
+
+    /** */
+    @Test
+    public void primitiveTest() {
+        assertEquals("1 size, random access.", 1,
+            new SparseLocalVector(1, StorageConstants.RANDOM_ACCESS_MODE).size());
+
+        assertEquals("1 size, sequential access.", 1,
+            new SparseLocalVector(1, StorageConstants.SEQUENTIAL_ACCESS_MODE).size());
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorAttributesTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorAttributesTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorAttributesTest.java
new file mode 100644
index 0000000..992018a
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorAttributesTest.java
@@ -0,0 +1,217 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.DenseLocalOffHeapMatrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class VectorAttributesTest {
+    /** */
+    private final List<AttrCfg> attrCfgs = Arrays.asList(
+        new AttrCfg("isDense", Vector::isDense,
+            DenseLocalOnHeapVector.class, DenseLocalOffHeapVector.class, RandomVector.class, ConstantVector.class,
+            SingleElementVector.class),
+        new AttrCfg("isArrayBased", Vector::isArrayBased,
+            DenseLocalOnHeapVector.class),
+        new AttrCfg("isSequentialAccess", Vector::isSequentialAccess,
+            DenseLocalOnHeapVector.class, DenseLocalOffHeapVector.class, SparseLocalVectorSequentialAccess.class,
+            RandomVector.class, ConstantVector.class, SingleElementVector.class),
+        new AttrCfg("guidNotNull", v -> v.guid() == null), // IMPL NOTE this is somewhat artificial
+        new AttrCfg("isRandomAccess", Vector::isRandomAccess,
+            DenseLocalOnHeapVector.class, DenseLocalOffHeapVector.class, RandomVector.class, ConstantVector.class,
+            SingleElementVector.class, SparseLocalVectorSequentialAccess.class, SparseLocalVectorRandomAccess.class),
+        new AttrCfg("isDistributed", Vector::isDistributed));
+
+    /** */
+    private final List<Specification> specFixture = Arrays.asList(
+        new Specification(new DenseLocalOnHeapVector(1)),
+        new Specification(new DenseLocalOffHeapVector(1)),
+        new Specification(new DelegatingVector(new DenseLocalOnHeapVector(1)),
+            DenseLocalOnHeapVector.class, "isDense", "isArrayBased", "isSequentialAccess",
+            "isRandomAccess", "isDistributed"),
+        new Specification(new DelegatingVector(new DenseLocalOffHeapVector(1)),
+            DenseLocalOffHeapVector.class, "isDense", "isArrayBased", "isSequentialAccess",
+            "isRandomAccess", "isDistributed"),
+        new Specification(new SparseLocalVectorSequentialAccess(1)),
+        new Specification(new SparseLocalVectorRandomAccess(1)),
+        new Specification(new RandomVector(1)),
+        new Specification(new ConstantVector(1, 1.0)),
+        new Specification(new FunctionVector(1, idx -> (double)idx)),
+        new Specification(new SingleElementVector(1, 0, 1.0)),
+        new Specification(new PivotedVectorView(new DenseLocalOnHeapVector(1), new int[] {0}),
+            DenseLocalOnHeapVector.class, "isDense", "isArrayBased", "isSequentialAccess",
+            "isRandomAccess", "isDistributed"),
+        new Specification(new PivotedVectorView(new DenseLocalOffHeapVector(1), new int[] {0}),
+            DenseLocalOffHeapVector.class, "isDense", "isArrayBased", "isSequentialAccess",
+            "isRandomAccess", "isDistributed"),
+        new Specification(new SingleElementVectorView(new DenseLocalOnHeapVector(1), 0),
+            DenseLocalOnHeapVector.class, "isDense", "isSequentialAccess",
+            "isRandomAccess", "isDistributed"),
+        new Specification(new SingleElementVectorView(new DenseLocalOffHeapVector(1), 0),
+            DenseLocalOffHeapVector.class, "isDense", "isSequentialAccess",
+            "isRandomAccess", "isDistributed"),
+        new Specification(new MatrixVectorView(new DenseLocalOnHeapMatrix(1, 1), 0, 0, 1, 1),
+            DenseLocalOnHeapVector.class, "isDense",
+            "isRandomAccess", "isDistributed"), // todo find out why "isSequentialAccess" fails here
+        new Specification(new MatrixVectorView(new DenseLocalOffHeapMatrix(1, 1), 0, 0, 1, 1),
+            DenseLocalOffHeapVector.class, "isDense",
+            "isRandomAccess", "isDistributed"));
+
+    /** */
+    @Test
+    public void isDenseTest() {
+        assertAttribute("isDense");
+    }
+
+    /** */
+    @Test
+    public void isArrayBasedTest() {
+        assertAttribute("isArrayBased");
+    }
+
+    /** */
+    @Test
+    public void isSequentialAccessTest() {
+        assertAttribute("isSequentialAccess");
+    }
+
+    /** */
+    @Test
+    public void guidTest() {
+        assertAttribute("guidNotNull");
+    }
+
+    /** */
+    @Test
+    public void isRandomAccessTest() {
+        assertAttribute("isRandomAccess");
+    }
+
+    /** */
+    @Test
+    public void isDistributedTest() {
+        assertAttribute("isDistributed");
+    }
+
+    /** */
+    private void assertAttribute(String name) {
+        final AttrCfg attr = attrCfg(name);
+
+        for (Specification spec : specFixture)
+            spec.verify(attr);
+    }
+
+    /** */
+    private AttrCfg attrCfg(String name) {
+        for (AttrCfg attr : attrCfgs)
+            if (attr.name.equals(name))
+                return attr;
+
+        throw new IllegalArgumentException("Undefined attribute " + name);
+    }
+
+    /** See http://en.wikipedia.org/wiki/Specification_pattern */
+    private static class Specification {
+        /** */
+        private final Vector v;
+        /** */
+        private final Class<? extends Vector> underlyingType;
+        /** */
+        private final List<String> attrsFromUnderlying;
+        /** */
+        final String desc;
+
+        /** */
+        Specification(Vector v, Class<? extends Vector> underlyingType, String... attrsFromUnderlying) {
+            this.v = v;
+            this.underlyingType = underlyingType;
+            this.attrsFromUnderlying = Arrays.asList(attrsFromUnderlying);
+            final Class<? extends Vector> clazz = v.getClass();
+            desc = clazz.getSimpleName() + (clazz.equals(underlyingType)
+                ? "" : " (underlying type " + underlyingType.getSimpleName() + ")");
+        }
+
+        /** */
+        Specification(Vector v) {
+            this(v, v.getClass());
+        }
+
+        /** */
+        void verify(AttrCfg attr) {
+            final boolean obtained = attr.obtain.apply(v);
+
+            final Class<? extends Vector> typeToCheck
+                = attrsFromUnderlying.contains(attr.name) ? underlyingType : v.getClass();
+
+            final boolean exp = attr.trueInTypes.contains(typeToCheck);
+
+            assertEquals("Unexpected " + attr.name + " value for " + desc, exp, obtained);
+        }
+    }
+
+    /** */
+    private static class AttrCfg {
+        /** */
+        final String name;
+        /** */
+        final Function<Vector, Boolean> obtain;
+        /** */
+        final List<Class> trueInTypes;
+
+        /** */
+        AttrCfg(String name, Function<Vector, Boolean> obtain, Class... trueInTypes) {
+            this.name = name;
+            this.obtain = obtain;
+            this.trueInTypes = Arrays.asList(trueInTypes);
+        }
+    }
+
+    /** */
+    private static class SparseLocalVectorSequentialAccess extends SparseLocalVector {
+        /** */
+        public SparseLocalVectorSequentialAccess() {
+            // No-op.
+        }
+
+        /** */
+        SparseLocalVectorSequentialAccess(int size) {
+            super(size, SEQUENTIAL_ACCESS_MODE);
+        }
+    }
+
+    /** */
+    private static class SparseLocalVectorRandomAccess extends SparseLocalVector {
+        /** */
+        public SparseLocalVectorRandomAccess() {
+            // No-op.
+        }
+
+        /** */
+        SparseLocalVectorRandomAccess(int size) {
+            super(size, RANDOM_ACCESS_MODE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorFoldMapTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorFoldMapTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorFoldMapTest.java
new file mode 100644
index 0000000..67eb8ba
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorFoldMapTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Arrays;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.functions.Functions;
+import org.junit.Test;
+
+import static java.util.function.DoubleUnaryOperator.identity;
+import static org.junit.Assert.assertTrue;
+
+/** See also: {@link AbstractVectorTest} and {@link VectorToMatrixTest}. */
+public class VectorFoldMapTest {
+    /** */
+    @Test
+    public void mapVectorTest() {
+        operationVectorTest((operand1, operand2) -> operand1 + operand2, (Vector v1, Vector v2) -> v1.map(v2, Functions.PLUS));
+    }
+
+    /** */
+    @Test
+    public void mapDoubleFunctionTest() {
+        consumeSampleVectors((v, desc) -> operatorTest(v, desc,
+            (vec) -> vec.map(Functions.INV), (val) -> 1.0 / val));
+    }
+
+    /** */
+    @Test
+    public void mapBiFunctionTest() {
+        consumeSampleVectors((v, desc) -> operatorTest(v, desc,
+            (vec) -> vec.map(Functions.PLUS, 1.0), (val) -> 1.0 + val));
+    }
+
+    /** */
+    @Test
+    public void foldMapTest() {
+        toDoubleTest(
+            ref -> Arrays.stream(ref).map(identity()).sum(),
+            (v) -> v.foldMap(Functions.PLUS, Functions.IDENTITY, 0.0));
+    }
+
+    /** */
+    @Test
+    public void foldMapVectorTest() {
+        toDoubleTest(
+            ref -> 2.0 * Arrays.stream(ref).sum(),
+            (v) -> v.foldMap(v, Functions.PLUS, Functions.PLUS, 0.0));
+
+    }
+
+    /** */
+    private void operatorTest(Vector v, String desc, Function<Vector, Vector> op, Function<Double, Double> refOp) {
+        final int size = v.size();
+        final double[] ref = new double[size];
+
+        VectorImplementationsTest.ElementsChecker checker = new VectorImplementationsTest.ElementsChecker(v, ref, desc);
+
+        Vector actual = op.apply(v);
+
+        for (int idx = 0; idx < size; idx++)
+            ref[idx] = refOp.apply(ref[idx]);
+
+        checker.assertCloseEnough(actual, ref);
+    }
+
+    /** */
+    private void toDoubleTest(Function<double[], Double> calcRef, Function<Vector, Double> calcVec) {
+        consumeSampleVectors((v, desc) -> {
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            new VectorImplementationsTest.ElementsChecker(v, ref, desc); // IMPL NOTE this initialises vector and reference array
+
+            final VectorImplementationsTest.Metric metric = new VectorImplementationsTest.Metric(calcRef.apply(ref), calcVec.apply(v));
+
+            assertTrue("Not close enough at " + desc
+                + ", " + metric, metric.closeEnough());
+        });
+    }
+
+    /** */
+    private void operationVectorTest(BiFunction<Double, Double, Double> operation,
+        BiFunction<Vector, Vector, Vector> vecOperation) {
+        consumeSampleVectors((v, desc) -> {
+            // TODO find out if more elaborate testing scenario is needed or it's okay as is.
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            final VectorImplementationsTest.ElementsChecker checker = new VectorImplementationsTest.ElementsChecker(v, ref, desc);
+            final Vector operand = v.copy();
+
+            for (int idx = 0; idx < size; idx++)
+                ref[idx] = operation.apply(ref[idx], ref[idx]);
+
+            checker.assertCloseEnough(vecOperation.apply(v, operand), ref);
+        });
+    }
+
+    /** */
+    private void consumeSampleVectors(BiConsumer<Vector, String> consumer) {
+        new VectorImplementationsFixtures().consumeSampleVectors(null, consumer);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsFixtures.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsFixtures.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsFixtures.java
new file mode 100644
index 0000000..5a46218
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsFixtures.java
@@ -0,0 +1,655 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.storage.vector.FunctionVectorStorage;
+import org.jetbrains.annotations.NotNull;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/** */
+class VectorImplementationsFixtures {
+    /** */
+    private static final List<Supplier<Iterable<Vector>>> suppliers = Arrays.asList(
+        (Supplier<Iterable<Vector>>)DenseLocalOnHeapVectorFixture::new,
+        (Supplier<Iterable<Vector>>)DenseLocalOffHeapVectorFixture::new,
+        (Supplier<Iterable<Vector>>)SparseLocalVectorFixture::new,
+        (Supplier<Iterable<Vector>>)RandomVectorFixture::new,
+        (Supplier<Iterable<Vector>>)ConstantVectorFixture::new,
+        (Supplier<Iterable<Vector>>)DelegatingVectorFixture::new,
+        (Supplier<Iterable<Vector>>)FunctionVectorFixture::new,
+        (Supplier<Iterable<Vector>>)SingleElementVectorFixture::new,
+        (Supplier<Iterable<Vector>>)PivotedVectorViewFixture::new,
+        (Supplier<Iterable<Vector>>)SingleElementVectorViewFixture::new,
+        (Supplier<Iterable<Vector>>)MatrixVectorViewFixture::new,
+        (Supplier<Iterable<Vector>>)SparseLocalOffHeapVectorFixture::new
+    );
+
+    /** */
+    void consumeSampleVectors(Consumer<Integer> paramsConsumer, BiConsumer<Vector, String> consumer) {
+        for (Supplier<Iterable<Vector>> fixtureSupplier : VectorImplementationsFixtures.suppliers) {
+            final Iterable<Vector> fixture = fixtureSupplier.get();
+
+            for (Vector v : fixture) {
+                if (paramsConsumer != null)
+                    paramsConsumer.accept(v.size());
+
+                consumer.accept(v, fixture.toString());
+            }
+        }
+    }
+
+    /** */
+    void selfTest() {
+        new VectorSizesExtraIterator<>("VectorSizesExtraIterator test",
+            (size, shallowCp) -> new DenseLocalOnHeapVector(new double[size], shallowCp),
+            null, "shallow copy", new Boolean[] {false, true, null}).selfTest();
+
+        new VectorSizesIterator("VectorSizesIterator test", DenseLocalOffHeapVector::new, null).selfTest();
+    }
+
+    /** */
+    private static class DenseLocalOnHeapVectorFixture extends VectorSizesExtraFixture<Boolean> {
+        /** */
+        DenseLocalOnHeapVectorFixture() {
+            super("DenseLocalOnHeapVector",
+                (size, shallowCp) -> new DenseLocalOnHeapVector(new double[size], shallowCp),
+                "shallow copy", new Boolean[] {false, true, null});
+        }
+    }
+
+    /** */
+    private static class DenseLocalOffHeapVectorFixture extends VectorSizesFixture {
+        /** */
+        DenseLocalOffHeapVectorFixture() {
+            super("DenseLocalOffHeapVector", DenseLocalOffHeapVector::new);
+        }
+    }
+
+    /** */
+    private static class SparseLocalVectorFixture extends VectorSizesExtraFixture<Integer> {
+        /** */
+        SparseLocalVectorFixture() {
+            super("SparseLocalVector", SparseLocalVector::new, "access mode",
+                new Integer[] {StorageConstants.SEQUENTIAL_ACCESS_MODE, StorageConstants.RANDOM_ACCESS_MODE, null});
+        }
+    }
+
+    /** */
+    private static class RandomVectorFixture extends VectorSizesFixture {
+        /** */
+        RandomVectorFixture() {
+            super("RandomVector", RandomVector::new);
+        }
+    }
+
+    /** */
+    private static class ConstantVectorFixture extends VectorSizesExtraFixture<Double> {
+        /** */
+        ConstantVectorFixture() {
+            super("ConstantVector", ConstantVector::new,
+                "value", new Double[] {-1.0, 0.0, 0.5, 1.0, 2.0, null});
+        }
+    }
+
+    /** */
+    private static class FunctionVectorFixture extends VectorSizesExtraFixture<Double> {
+        /** */
+        FunctionVectorFixture() {
+            super("FunctionVector",
+                (size, scale) -> new FunctionVectorForTest(new double[size], scale),
+                "scale", new Double[] {0.5, 1.0, 2.0, null});
+        }
+    }
+
+    /** */
+    private static class SingleElementVectorFixture implements Iterable<Vector> {
+        /** */
+        private final Supplier<TwoParamsIterator<Integer, Double>> iter;
+
+        /** */
+        private final AtomicReference<String> ctxDescrHolder = new AtomicReference<>("Iterator not started.");
+
+        /** */
+        SingleElementVectorFixture() {
+            iter = () -> new TwoParamsIterator<Integer, Double>("SingleElementVector",
+                null, ctxDescrHolder::set,
+                "size", new Integer[] {1, null},
+                "value", new Double[] {-1.0, 0.0, 0.5, 1.0, 2.0, null}) {
+
+                /** {@inheritDoc} */
+                @Override BiFunction<Integer, Double, Vector> ctor() {
+                    return (size, value) -> new SingleElementVector(size, 0, value);
+                }
+            };
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Vector> iterator() {
+            return iter.get();//(
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return ctxDescrHolder.get();
+        }
+    }
+
+    /** */
+    private static class PivotedVectorViewFixture extends VectorSizesFixture {
+        /** */
+        PivotedVectorViewFixture() {
+            super("PivotedVectorView", PivotedVectorViewFixture::pivotedVectorView);
+        }
+
+        /** */
+        private static PivotedVectorView pivotedVectorView(int size) {
+            final DenseLocalOnHeapVector vec = new DenseLocalOnHeapVector(size);
+
+            final int[] pivot = new int[size];
+
+            for (int idx = 0; idx < size; idx++)
+                pivot[idx] = size - 1 - idx;
+
+            PivotedVectorView tmp = new PivotedVectorView(vec, pivot);
+
+            final int[] unpivot = new int[size];
+
+            for (int idx = 0; idx < size; idx++)
+                unpivot[idx] = tmp.unpivot(idx);
+
+            final int[] idxRecovery = new int[size];
+
+            for (int idx = 0; idx < size; idx++)
+                idxRecovery[idx] = idx;
+
+            return new PivotedVectorView(new PivotedVectorView(tmp, unpivot), idxRecovery);
+        }
+    }
+
+    /** */
+    private static class SingleElementVectorViewFixture implements Iterable<Vector> {
+        /** */
+        private final Supplier<TwoParamsIterator<Integer, Double>> iter;
+
+        /** */
+        private final AtomicReference<String> ctxDescrHolder = new AtomicReference<>("Iterator not started.");
+
+        /** */
+        SingleElementVectorViewFixture() {
+            iter = () -> new TwoParamsIterator<Integer, Double>("SingleElementVectorView",
+                null, ctxDescrHolder::set,
+                "size", new Integer[] {1, null},
+                "value", new Double[] {-1.0, 0.0, 0.5, 1.0, 2.0, null}) {
+
+                /** {@inheritDoc} */
+                @Override BiFunction<Integer, Double, Vector> ctor() {
+                    return (size, value) -> new SingleElementVectorView(new SingleElementVector(size, 0, value), 0);
+                }
+            };
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Vector> iterator() {
+            return iter.get();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return ctxDescrHolder.get();
+        }
+    }
+
+    /** */
+    private static class MatrixVectorViewFixture extends VectorSizesExtraFixture<Integer> {
+        /** */
+        MatrixVectorViewFixture() {
+            super("MatrixVectorView",
+                MatrixVectorViewFixture::newView,
+                "stride kind", new Integer[] {0, 1, 2, null});
+        }
+
+        /** */
+        private static Vector newView(int size, int strideKind) {
+            final Matrix parent = new DenseLocalOnHeapMatrix(size, size);
+
+            return new MatrixVectorView(parent, 0, 0, strideKind != 1 ? 1 : 0, strideKind != 0 ? 1 : 0);
+        }
+    }
+
+    /** */
+    private static class VectorSizesExtraFixture<T> implements Iterable<Vector> {
+        /** */
+        private final Supplier<VectorSizesExtraIterator<T>> iter;
+
+        /** */
+        private final AtomicReference<String> ctxDescrHolder = new AtomicReference<>("Iterator not started.");
+
+        /** */
+        VectorSizesExtraFixture(String vectorKind, BiFunction<Integer, T, Vector> ctor, String extraParamName,
+            T[] extras) {
+            iter = () -> new VectorSizesExtraIterator<>(vectorKind, ctor, ctxDescrHolder::set, extraParamName, extras);
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Vector> iterator() {
+            return iter.get();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return ctxDescrHolder.get();
+        }
+    }
+
+    /** */
+    private static abstract class VectorSizesFixture implements Iterable<Vector> {
+        /** */
+        private final Supplier<VectorSizesIterator> iter;
+
+        /** */
+        private final AtomicReference<String> ctxDescrHolder = new AtomicReference<>("Iterator not started.");
+
+        /** */
+        VectorSizesFixture(String vectorKind, Function<Integer, Vector> ctor) {
+            iter = () -> new VectorSizesIterator(vectorKind, ctor, ctxDescrHolder::set);
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Vector> iterator() {
+            return iter.get();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return ctxDescrHolder.get();
+        }
+    }
+
+    /** */
+    private static class VectorSizesExtraIterator<T> extends VectorSizesIterator {
+        /** */
+        private final T[] extras;
+        /** */
+        private int extraIdx = 0;
+        /** */
+        private final BiFunction<Integer, T, Vector> ctor;
+        /** */
+        private final String extraParamName;
+
+        /**
+         * @param vectorKind Descriptive name to use for context logging.
+         * @param ctor Constructor for objects to iterate over.
+         * @param ctxDescrConsumer Context logging consumer.
+         * @param extraParamName Name of extra parameter to iterate over.
+         * @param extras Array of extra parameter values to iterate over.
+         */
+        VectorSizesExtraIterator(String vectorKind, BiFunction<Integer, T, Vector> ctor,
+            Consumer<String> ctxDescrConsumer, String extraParamName, T[] extras) {
+            super(vectorKind, null, ctxDescrConsumer);
+
+            this.ctor = ctor;
+            this.extraParamName = extraParamName;
+            this.extras = extras;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean hasNext() {
+            return super.hasNext() && hasNextExtra(extraIdx);
+        }
+
+        /** {@inheritDoc} */
+        @Override void nextIdx() {
+            assert extras[extraIdx] != null
+                : "Index(es) out of bound at " + VectorSizesExtraIterator.this;
+
+            if (hasNextExtra(extraIdx + 1)) {
+                extraIdx++;
+
+                return;
+            }
+
+            extraIdx = 0;
+
+            super.nextIdx();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return "{" + super.toString() +
+                ", " + extraParamName + "=" + extras[extraIdx] +
+                '}';
+        }
+
+        /** {@inheritDoc} */
+        @Override BiFunction<Integer, Integer, Vector> ctor() {
+            return (size, delta) -> ctor.apply(size + delta, extras[extraIdx]);
+        }
+
+        /** */
+        void selfTest() {
+            final Set<Integer> extraIdxs = new HashSet<>();
+
+            int cnt = 0;
+
+            while (hasNext()) {
+                assertNotNull("Expect not null vector at " + this, next());
+
+                if (extras[extraIdx] != null)
+                    extraIdxs.add(extraIdx);
+
+                cnt++;
+            }
+
+            assertEquals("Extra param tested", extraIdxs.size(), extras.length - 1);
+
+            assertEquals("Combinations tested mismatch.",
+                7 * 3 * (extras.length - 1), cnt);
+        }
+
+        /** */
+        private boolean hasNextExtra(int idx) {
+            return extras[idx] != null;
+        }
+    }
+
+    /** */
+    private static class VectorSizesIterator extends TwoParamsIterator<Integer, Integer> {
+        /** */
+        private final Function<Integer, Vector> ctor;
+
+        /** */
+        VectorSizesIterator(String vectorKind, Function<Integer, Vector> ctor, Consumer<String> ctxDescrConsumer) {
+            super(vectorKind, null, ctxDescrConsumer,
+                "size", new Integer[] {2, 4, 8, 16, 32, 64, 128, null},
+                "size delta", new Integer[] {-1, 0, 1, null});
+
+            this.ctor = ctor;
+        }
+
+        /** {@inheritDoc} */
+        @Override BiFunction<Integer, Integer, Vector> ctor() {
+            return (size, delta) -> ctor.apply(size + delta);
+        }
+    }
+
+    /** */
+    private static class TwoParamsIterator<T, U> implements Iterator<Vector> {
+        /** */
+        private final T params1[];
+
+        /** */
+        private final U params2[];
+
+        /** */
+        private final String vectorKind;
+
+        /** */
+        private final String param1Name;
+
+        /** */
+        private final String param2Name;
+
+        /** */
+        private final BiFunction<T, U, Vector> ctor;
+
+        /** */
+        private final Consumer<String> ctxDescrConsumer;
+
+        /** */
+        private int param1Idx = 0;
+
+        /** */
+        private int param2Idx = 0;
+
+        /** */
+        TwoParamsIterator(String vectorKind, BiFunction<T, U, Vector> ctor,
+            Consumer<String> ctxDescrConsumer, String param1Name, T[] params1, String param2Name, U[] params2) {
+            this.param1Name = param1Name;
+            this.params1 = params1;
+
+            this.param2Name = param2Name;
+            this.params2 = params2;
+
+            this.vectorKind = vectorKind;
+
+            this.ctor = ctor;
+
+            this.ctxDescrConsumer = ctxDescrConsumer;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean hasNext() {
+            return hasNextParam1(param1Idx) && hasNextParam2(param2Idx);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Vector next() {
+            if (!hasNext())
+                throw new NoSuchElementException(TwoParamsIterator.this.toString());
+
+            if (ctxDescrConsumer != null)
+                ctxDescrConsumer.accept(toString());
+
+            Vector res = ctor().apply(params1[param1Idx], params2[param2Idx]);
+
+            nextIdx();
+
+            return res;
+        }
+
+        /** */
+        void selfTest() {
+            final Set<Integer> sizeIdxs = new HashSet<>(), deltaIdxs = new HashSet<>();
+
+            int cnt = 0;
+
+            while (hasNext()) {
+                assertNotNull("Expect not null vector at " + this, next());
+
+                if (params1[param1Idx] != null)
+                    sizeIdxs.add(param1Idx);
+
+                if (params2[param2Idx] != null)
+                    deltaIdxs.add(param2Idx);
+
+                cnt++;
+            }
+
+            assertEquals("Sizes tested mismatch.", sizeIdxs.size(), params1.length - 1);
+
+            assertEquals("Deltas tested", deltaIdxs.size(), params2.length - 1);
+
+            assertEquals("Combinations tested mismatch.",
+                (params1.length - 1) * (params2.length - 1), cnt);
+        }
+
+        /** IMPL NOTE override in subclasses if needed */
+        void nextIdx() {
+            assert params1[param1Idx] != null && params2[param2Idx] != null
+                : "Index(es) out of bound at " + TwoParamsIterator.this;
+
+            if (hasNextParam2(param2Idx + 1)) {
+                param2Idx++;
+
+                return;
+            }
+
+            param2Idx = 0;
+
+            param1Idx++;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return vectorKind + "{" + param1Name + "=" + params1[param1Idx] +
+                ", " + param2Name + "=" + params2[param2Idx] +
+                '}';
+        }
+
+        /** IMPL NOTE override in subclasses if needed */
+        BiFunction<T, U, Vector> ctor() {
+            return ctor;
+        }
+
+        /** */
+        private boolean hasNextParam1(int idx) {
+            return params1[idx] != null;
+        }
+
+        /** */
+        private boolean hasNextParam2(int idx) {
+            return params2[idx] != null;
+        }
+    }
+
+    /** Delegating vector with dense local onheap vector */
+    private static class DelegatingVectorFixture implements Iterable<Vector> {
+
+        /** */
+        private final Supplier<VectorSizesExtraIterator<Boolean>> iter;
+
+        /** */
+        private final AtomicReference<String> ctxDescrHolder = new AtomicReference<>("Iterator not started.");
+
+        /** */
+        DelegatingVectorFixture() {
+            iter = () -> new VectorSizesExtraIterator<>("DelegatingVector with DenseLocalOnHeapVector",
+                (size, shallowCp) -> new DelegatingVector(new DenseLocalOnHeapVector(new double[size], shallowCp)),
+                ctxDescrHolder::set, "shallow copy", new Boolean[] {false, true, null});
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Vector> iterator() {
+            return iter.get();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            // IMPL NOTE index within bounds is expected to be guaranteed by proper code in this class
+            return ctxDescrHolder.get();
+        }
+    }
+
+    /** Subclass tweaked for serialization */
+    private static class FunctionVectorForTest extends FunctionVector {
+        /** */
+        double[] arr;
+
+        /** */
+        double scale;
+
+        /** */
+        public FunctionVectorForTest() {
+            // No-op.
+        }
+
+        /** */
+        FunctionVectorForTest(double[] arr, double scale) {
+            super(arr.length, idx -> arr[idx] * scale, (idx, value) -> arr[idx] = value / scale);
+
+            this.arr = arr;
+
+            this.scale = scale;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            super.writeExternal(out);
+
+            out.writeObject(arr);
+
+            out.writeDouble(scale);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            super.readExternal(in);
+
+            arr = (double[])in.readObject();
+
+            scale = in.readDouble();
+
+            setStorage(new FunctionVectorStorage(arr.length, idx -> arr[idx] * scale, (idx, value) -> arr[idx] = value / scale));
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = 1;
+
+            res = res * 37 + Double.hashCode(scale);
+            res = res * 37 + Integer.hashCode(getStorage().size());
+
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            FunctionVectorForTest that = (FunctionVectorForTest)o;
+
+            return new Double(scale).equals(that.scale)
+                && (arr != null ? Arrays.equals(arr, that.arr) : that.arr == null);
+        }
+    }
+
+    /** */
+    private static class SparseLocalOffHeapVectorFixture extends VectorSizesFixture {
+
+        /** */
+        SparseLocalOffHeapVectorFixture() {
+            super("SparseLocalOffHeapVector", SparseLocalOffHeapVector::new);
+        }
+    }
+}


[03/50] [abbrv] ignite git commit: Added missing package info for o.a.i.hadoop.planner package.

Posted by sb...@apache.org.
Added missing package info for o.a.i.hadoop.planner package.


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

Branch: refs/heads/ignite-1561-1
Commit: 378475649ec3fbaf84929863fa36fe6f683b1530
Parents: 1708ffb
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 16:10:49 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 16:10:49 2017 +0300

----------------------------------------------------------------------
 .../ignite/hadoop/planner/package-info.java     | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/37847564/modules/hadoop/src/main/java/org/apache/ignite/hadoop/planner/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/planner/package-info.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/planner/package-info.java
new file mode 100644
index 0000000..08a5fab
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/planner/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Ignite Hadoop Accelerator planner classes.
+ */
+package org.apache.ignite.hadoop.planner;
\ No newline at end of file


[42/50] [abbrv] ignite git commit: Compilation fixed

Posted by sb...@apache.org.
Compilation fixed


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

Branch: refs/heads/ignite-1561-1
Commit: 0a7e82403ba81be91e5aa06c9f238cb97c22a441
Parents: 7def66c
Author: agura <ag...@apache.org>
Authored: Fri Apr 14 20:04:00 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Fri Apr 14 20:04:49 2017 +0300

----------------------------------------------------------------------
 .../hibernate/CacheHibernateBlobStoreNodeRestartTest.java    | 8 --------
 .../impls/storage/matrix/SparseDistributedMatrixStorage.java | 2 --
 2 files changed, 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0a7e8240/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
index 0c06190..d5496af 100644
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
+++ b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
@@ -17,15 +17,12 @@
 
 package org.apache.ignite.cache.store.hibernate;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.integration.IgniteCacheStoreNodeRestartAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
 public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
     /** {@inheritDoc} */
     @Override protected CacheStore getStore() {
@@ -46,9 +43,4 @@ public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNode
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/0a7e8240/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
index 936f893..82807c5 100644
--- a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
@@ -17,7 +17,6 @@ import java.io.ObjectOutput;
 import java.util.Map;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CachePeekMode;
@@ -86,7 +85,6 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
         cfg.setStartSize(Math.max(1024, (rows * cols) / 10));
 
         // Write to primary.
-        cfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.PRIMARY);
         cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
 
         // Atomic transactions only.


[13/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
index fd3d980..dc1ba2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java
@@ -17,14 +17,17 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -32,7 +35,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 /**
  * Data transfer object for cache store configuration properties.
  */
-public class VisorCacheStoreConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheStoreConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -70,11 +73,19 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
     private boolean storeKeepBinary;
 
     /**
+     * Default constructor.
+     */
+    public VisorCacheStoreConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for cache store configuration properties.
+     *
      * @param ignite Ignite instance.
      * @param ccfg Cache configuration.
-     * @return Data transfer object for cache store configuration properties.
      */
-    public VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
+    public VisorCacheStoreConfiguration(IgniteEx ignite, CacheConfiguration ccfg) {
         IgniteCacheProxy<Object, Object> c = ignite.context().cache().jcache(ccfg.getName());
 
         CacheStore cstore = c != null && c.context().started() ? c.context().store().configuredStore() : null;
@@ -94,95 +105,123 @@ public class VisorCacheStoreConfiguration implements Serializable, LessNamingBea
         flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();
 
         storeKeepBinary = ccfg.isStoreKeepBinary();
-
-        return this;
     }
 
     /**
      * @return {@code true} if cache has store.
      */
-    public boolean enabled() {
+    public boolean isEnabled() {
         return store != null;
     }
 
     /**
      * @return {@code true} if cache has JDBC store.
      */
-    public boolean jdbcStore() {
+    public boolean isJdbcStore() {
         return jdbcStore;
     }
 
     /**
      * @return Cache store class name.
      */
-    @Nullable public String store() {
+    @Nullable public String getStore() {
         return store;
     }
 
     /**
      * @return Cache store factory class name..
      */
-    public String storeFactory() {
+    public String getStoreFactory() {
         return storeFactory;
     }
 
     /**
      * @return Whether cache should operate in read-through mode.
      */
-    public boolean readThrough() {
+    public boolean isReadThrough() {
         return readThrough;
     }
 
     /**
      * @return Whether cache should operate in write-through mode.
      */
-    public boolean writeThrough() {
+    public boolean isWriteThrough() {
         return writeThrough;
     }
 
     /**
      * @return Flag indicating whether write-behind behaviour should be used for the cache store.
      */
-    public boolean writeBehindEnabled() {
+    public boolean isWriteBehindEnabled() {
         return writeBehindEnabled;
     }
 
     /**
      * @return Maximum batch size for write-behind cache store operations.
      */
-    public int batchSize() {
+    public int getBatchSize() {
         return batchSz;
     }
 
     /**
      * @return Frequency with which write-behind cache is flushed to the cache store in milliseconds.
      */
-    public long flushFrequency() {
+    public long getFlushFrequency() {
         return flushFreq;
     }
 
     /**
      * @return Maximum object count in write-behind cache.
      */
-    public int flushSize() {
+    public int getFlushSize() {
         return flushSz;
     }
 
     /**
      * @return Number of threads that will perform cache flushing.
      */
-    public int flushThreadCount() {
+    public int getFlushThreadCount() {
         return flushThreadCnt;
     }
 
     /**
      * @return Keep binary in store flag.
      */
-    public boolean storeKeepBinary() {
+    public boolean isStoreKeepBinary() {
         return storeKeepBinary;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(jdbcStore);
+        U.writeString(out, store);
+        U.writeString(out, storeFactory);
+        out.writeBoolean(readThrough);
+        out.writeBoolean(writeThrough);
+        out.writeBoolean(writeBehindEnabled);
+        out.writeInt(batchSz);
+        out.writeLong(flushFreq);
+        out.writeInt(flushSz);
+        out.writeInt(flushThreadCnt);
+        out.writeBoolean(storeKeepBinary);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        jdbcStore = in.readBoolean();
+        store = U.readString(in);
+        storeFactory = U.readString(in);
+        readThrough = in.readBoolean();
+        writeThrough = in.readBoolean();
+        writeBehindEnabled = in.readBoolean();
+        batchSz = in.readInt();
+        flushFreq = in.readLong();
+        flushSz = in.readInt();
+        flushThreadCnt = in.readInt();
+        storeKeepBinary = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheStoreConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
deleted file mode 100644
index c9bf960..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeFieldMetadata.java
+++ /dev/null
@@ -1,92 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
-import org.apache.ignite.internal.LessNamingBean;
-
-/**
- * Data transfer object for {@link JdbcTypeField}.
- */
-public class VisorCacheTypeFieldMetadata implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Column name in database. */
-    private String dbName;
-
-    /** Column JDBC type in database. */
-    private int dbType;
-
-    /** Field name in java object. */
-    private String javaName;
-
-    /** Corresponding java type. */
-    private String javaType;
-
-    /**
-     * Empty constructor.
-     */
-    public VisorCacheTypeFieldMetadata() {
-        // No-op.
-    }
-
-    /**
-     * Full constructor.
-     *
-     * @param dbName Column name in database.
-     * @param dbType Column JDBC type in database.
-     * @param javaName Field name in java object.
-     * @param javaType Corresponding java type.
-     */
-    public VisorCacheTypeFieldMetadata(String dbName, int dbType, String javaName, String javaType) {
-        this.dbName = dbName;
-        this.dbType = dbType;
-        this.javaName = javaName;
-        this.javaType = javaType;
-    }
-
-    /**
-     * @return Column name in database.
-     */
-    public String dbName() {
-        return dbName;
-    }
-
-    /**
-     * @return Column JDBC type in database.
-     */
-    public int dbType() {
-        return dbType;
-    }
-
-    /**
-     * @return Field name in java object.
-     */
-    public String javaName() {
-        return javaName;
-    }
-
-    /**
-     * @return Corresponding java type.
-     */
-    public String javaType() {
-        return javaType;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
deleted file mode 100644
index 7463887..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
+++ /dev/null
@@ -1,294 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.ignite.cache.QueryEntity;
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
-import org.apache.ignite.cache.store.jdbc.JdbcType;
-import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-
-import javax.cache.configuration.Factory;
-
-/**
- * Data transfer object for {@link JdbcType}.
- */
-public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Schema name in database. */
-    private String dbSchema;
-
-    /** Table name in database. */
-    private String dbTbl;
-
-    /** Key class used to store key in cache. */
-    private String keyType;
-
-    /** Value class used to store value in cache. */
-    private String valType;
-
-    /** Key fields. */
-    @GridToStringInclude
-    private Collection<VisorCacheTypeFieldMetadata> keyFields;
-
-    /** Value fields. */
-    @GridToStringInclude
-    private Collection<VisorCacheTypeFieldMetadata> valFields;
-
-    /** Fields to be queried, in addition to indexed fields. */
-    @GridToStringInclude
-    private Map<String, String> qryFlds;
-
-    /** Fields to index in ascending order. */
-    @GridToStringInclude
-    private Map<String, String> ascFlds;
-
-    /** Fields to index in descending order. */
-    @GridToStringInclude
-    private Map<String, String> descFlds;
-
-    /** Fields to index as text. */
-    @GridToStringInclude
-    private Collection<String> txtFlds;
-
-    /** Fields to create group indexes for. */
-    @GridToStringInclude
-    private Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps;
-
-    /**
-     * @param qryEntities Collection of query entities.
-     * @param factory Store factory to extract JDBC types info.
-     * @return Data transfer object for cache type metadata configurations.
-     */
-    public static Collection<VisorCacheTypeMetadata> list(Collection<QueryEntity> qryEntities, Factory factory) {
-        final Collection<VisorCacheTypeMetadata> metas = new ArrayList<>();
-
-        Map<String, VisorCacheTypeMetadata> metaMap =
-                U.newHashMap(qryEntities != null ? qryEntities.size() : 0);
-
-        // Add query entries.
-        if (qryEntities != null)
-            for (QueryEntity qryEntity : qryEntities) {
-                VisorCacheTypeMetadata meta = from(qryEntity);
-
-                metas.add(meta);
-
-                metaMap.put(meta.keyType, meta);
-            }
-
-        // Add JDBC types.
-        if (factory != null && factory instanceof CacheJdbcPojoStoreFactory) {
-             CacheJdbcPojoStoreFactory jdbcFactory = (CacheJdbcPojoStoreFactory) factory;
-
-            JdbcType[] jdbcTypes = jdbcFactory.getTypes();
-
-            if (jdbcTypes != null && jdbcTypes.length > 0) {
-                for (JdbcType jdbcType : jdbcTypes) {
-                    VisorCacheTypeMetadata meta = metaMap.get(jdbcType.getKeyType());
-
-                    boolean notFound = meta == null;
-
-                    if (notFound) {
-                        meta = new VisorCacheTypeMetadata();
-
-                        meta.keyType = jdbcType.getKeyType();
-                        meta.valType = jdbcType.getValueType();
-
-                        meta.qryFlds = Collections.emptyMap();
-                        meta.ascFlds = Collections.emptyMap();
-                        meta.descFlds = Collections.emptyMap();
-                        meta.txtFlds = Collections.emptyList();
-                        meta.grps = Collections.emptyMap();
-                    }
-
-                    meta.dbSchema = jdbcType.getDatabaseSchema();
-                    meta.dbTbl = jdbcType.getDatabaseTable();
-
-                    JdbcTypeField[] keyFields = jdbcType.getKeyFields();
-
-                    if (keyFields != null) {
-                        meta.keyFields = new ArrayList<>(keyFields.length);
-
-                        for (JdbcTypeField fld : keyFields)
-                            meta.keyFields.add(new VisorCacheTypeFieldMetadata(
-                                fld.getDatabaseFieldName(), fld.getDatabaseFieldType(),
-                                fld.getDatabaseFieldName(), U.compact(fld.getJavaFieldType().getName())));
-                    }
-
-                    JdbcTypeField[] valFields = jdbcType.getValueFields();
-
-                    if (valFields != null) {
-                        meta.valFields = new ArrayList<>(valFields.length);
-
-                        for (JdbcTypeField fld : valFields)
-                            meta.valFields.add(new VisorCacheTypeFieldMetadata(
-                                fld.getDatabaseFieldName(), fld.getDatabaseFieldType(),
-                                fld.getDatabaseFieldName(), U.compact(fld.getJavaFieldType().getName())));
-                    }
-
-                    if (notFound)
-                        metas.add(meta);
-                }
-            }
-        }
-
-        return metas;
-    }
-
-    /**
-     * @param q Actual cache query entities.
-     * @return Data transfer object for given cache type metadata.
-     */
-    public static VisorCacheTypeMetadata from(QueryEntity q) {
-        assert q != null;
-
-        VisorCacheTypeMetadata metadata = new VisorCacheTypeMetadata();
-
-        metadata.keyType = q.getKeyType();
-        metadata.valType = q.getValueType();
-
-        metadata.dbSchema = "";
-        metadata.dbTbl = "";
-
-        metadata.keyFields = Collections.emptyList();
-        metadata.valFields = Collections.emptyList();
-
-        LinkedHashMap<String, String> qryFields = q.getFields();
-
-        metadata.qryFlds = new LinkedHashMap<>(qryFields);
-
-        metadata.ascFlds = Collections.emptyMap();
-        metadata.descFlds = Collections.emptyMap();
-        metadata.txtFlds = Collections.emptyList();
-
-        Collection<QueryIndex> qryIdxs = q.getIndexes();
-
-        metadata.grps = new LinkedHashMap<>(qryIdxs.size());
-
-        for (QueryIndex qryIdx : qryIdxs) {
-            LinkedHashMap<String, Boolean> qryIdxFlds = qryIdx.getFields();
-
-            LinkedHashMap<String, IgniteBiTuple<String, Boolean>> grpFlds = new LinkedHashMap<>();
-
-            for (Map.Entry<String, Boolean> qryIdxFld : qryIdxFlds.entrySet()) {
-                String fldName = qryIdxFld.getKey();
-
-                grpFlds.put(fldName, new IgniteBiTuple<>(qryFields.get(fldName), !qryIdxFld.getValue()));
-            }
-
-            metadata.grps.put(qryIdx.getName(), grpFlds);
-        }
-
-        return metadata;
-    }
-
-    /**
-     * @return Schema name in database.
-     */
-    public String dbSchema() {
-        return dbSchema;
-    }
-
-    /**
-     * @return Table name in database.
-     */
-    public String dbTbl() {
-        return dbTbl;
-    }
-
-    /**
-     * @return Key class used to store key in cache.
-     */
-    public String keyType() {
-        return keyType;
-    }
-
-    /**
-     * @return Value class used to store value in cache.
-     */
-    public String valType() {
-        return valType;
-    }
-
-    /**
-     * @return Key fields.
-     */
-    public Collection<VisorCacheTypeFieldMetadata> keyFields() {
-        return keyFields;
-    }
-
-    /**
-     * @return Value fields.
-     */
-    public Collection<VisorCacheTypeFieldMetadata> valFields() {
-        return valFields;
-    }
-
-    /**
-     * @return Fields to be queried, in addition to indexed fields.
-     */
-    public Map<String, String> qryFlds() {
-        return qryFlds;
-    }
-
-    /**
-     * @return Fields to index in ascending order.
-     */
-    public Map<String, String> ascFlds() {
-        return ascFlds;
-    }
-
-    /**
-     * @return Fields to index in descending order.
-     */
-    public Map<String, String> descFlds() {
-        return descFlds;
-    }
-
-    /**
-     * @return Fields to index as text.
-     */
-    public Collection<String> txtFlds() {
-        return txtFlds;
-    }
-
-    /**
-     * @return Fields to create group indexes for.
-     */
-    public Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps() {
-        return grps;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorCacheTypeMetadata.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
new file mode 100644
index 0000000..f263db5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorPartitionMap.java
@@ -0,0 +1,90 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for partitions map.
+ */
+public class VisorPartitionMap extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Map of partition states. */
+    private Map<Integer, GridDhtPartitionState> parts;
+
+    /**
+     * Default constructor.
+     */
+    public VisorPartitionMap() {
+        // No-op.
+    }
+
+    /**
+     * @param map Partitions map.
+     */
+    public VisorPartitionMap(GridDhtPartitionMap map) {
+        parts = map.map();
+    }
+
+    /**
+     * @return Partitions map.
+     */
+    public Map<Integer, GridDhtPartitionState> getPartitions() {
+        return parts;
+    }
+
+    /**
+     * @return Partitions map size.
+     */
+    public int size() {
+        return parts.size();
+    }
+
+    /**
+     * @param part Partition.
+     * @return Partition state.
+     */
+    public GridDhtPartitionState get(Integer part) {
+        return parts.get(part);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeIntKeyMap(out, parts);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        parts = U.readIntKeyMap(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorPartitionMap.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java
index 01d6f4f..42eb4f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeMonitoringHolder.java
@@ -55,7 +55,7 @@ public class VisorComputeMonitoringHolder {
                 cleanupStopped = false;
             }
 
-            listenVisor.put(visorKey, true);
+            listenVisor.put(visorKey, Boolean.TRUE);
 
             ignite.events().enableLocal(VISOR_TASK_EVTS);
         }
@@ -68,7 +68,7 @@ public class VisorComputeMonitoringHolder {
      * @return {@code true} if task events should remain enabled.
      */
     private boolean tryDisableEvents(IgniteEx ignite) {
-        if (!listenVisor.values().contains(true)) {
+        if (!listenVisor.values().contains(Boolean.TRUE)) {
             listenVisor.clear();
 
             ignite.events().disableLocal(VISOR_TASK_EVTS);
@@ -103,7 +103,7 @@ public class VisorComputeMonitoringHolder {
                 synchronized (listenVisor) {
                     if (tryDisableEvents(ignite)) {
                         for (String visorKey : listenVisor.keySet())
-                            listenVisor.put(visorKey, false);
+                            listenVisor.put(visorKey, Boolean.FALSE);
 
                         scheduleCleanupJob(ignite);
                     }
@@ -118,4 +118,4 @@ public class VisorComputeMonitoringHolder {
     @Override public String toString() {
         return S.toString(VisorComputeMonitoringHolder.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java
index ae66d4b..e9bd940 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTask.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder.COMPUTE_MONITORING_HOLDER_KEY;
@@ -38,7 +37,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.checkExplicit
  */
 @GridInternal
 public class VisorComputeToggleMonitoringTask extends
-    VisorMultiNodeTask<IgniteBiTuple<String, Boolean>, Boolean, Boolean> {
+    VisorMultiNodeTask<VisorComputeToggleMonitoringTaskArg, Boolean, Boolean> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -54,14 +53,14 @@ public class VisorComputeToggleMonitoringTask extends
     }
 
     /** {@inheritDoc} */
-    @Override protected VisorComputeToggleMonitoringJob job(IgniteBiTuple<String, Boolean> arg) {
+    @Override protected VisorComputeToggleMonitoringJob job(VisorComputeToggleMonitoringTaskArg arg) {
         return new VisorComputeToggleMonitoringJob(arg, debug);
     }
 
     /**
      * Job to toggle task monitoring on node.
      */
-    private static class VisorComputeToggleMonitoringJob extends VisorJob<IgniteBiTuple<String, Boolean>, Boolean> {
+    private static class VisorComputeToggleMonitoringJob extends VisorJob<VisorComputeToggleMonitoringTaskArg, Boolean> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -69,41 +68,40 @@ public class VisorComputeToggleMonitoringTask extends
          * @param arg Visor ID key and monitoring state flag.
          * @param debug Debug flag.
          */
-        private VisorComputeToggleMonitoringJob(IgniteBiTuple<String, Boolean> arg, boolean debug) {
+        private VisorComputeToggleMonitoringJob(VisorComputeToggleMonitoringTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected Boolean run(IgniteBiTuple<String, Boolean> arg) {
+        @Override protected Boolean run(VisorComputeToggleMonitoringTaskArg arg) {
             if (checkExplicitTaskMonitoring(ignite))
-                return true;
-            else {
-                ConcurrentMap<String, VisorComputeMonitoringHolder> storage = ignite.cluster().nodeLocalMap();
+                return Boolean.TRUE;
 
-                VisorComputeMonitoringHolder holder = storage.get(COMPUTE_MONITORING_HOLDER_KEY);
+            ConcurrentMap<String, VisorComputeMonitoringHolder> storage = ignite.cluster().nodeLocalMap();
 
-                if (holder == null) {
-                    VisorComputeMonitoringHolder holderNew = new VisorComputeMonitoringHolder();
+            VisorComputeMonitoringHolder holder = storage.get(COMPUTE_MONITORING_HOLDER_KEY);
 
-                    VisorComputeMonitoringHolder holderOld =
-                        storage.putIfAbsent(COMPUTE_MONITORING_HOLDER_KEY, holderNew);
+            if (holder == null) {
+                VisorComputeMonitoringHolder holderNew = new VisorComputeMonitoringHolder();
 
-                    holder = holderOld == null ? holderNew : holderOld;
-                }
+                VisorComputeMonitoringHolder holderOld =
+                    storage.putIfAbsent(COMPUTE_MONITORING_HOLDER_KEY, holderNew);
 
-                String visorKey = arg.get1();
+                holder = holderOld == null ? holderNew : holderOld;
+            }
 
-                boolean state = arg.get2();
+            String visorKey = arg.getVisorKey();
 
-                // Set task monitoring state.
-                if (state)
-                    holder.startCollect(ignite, visorKey);
-                else
-                    holder.stopCollect(ignite, visorKey);
+            boolean state = arg.isEnabled();
 
-                // Return actual state. It could stay the same if events explicitly enabled in configuration.
-                return ignite.allEventsUserRecordable(VISOR_TASK_EVTS);
-            }
+            // Set task monitoring state.
+            if (state)
+                holder.startCollect(ignite, visorKey);
+            else
+                holder.stopCollect(ignite, visorKey);
+
+            // Return actual state. It could stay the same if events explicitly enabled in configuration.
+            return ignite.allEventsUserRecordable(VISOR_TASK_EVTS);
         }
 
         /** {@inheritDoc} */
@@ -111,4 +109,4 @@ public class VisorComputeToggleMonitoringTask extends
             return S.toString(VisorComputeToggleMonitoringJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java
new file mode 100644
index 0000000..e17379a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorComputeToggleMonitoringTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * 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.internal.visor.compute;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Toggle compute monitoring arguments.
+ */
+public class VisorComputeToggleMonitoringTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Visor monitoring id */
+    private String visorKey;
+
+    /** Enable state of compute monitoring */
+    private boolean enabled;
+
+    /**
+     * Default constructor.
+     */
+    public VisorComputeToggleMonitoringTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param visorKey Visor monitoring id.
+     * @param enabled Enable state of compute monitoring.
+     */
+    public VisorComputeToggleMonitoringTaskArg(String visorKey, boolean enabled) {
+        this.visorKey = visorKey;
+        this.enabled = enabled;
+    }
+
+    /**
+     * @return Visor monitoring id.
+     */
+    public String getVisorKey() {
+        return visorKey;
+    }
+
+    /**
+     * @return Enable state of compute monitoring.
+     */
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, visorKey);
+        out.writeBoolean(enabled);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        visorKey = U.readString(in);
+        enabled = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorComputeToggleMonitoringTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
index 1113ca1..22cd460 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
@@ -277,7 +277,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
                 byte[] res = new byte[els.length];
 
                 for (int i = 0; i < els.length; i ++)
-                    res[i] =  Byte.valueOf(els[i]);
+                    res[i] = Byte.valueOf(els[i]);
 
                 return res;
             }
@@ -348,7 +348,7 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
                 }
             }
 
-            final Collection<UUID> nids;
+            final List<UUID> nids;
 
             if (nidsArg == null || "null".equals(nidsArg) || nidsArg.isEmpty()) {
                 Collection<ClusterNode> nodes = ignite.cluster().nodes();

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java
index 68cfdb3..9c6aa60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTask.java
@@ -24,13 +24,12 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 
 /**
  * Creates thread dump.
  */
 @GridInternal
-public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<VisorThreadInfo[], long[]>> {
+public class VisorThreadDumpTask extends VisorOneNodeTask<Void, VisorThreadDumpTaskResult> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -42,7 +41,7 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
     /**
      * Job that take thread dump on node.
      */
-    private static class VisorDumpThreadJob extends VisorJob<Void, IgniteBiTuple<VisorThreadInfo[], long[]>> {
+    private static class VisorDumpThreadJob extends VisorJob<Void, VisorThreadDumpTaskResult> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -55,7 +54,7 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
         }
 
         /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<VisorThreadInfo[], long[]> run(Void arg) {
+        @Override protected VisorThreadDumpTaskResult run(Void arg) {
             ThreadMXBean mx = U.getThreadMx();
 
             ThreadInfo[] info = mx.dumpAllThreads(true, true);
@@ -63,9 +62,9 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
             VisorThreadInfo[] visorInfo = new VisorThreadInfo[info.length];
 
             for (int i = 0; i < info.length; i++)
-                visorInfo[i] = VisorThreadInfo.from(info[i]);
+                visorInfo[i] = new VisorThreadInfo(info[i]);
 
-            return new IgniteBiTuple<>(visorInfo, mx.findDeadlockedThreads());
+            return new VisorThreadDumpTaskResult(visorInfo, mx.findDeadlockedThreads());
         }
 
         /** {@inheritDoc} */
@@ -73,4 +72,4 @@ public class VisorThreadDumpTask extends VisorOneNodeTask<Void, IgniteBiTuple<Vi
             return S.toString(VisorDumpThreadJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java
new file mode 100644
index 0000000..f6e0161
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadDumpTaskResult.java
@@ -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.
+ */
+
+package org.apache.ignite.internal.visor.debug;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.management.ThreadInfo;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for Visor {@link ThreadInfo}.
+ */
+public class VisorThreadDumpTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** List of information about threads. */
+    private VisorThreadInfo[] threadInfo;
+
+    /** List of deadlocked thread ids. */
+    private long[] deadlockedThreads;
+
+    /**
+     * Default constructor.
+     */
+    public VisorThreadDumpTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given thread info.
+     *
+     * @param threadInfo Thread info.
+     * @param deadlockedThreads Thread info.
+     */
+    public VisorThreadDumpTaskResult(VisorThreadInfo[] threadInfo, long[] deadlockedThreads) {
+        this.threadInfo = threadInfo;
+        this.deadlockedThreads = deadlockedThreads;
+    }
+
+    /**
+     * @return List of information about threads.
+     */
+    public VisorThreadInfo[] getThreadInfo() {
+        return threadInfo;
+    }
+
+    /**
+     * @return List of deadlocked thread ids.
+     */
+    public long[] getDeadlockedThreads() {
+        return deadlockedThreads;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeObject(threadInfo);
+        out.writeObject(deadlockedThreads);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        threadInfo = (VisorThreadInfo[])in.readObject();
+        deadlockedThreads = (long[])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorThreadDumpTaskResult.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
index d656ad1..3db4074 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadInfo.java
@@ -17,14 +17,21 @@
 
 package org.apache.ignite.internal.visor.debug;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.lang.management.ThreadInfo;
-import org.apache.ignite.internal.LessNamingBean;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for Visor {@link ThreadInfo}.
  */
-public class VisorThreadInfo implements Serializable, LessNamingBean {
+public class VisorThreadInfo extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -32,241 +39,260 @@ public class VisorThreadInfo implements Serializable, LessNamingBean {
     private static final int MAX_FRAMES = 8;
 
     /** Thread name. */
-    private final String name;
+    private String name;
 
     /** Thread ID. */
-    private final Long id;
+    private Long id;
 
     /** Thread state. */
-    private final Thread.State state;
+    private Thread.State state;
 
     /** Lock information. */
-    private final VisorThreadLockInfo lock;
+    private VisorThreadLockInfo lock;
 
     /** Lock name. */
-    private final String lockName;
+    private String lockName;
 
     /** Lock owner thread ID. */
-    private final Long lockOwnerId;
+    private Long lockOwnerId;
 
     /** Lock owner name. */
-    private final String lockOwnerName;
+    private String lockOwnerName;
 
     /** Thread executing native code. */
-    private final Boolean inNative;
+    private Boolean inNative;
 
     /** Thread is suspended. */
-    private final Boolean suspended;
+    private Boolean suspended;
 
     /** Waited count. */
-    private final Long waitedCnt;
+    private Long waitedCnt;
 
     /** Waited time. */
-    private final Long waitedTime;
+    private Long waitedTime;
 
     /** Blocked count. */
-    private final Long blockedCnt;
+    private Long blockedCnt;
 
     /** Blocked time. */
-    private final Long blockedTime;
+    private Long blockedTime;
 
     /** Stack trace. */
-    private final StackTraceElement[] stackTrace;
+    private List<StackTraceElement> stackTrace;
 
     /** Locks info. */
-    private final VisorThreadLockInfo[] locks;
+    private List<VisorThreadLockInfo> locks;
 
     /** Locked monitors. */
-    private final VisorThreadMonitorInfo[] lockedMonitors;
-
-    /** Create thread info with given parameters. */
-    public VisorThreadInfo(String name,
-        Long id,
-        Thread.State state,
-        VisorThreadLockInfo lock,
-        String lockName,
-        Long lockOwnerId,
-        String lockOwnerName,
-        Boolean inNative,
-        Boolean suspended,
-        Long waitedCnt,
-        Long waitedTime,
-        Long blockedCnt,
-        Long blockedTime,
-        StackTraceElement[] stackTrace,
-        VisorThreadLockInfo[] locks,
-        VisorThreadMonitorInfo[] lockedMonitors
-    ) {
-        this.name = name;
-        this.id = id;
-        this.state = state;
-        this.lock = lock;
-        this.lockName = lockName;
-        this.lockOwnerId = lockOwnerId;
-        this.lockOwnerName = lockOwnerName;
-        this.inNative = inNative;
-        this.suspended = suspended;
-        this.waitedCnt = waitedCnt;
-        this.waitedTime = waitedTime;
-        this.blockedCnt = blockedCnt;
-        this.blockedTime = blockedTime;
-        this.stackTrace = stackTrace;
-        this.locks = locks;
-        this.lockedMonitors = lockedMonitors;
+    private List<VisorThreadMonitorInfo> lockedMonitors;
+
+    /**
+     * Default constructor.
+     */
+    public VisorThreadInfo() {
+        // No-op.
     }
 
-    /** Create data transfer object for given thread info. */
-    public static VisorThreadInfo from(ThreadInfo ti) {
+    /**
+     * Create data transfer object for given thread info.
+     *
+     * @param ti Thread info.
+     */
+    public VisorThreadInfo(ThreadInfo ti) {
         assert ti != null;
 
-        VisorThreadLockInfo[] linfos = ti.getLockedSynchronizers() != null ?
-            new VisorThreadLockInfo[ti.getLockedSynchronizers().length] : null;
+        name = ti.getThreadName();
+        id = ti.getThreadId();
+        state = ti.getThreadState();
+        lock = ti.getLockInfo() != null ? new VisorThreadLockInfo(ti.getLockInfo()) : null;
+        lockName =ti.getLockName();
+        lockOwnerId = ti.getLockOwnerId();
+        lockOwnerName = ti.getLockOwnerName();
+        inNative = ti.isInNative();
+        suspended = ti.isSuspended();
+        waitedCnt = ti.getWaitedCount();
+        waitedTime = ti.getWaitedTime();
+        blockedCnt = ti.getBlockedCount();
+        blockedTime = ti.getBlockedTime();
+        stackTrace = Arrays.asList(ti.getStackTrace());
+
+        locks = ti.getLockedSynchronizers() != null ?
+            new ArrayList<VisorThreadLockInfo>(ti.getLockedSynchronizers().length) : null;
 
         if (ti.getLockedSynchronizers() != null)
             for (int i = 0; i < ti.getLockedSynchronizers().length; i++)
-                linfos[i] = VisorThreadLockInfo.from(ti.getLockedSynchronizers()[i]);
+                locks.add(new VisorThreadLockInfo(ti.getLockedSynchronizers()[i]));
 
-        VisorThreadMonitorInfo[] minfos = ti.getLockedMonitors() != null ?
-            new VisorThreadMonitorInfo[ti.getLockedMonitors().length] : null;
+        lockedMonitors = ti.getLockedMonitors() != null ?
+            new ArrayList<VisorThreadMonitorInfo>(ti.getLockedMonitors().length) : null;
 
         if (ti.getLockedMonitors() != null)
             for (int i = 0; i < ti.getLockedMonitors().length; i++)
-                minfos[i] = VisorThreadMonitorInfo.from(ti.getLockedMonitors()[i]);
-
-        return new VisorThreadInfo(ti.getThreadName(),
-            ti.getThreadId(),
-            ti.getThreadState(),
-            ti.getLockInfo() != null ? VisorThreadLockInfo.from(ti.getLockInfo()) : null,
-            ti.getLockName(),
-            ti.getLockOwnerId(),
-            ti.getLockOwnerName(),
-            ti.isInNative(),
-            ti.isSuspended(),
-            ti.getWaitedCount(),
-            ti.getWaitedTime(),
-            ti.getBlockedCount(),
-            ti.getBlockedTime(),
-            ti.getStackTrace(),
-            linfos,
-            minfos
-        );
+                lockedMonitors.add(new VisorThreadMonitorInfo(ti.getLockedMonitors()[i]));
     }
 
     /**
      * @return Thread name.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
     /**
      * @return Thread ID.
      */
-    public Long id() {
+    public Long getId() {
         return id;
     }
 
     /**
      * @return Thread state.
      */
-    public Thread.State state() {
+    public Thread.State getState() {
         return state;
     }
 
     /**
      * @return Lock information.
      */
-    public VisorThreadLockInfo lock() {
+    public VisorThreadLockInfo getLock() {
         return lock;
     }
 
     /**
      * @return Lock name.
      */
-    public String lockName() {
+    public String getLockName() {
         return lockName;
     }
 
     /**
      * @return Lock owner thread ID.
      */
-    public Long lockOwnerId() {
+    public Long getLockOwnerId() {
         return lockOwnerId;
     }
 
     /**
      * @return Lock owner name.
      */
-    public String lockOwnerName() {
+    public String getLockOwnerName() {
         return lockOwnerName;
     }
 
     /**
      * @return Thread executing native code.
      */
-    public Boolean inNative() {
+    public Boolean isInNative() {
         return inNative;
     }
 
     /**
      * @return Thread is suspended.
      */
-    public Boolean suspended() {
+    public Boolean isSuspended() {
         return suspended;
     }
 
     /**
      * @return Waited count.
      */
-    public Long waitedCount() {
+    public Long getWaitedCount() {
         return waitedCnt;
     }
 
     /**
      * @return Waited time.
      */
-    public Long waitedTime() {
+    public Long getWaitedTime() {
         return waitedTime;
     }
 
     /**
      * @return Blocked count.
      */
-    public Long blockedCount() {
+    public Long getBlockedCount() {
         return blockedCnt;
     }
 
     /**
      * @return Blocked time.
      */
-    public Long blockedTime() {
+    public Long getBlockedTime() {
         return blockedTime;
     }
 
     /**
      * @return Stack trace.
      */
-    public StackTraceElement[] stackTrace() {
+    public List<StackTraceElement> getStackTrace() {
         return stackTrace;
     }
 
     /**
      * @return Locks info.
      */
-    public VisorThreadLockInfo[] locks() {
+    public List<VisorThreadLockInfo> getLocks() {
         return locks;
     }
 
     /**
      * @return Locked monitors.
      */
-    public VisorThreadMonitorInfo[] lockedMonitors() {
+    public List<VisorThreadMonitorInfo> getLockedMonitors() {
         return lockedMonitors;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        out.writeObject(id);
+        U.writeString(out, state.toString());
+        out.writeObject(lock);
+        U.writeString(out, lockName);
+        out.writeObject(lockOwnerId);
+        U.writeString(out, lockOwnerName);
+        out.writeObject(inNative);
+        out.writeObject(suspended);
+        out.writeObject(waitedCnt);
+        out.writeObject(waitedTime);
+        out.writeObject(blockedCnt);
+        out.writeObject(blockedTime);
+        U.writeCollection(out, stackTrace);
+        U.writeCollection(out, locks);
+        U.writeCollection(out, lockedMonitors);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        id = (Long)in.readObject();
+
+        String statePresentation = U.readString(in);
+
+        if (statePresentation != null)
+            state = Enum.valueOf(Thread.State.class, statePresentation);
+
+        lock = (VisorThreadLockInfo)in.readObject();
+        lockName = U.readString(in);
+        lockOwnerId = (Long)in.readObject();
+        lockOwnerName = U.readString(in);
+        inNative = (Boolean)in.readObject();
+        suspended = (Boolean)in.readObject();
+        waitedCnt = (Long)in.readObject();
+        waitedTime = (Long)in.readObject();
+        blockedCnt = (Long)in.readObject();
+        blockedTime = (Long)in.readObject();
+        stackTrace = U.readList(in);
+        locks = U.readList(in);
+        lockedMonitors = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
-        StringBuilder sb = new StringBuilder("\"" + name + "\"" + " Id=" + id + " " + state);
+        StringBuilder sb = new StringBuilder(512);
+
+        sb.append('"').append(name).append('"').append(" Id=").append(id).append(' ').append(state);
 
         if (lockName != null)
             sb.append(" on ").append(lockName);
@@ -282,12 +308,12 @@ public class VisorThreadInfo implements Serializable, LessNamingBean {
 
         sb.append('\n');
 
-        int maxFrames = Math.min(stackTrace.length, MAX_FRAMES);
+        int maxFrames = Math.min(stackTrace.size(), MAX_FRAMES);
 
         for (int i = 0; i < maxFrames; i++) {
-            StackTraceElement ste = stackTrace[i];
+            StackTraceElement ste = stackTrace.get(i);
 
-            sb.append("\tat ").append(ste.toString()).append('\n');
+            sb.append("\tat ").append(ste).append('\n');
 
             if (i == 0 && lock != null) {
                 switch (state) {
@@ -308,16 +334,16 @@ public class VisorThreadInfo implements Serializable, LessNamingBean {
             }
 
             for (VisorThreadMonitorInfo mi : lockedMonitors) {
-                if (mi.stackDepth() == i)
+                if (mi.getStackDepth() == i)
                     sb.append("\t-  locked ").append(mi).append('\n');
             }
         }
 
-        if (maxFrames < stackTrace.length)
+        if (maxFrames < stackTrace.size())
             sb.append("\t...").append('\n');
 
-        if (locks.length > 0) {
-            sb.append("\n\tNumber of locked synchronizers = ").append(locks.length).append('\n');
+        if (!F.isEmpty(locks)) {
+            sb.append("\n\tNumber of locked synchronizers = ").append(locks.size()).append('\n');
 
             for (VisorThreadLockInfo li : locks)
                 sb.append("\t- ").append(li).append('\n');

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
index 0fdd95f..4aab0e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadLockInfo.java
@@ -17,57 +17,76 @@
 
 package org.apache.ignite.internal.visor.debug;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.lang.management.LockInfo;
-import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for {@link LockInfo}.
  */
-public class VisorThreadLockInfo implements Serializable, LessNamingBean {
+public class VisorThreadLockInfo extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /**
      * Fully qualified name of the class of the lock object.
      */
-    protected final String clsName;
+    protected String clsName;
 
     /**
      * Identity hash code of the lock object.
      */
-    protected final Integer identityHashCode;
+    protected Integer identityHashCode;
 
-    /** Create thread lock info with given parameters. */
-    public VisorThreadLockInfo(String clsName, Integer identityHashCode) {
-        assert clsName != null;
-
-        this.clsName = clsName;
-        this.identityHashCode = identityHashCode;
+    /**
+     * Default constructor.
+     */
+    public VisorThreadLockInfo() {
+        // No-op.
     }
 
-    /** Create data transfer object for given lock info. */
-    public static VisorThreadLockInfo from(LockInfo li) {
+    /**
+     * Create data transfer object for given lock info.
+     *
+     * @param li Lock info.
+     */
+    public VisorThreadLockInfo(LockInfo li) {
         assert li != null;
 
-        return new VisorThreadLockInfo(li.getClassName(), li.getIdentityHashCode());
+        clsName = li.getClassName();
+        identityHashCode = li.getIdentityHashCode();
     }
 
     /**
      * @return Fully qualified name of the class of the lock object.
      */
-    public String className() {
+    public String getClassName() {
         return clsName;
     }
 
     /**
      * @return Identity hash code of the lock object.
      */
-    public Integer identityHashCode() {
+    public Integer getIdentityHashCode() {
         return identityHashCode;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, clsName);
+        out.writeObject(identityHashCode);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        clsName = U.readString(in);
+        identityHashCode = (Integer)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return clsName + '@' + Integer.toHexString(identityHashCode);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
index cc68665..11e1141 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/debug/VisorThreadMonitorInfo.java
@@ -17,7 +17,13 @@
 
 package org.apache.ignite.internal.visor.debug;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.lang.management.MonitorInfo;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectInput;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput;
 
 /**
  * Data transfer object for {@link MonitorInfo}.
@@ -27,46 +33,72 @@ public class VisorThreadMonitorInfo extends VisorThreadLockInfo {
     private static final long serialVersionUID = 0L;
 
     /** Stack depth. */
-    private final Integer stackDepth;
+    private Integer stackDepth;
 
     /** Stack frame. */
-    private final StackTraceElement stackFrame;
+    private StackTraceElement stackFrame;
 
     /**
-     * Create thread monitor info with given parameters.
-     *
-     * @param clsName Fully qualified name of the class of the lock object.
-     * @param identityHashCode Identity hash code of the lock object.
-     * @param stackDepth Depth in the stack trace where the object monitor was locked.
-     * @param stackFrame Stack frame that locked the object monitor.
+     * Default constructor.
      */
-    public VisorThreadMonitorInfo(String clsName, Integer identityHashCode, Integer stackDepth,
-        StackTraceElement stackFrame) {
-        super(clsName, identityHashCode);
-
-        this.stackDepth = stackDepth;
-        this.stackFrame = stackFrame;
+    public VisorThreadMonitorInfo() {
+        // No-op.
     }
 
-    /** Create data transfer object for given monitor info. */
-    public static VisorThreadMonitorInfo from(MonitorInfo mi) {
-        assert mi != null;
+    /**
+     * Create data transfer object for given monitor info.
+     *
+     * @param mi Monitoring info.
+     */
+    public VisorThreadMonitorInfo(MonitorInfo mi) {
+        super(mi);
 
-        return new VisorThreadMonitorInfo(mi.getClassName(), mi.getIdentityHashCode(), mi.getLockedStackDepth(),
-            mi.getLockedStackFrame());
+        stackDepth = mi.getLockedStackDepth();
+        stackFrame = mi.getLockedStackFrame();
     }
 
     /**
      * @return Stack depth.
      */
-    public Integer stackDepth() {
+    public Integer getStackDepth() {
         return stackDepth;
     }
 
     /**
      * @return Stack frame.
      */
-    public StackTraceElement stackFrame() {
+    public StackTraceElement getStackFrame() {
         return stackFrame;
     }
-}
\ No newline at end of file
+
+    /** {@inheritDoc} */
+    @Override public byte getProtocolVersion() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+            dtout.writeByte(super.getProtocolVersion());
+            super.writeExternalData(dtout);
+        }
+
+        out.writeObject(stackDepth);
+        out.writeObject(stackFrame);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+            super.readExternalData(dtin.readByte(), dtin);
+        }
+
+        stackDepth = (Integer)in.readObject();
+        stackFrame = (StackTraceElement)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorThreadMonitorInfo.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java
index 0eefa6b..1d41e19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDeploymentEvent.java
@@ -17,8 +17,14 @@
 
 package org.apache.ignite.internal.visor.event;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.UUID;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectInput;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
@@ -30,7 +36,14 @@ public class VisorGridDeploymentEvent extends VisorGridEvent {
     private static final long serialVersionUID = 0L;
 
     /** Deployment alias. */
-    private final String alias;
+    private String alias;
+
+    /**
+     * Default constructor.
+     */
+    public VisorGridDeploymentEvent() {
+        // No-op.
+    }
 
     /**
      * Create event with given parameters.
@@ -62,12 +75,36 @@ public class VisorGridDeploymentEvent extends VisorGridEvent {
     /**
      * @return Deployment alias.
      */
-    public String alias() {
+    public String getAlias() {
         return alias;
     }
 
     /** {@inheritDoc} */
+    @Override public byte getProtocolVersion() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+            dtout.writeByte(super.getProtocolVersion());
+            super.writeExternalData(dtout);
+        }
+
+        U.writeString(out, alias);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+            super.readExternalData(dtin.readByte(), dtin);
+        }
+
+        alias = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorGridDeploymentEvent.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
index bad6966..b4afed9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridDiscoveryEvent.java
@@ -17,8 +17,14 @@
 
 package org.apache.ignite.internal.visor.event;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.UUID;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectInput;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
@@ -30,16 +36,23 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
     private static final long serialVersionUID = 0L;
 
     /** Node that caused this event to be generated. */
-    private final UUID evtNodeId;
+    private UUID evtNodeId;
 
     /** Node address that caused this event to be generated. */
-    private final String addr;
+    private String addr;
 
     /** If node that caused this event is daemon. */
-    private final boolean isDaemon;
+    private boolean isDaemon;
 
     /** Topology version. */
-    private final long topVer;
+    private long topVer;
+
+    /**
+     * Default constructor.
+     */
+    public VisorGridDiscoveryEvent() {
+        // No-op.
+    }
 
     /**
      * Create event with given parameters.
@@ -78,16 +91,16 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
     }
 
     /**
-     * @return Deployment alias.
+     * @return Event node ID.
      */
-    public UUID evtNodeId() {
+    public UUID getEventNodeId() {
         return evtNodeId;
     }
 
     /**
      * @return Node address that caused this event to be generated.
      */
-    public String address() {
+    public String getAddress() {
         return addr;
     }
 
@@ -102,11 +115,41 @@ public class VisorGridDiscoveryEvent extends VisorGridEvent {
      * @return Topology version or {@code 0} if configured discovery SPI implementation
      *      does not support versioning.
      **/
-    public long topologyVersion() {
+    public long getTopologyVersion() {
         return topVer;
     }
 
     /** {@inheritDoc} */
+    @Override public byte getProtocolVersion() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+            dtout.writeByte(super.getProtocolVersion());
+            super.writeExternalData(dtout);
+        }
+
+        U.writeUuid(out, evtNodeId);
+        U.writeString(out, addr);
+        out.writeBoolean(isDaemon);
+        out.writeLong(topVer);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+            super.readExternalData(dtin.readByte(), dtin);
+        }
+
+        evtNodeId = U.readUuid(in);
+        addr = U.readString(in);
+        isDaemon = in.readBoolean();
+        topVer = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorGridDiscoveryEvent.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
index b24e860..4814aba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEvent.java
@@ -17,40 +17,50 @@
 
 package org.apache.ignite.internal.visor.event;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.UUID;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Base class for lightweight counterpart for various {@link org.apache.ignite.events.Event}.
  */
-public class VisorGridEvent implements Serializable, LessNamingBean {
+public class VisorGridEvent extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Event type. */
-    private final int typeId;
+    private int typeId;
 
     /** Globally unique ID of this event. */
-    private final IgniteUuid id;
+    private IgniteUuid id;
 
     /** Name of this event. */
-    private final String name;
+    private String name;
 
     /** Node Id where event occurred and was recorded. */
-    private final UUID nid;
+    private UUID nid;
 
     /** Event timestamp. */
-    private final long ts;
+    private long ts;
 
     /** Event message. */
-    private final String msg;
+    private String msg;
 
     /** Shortened version of {@code toString()} result. Suitable for humans to read. */
-    private final String shortDisplay;
+    private String shortDisplay;
+
+    /**
+     * Default constructor.
+     */
+    public VisorGridEvent() {
+        // No-op.
+    }
 
     /**
      * Create event with given parameters.
@@ -77,53 +87,75 @@ public class VisorGridEvent implements Serializable, LessNamingBean {
     /**
      * @return Event type.
      */
-    public int typeId() {
+    public int getTypeId() {
         return typeId;
     }
 
     /**
      * @return Globally unique ID of this event.
      */
-    public IgniteUuid id() {
+    public IgniteUuid getId() {
         return id;
     }
 
     /**
      * @return Name of this event.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
     /**
      * @return Node Id where event occurred and was recorded.
      */
-    public UUID nid() {
+    public UUID getNid() {
         return nid;
     }
 
     /**
      * @return Event timestamp.
      */
-    public long timestamp() {
+    public long getTimestamp() {
         return ts;
     }
 
     /**
      * @return Event message.
      */
-    @Nullable public String message() {
+    @Nullable public String getMessage() {
         return msg;
     }
 
     /**
      * @return Shortened version of  result. Suitable for humans to read.
      */
-    public String shortDisplay() {
+    public String getShortDisplay() {
         return shortDisplay;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeInt(typeId);
+        U.writeGridUuid(out, id);
+        U.writeString(out, name);
+        U.writeUuid(out, nid);
+        out.writeLong(ts);
+        U.writeString(out, msg);
+        U.writeString(out, shortDisplay);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        typeId = in.readInt();
+        id = U.readGridUuid(in);
+        name = U.readString(in);
+        nid = U.readUuid(in);
+        ts = in.readLong();
+        msg = U.readString(in);
+        shortDisplay = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorGridEvent.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java
index 92f149a..e07a3a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridEventsLost.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.visor.event;
 
 import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
 
@@ -29,6 +30,13 @@ public class VisorGridEventsLost extends VisorGridEvent {
     private static final long serialVersionUID = 0L;
 
     /**
+     * Default constructor.
+     */
+    public VisorGridEventsLost() {
+        // No-op.
+    }
+
+    /**
      * Create event with given parameters.
      *
      * @param nid Node where events were lost.
@@ -38,4 +46,9 @@ public class VisorGridEventsLost extends VisorGridEvent {
             "Some Visor events were lost and Visor may show inconsistent results. " +
             "Configure your grid to disable not important events.", "");
     }
-}
\ No newline at end of file
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorGridEventsLost.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java
index a1a0c04..2e4c627 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridJobEvent.java
@@ -17,8 +17,14 @@
 
 package org.apache.ignite.internal.visor.event;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.UUID;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectInput;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
@@ -30,16 +36,23 @@ public class VisorGridJobEvent extends VisorGridEvent {
     private static final long serialVersionUID = 0L;
 
     /** Name of the task that triggered the event. */
-    private final String taskName;
+    private String taskName;
 
     /** Name of task class that triggered the event. */
-    private final String taskClsName;
+    private String taskClsName;
 
     /** Task session ID of the task that triggered the event. */
-    private final IgniteUuid taskSesId;
+    private IgniteUuid taskSesId;
 
     /** Job ID. */
-    private final IgniteUuid jobId;
+    private IgniteUuid jobId;
+
+    /**
+     * Default constructor.
+     */
+    public VisorGridJobEvent() {
+        // No-op.
+    }
 
     /**
      * Create event with given parameters.
@@ -80,33 +93,63 @@ public class VisorGridJobEvent extends VisorGridEvent {
     /**
      * @return Name of the task that triggered the event.
      */
-    public String taskName() {
+    public String getTaskName() {
         return taskName;
     }
 
     /**
      * @return Name of task class that triggered the event.
      */
-    public String taskClassName() {
+    public String getTaskClassName() {
         return taskClsName;
     }
 
     /**
      * @return Task session ID of the task that triggered the event.
      */
-    public IgniteUuid taskSessionId() {
+    public IgniteUuid getTaskSessionId() {
         return taskSesId;
     }
 
     /**
      * @return Job ID.
      */
-    public IgniteUuid jobId() {
+    public IgniteUuid getJobId() {
         return jobId;
     }
 
     /** {@inheritDoc} */
+    @Override public byte getProtocolVersion() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+            dtout.writeByte(super.getProtocolVersion());
+            super.writeExternalData(dtout);
+        }
+
+        U.writeString(out, taskName);
+        U.writeString(out, taskClsName);
+        U.writeGridUuid(out, taskSesId);
+        U.writeGridUuid(out, jobId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+            super.readExternalData(dtin.readByte(), dtin);
+        }
+
+        taskName = U.readString(in);
+        taskClsName = U.readString(in);
+        taskSesId = U.readGridUuid(in);
+        jobId = U.readGridUuid(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorGridJobEvent.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java
index 255d559..0f3eee4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/event/VisorGridTaskEvent.java
@@ -17,8 +17,14 @@
 
 package org.apache.ignite.internal.visor.event;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.UUID;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectInput;
+import org.apache.ignite.internal.visor.VisorDataTransferObjectOutput;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
 
@@ -30,16 +36,23 @@ public class VisorGridTaskEvent extends VisorGridEvent {
     private static final long serialVersionUID = 0L;
 
     /** Name of the task that triggered the event. */
-    private final String taskName;
+    private String taskName;
 
     /** Name of task class that triggered the event. */
-    private final String taskClsName;
+    private String taskClsName;
 
     /** Task session ID. */
-    private final IgniteUuid taskSesId;
+    private IgniteUuid taskSesId;
 
     /** Whether task was created for system needs. */
-    private final boolean internal;
+    private boolean internal;
+
+    /**
+     * Default constructor.
+     */
+    public VisorGridTaskEvent() {
+        // No-op.
+    }
 
     /**
      * Create event with given parameters.
@@ -80,33 +93,63 @@ public class VisorGridTaskEvent extends VisorGridEvent {
     /**
      * @return Name of the task that triggered the event.
      */
-    public String taskName() {
+    public String getTaskName() {
         return taskName;
     }
 
     /**
      * @return Name of task class that triggered the event.
      */
-    public String taskClassName() {
+    public String getTaskClassName() {
         return taskClsName;
     }
 
     /**
      * @return Task session ID.
      */
-    public IgniteUuid taskSessionId() {
+    public IgniteUuid getTaskSessionId() {
         return taskSesId;
     }
 
     /**
      * @return Whether task was created for system needs.
      */
-    public boolean internal() {
+    public boolean isInternal() {
         return internal;
     }
 
     /** {@inheritDoc} */
+    @Override public byte getProtocolVersion() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        try (VisorDataTransferObjectOutput dtout = new VisorDataTransferObjectOutput(out)) {
+            dtout.writeByte(super.getProtocolVersion());
+            super.writeExternalData(dtout);
+        }
+
+        U.writeString(out, taskName);
+        U.writeString(out, taskClsName);
+        U.writeGridUuid(out, taskSesId);
+        out.writeBoolean(internal);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        try (VisorDataTransferObjectInput dtin = new VisorDataTransferObjectInput(in)) {
+            super.readExternalData(dtin.readByte(), dtin);
+        }
+
+        taskName = U.readString(in);
+        taskClsName = U.readString(in);
+        taskSesId = U.readGridUuid(in);
+        internal = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorGridTaskEvent.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
index dba7037..23540b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlock.java
@@ -17,34 +17,44 @@
 
 package org.apache.ignite.internal.visor.file;
 
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Represents block of bytes from a file, could be optionally zipped.
  */
-public class VisorFileBlock implements Serializable, LessNamingBean {
+public class VisorFileBlock extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** File path. */
-    private final String path;
+    private String path;
 
     /** Marker position. */
-    private final long off;
+    private long off;
 
     /** File size. */
-    private final long size;
+    private long size;
 
     /** Timestamp of last modification of the file. */
-    private final long lastModified;
+    private long lastModified;
 
     /** Whether data was zipped. */
-    private final boolean zipped;
+    private boolean zipped;
 
     /** Data bytes. */
-    private final byte[] data;
+    private byte[] data;
+
+    /**
+     * Default constructor.
+     */
+    public VisorFileBlock() {
+
+    }
 
     /**
      * Create file block with given parameters.
@@ -68,46 +78,66 @@ public class VisorFileBlock implements Serializable, LessNamingBean {
     /**
      * @return File path.
      */
-    public String path() {
+    public String getPath() {
         return path;
     }
 
     /**
      * @return Marker position.
      */
-    public long offset() {
+    public long getOffset() {
         return off;
     }
 
     /**
      * @return File size.
      */
-    public long size() {
+    public long getSize() {
         return size;
     }
 
     /**
      * @return Timestamp of last modification of the file.
      */
-    public long lastModified() {
+    public long getLastModified() {
         return lastModified;
     }
 
     /**
      * @return Whether data was zipped.
      */
-    public boolean zipped() {
+    public boolean isZipped() {
         return zipped;
     }
 
     /**
      * @return Data bytes.
      */
-    public byte[] data() {
+    public byte[] getData() {
         return data;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, path);
+        out.writeLong(off);
+        out.writeLong(size);
+        out.writeLong(lastModified);
+        out.writeBoolean(zipped);
+        U.writeByteArray(out, data);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        path = U.readString(in);
+        off = in.readLong();
+        size = in.readLong();
+        lastModified = in.readLong();
+        zipped = in.readBoolean();
+        data = U.readByteArray(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorFileBlock.class, this);
     }


[12/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
new file mode 100644
index 0000000..babb630
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockArg.java
@@ -0,0 +1,114 @@
+/*
+ * 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.internal.visor.file;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Arguments for {@link VisorFileBlockTask}
+ */
+public class VisorFileBlockArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Log file path. */
+    private String path;
+
+    /** Log file offset. */
+    private long off;
+
+    /** Block size. */
+    private int blockSz;
+
+    /** Log file last modified timestamp. */
+    private long lastModified;
+
+    /**
+     * Default constructor.
+     */
+    public VisorFileBlockArg() {
+        // No-op.
+    }
+
+    /**
+     * @param path Log file path.
+     * @param off Offset in file.
+     * @param blockSz Block size.
+     * @param lastModified Log file last modified timestamp.
+     */
+    public VisorFileBlockArg(String path, long off, int blockSz, long lastModified) {
+        this.path = path;
+        this.off = off;
+        this.blockSz = blockSz;
+        this.lastModified = lastModified;
+    }
+
+    /**
+     * @return Log file path.
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * @return Log file offset.
+     */
+    public long getOffset() {
+        return off;
+    }
+
+    /**
+     * @return Block size
+     */
+    public int getBlockSize() {
+        return blockSz;
+    }
+
+    /**
+     * @return Log file last modified timestamp.
+     */
+    public long getLastModified() {
+        return lastModified;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, path);
+        out.writeLong(off);
+        out.writeInt(blockSz);
+        out.writeLong(lastModified);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        path = U.readString(in);
+        off = in.readLong();
+        blockSz = in.readInt();
+        lastModified = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorFileBlockArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java
index 58a25ee..85a790b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorFileBlockTask.java
@@ -19,16 +19,15 @@ package org.apache.ignite.internal.visor.file;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.Serializable;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.file.NoSuchFileException;
 import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorEither;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.readBlock;
 
@@ -36,8 +35,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.readBlock;
  * Task to read file block.
  */
 @GridInternal
-public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.VisorFileBlockArg,
-    IgniteBiTuple<? extends IOException, VisorFileBlock>> {
+public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockArg, VisorEither<VisorFileBlock>> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -47,49 +45,10 @@ public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.Viso
     }
 
     /**
-     * Arguments for {@link VisorFileBlockTask}
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class VisorFileBlockArg implements Serializable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Log file path. */
-        private final String path;
-
-        /** Log file offset. */
-        private final long off;
-
-        /** Block size. */
-        private final int blockSz;
-
-        /** Log file last modified timestamp. */
-        private final long lastModified;
-
-        /**
-         * @param path Log file path.
-         * @param off Offset in file.
-         * @param blockSz Block size.
-         * @param lastModified Log file last modified timestamp.
-         */
-        public VisorFileBlockArg(String path, long off, int blockSz, long lastModified) {
-            this.path = path;
-            this.off = off;
-            this.blockSz = blockSz;
-            this.lastModified = lastModified;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorFileBlockArg.class, this);
-        }
-    }
-
-    /**
      * Job that read file block on node.
      */
     private static class VisorFileBlockJob
-        extends VisorJob<VisorFileBlockArg, IgniteBiTuple<? extends IOException, VisorFileBlock>> {
+        extends VisorJob<VisorFileBlockArg, VisorEither<VisorFileBlock>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -102,22 +61,23 @@ public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.Viso
         }
 
         /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<? extends IOException, VisorFileBlock> run(VisorFileBlockArg arg) {
+        @Override protected VisorEither<VisorFileBlock> run(VisorFileBlockArg arg) {
             try {
-                URL url = U.resolveIgniteUrl(arg.path);
+                URL url = U.resolveIgniteUrl(arg.getPath());
 
                 if (url == null)
-                    return new IgniteBiTuple<>(new NoSuchFileException("File path not found: " + arg.path), null);
+                    return new VisorEither<>(new NoSuchFileException("File path not found: " + arg.getPath()));
 
-                VisorFileBlock block = readBlock(new File(url.toURI()), arg.off, arg.blockSz, arg.lastModified);
+                VisorFileBlock block = readBlock(
+                    new File(url.toURI()), arg.getOffset(), arg.getBlockSize(), arg.getLastModified());
 
-                return new IgniteBiTuple<>(null, block);
+                return new VisorEither<>(block);
             }
             catch (IOException e) {
-                return new IgniteBiTuple<>(e, null);
+                return new VisorEither<>(e);
             }
             catch (URISyntaxException ignored) {
-                return new IgniteBiTuple<>(new NoSuchFileException("File path not found: " + arg.path), null);
+                return new VisorEither<>(new NoSuchFileException("File path not found: " + arg.getPath()));
             }
         }
 
@@ -126,4 +86,4 @@ public class VisorFileBlockTask extends VisorOneNodeTask<VisorFileBlockTask.Viso
             return S.toString(VisorFileBlockJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
index 55d358c..9ae0b26 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
@@ -28,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
 import org.apache.ignite.internal.visor.log.VisorLogFile;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.LOG_FILES_COUNT_LIMIT;
@@ -38,19 +37,19 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.matchedFiles;
  * Get list files matching filter.
  */
 @GridInternal
-public class VisorLatestTextFilesTask extends VisorOneNodeTask<IgniteBiTuple<String, String>, Collection<VisorLogFile>> {
+public class VisorLatestTextFilesTask extends VisorOneNodeTask<VisorLatestTextFilesTaskArg, Collection<VisorLogFile>> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Override protected VisorLatestTextFilesJob job(IgniteBiTuple<String, String> arg) {
+    @Override protected VisorLatestTextFilesJob job(VisorLatestTextFilesTaskArg arg) {
         return new VisorLatestTextFilesJob(arg, debug);
     }
 
     /**
      * Job that gets list of files.
      */
-    private static class VisorLatestTextFilesJob extends VisorJob<IgniteBiTuple<String, String>, Collection<VisorLogFile>> {
+    private static class VisorLatestTextFilesJob extends VisorJob<VisorLatestTextFilesTaskArg, Collection<VisorLogFile>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -58,14 +57,14 @@ public class VisorLatestTextFilesTask extends VisorOneNodeTask<IgniteBiTuple<Str
          * @param arg Folder and regexp.
          * @param debug Debug flag.
          */
-        private VisorLatestTextFilesJob(IgniteBiTuple<String, String> arg, boolean debug) {
+        private VisorLatestTextFilesJob(VisorLatestTextFilesTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override protected Collection<VisorLogFile> run(final IgniteBiTuple<String, String> arg) {
-            String path = arg.get1();
-            String regexp = arg.get2();
+        @Nullable @Override protected Collection<VisorLogFile> run(final VisorLatestTextFilesTaskArg arg) {
+            String path = arg.getPath();
+            String regexp = arg.getRegexp();
 
             assert path != null;
             assert regexp != null;
@@ -98,4 +97,4 @@ public class VisorLatestTextFilesTask extends VisorOneNodeTask<IgniteBiTuple<Str
             return S.toString(VisorLatestTextFilesJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java
new file mode 100644
index 0000000..d0bc99d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * 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.internal.visor.file;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Arguments for {@link VisorLatestTextFilesTask}
+ */
+public class VisorLatestTextFilesTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Folder path to search files. */
+    private String path;
+
+    /** Pattern to match file names. */
+    private String regexp;
+
+    /**
+     * Default constructor.
+     */
+    public VisorLatestTextFilesTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param path Folder path to search in files.
+     * @param regexp Pattern to match file names.
+     */
+    public VisorLatestTextFilesTaskArg(String path, String regexp) {
+        this.path = path;
+        this.regexp = regexp;
+    }
+
+    /**
+     * @return Folder path to search in files.
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * @return Pattern to match file names.
+     */
+    public String getRegexp() {
+        return regexp;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, path);
+        U.writeString(out, regexp);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        path = U.readString(in);
+        regexp = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorLatestTextFilesTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
index 7369663..683eb91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfs.java
@@ -17,45 +17,50 @@
 
 package org.apache.ignite.internal.visor.igfs;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.igfs.IgfsMode;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for {@link IgniteFileSystem}.
  */
-public class VisorIgfs implements Serializable, LessNamingBean {
+public class VisorIgfs extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** IGFS instance name. */
-    private final String name;
+    private String name;
 
     /** IGFS instance working mode. */
-    private final IgfsMode mode;
+    private IgfsMode mode;
 
     /** IGFS metrics. */
-    private final VisorIgfsMetrics metrics;
+    private VisorIgfsMetrics metrics;
 
     /** Whether IGFS has configured secondary file system. */
-    private final boolean secondaryFsConfigured;
+    private boolean secondaryFsConfigured;
 
     /**
-     * Create data transfer object.
+     * Default constructor.
+     */
+    public VisorIgfs() {
+        // No-op.
+    }
+
+    /**
+     * Create IGFS configuration transfer object.
      *
-     * @param name IGFS name.
-     * @param mode IGFS mode.
+     * @param name IGFS instance name.
+     * @param mode IGFS instance working mode.
      * @param metrics IGFS metrics.
      * @param secondaryFsConfigured Whether IGFS has configured secondary file system.
      */
-    public VisorIgfs(
-        String name,
-        IgfsMode mode,
-        VisorIgfsMetrics metrics,
-        boolean secondaryFsConfigured
-    ) {
+    public VisorIgfs(String name, IgfsMode mode, VisorIgfsMetrics metrics, boolean secondaryFsConfigured) {
         this.name = name;
         this.mode = mode;
         this.metrics = metrics;
@@ -63,49 +68,64 @@ public class VisorIgfs implements Serializable, LessNamingBean {
     }
 
     /**
+     * Create data transfer object.
+     *
      * @param igfs Source IGFS.
-     * @return Data transfer object for given IGFS.
      */
-    public static VisorIgfs from(IgniteFileSystem igfs) {
+    public VisorIgfs(IgniteFileSystem igfs) {
         assert igfs != null;
 
-        return new VisorIgfs(
-            igfs.name(),
-            igfs.configuration().getDefaultMode(),
-            VisorIgfsMetrics.from(igfs),
-            igfs.configuration().getSecondaryFileSystem() != null
-        );
+        name = igfs.name();
+        mode = igfs.configuration().getDefaultMode();
+        metrics = new VisorIgfsMetrics(igfs);
+        secondaryFsConfigured = igfs.configuration().getSecondaryFileSystem() != null;
     }
 
     /**
      * @return IGFS instance name.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
     /**
      * @return IGFS instance working mode.
      */
-    public IgfsMode mode() {
+    public IgfsMode getMode() {
         return mode;
     }
 
     /**
      * @return IGFS metrics.
      */
-    public VisorIgfsMetrics metrics() {
+    public VisorIgfsMetrics getMetrics() {
         return metrics;
     }
 
     /**
      * @return Whether IGFS has configured secondary file system.
      */
-    public boolean secondaryFileSystemConfigured() {
+    public boolean isSecondaryFileSystemConfigured() {
         return secondaryFsConfigured;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeEnum(out, mode);
+        out.writeObject(metrics);
+        out.writeBoolean(secondaryFsConfigured);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        mode = IgfsMode.fromOrdinal(in.readByte());
+        metrics = (VisorIgfsMetrics)in.readObject();
+        secondaryFsConfigured = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorIgfs.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
index 8ddd883..784b970 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsEndpoint.java
@@ -17,43 +17,51 @@
 
 package org.apache.ignite.internal.visor.igfs;
 
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * IGFS endpoint descriptor.
  */
-public class VisorIgfsEndpoint implements Serializable, LessNamingBean {
+public class VisorIgfsEndpoint extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** IGFS name. */
-    private final String igfsName;
+    private String igfsName;
 
-    /** Ignite instance name. */
-    private final String igniteInstanceName;
+    /** Grid name. */
+    private String gridName;
 
     /** Host address / name. */
-    private final String hostName;
+    private String hostName;
 
     /** Port number. */
-    private final int port;
+    private int port;
+
+    /**
+     * Default constructor.
+     */
+    public VisorIgfsEndpoint() {
+        // No-op.
+    }
 
     /**
      * Create IGFS endpoint descriptor with given parameters.
      *
      * @param igfsName IGFS name.
-     * @param igniteInstanceName Ignite instance name.
+     * @param gridName Grid name.
      * @param hostName Host address / name.
      * @param port Port number.
      */
-    public VisorIgfsEndpoint(
-        @Nullable String igfsName, String igniteInstanceName, @Nullable String hostName, int port
-    ) {
+    public VisorIgfsEndpoint(@Nullable String igfsName, String gridName, @Nullable String hostName, int port) {
         this.igfsName = igfsName;
-        this.igniteInstanceName = igniteInstanceName;
+        this.gridName = gridName;
         this.hostName = hostName;
         this.port = port;
     }
@@ -61,45 +69,61 @@ public class VisorIgfsEndpoint implements Serializable, LessNamingBean {
     /**
      * @return IGFS name.
      */
-    @Nullable public String igfsName() {
+    @Nullable public String getIgfsName() {
         return igfsName;
     }
 
     /**
-     * @return Ignite instance name.
+     * @return Grid name.
      */
-    public String igniteInstanceName() {
-        return igniteInstanceName;
+    public String getGridName() {
+        return gridName;
     }
 
     /**
      * @return Host address / name.
      */
-    @Nullable public String hostName() {
+    @Nullable public String getHostName() {
         return hostName;
     }
 
     /**
      * @return Port number.
      */
-    public int port() {
+    public int getPort() {
         return port;
     }
 
     /**
      * @return URI Authority
      */
-    public String authority() {
+    public String getAuthority() {
         String addr = hostName + ":" + port;
 
-        if (igfsName == null && igniteInstanceName == null)
+        if (igfsName == null && gridName == null)
             return addr;
         else if (igfsName == null)
-            return igniteInstanceName + "@" + addr;
-        else if (igniteInstanceName == null)
+            return gridName + "@" + addr;
+        else if (gridName == null)
             return igfsName + "@" + addr;
         else
-            return igfsName + ":" + igniteInstanceName + "@" + addr;
+            return igfsName + ":" + gridName + "@" + addr;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, igfsName);
+        U.writeString(out, gridName);
+        U.writeString(out, hostName);
+        out.writeInt(port);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        igfsName = U.readString(in);
+        gridName = U.readString(in);
+        hostName = U.readString(in);
+        port = in.readInt();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
index 58acee1..6ce5d80 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsMetrics.java
@@ -17,16 +17,18 @@
 
 package org.apache.ignite.internal.visor.igfs;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.igfs.IgfsMetrics;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for {@link IgfsMetrics}.
  */
-public class VisorIgfsMetrics implements Serializable, LessNamingBean {
+public class VisorIgfsMetrics extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -73,32 +75,36 @@ public class VisorIgfsMetrics implements Serializable, LessNamingBean {
     private long bytesWrtTm;
 
     /**
+     * Create data transfer object for given IGFS metrics.
+     */
+    public VisorIgfsMetrics() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given IGFS metrics.
+     *
      * @param igfs Source IGFS.
-     * @return Data transfer object for given IGFS metrics.
      */
-    public static VisorIgfsMetrics from(IgniteFileSystem igfs) {
+    public VisorIgfsMetrics(IgniteFileSystem igfs) {
         assert igfs != null;
 
         IgfsMetrics m = igfs.metrics();
 
-        VisorIgfsMetrics metrics = new VisorIgfsMetrics();
-
-        metrics.totalSpaceSz = igfs.configuration().getMaxSpaceSize();
-        metrics.usedSpaceSz = m.localSpaceSize();
-        metrics.foldersCnt = m.directoriesCount();
-        metrics.filesCnt = m.filesCount();
-        metrics.filesOpenedForRd = m.filesOpenedForRead();
-        metrics.filesOpenedForWrt = m.filesOpenedForWrite();
-        metrics.blocksRd = m.blocksReadTotal();
-        metrics.blocksRdRmt = m.blocksReadRemote();
-        metrics.blocksWrt = m.blocksWrittenTotal();
-        metrics.blocksWrtRmt = m.blocksWrittenRemote();
-        metrics.bytesRd = m.bytesRead();
-        metrics.bytesRdTm = m.bytesReadTime();
-        metrics.bytesWrt = m.bytesWritten();
-        metrics.bytesWrtTm = m.bytesWriteTime();
-
-        return metrics;
+        totalSpaceSz = igfs.configuration().getMaxSpaceSize();
+        usedSpaceSz = m.localSpaceSize();
+        foldersCnt = m.directoriesCount();
+        filesCnt = m.filesCount();
+        filesOpenedForRd = m.filesOpenedForRead();
+        filesOpenedForWrt = m.filesOpenedForWrite();
+        blocksRd = m.blocksReadTotal();
+        blocksRdRmt = m.blocksReadRemote();
+        blocksWrt = m.blocksWrittenTotal();
+        blocksWrtRmt = m.blocksWrittenRemote();
+        bytesRd = m.bytesRead();
+        bytesRdTm = m.bytesReadTime();
+        bytesWrt = m.bytesWritten();
+        bytesWrtTm = m.bytesWriteTime();
     }
 
     /**
@@ -146,109 +152,145 @@ public class VisorIgfsMetrics implements Serializable, LessNamingBean {
     /**
      * @return Maximum amount of data that can be stored on local node.
      */
-    public long totalSpaceSize() {
+    public long getTotalSpaceSize() {
         return totalSpaceSz;
     }
 
     /**
      * @return Local used space in bytes on local node.
      */
-    public long usedSpaceSize() {
+    public long getUsedSpaceSize() {
         return usedSpaceSz;
     }
 
     /**
      * @return Local free space in bytes on local node.
      */
-    public long freeSpaceSize() {
+    public long getFreeSpaceSize() {
         return totalSpaceSz - usedSpaceSz;
     }
 
     /**
      * @return Number of directories created in file system.
      */
-    public int foldersCount() {
+    public int getFoldersCount() {
         return foldersCnt;
     }
 
     /**
      * @return Number of files stored in file system.
      */
-    public int filesCount() {
+    public int getFilesCount() {
         return filesCnt;
     }
 
     /**
      * @return Number of files that are currently opened for reading on local node.
      */
-    public int filesOpenedForRead() {
+    public int getFilesOpenedForRead() {
         return filesOpenedForRd;
     }
 
     /**
      * @return Number of files that are currently opened for writing on local node.
      */
-    public int filesOpenedForWrite() {
+    public int getFilesOpenedForWrite() {
         return filesOpenedForWrt;
     }
 
     /**
      * @return Total blocks read, local and remote.
      */
-    public long blocksRead() {
+    public long getBlocksRead() {
         return blocksRd;
     }
 
     /**
      * @return Total remote blocks read.
      */
-    public long blocksReadRemote() {
+    public long getBlocksReadRemote() {
         return blocksRdRmt;
     }
 
     /**
      * @return Total blocks write, local and remote.
      */
-    public long blocksWritten() {
+    public long getBlocksWritten() {
         return blocksWrt;
     }
 
     /**
      * @return Total remote blocks write.
      */
-    public long blocksWrittenRemote() {
+    public long getBlocksWrittenRemote() {
         return blocksWrtRmt;
     }
 
     /**
      * @return Total bytes read.
      */
-    public long bytesRead() {
+    public long getBytesRead() {
         return bytesRd;
     }
 
     /**
      * @return Total bytes read time.
      */
-    public long bytesReadTime() {
+    public long getBytesReadTime() {
         return bytesRdTm;
     }
 
     /**
      * @return Total bytes write.
      */
-    public long bytesWritten() {
+    public long getBytesWritten() {
         return bytesWrt;
     }
 
     /**
      * @return Total bytes write time.
      */
-    public long bytesWriteTime() {
+    public long getBytesWriteTime() {
         return bytesWrtTm;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(totalSpaceSz);
+        out.writeLong(usedSpaceSz);
+        out.writeInt(foldersCnt);
+        out.writeInt(filesCnt);
+        out.writeInt(filesOpenedForRd);
+        out.writeInt(filesOpenedForWrt);
+        out.writeLong(blocksRd);
+        out.writeLong(blocksRdRmt);
+        out.writeLong(blocksWrt);
+        out.writeLong(blocksWrtRmt);
+        out.writeLong(bytesRd);
+        out.writeLong(bytesRdTm);
+        out.writeLong(bytesWrt);
+        out.writeLong(bytesWrtTm);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        totalSpaceSz = in.readLong();
+        usedSpaceSz = in.readLong();
+        foldersCnt = in.readInt();
+        filesCnt = in.readInt();
+        filesOpenedForRd = in.readInt();
+        filesOpenedForWrt = in.readInt();
+        blocksRd = in.readLong();
+        blocksRdRmt = in.readLong();
+        blocksWrt = in.readLong();
+        blocksWrtRmt = in.readLong();
+        bytesRd = in.readLong();
+        bytesRdTm = in.readLong();
+        bytesWrt = in.readLong();
+        bytesWrtTm = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorIgfsMetrics.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java
index 06460d5..e6b40fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfiler.java
@@ -44,7 +44,7 @@ public class VisorIgfsProfiler {
         if (entries.size() == 1)
             return entries.get(0); // No need to aggregate.
         else {
-            String path = entries.get(0).path();
+            String path = entries.get(0).getPath();
 
             Collections.sort(entries, VisorIgfsProfilerEntry.ENTRY_TIMESTAMP_COMPARATOR);
 
@@ -61,23 +61,23 @@ public class VisorIgfsProfiler {
 
             for (VisorIgfsProfilerEntry entry : entries) {
                 // Take last timestamp.
-                ts = entry.timestamp();
+                ts = entry.getTimestamp();
 
                 // Take last size.
-                size = entry.size();
+                size = entry.getSize();
 
                 // Take last mode.
-                mode = entry.mode();
+                mode = entry.getMode();
 
                 // Aggregate metrics.
-                bytesRead += entry.bytesRead();
-                readTime += entry.readTime();
-                userReadTime += entry.userReadTime();
-                bytesWritten += entry.bytesWritten();
-                writeTime += entry.writeTime();
-                userWriteTime += entry.userWriteTime();
+                bytesRead += entry.getBytesRead();
+                readTime += entry.getReadTime();
+                userReadTime += entry.getUserReadTime();
+                bytesWritten += entry.getBytesWritten();
+                writeTime += entry.getWriteTime();
+                userWriteTime += entry.getUserWriteTime();
 
-                counters.aggregate(entry.counters());
+                counters.aggregate(entry.getCounters());
             }
 
             return new VisorIgfsProfilerEntry(path, ts, mode, size, bytesRead, readTime, userReadTime,
@@ -85,4 +85,4 @@ public class VisorIgfsProfiler {
         }
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
index ba805c1..b8bfe9e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTask.java
@@ -32,7 +32,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsProfilerLogsDir;
 
@@ -40,14 +39,14 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsPr
  * Remove all IGFS profiler logs.
  */
 @GridInternal
-public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteBiTuple<Integer, Integer>> {
+public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, VisorIgfsProfilerClearTaskResult> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /**
      * Job to clear profiler logs.
      */
-    private static class VisorIgfsProfilerClearJob extends VisorJob<String, IgniteBiTuple<Integer, Integer>> {
+    private static class VisorIgfsProfilerClearJob extends VisorJob<String, VisorIgfsProfilerClearTaskResult> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -62,7 +61,7 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteB
         }
 
         /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<Integer, Integer> run(String arg) {
+        @Override protected VisorIgfsProfilerClearTaskResult run(String arg) {
             int deleted = 0;
             int notDeleted = 0;
 
@@ -106,7 +105,7 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteB
                 throw U.convertException(e);
             }
 
-            return new IgniteBiTuple<>(deleted, notDeleted);
+            return new VisorIgfsProfilerClearTaskResult(deleted, notDeleted);
         }
 
         /** {@inheritDoc} */
@@ -119,4 +118,4 @@ public class VisorIgfsProfilerClearTask extends VisorOneNodeTask<String, IgniteB
     @Override protected VisorIgfsProfilerClearJob job(String arg) {
         return new VisorIgfsProfilerClearJob(arg, debug);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
new file mode 100644
index 0000000..4eafe53
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerClearTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * 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.internal.visor.igfs;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for {@link VisorIgfsProfilerClearTask}.
+ */
+public class VisorIgfsProfilerClearTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Count of deleted files. */
+    private Integer deleted;
+
+    /** Count of not deleted files. */
+    private Integer notDeleted;
+
+    /**
+     * Default constructor.
+     */
+    public VisorIgfsProfilerClearTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * @param deleted Count of deleted files.
+     * @param notDeleted Count of not deleted files.
+     */
+    public VisorIgfsProfilerClearTaskResult(Integer deleted, Integer notDeleted) {
+        this.deleted = deleted;
+        this.notDeleted = notDeleted;
+    }
+
+    /**
+     * @return Count of deleted files.
+     */
+    public Integer getDeleted() {
+        return deleted;
+    }
+
+    /**
+     * @return Count of not deleted files.
+     */
+    public Integer getNotDeleted() {
+        return notDeleted;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeInt(deleted);
+        out.writeInt(notDeleted);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        deleted = in.readInt();
+        notDeleted = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorIgfsProfilerClearTaskResult.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
index b157296..dd33806 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerEntry.java
@@ -17,16 +17,19 @@
 
 package org.apache.ignite.internal.visor.igfs;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Comparator;
 import org.apache.ignite.igfs.IgfsMode;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Visor IGFS profiler information about one file.
  */
-public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
+public class VisorIgfsProfilerEntry extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -39,46 +42,53 @@ public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
         };
 
     /** Path to file. */
-    private final String path;
+    private String path;
 
     /** Timestamp of last file operation. */
-    private final long ts;
+    private long ts;
 
     /** IGFS mode. */
-    private final IgfsMode mode;
+    private IgfsMode mode;
 
     /** File size. */
-    private final long size;
+    private long size;
 
     /** How many bytes were read. */
-    private final long bytesRead;
+    private long bytesRead;
 
     /** How long read take. */
-    private final long readTime;
+    private long readTime;
 
     /** User read time. */
-    private final long userReadTime;
+    private long userReadTime;
 
     /** How many bytes were written. */
-    private final long bytesWritten;
+    private long bytesWritten;
 
     /** How long write take. */
-    private final long writeTime;
+    private long writeTime;
 
     /** User write read time. */
-    private final long userWriteTime;
+    private long userWriteTime;
 
     /** Calculated uniformity. */
     private double uniformity = -1;
 
     /** Counters for uniformity calculation. */
-    private final VisorIgfsProfilerUniformityCounters counters;
+    private VisorIgfsProfilerUniformityCounters counters;
 
     /** Read speed in bytes per second or {@code -1} if speed not available. */
-    private final long readSpeed;
+    private long readSpeed;
 
     /** Write speed in bytes per second or {@code -1} if speed not available. */
-    private final long writeSpeed;
+    private long writeSpeed;
+
+    /**
+     * Default constructor.
+     */
+    public VisorIgfsProfilerEntry() {
+        // No-op.
+    }
 
     /** Create data transfer object with given parameters. */
     public VisorIgfsProfilerEntry(
@@ -133,77 +143,77 @@ public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
     /**
      * @return Path to file.
      */
-    public String path() {
+    public String getPath() {
         return path;
     }
 
     /**
      * @return Timestamp of last file operation.
      */
-    public long timestamp() {
+    public long getTimestamp() {
         return ts;
     }
 
     /**
      * @return IGFS mode.
      */
-    public IgfsMode mode() {
+    public IgfsMode getMode() {
         return mode;
     }
 
     /**
      * @return File size.
      */
-    public long size() {
+    public long getSize() {
         return size;
     }
 
     /**
      * @return How many bytes were read.
      */
-    public long bytesRead() {
+    public long getBytesRead() {
         return bytesRead;
     }
 
     /**
      * @return How long read take.
      */
-    public long readTime() {
+    public long getReadTime() {
         return readTime;
     }
 
     /**
      * @return User read time.
      */
-    public long userReadTime() {
+    public long getUserReadTime() {
         return userReadTime;
     }
 
     /**
      * @return How many bytes were written.
      */
-    public long bytesWritten() {
+    public long getBytesWritten() {
         return bytesWritten;
     }
 
     /**
      * @return How long write take.
      */
-    public long writeTime() {
+    public long getWriteTime() {
         return writeTime;
     }
 
     /**
      * @return User write read time.
      */
-    public long userWriteTime() {
+    public long getUserWriteTime() {
         return userWriteTime;
     }
 
     /**
      * @return Calculated uniformity.
      */
-    public double uniformity() {
+    public double getUniformity() {
         if (uniformity < 0)
             uniformity = counters.calc();
 
@@ -213,25 +223,61 @@ public class VisorIgfsProfilerEntry implements Serializable, LessNamingBean {
     /**
      * @return Counters for uniformity calculation.
      */
-    public VisorIgfsProfilerUniformityCounters counters() {
+    public VisorIgfsProfilerUniformityCounters getCounters() {
         return counters;
     }
 
     /**
      * @return Read speed in bytes per second or {@code -1} if speed not available.
      */
-    public long readSpeed() {
+    public long getReadSpeed() {
         return readSpeed;
     }
 
     /**
      * @return Write speed in bytes per second or {@code -1} if speed not available.
      */
-    public long writeSpeed() {
+    public long getWriteSpeed() {
         return writeSpeed;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, path);
+        out.writeLong(ts);
+        U.writeEnum(out, mode);
+        out.writeLong(size);
+        out.writeLong(bytesRead);
+        out.writeLong(readTime);
+        out.writeLong(userReadTime);
+        out.writeLong(bytesWritten);
+        out.writeLong(writeTime);
+        out.writeLong(userWriteTime);
+        out.writeDouble(uniformity);
+        out.writeObject(counters);
+        out.writeLong(readSpeed);
+        out.writeLong(writeSpeed);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        path = U.readString(in);
+        ts = in.readLong();
+        mode = IgfsMode.fromOrdinal(in.readByte());
+        size = in.readLong();
+        bytesRead = in.readLong();
+        readTime = in.readLong();
+        userReadTime = in.readLong();
+        bytesWritten = in.readLong();
+        writeTime = in.readLong();
+        userWriteTime = in.readLong();
+        uniformity = in.readDouble();
+        counters = (VisorIgfsProfilerUniformityCounters)in.readObject();
+        readSpeed = in.readLong();
+        writeSpeed = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorIgfsProfilerEntry.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
index d57d7f9..be48a1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerTask.java
@@ -27,7 +27,6 @@ import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
 import java.nio.file.PathMatcher;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -57,7 +56,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgfsPr
  * Task that parse hadoop profiler logs.
  */
 @GridInternal
-public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<VisorIgfsProfilerEntry>> {
+public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, List<VisorIgfsProfilerEntry>> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -143,7 +142,7 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
     /**
      * Job that do actual profiler work.
      */
-    private static class VisorIgfsProfilerJob extends VisorJob<String, Collection<VisorIgfsProfilerEntry>> {
+    private static class VisorIgfsProfilerJob extends VisorJob<String, List<VisorIgfsProfilerEntry>> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -197,14 +196,14 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
         }
 
         /** {@inheritDoc} */
-        @Override protected Collection<VisorIgfsProfilerEntry> run(String arg) {
+        @Override protected List<VisorIgfsProfilerEntry> run(String arg) {
             try {
                 Path logsDir = resolveIgfsProfilerLogsDir(ignite.fileSystem(arg));
 
                 if (logsDir != null)
                     return parse(logsDir, arg);
-                else
-                    return Collections.emptyList();
+
+                return Collections.emptyList();
             }
             catch (IOException | IllegalArgumentException e) {
                 throw new IgniteException("Failed to parse profiler logs for IGFS: " + arg, e);
@@ -425,15 +424,15 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
          * @return Collection of parsed and aggregated entries.
          * @throws IOException if failed to read log file.
          */
-        private Collection<VisorIgfsProfilerEntry> parseFile(Path p) throws IOException {
-            Collection<VisorIgfsProfilerParsedLine> parsedLines = new ArrayList<>(512);
+        private List<VisorIgfsProfilerEntry> parseFile(Path p) throws IOException {
+            List<VisorIgfsProfilerParsedLine> parsedLines = new ArrayList<>(512);
 
             try (BufferedReader br = Files.newBufferedReader(p, Charset.forName("UTF-8"))) {
                 String line = br.readLine(); // Skip first line with columns header.
 
                 if (line != null) {
                     // Check file header.
-                    if (line.equalsIgnoreCase(HDR))
+                    if (HDR.equalsIgnoreCase(line))
                         line = br.readLine();
 
                     while (line != null) {
@@ -468,7 +467,7 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
             }
 
             // Aggregate each group.
-            Collection<VisorIgfsProfilerEntry> entries = new ArrayList<>(byStreamId.size());
+            List<VisorIgfsProfilerEntry> entries = new ArrayList<>(byStreamId.size());
 
             for (List<VisorIgfsProfilerParsedLine> lines : byStreamId.values()) {
                 VisorIgfsProfilerEntry entry = aggregateParsedLines(lines);
@@ -481,19 +480,19 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
             Map<String, List<VisorIgfsProfilerEntry>> byPath = new HashMap<>();
 
             for (VisorIgfsProfilerEntry entry : entries) {
-                List<VisorIgfsProfilerEntry> grp = byPath.get(entry.path());
+                List<VisorIgfsProfilerEntry> grp = byPath.get(entry.getPath());
 
                 if (grp == null) {
                     grp = new ArrayList<>();
 
-                    byPath.put(entry.path(), grp);
+                    byPath.put(entry.getPath(), grp);
                 }
 
                 grp.add(entry);
             }
 
             // Aggregate by files.
-            Collection<VisorIgfsProfilerEntry> res = new ArrayList<>(byPath.size());
+            List<VisorIgfsProfilerEntry> res = new ArrayList<>(byPath.size());
 
             for (List<VisorIgfsProfilerEntry> lst : byPath.values())
                 res.add(VisorIgfsProfiler.aggregateIgfsProfilerEntries(lst));
@@ -507,8 +506,8 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
          * @param logDir Folder were log files located.
          * @return List of line with aggregated information by files.
          */
-        private Collection<VisorIgfsProfilerEntry> parse(Path logDir, String igfsName) throws IOException {
-            Collection<VisorIgfsProfilerEntry> parsedFiles = new ArrayList<>(512);
+        private List<VisorIgfsProfilerEntry> parse(Path logDir, String igfsName) throws IOException {
+            List<VisorIgfsProfilerEntry> parsedFiles = new ArrayList<>(512);
 
             try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(logDir)) {
                 PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:igfs-log-" + igfsName + "-*.csv");
@@ -541,4 +540,4 @@ public class VisorIgfsProfilerTask extends VisorOneNodeTask<String, Collection<V
     @Override protected VisorIgfsProfilerJob job(String arg) {
         return new VisorIgfsProfilerJob(arg, debug);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
index 9184ce3..d1df3d0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
@@ -17,10 +17,14 @@
 
 package org.apache.ignite.internal.visor.igfs;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
-import org.apache.ignite.internal.LessNamingBean;
 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.internal.visor.VisorDataTransferObject;
 
 import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY_BLOCKS;
 import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY_DFLT_BLOCK_SIZE;
@@ -32,7 +36,7 @@ import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.UNIFORMITY
  * </p>
  * Count read frequency for each file and compare with ideal uniform distribution.
  */
-public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNamingBean {
+public class VisorIgfsProfilerUniformityCounters extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -43,7 +47,14 @@ public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNa
     private long blockSize = UNIFORMITY_DFLT_BLOCK_SIZE;
 
     /** Collection of calculated counters. */
-    private final ArrayList<Integer> counters = new ArrayList<>();
+    private ArrayList<Integer> counters = new ArrayList<>();
+
+    /**
+     * Default constructor.
+     */
+    public VisorIgfsProfilerUniformityCounters() {
+        // No-op.
+    }
 
     /**
      * Calculate block size.
@@ -199,4 +210,23 @@ public class VisorIgfsProfilerUniformityCounters implements Serializable, LessNa
             return 1.0 - sigma;
         }
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(fileSize);
+        out.writeLong(blockSize);
+        U.writeCollection(out, counters);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        fileSize = in.readLong();
+        blockSize = in.readLong();
+        counters = (ArrayList<Integer>)U.readIntList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorIgfsProfilerUniformityCounters.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java
index 62d93d4..7367492 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTask.java
@@ -25,20 +25,19 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 
 /**
  * Task to set IGFS instance sampling state.
  */
 @GridInternal
-public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<IgniteBiTuple<String, Boolean>, Void> {
+public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<VisorIgfsSamplingStateTaskArg, Void> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /**
      * Job that perform parsing of IGFS profiler logs.
      */
-    private static class VisorIgfsSamplingStateJob extends VisorJob<IgniteBiTuple<String, Boolean>, Void> {
+    private static class VisorIgfsSamplingStateJob extends VisorJob<VisorIgfsSamplingStateTaskArg, Void> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -48,19 +47,19 @@ public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<IgniteBiTuple<S
          * @param arg Job argument.
          * @param debug Debug flag.
          */
-        private VisorIgfsSamplingStateJob(IgniteBiTuple<String, Boolean> arg, boolean debug) {
+        private VisorIgfsSamplingStateJob(VisorIgfsSamplingStateTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected Void run(IgniteBiTuple<String, Boolean> arg) {
+        @Override protected Void run(VisorIgfsSamplingStateTaskArg arg) {
             try {
-                ((IgfsEx)ignite.fileSystem(arg.get1())).globalSampling(arg.get2());
+                ((IgfsEx)ignite.fileSystem(arg.getName())).globalSampling(arg.isEnabled());
 
                 return null;
             }
             catch (IllegalArgumentException iae) {
-                throw new IgniteException("Failed to set sampling state for IGFS: " + arg.get1(), iae);
+                throw new IgniteException("Failed to set sampling state for IGFS: " + arg.getName(), iae);
             }
             catch (IgniteCheckedException e) {
                 throw U.convertException(e);
@@ -74,7 +73,7 @@ public class VisorIgfsSamplingStateTask extends VisorOneNodeTask<IgniteBiTuple<S
     }
 
     /** {@inheritDoc} */
-    @Override protected VisorIgfsSamplingStateJob job(IgniteBiTuple<String, Boolean> arg) {
+    @Override protected VisorIgfsSamplingStateJob job(VisorIgfsSamplingStateTaskArg arg) {
         return new VisorIgfsSamplingStateJob(arg, debug);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java
new file mode 100644
index 0000000..219d943
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsSamplingStateTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * 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.internal.visor.igfs;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for task returns changing of sampling state result.
+ */
+public class VisorIgfsSamplingStateTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** IGFS name. */
+    private String name;
+
+    /** {@code True} to turn on sampling, {@code false} to turn it off, {@code null} to clear sampling state. */
+    private boolean enabled;
+
+    /**
+     * Default constructor.
+     */
+    public VisorIgfsSamplingStateTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param name IGFS name.
+     * @param enabled {@code True} to turn on sampling, {@code false} to turn it off, {@code null} to clear sampling state.
+     */
+    public VisorIgfsSamplingStateTaskArg(String name, boolean enabled) {
+        this.name = name;
+        this.enabled = enabled;
+    }
+
+    /**
+     * @return IGFS name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @return {@code True} to turn on sampling, {@code false} to turn it off, {@code null} to clear sampling state.
+     */
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        out.writeBoolean(enabled);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        enabled = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorIgfsSamplingStateTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java
index 211a171..2c2ac21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogFile.java
@@ -18,24 +18,35 @@
 package org.apache.ignite.internal.visor.log;
 
 import java.io.File;
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Visor log file.
  */
-public class VisorLogFile implements Serializable {
+public class VisorLogFile extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** File path. */
-    private final String path;
+    private String path;
 
     /** File size. */
-    private final long size;
+    private long size;
 
     /** File last modified timestamp. */
-    private final long lastModified;
+    private long lastModified;
+
+    /**
+     * Default constructor.
+     */
+    public VisorLogFile() {
+        // No-op.
+    }
 
     /**
      * Create log file for given file.
@@ -62,26 +73,40 @@ public class VisorLogFile implements Serializable {
     /**
      * @return File path.
      */
-    public String path() {
+    public String getPath() {
         return path;
     }
 
     /**
      * @return File size.
      */
-    public long size() {
+    public long getSize() {
         return size;
     }
 
     /**
      * @return File last modified timestamp.
      */
-    public long lastModified() {
+    public long getLastModified() {
         return lastModified;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, path);
+        out.writeLong(size);
+        out.writeLong(lastModified);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        path = U.readString(in);
+        size = in.readLong();
+        lastModified = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorLogFile.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
new file mode 100644
index 0000000..2a6b79b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchArg.java
@@ -0,0 +1,114 @@
+/*
+ * 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.internal.visor.log;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Arguments for {@link VisorLogSearchTask}.
+ */
+public class VisorLogSearchArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Searched string. */
+    private String searchStr;
+
+    /** Folder. */
+    private String folder;
+
+    /** File name search pattern. */
+    private String filePtrn;
+
+    /** Max number of results. */
+    private int limit;
+
+    /**
+     * Default constructor.
+     */
+    public VisorLogSearchArg() {
+        // No-op.
+    }
+
+    /**
+     * @param searchStr Searched string.
+     * @param folder Folder.
+     * @param filePtrn File name search pattern.
+     * @param limit Max number of results.
+     */
+    public VisorLogSearchArg(String searchStr, String folder, String filePtrn, int limit) {
+        this.searchStr = searchStr;
+        this.folder = folder;
+        this.filePtrn = filePtrn;
+        this.limit = limit;
+    }
+
+    /**
+     * @return Searched string.
+     */
+    public String getSearchString() {
+        return searchStr;
+    }
+
+    /**
+     * @return Folder.
+     */
+    public String getFolder() {
+        return folder;
+    }
+
+    /**
+     * @return File name search pattern.
+     */
+    public String getFilePattern() {
+        return filePtrn;
+    }
+
+    /**
+     * @return Max number of results.
+     */
+    public int getLimit() {
+        return limit;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, searchStr);
+        U.writeString(out, folder);
+        U.writeString(out, filePtrn);
+        out.writeInt(limit);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        searchStr = U.readString(in);
+        folder = U.readString(in);
+        filePtrn = U.readString(in);
+        limit = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorLogSearchArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
index 35ace13..4eee458 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchResult.java
@@ -17,42 +17,54 @@
 
 package org.apache.ignite.internal.visor.log;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.List;
 import java.util.UUID;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Result for log search operation.
  * Contains found line and several lines before and after, plus other info.
  */
-public class VisorLogSearchResult implements Serializable, LessNamingBean {
+public class VisorLogSearchResult extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Node ID. */
-    private final UUID nid;
+    private UUID nid;
 
     /** File path relative to the search folder. */
-    private final String filePath;
+    private String filePath;
 
     /** File size. */
-    private final long fileSize;
+    private long fileSize;
 
     /** Timestamp of last modification of the file. */
-    private final long lastModified;
+    private long lastModified;
 
     /** Lines of text including found line and several lines before and after. */
-    private final String[] lines;
+    private List<String> lines;
 
     /** Line number in the file, 1 based. */
-    private final int lineNum;
+    private int lineNum;
 
     /** Lines count in the file. */
-    private final int lineCnt;
+    private int lineCnt;
 
     /** File content encoding. */
-    private final String encoding;
+    private String encoding;
+
+    /**
+     * Default constructor.
+     */
+    public VisorLogSearchResult() {
+        // No-op.
+    }
 
     /**
      * Create log search result with given parameters.
@@ -80,7 +92,7 @@ public class VisorLogSearchResult implements Serializable, LessNamingBean {
         this.filePath = filePath;
         this.fileSize = fileSize;
         this.lastModified = lastModified;
-        this.lines = lines;
+        this.lines = Arrays.asList(lines);
         this.lineNum = lineNum;
         this.lineCnt = lineCnt;
         this.encoding = encoding;
@@ -89,64 +101,88 @@ public class VisorLogSearchResult implements Serializable, LessNamingBean {
     /**
      * @return Node ID.
      */
-    public UUID nid() {
+    public UUID getNid() {
         return nid;
     }
 
     /**
      * @return File path relative to the search folder.
      */
-    public String filePath() {
+    public String getFilePath() {
         return filePath;
     }
 
     /**
      * @return File size.
      */
-    public long fileSize() {
+    public long getFileSize() {
         return fileSize;
     }
 
     /**
      * @return Timestamp of last modification of the file.
      */
-    public long lastModified() {
+    public long getLastModified() {
         return lastModified;
     }
 
     /**
      * @return Lines of text including found line and several lines before and after.
      */
-    public String[] lines() {
+    public List<String> getLines() {
         return lines;
     }
 
     /**
      * @return Line number in the file, 1 based.
      */
-    public int lineNumber() {
+    public int getLineNumber() {
         return lineNum;
     }
 
     /**
      * @return Lines count in the file.
      */
-    public int lineCount() {
+    public int getLineCount() {
         return lineCnt;
     }
 
     /**
      * @return File content encoding.
      */
-    public String encoding() {
+    public String getEncoding() {
         return encoding;
     }
 
     /**
      * @return Found line.
      */
-    public String line() {
-        return lines[lines.length / 2];
+    public String getLine() {
+        return lines.get(lines.size() / 2);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeUuid(out, nid);
+        U.writeString(out, filePath);
+        out.writeLong(fileSize);
+        out.writeLong(lastModified);
+        U.writeCollection(out, lines);
+        out.writeInt(lineNum);
+        out.writeInt(lineCnt);
+        U.writeString(out, encoding);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        nid = U.readUuid(in);
+        filePath = U.readString(in);
+        fileSize = in.readLong();
+        lastModified = in.readLong();
+        lines = U.readList(in);
+        lineNum = in.readInt();
+        lineCnt = in.readInt();
+        encoding = U.readString(in);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
index b6552b2..924c285 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.visor.log;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.Serializable;
 import java.net.URL;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
@@ -28,6 +27,7 @@ import java.util.Collection;
 import java.util.Deque;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.compute.ComputeJobResult;
@@ -38,7 +38,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.decode;
@@ -49,8 +48,8 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.textFile;
  * Search text matching in logs
  */
 @GridInternal
-public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.VisorLogSearchArg,
-    IgniteBiTuple<Iterable<IgniteBiTuple<Exception, UUID>>, Iterable<VisorLogSearchResult>>,
+public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchArg,
+    VisorLogSearchTaskResult,
     Collection<VisorLogSearchResult>> {
     /** */
     private static final long serialVersionUID = 0L;
@@ -67,15 +66,14 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override protected IgniteBiTuple<Iterable<IgniteBiTuple<Exception, UUID>>,
-        Iterable<VisorLogSearchResult>> reduce0(List<ComputeJobResult> results) {
-        Collection<VisorLogSearchResult> searchRes = new ArrayList<>();
-        Collection<IgniteBiTuple<Exception, UUID>> exRes = new ArrayList<>();
+    @Nullable @Override protected VisorLogSearchTaskResult reduce0(List<ComputeJobResult> results) {
+        List<VisorLogSearchResult> searchRes = new ArrayList<>();
+        Map<Exception, UUID> exRes = U.newHashMap(0);
 
         // Separate successfully executed results and exceptions.
         for (ComputeJobResult result : results) {
             if (result.getException() != null)
-                exRes.add(new IgniteBiTuple<Exception, UUID>(result.getException(), result.getNode().id()));
+                exRes.put(result.getException(), result.getNode().id());
             else if (result.getData() != null) {
                 Collection<VisorLogSearchResult> data = result.getData();
 
@@ -83,47 +81,7 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
             }
         }
 
-        return new IgniteBiTuple<Iterable<IgniteBiTuple<Exception, UUID>>, Iterable<VisorLogSearchResult>>
-            (exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes);
-    }
-
-    /**
-     * Arguments for {@link VisorLogSearchTask}.
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class VisorLogSearchArg implements Serializable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Searched string. */
-        private final String searchStr;
-
-        /** Folder. */
-        private final String folder;
-
-        /** File name search pattern. */
-        private final String filePtrn;
-
-        /** Max number of results. */
-        private final int limit;
-
-        /**
-         * @param searchStr Searched string.
-         * @param folder Folder.
-         * @param filePtrn File name search pattern.
-         * @param limit Max number of results.
-         */
-        public VisorLogSearchArg(String searchStr, String folder, String filePtrn, int limit) {
-            this.searchStr = searchStr;
-            this.folder = folder;
-            this.filePtrn = filePtrn;
-            this.limit = limit;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorLogSearchArg.class, this);
-        }
+        return new VisorLogSearchTaskResult(exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes);
     }
 
     /**
@@ -216,15 +174,15 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
 
         /** {@inheritDoc} */
         @Override protected Collection<VisorLogSearchResult> run(VisorLogSearchArg arg) {
-            URL url = U.resolveIgniteUrl(arg.folder);
+            URL url = U.resolveIgniteUrl(arg.getFolder());
 
             if (url == null)
-                throw new IgniteException(new FileNotFoundException("Log folder not found: " + arg.folder));
+                throw new IgniteException(new FileNotFoundException("Log folder not found: " + arg.getFolder()));
 
             UUID uuid = ignite.localNode().id();
             String nid = uuid.toString().toLowerCase();
 
-            String filePtrn = arg.filePtrn.replace("@nid8", nid.substring(0, 8)).replace("@nid", nid);
+            String filePtrn = arg.getFilePattern().replace("@nid8", nid.substring(0, 8)).replace("@nid", nid);
 
             try {
                 File fld = new File(url.toURI());
@@ -232,22 +190,22 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
 
                 List<VisorLogFile> matchingFiles = matchedFiles(fld, filePtrn);
 
-                Collection<VisorLogSearchResult> results = new ArrayList<>(arg.limit);
+                Collection<VisorLogSearchResult> results = new ArrayList<>(arg.getLimit());
 
                 int resCnt = 0;
 
                 for (VisorLogFile logFile : matchingFiles) {
                     try {
-                        File f = new File(logFile.path());
+                        File f = new File(logFile.getPath());
 
                         if (textFile(f, false)) {
                             Charset charset = decode(f);
 
-                            if (resCnt == arg.limit)
+                            if (resCnt == arg.getLimit())
                                 break;
 
                             List<GridTuple3<String[], Integer, Integer>> searched =
-                                searchInFile(f, charset, arg.searchStr, arg.limit - resCnt);
+                                searchInFile(f, charset, arg.getSearchString(), arg.getLimit() - resCnt);
 
                             resCnt += searched.size();
 
@@ -276,4 +234,4 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTask.Vi
             return S.toString(VisorLogSearchJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java
new file mode 100644
index 0000000..3104c3a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTaskResult.java
@@ -0,0 +1,92 @@
+/*
+ * 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.internal.visor.log;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for log search operation.
+ * Contains found line and several lines before and after, plus other info.
+ */
+public class VisorLogSearchTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** List of exceptions by node ID. */
+    private Map<Exception, UUID> exceptions;
+
+    /** List of log search results. */
+    private List<VisorLogSearchResult> results;
+
+    /**
+     * Default constructor.
+     */
+    public VisorLogSearchTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * Create log search result with given parameters.
+     *
+     * @param exceptions List of exceptions by node ID.
+     * @param results List of log search results.
+     */
+    public VisorLogSearchTaskResult(Map<Exception, UUID> exceptions, List<VisorLogSearchResult> results) {
+        this.exceptions = exceptions;
+        this.results = results;
+    }
+
+    /**
+     * @return List of exceptions by node ID.
+     */
+    public Map<Exception, UUID> getExceptions() {
+        return exceptions;
+    }
+
+    /**
+     * @return List of log search results.
+     */
+    public List<VisorLogSearchResult> getResults() {
+        return results;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeMap(out, exceptions);
+        U.writeCollection(out, results);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        exceptions = U.readMap(in);
+        results = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorLogSearchTaskResult.class, this);
+    }
+}


[33/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.


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

Branch: refs/heads/ignite-1561-1
Commit: acd21fb8b0d1c7f274d50d30da292c96ede7515c
Parents: 1f867c6
Author: Yury Babak <yb...@gridgain.com>
Authored: Fri Apr 14 18:50:30 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Apr 14 18:50:30 2017 +0300

----------------------------------------------------------------------
 examples/pom-standalone-lgpl.xml                |    6 +
 examples/pom-standalone.xml                     |    6 +
 examples/pom.xml                                |    6 +
 .../CholeskyDecompositionExample.java           |   80 ++
 .../EigenDecompositionExample.java              |   69 ++
 .../decompositions/LUDecompositionExample.java  |   83 ++
 .../SingularValueDecompositionExample.java      |   70 ++
 .../java8/math/decompositions/package-info.java |   22 +
 .../java8/math/matrix/CacheMatrixExample.java   |   91 ++
 .../java8/math/matrix/ExampleMatrixStorage.java |  162 +++
 .../math/matrix/MatrixCustomStorageExample.java |  141 +++
 .../java8/math/matrix/MatrixExample.java        |   79 ++
 .../java8/math/matrix/MatrixExampleUtil.java    |   52 +
 .../java8/math/matrix/OffHeapMatrixExample.java |   84 ++
 .../matrix/SparseDistributedMatrixExample.java  |   65 +
 .../java8/math/matrix/SparseMatrixExample.java  |   84 ++
 .../java8/math/matrix/package-info.java         |   22 +
 .../examples/java8/math/package-info.java       |   22 +
 .../java8/math/tracer/TracerExample.java        |   63 +
 .../java8/math/tracer/package-info.java         |   22 +
 .../java8/math/vector/CacheVectorExample.java   |  102 ++
 .../java8/math/vector/ExampleVectorStorage.java |  126 ++
 .../java8/math/vector/OffHeapVectorExample.java |   78 ++
 .../java8/math/vector/SparseVectorExample.java  |   80 ++
 .../math/vector/VectorCustomStorageExample.java |  124 ++
 .../java8/math/vector/VectorExample.java        |   75 ++
 .../java8/math/vector/package-info.java         |   22 +
 modules/math/README.txt                         |   15 +
 modules/math/licenses/apache-2.0.txt            |  202 ++++
 modules/math/licenses/mit.txt                   |    7 +
 modules/math/pom.xml                            |  109 ++
 .../java/org/apache/ignite/math/Algebra.java    |  571 +++++++++
 .../java/org/apache/ignite/math/Constants.java  |   42 +
 .../org/apache/ignite/math/Destroyable.java     |   30 +
 .../apache/ignite/math/IdentityValueMapper.java |   53 +
 .../java/org/apache/ignite/math/KeyMapper.java  |   33 +
 .../java/org/apache/ignite/math/Matrix.java     |  518 ++++++++
 .../org/apache/ignite/math/MatrixKeyMapper.java |   30 +
 .../org/apache/ignite/math/MatrixStorage.java   |   58 +
 .../org/apache/ignite/math/MetaAttributes.java  |   76 ++
 .../java/org/apache/ignite/math/MurmurHash.java |  246 ++++
 .../apache/ignite/math/StorageConstants.java    |   49 +
 .../apache/ignite/math/StorageOpsMetrics.java   |   49 +
 .../java/org/apache/ignite/math/Tracer.java     |  456 +++++++
 .../org/apache/ignite/math/ValueMapper.java     |   27 +
 .../java/org/apache/ignite/math/Vector.java     |  498 ++++++++
 .../org/apache/ignite/math/VectorKeyMapper.java |   29 +
 .../org/apache/ignite/math/VectorStorage.java   |   53 +
 .../decompositions/CholeskyDecomposition.java   |  306 +++++
 .../decompositions/DecompositionSupport.java    |  105 ++
 .../math/decompositions/EigenDecomposition.java |  923 +++++++++++++++
 .../math/decompositions/LUDecomposition.java    |  366 ++++++
 .../math/decompositions/QRDecomposition.java    |  186 +++
 .../SingularValueDecomposition.java             |  620 ++++++++++
 .../math/decompositions/package-info.java       |   22 +
 .../math/exceptions/CardinalityException.java   |   38 +
 .../math/exceptions/ColumnIndexException.java   |   35 +
 .../ignite/math/exceptions/IndexException.java  |   35 +
 .../NonPositiveDefiniteMatrixException.java     |   20 +
 .../exceptions/NonSymmetricMatrixException.java |   18 +
 .../math/exceptions/RowIndexException.java      |   35 +
 .../exceptions/SingularMatrixException.java     |   30 +
 .../exceptions/UnknownProviderException.java    |   35 +
 .../UnsupportedOperationException.java          |   44 +
 .../ignite/math/exceptions/package-info.java    |   22 +
 .../apache/ignite/math/functions/Functions.java |  136 +++
 .../ignite/math/functions/IgniteBiConsumer.java |   12 +
 .../ignite/math/functions/IgniteBiFunction.java |   29 +
 .../ignite/math/functions/IgniteConsumer.java   |   29 +
 .../math/functions/IgniteDoubleFunction.java    |   29 +
 .../ignite/math/functions/IgniteFunction.java   |   30 +
 .../math/functions/IntDoubleToVoidFunction.java |   25 +
 .../functions/IntIntDoubleToVoidFunction.java   |   28 +
 .../math/functions/IntIntToDoubleFunction.java  |   24 +
 .../ignite/math/functions/package-info.java     |   22 +
 .../apache/ignite/math/impls/CacheUtils.java    |  356 ++++++
 .../math/impls/matrix/AbstractMatrix.java       |  880 ++++++++++++++
 .../ignite/math/impls/matrix/CacheMatrix.java   |  158 +++
 .../impls/matrix/DenseLocalOffHeapMatrix.java   |   90 ++
 .../impls/matrix/DenseLocalOnHeapMatrix.java    |   86 ++
 .../math/impls/matrix/DiagonalMatrix.java       |  101 ++
 .../math/impls/matrix/FunctionMatrix.java       |   95 ++
 .../ignite/math/impls/matrix/MatrixView.java    |   84 ++
 .../math/impls/matrix/PivotedMatrixView.java    |  243 ++++
 .../ignite/math/impls/matrix/RandomMatrix.java  |   97 ++
 .../impls/matrix/SparseDistributedMatrix.java   |  155 +++
 .../impls/matrix/SparseLocalOnHeapMatrix.java   |   72 ++
 .../math/impls/matrix/TransposedMatrixView.java |   84 ++
 .../ignite/math/impls/matrix/package-info.java  |   22 +
 .../apache/ignite/math/impls/package-info.java  |   22 +
 .../storage/matrix/ArrayMatrixStorage.java      |  161 +++
 .../storage/matrix/CacheMatrixStorage.java      |  180 +++
 .../matrix/DenseOffHeapMatrixStorage.java       |  197 ++++
 .../storage/matrix/DiagonalMatrixStorage.java   |  136 +++
 .../storage/matrix/FunctionMatrixStorage.java   |  175 +++
 .../storage/matrix/MatrixDelegateStorage.java   |  205 ++++
 .../storage/matrix/PivotedMatrixStorage.java    |  256 ++++
 .../storage/matrix/RandomMatrixStorage.java     |  176 +++
 .../matrix/SparseDistributedMatrixStorage.java  |  283 +++++
 .../matrix/SparseLocalOnHeapMatrixStorage.java  |  226 ++++
 .../math/impls/storage/matrix/package-info.java |   22 +
 .../storage/vector/ArrayVectorStorage.java      |  135 +++
 .../storage/vector/CacheVectorStorage.java      |  175 +++
 .../storage/vector/ConstantVectorStorage.java   |  133 +++
 .../storage/vector/DelegateVectorStorage.java   |  157 +++
 .../vector/DenseLocalOffHeapVectorStorage.java  |  172 +++
 .../storage/vector/FunctionVectorStorage.java   |  141 +++
 .../storage/vector/MatrixVectorStorage.java     |  185 +++
 .../storage/vector/PivotedVectorStorage.java    |  175 +++
 .../storage/vector/RandomVectorStorage.java     |  152 +++
 .../SingleElementVectorDelegateStorage.java     |  145 +++
 .../vector/SingleElementVectorStorage.java      |  143 +++
 .../vector/SparseLocalOffHeapVectorStorage.java |  148 +++
 .../vector/SparseLocalOnHeapVectorStorage.java  |  152 +++
 .../math/impls/storage/vector/package-info.java |   22 +
 .../impls/vector/AbstractReadOnlyVector.java    |  108 ++
 .../math/impls/vector/AbstractVector.java       |  903 ++++++++++++++
 .../ignite/math/impls/vector/CacheVector.java   |  140 +++
 .../math/impls/vector/ConstantVector.java       |   84 ++
 .../math/impls/vector/DelegatingVector.java     |  391 ++++++
 .../impls/vector/DenseLocalOffHeapVector.java   |   89 ++
 .../impls/vector/DenseLocalOnHeapVector.java    |  104 ++
 .../math/impls/vector/FunctionVector.java       |  112 ++
 .../math/impls/vector/MatrixVectorView.java     |  139 +++
 .../math/impls/vector/PivotedVectorView.java    |  163 +++
 .../ignite/math/impls/vector/RandomVector.java  |  128 ++
 .../math/impls/vector/SingleElementVector.java  |  102 ++
 .../impls/vector/SingleElementVectorView.java   |   97 ++
 .../impls/vector/SparseLocalOffHeapVector.java  |   47 +
 .../math/impls/vector/SparseLocalVector.java    |   71 ++
 .../ignite/math/impls/vector/VectorView.java    |   85 ++
 .../ignite/math/impls/vector/package-info.java  |   22 +
 .../org/apache/ignite/math/package-info.java    |   22 +
 .../apache/ignite/math/d3-matrix-template.html  |  128 ++
 .../apache/ignite/math/d3-vector-template.html  |  111 ++
 .../org/apache/ignite/math/ExternalizeTest.java |   66 ++
 .../math/MathImplDistributedTestSuite.java      |   39 +
 .../ignite/math/MathImplLocalTestSuite.java     |  123 ++
 .../ignite/math/MathImplMainTestSuite.java      |   33 +
 .../java/org/apache/ignite/math/TracerTest.java |  195 +++
 .../ignite/math/benchmark/MathBenchmark.java    |  205 ++++
 .../math/benchmark/MathBenchmarkSelfTest.java   |  100 ++
 .../ignite/math/benchmark/ResultsWriter.java    |  127 ++
 .../math/benchmark/VectorBenchmarkTest.java     |  138 +++
 .../ignite/math/benchmark/package-info.java     |   18 +
 .../CholeskyDecompositionTest.java              |  158 +++
 .../decompositions/EigenDecompositionTest.java  |  193 +++
 .../decompositions/LUDecompositionTest.java     |  250 ++++
 .../decompositions/QRDecompositionTest.java     |  139 +++
 .../SingularValueDecompositionTest.java         |  120 ++
 .../ignite/math/impls/MathTestConstants.java    |   88 ++
 .../math/impls/matrix/CacheMatrixTest.java      |  369 ++++++
 .../DenseLocalOffHeapMatrixConstructorTest.java |   65 +
 .../DenseLocalOnHeapMatrixConstructorTest.java  |   71 ++
 .../math/impls/matrix/DiagonalMatrixTest.java   |  209 ++++
 .../matrix/FunctionMatrixConstructorTest.java   |  113 ++
 .../math/impls/matrix/MatrixAttributeTest.java  |  156 +++
 .../matrix/MatrixImplementationFixtures.java    |  381 ++++++
 .../impls/matrix/MatrixImplementationsTest.java | 1113 ++++++++++++++++++
 .../impls/matrix/MatrixKeyMapperForTests.java   |   69 ++
 .../impls/matrix/MatrixViewConstructorTest.java |  114 ++
 .../PivotedMatrixViewConstructorTest.java       |  128 ++
 .../matrix/RandomMatrixConstructorTest.java     |   71 ++
 .../matrix/SparseDistributedMatrixTest.java     |  265 +++++
 .../SparseLocalOnHeapMatrixConstructorTest.java |   53 +
 .../impls/matrix/TransposedMatrixViewTest.java  |   87 ++
 .../storage/matrix/MatrixArrayStorageTest.java  |   63 +
 .../storage/matrix/MatrixBaseStorageTest.java   |   89 ++
 .../matrix/MatrixOffHeapStorageTest.java        |   39 +
 .../storage/matrix/MatrixStorageFixtures.java   |  141 +++
 .../matrix/MatrixStorageImplementationTest.java |   73 ++
 .../SparseDistributedMatrixStorageTest.java     |  126 ++
 .../RandomAccessSparseVectorStorageTest.java    |   60 +
 .../SparseLocalOffHeapVectorStorageTest.java    |   78 ++
 .../storage/vector/VectorArrayStorageTest.java  |   58 +
 .../storage/vector/VectorBaseStorageTest.java   |   69 ++
 .../vector/VectorOffheapStorageTest.java        |   73 ++
 .../math/impls/vector/AbstractVectorTest.java   |  543 +++++++++
 .../math/impls/vector/CacheVectorTest.java      |  417 +++++++
 .../vector/ConstantVectorConstructorTest.java   |   52 +
 .../vector/DelegatingVectorConstructorTest.java |   62 +
 .../DenseLocalOffHeapVectorConstructorTest.java |   59 +
 .../DenseLocalOnHeapVectorConstructorTest.java  |  163 +++
 .../vector/FunctionVectorConstructorTest.java   |  121 ++
 .../math/impls/vector/MatrixVectorViewTest.java |  209 ++++
 .../PivotedVectorViewConstructorTest.java       |  211 ++++
 .../vector/RandomVectorConstructorTest.java     |  145 +++
 .../SingleElementVectorConstructorTest.java     |  159 +++
 .../SingleElementVectorViewConstructorTest.java |  137 +++
 .../SparseLocalVectorConstructorTest.java       |   54 +
 .../math/impls/vector/VectorAttributesTest.java |  217 ++++
 .../math/impls/vector/VectorFoldMapTest.java    |  122 ++
 .../vector/VectorImplementationsFixtures.java   |  655 +++++++++++
 .../impls/vector/VectorImplementationsTest.java |  860 ++++++++++++++
 .../math/impls/vector/VectorIterableTest.java   |  376 ++++++
 .../math/impls/vector/VectorNormTest.java       |  247 ++++
 .../math/impls/vector/VectorToMatrixTest.java   |  291 +++++
 .../math/impls/vector/VectorViewTest.java       |  162 +++
 pom.xml                                         |    7 +
 199 files changed, 29228 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index d9e630b..f9d8a2c 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -73,6 +73,12 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-math</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-spring-data</artifactId>
             <version>to_be_replaced_by_ignite_version</version>
         </dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index fe559f8..f48b74f 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -78,6 +78,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-math</artifactId>
+            <version>to_be_replaced_by_ignite_version</version>
+        </dependency>
+
+        <dependency>
             <groupId>com.google.code.simple-spring-memcached</groupId>
             <artifactId>spymemcached</artifactId>
             <version>2.7.3</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index cdb72ca..bed361b 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -107,6 +107,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-math</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.gridgain</groupId>
             <artifactId>ignite-shmem</artifactId>
             <version>1.0.0</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/CholeskyDecompositionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/CholeskyDecompositionExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/CholeskyDecompositionExample.java
new file mode 100644
index 0000000..9a68e28
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/CholeskyDecompositionExample.java
@@ -0,0 +1,80 @@
+/*
+ * 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.examples.java8.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Tracer;
+import org.apache.ignite.math.decompositions.CholeskyDecomposition;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+
+/**
+ * Example of using {@link CholeskyDecomposition}.
+ */
+public class CholeskyDecompositionExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println(">>> Cholesky decomposition example started.");
+        // Let's compute a Cholesky decomposition of Hermitian matrix m:
+        // m = l l^{*}, where
+        // l is a lower triangular matrix
+        // l^{*} is its conjugate transpose
+
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        });
+        System.out.println("\n>>> Matrix m for decomposition: ");
+        Tracer.showAscii(m);
+
+        // This decomposition is useful when dealing with systems of linear equations of the form
+        // m x = b where m is a Hermitian matrix.
+        // For such systems Cholesky decomposition provides
+        // more effective method of solving compared to LU decomposition.
+        // Suppose we want to solve system
+        // m x = b for various bs. Then after we computed Cholesky decomposition, we can feed various bs
+        // as a matrix of the form
+        // (b1, b2, ..., bm)
+        // to the method Cholesky::solve which returns solutions in the form
+        // (sol1, sol2, ..., solm)
+        CholeskyDecomposition dec = new CholeskyDecomposition(m);
+        System.out.println("\n>>> Made decomposition m = l * l^{*}.");
+        System.out.println(">>> Matrix l is ");
+        Tracer.showAscii(dec.getL());
+        System.out.println(">>> Matrix l^{*} is ");
+        Tracer.showAscii(dec.getLT());
+
+        Matrix bs = new DenseLocalOnHeapMatrix(new double[][] {
+            {4.0, -6.0, 7.0},
+            {1.0, 1.0, 1.0}
+        }).transpose();
+        System.out.println("\n>>> Solving systems of linear equations of the form m x = b for various bs represented by columns of matrix");
+        Tracer.showAscii(bs);
+        Matrix sol = dec.solve(bs);
+
+        System.out.println("\n>>> List of solutions: ");
+        for (int i = 0; i < sol.columnSize(); i++)
+            Tracer.showAscii(sol.viewColumn(i));
+
+        System.out.println("\n>>> Cholesky decomposition example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/EigenDecompositionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/EigenDecompositionExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/EigenDecompositionExample.java
new file mode 100644
index 0000000..e11d642
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/EigenDecompositionExample.java
@@ -0,0 +1,69 @@
+/*
+ * 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.examples.java8.math.decompositions;
+
+import org.apache.ignite.math.Tracer;
+import org.apache.ignite.math.decompositions.EigenDecomposition;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+
+/**
+ * Example of using {@link EigenDecomposition}.
+ */
+public class EigenDecompositionExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println(">>> Eigen decomposition example started.");
+
+        // Let's compute EigenDecomposition for some square (n x n) matrix m with real eigenvalues:
+        // m = v d v^{-1}, where d is diagonal matrix having eigenvalues of m on diagonal
+        // and v is matrix where i-th column is eigenvector for i-th eigenvalue (i from 0 to n - 1)
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
+            {1.0d, 0.0d, 0.0d, 0.0d},
+            {0.0d, 1.0d, 0.0d, 0.0d},
+            {0.0d, 0.0d, 2.0d, 0.0d},
+            {1.0d, 1.0d, 0.0d, 2.0d}
+        });
+        System.out.println("\n>>> Matrix m for decomposition: ");
+        Tracer.showAscii(m);
+
+        EigenDecomposition dec = new EigenDecomposition(m);
+        System.out.println("\n>>> Made decomposition.");
+        System.out.println(">>> Matrix getV is ");
+        Tracer.showAscii(dec.getV());
+        System.out.println(">>> Matrix getD is ");
+        Tracer.showAscii(dec.getD());
+
+        // From this decomposition we, for example, can easily compute determinant of matrix m
+        // det (m) = det (v d v^{-1}) =
+        // det(v) det (d) det(v^{-1}) =
+        // det(v) det(v)^{-1} det(d) =
+        // det (d) =
+        // product of diagonal elements of d =
+        // product of eigenvalues
+        double det = dec.getRealEigenValues().foldMap(Functions.MULT, Functions.IDENTITY, 1.0);
+        System.out.println("\n>>> Determinant is " + det);
+
+        System.out.println("\n>>> Eigen decomposition example completed.");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/LUDecompositionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/LUDecompositionExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/LUDecompositionExample.java
new file mode 100644
index 0000000..bf005ec
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/LUDecompositionExample.java
@@ -0,0 +1,83 @@
+/*
+ * 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.examples.java8.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Tracer;
+import org.apache.ignite.math.decompositions.LUDecomposition;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+
+/**
+ * Example of using {@link LUDecomposition}.
+ */
+public class LUDecompositionExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println(">>> LU decomposition example started.");
+        // Let's compute a LU decomposition for some (n x n) matrix m:
+        // m = p l u, where
+        // p is an (n x n) is a row-permutation matrix
+        // l is a (n x n) lower triangular matrix
+        // u is a (n x n) upper triangular matrix
+
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
+            {1.0d, 1.0d, -1.0d},
+            {1.0d, -2.0d, 3.0d},
+            {2.0d, 3.0d, 1.0d}
+        });
+        System.out.println("\n>>> Matrix m for decomposition: ");
+        Tracer.showAscii(m);
+
+        // This decomposition is useful when dealing with systems of linear equations.
+        // (see https://en.wikipedia.org/wiki/LU_decomposition)
+        // suppose we want to solve system
+        // m x = b for various bs. Then after we computed LU decomposition, we can feed various bs
+        // as a matrix of the form
+        // (b1, b2, ..., bm)
+        // to the method LUDecomposition::solve which returns solutions in the form
+        // (sol1, sol2, ..., solm)
+
+        LUDecomposition dec = new LUDecomposition(m);
+        System.out.println("\n>>> Made decomposition.");
+        System.out.println(">>> Matrix getL is ");
+        Tracer.showAscii(dec.getL());
+        System.out.println(">>> Matrix getU is ");
+        Tracer.showAscii(dec.getU());
+        System.out.println(">>> Matrix getP is ");
+        Tracer.showAscii(dec.getP());
+
+        Matrix bs = new DenseLocalOnHeapMatrix(new double[][] {
+            {4.0, -6.0, 7.0},
+            {1.0, 1.0, 1.0}
+        });
+        System.out.println("\n>>> Matrix to solve: ");
+        Tracer.showAscii(bs);
+
+        Matrix sol = dec.solve(bs.transpose());
+
+        System.out.println("\n>>> List of solutions: ");
+        for (int i = 0; i < sol.columnSize(); i++)
+            Tracer.showAscii(sol.viewColumn(i));
+
+        System.out.println("\n>>> LU decomposition example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/SingularValueDecompositionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/SingularValueDecompositionExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/SingularValueDecompositionExample.java
new file mode 100644
index 0000000..1b2998f
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/SingularValueDecompositionExample.java
@@ -0,0 +1,70 @@
+/*
+ * 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.examples.java8.math.decompositions;
+
+import org.apache.ignite.math.Tracer;
+import org.apache.ignite.math.decompositions.SingularValueDecomposition;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+
+/**
+ * Example of using {@link SingularValueDecomposition}.
+ */
+public class SingularValueDecompositionExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println(">>> Singular value decomposition (SVD) example started.");
+
+        // Let's compute a SVD of (l x k) matrix m. This decomposition can be thought as extension of EigenDecomposition to
+        // rectangular matrices. The factorization we get is following:
+        // m = u * s * v^{*}, where
+        // u is a real or complex unitary matrix
+        // s is a rectangular diagonal matrix with non-negative real numbers on diagonal (this numbers are singular values of m)
+        // v is a real or complex unitary matrix
+        // If m is real then u and v are also real.
+        // Complex case is not supported for the moment.
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
+            {1.0d, 0.0d, 0.0d, 0.0d, 2.0d},
+            {0.0d, 0.0d, 3.0d, 0.0d, 0.0d},
+            {0.0d, 0.0d, 0.0d, 0.0d, 0.0d},
+            {0.0d, 2.0d, 0.0d, 0.0d, 0.0d}
+        });
+        System.out.println("\n>>> Matrix m for decomposition: ");
+        Tracer.showAscii(m);
+
+        SingularValueDecomposition dec = new SingularValueDecomposition(m);
+        System.out.println("\n>>> Made decomposition m = u * s * v^{*}.");
+        System.out.println(">>> Matrix u is ");
+        Tracer.showAscii(dec.getU());
+        System.out.println(">>> Matrix s is ");
+        Tracer.showAscii(dec.getS());
+        System.out.println(">>> Matrix v is ");
+        Tracer.showAscii(dec.getV());
+
+        // This decomposition can in particular help with solving problem of finding x minimizing 2-norm of m x such
+        // that 2-norm of x is 1. It appears that it is the right singular vector corresponding to minimal singular
+        // value, which is always last.
+        System.out.println("\n>>> Vector x minimizing 2-norm of m x such that 2 norm of x is 1: ");
+        Tracer.showAscii(dec.getV().viewColumn(dec.getSingularValues().length - 1));
+
+        System.out.println("\n>>> Singular value decomposition (SVD) example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/package-info.java
new file mode 100644
index 0000000..cd02b21
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/decompositions/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Core algebra decomposition examples.
+ */
+package org.apache.ignite.examples.java8.math.decompositions;

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/CacheMatrixExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/CacheMatrixExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/CacheMatrixExample.java
new file mode 100644
index 0000000..44f97d2
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/CacheMatrixExample.java
@@ -0,0 +1,91 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.math.IdentityValueMapper;
+import org.apache.ignite.math.MatrixKeyMapper;
+import org.apache.ignite.math.ValueMapper;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.impls.matrix.CacheMatrix;
+
+/** */
+public class CacheMatrixExample {
+    /** */ private static final String CACHE_NAME = CacheMatrixExample.class.getSimpleName();
+    /** */ private static final int ROWS = 3;
+    /** */ private static final int COLS = 3;
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> CacheMatrix example started.");
+
+            CacheConfiguration<Integer, Double> cfg = new CacheConfiguration<>();
+
+            cfg.setName(CACHE_NAME);
+
+            try (IgniteCache<Integer, Double> cache = ignite.getOrCreateCache(cfg)) {
+                double[][] testValues = {{1.0, 0.0, 0.0}, {1.0, 1.0, 0.0}, {1.0, 1.0, 1.0}};
+
+                ValueMapper valMapper = new IdentityValueMapper();
+
+                // Map matrix element indices to cache keys.
+                MatrixKeyMapper<Integer> keyMapper = new MatrixKeyMapper<Integer>() {
+                    @Override public Integer apply(int x, int y) {
+                        return x * COLS + y;
+                    }
+
+                    @Override public boolean isValid(Integer integer) {
+                        return integer >= 0 && integer < COLS * ROWS;
+                    }
+                };
+
+                // Create cache matrix.
+                CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(ROWS, COLS, cache, keyMapper, valMapper);
+
+                cacheMatrix.assign(testValues);
+
+                // Find all positive elements.
+                Integer nonZeroes = cacheMatrix.foldMap((o, aDouble) -> {
+                    if (aDouble > 0)
+                        return o + 1;
+                    return o;
+                }, Functions.IDENTITY, 0);
+
+                assert nonZeroes.equals(6);
+
+                System.out.println(">>>");
+                System.out.println(">>> Finished executing Ignite \"CacheMatrix\" example.");
+                System.out.println(">>> Lower triangular matrix 3x3 have only 6 positive elements.");
+                System.out.println(">>>");
+            }
+            finally {
+                // Distributed cache could be removed from cluster only by #destroyCache() call.
+                ignite.destroyCache(CACHE_NAME);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/ExampleMatrixStorage.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/ExampleMatrixStorage.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/ExampleMatrixStorage.java
new file mode 100644
index 0000000..260f62d
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/ExampleMatrixStorage.java
@@ -0,0 +1,162 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+
+import org.apache.ignite.math.MatrixStorage;
+
+/**
+ * Example matrix storage, modeled after {@link org.apache.ignite.math.impls.storage.matrix.ArrayMatrixStorage}.
+ */
+class ExampleMatrixStorage implements MatrixStorage {
+    /** Backing data array. */
+    private double[][] data;
+    /** Amount of rows in a matrix storage. */
+    private int rows;
+    /** Amount of columns in a matrix storage. */
+    private int cols;
+
+    /**
+     *
+     */
+    public ExampleMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param rows Amount of rows in a matrix storage.
+     * @param cols Amount of columns in a matrix storage.
+     */
+    ExampleMatrixStorage(int rows, int cols) {
+        assert rows > 0;
+        assert cols > 0;
+
+        this.data = new double[rows][cols];
+        this.rows = rows;
+        this.cols = cols;
+    }
+
+    /**
+     * @param data Backing data array.
+     */
+    ExampleMatrixStorage(double[][] data) {
+        assert data != null;
+        assert data[0] != null;
+
+        this.data = data;
+        this.rows = data.length;
+        this.cols = data[0].length;
+
+        assert rows > 0;
+        assert cols > 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return data[x][y];
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        data[x][y] = v;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[][] data() {
+        return data;
+    }
+
+    /** {@inheritDoc */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+
+        out.writeObject(data);
+    }
+
+    /** {@inheritDoc */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+
+        data = (double[][])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res += res * 37 + rows;
+        res += res * 37 + cols;
+        res += res * 37 + Arrays.deepHashCode(data);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        ExampleMatrixStorage that = (ExampleMatrixStorage)o;
+
+        return Arrays.deepEquals(data, that.data);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixCustomStorageExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixCustomStorageExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixCustomStorageExample.java
new file mode 100644
index 0000000..637b2b4
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixCustomStorageExample.java
@@ -0,0 +1,141 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.AbstractMatrix;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+
+/**
+ * This example shows how to use {@link Matrix} API based on custom {@link MatrixStorage}.
+ */
+public final class MatrixCustomStorageExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Matrix API usage example started.");
+
+        System.out.println("\n>>> Creating a matrix to be transposed.");
+        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
+        Matrix m = new MatrixCustomStorage(data);
+        Matrix transposed = m.transpose();
+
+        System.out.println(">>> Matrix: ");
+        MatrixExampleUtil.print(m);
+        System.out.println(">>> Transposed matrix: ");
+        MatrixExampleUtil.print(transposed);
+
+        MatrixExampleUtil.verifyTransposition(m, transposed);
+
+        System.out.println("\n>>> Creating matrices to be multiplied.");
+        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
+        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
+
+        Matrix m1 = new MatrixCustomStorage(data1);
+        Matrix m2 = new MatrixCustomStorage(data2);
+        Matrix mult = m1.times(m2);
+
+        System.out.println(">>> First matrix: ");
+        MatrixExampleUtil.print(m1);
+        System.out.println(">>> Second matrix: ");
+        MatrixExampleUtil.print(m2);
+        System.out.println(">>> Matrix product: ");
+        MatrixExampleUtil.print(mult);
+
+        System.out.println("\n>>> Calculating matrices determinants.");
+        double det1 = m1.determinant();
+        double det2 = m2.determinant();
+        double detMult = mult.determinant();
+        boolean detMultIsAsExp = Math.abs(detMult - det1 * det2) < 0.0001d;
+
+        System.out.println(">>> First matrix determinant: [" + det1 + "].");
+        System.out.println(">>> Second matrix determinant: [" + det2 + "].");
+        System.out.println(">>> Matrix product determinant: [" + detMult
+            + "], equals product of two other matrices determinants: [" + detMultIsAsExp + "].");
+
+        assert detMultIsAsExp : "Determinant of product matrix [" + detMult
+            + "] should be equal to product of determinants [" + (det1 * det2) + "].";
+
+        System.out.println("\n>>> Matrix API usage example completed.");
+    }
+
+    /**
+     * Example of vector with custom storage, modeled after
+     * {@link org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix}.
+     */
+    static class MatrixCustomStorage extends AbstractMatrix {
+        /**
+         *
+         */
+        public MatrixCustomStorage() {
+            // No-op.
+        }
+
+        /**
+         * @param rows Amount of rows in a matrix.
+         * @param cols Amount of columns in a matrix.
+         */
+        MatrixCustomStorage(int rows, int cols) {
+            assert rows > 0;
+            assert cols > 0;
+
+            setStorage(new ExampleMatrixStorage(rows, cols));
+        }
+
+        /**
+         * @param mtx Source matrix.
+         */
+        MatrixCustomStorage(double[][] mtx) {
+            assert mtx != null;
+
+            setStorage(new ExampleMatrixStorage(mtx));
+        }
+
+        /**
+         * @param orig original matrix to be copied.
+         */
+        private MatrixCustomStorage(MatrixCustomStorage orig) {
+            assert orig != null;
+
+            setStorage(new ExampleMatrixStorage(orig.rowSize(), orig.columnSize()));
+
+            assign(orig);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Matrix copy() {
+            return new MatrixCustomStorage(this);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Matrix like(int rows, int cols) {
+            return new MatrixCustomStorage(rows, cols);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Vector likeVector(int crd) {
+            return new DenseLocalOnHeapVector(crd);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExample.java
new file mode 100644
index 0000000..58cedab
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExample.java
@@ -0,0 +1,79 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+
+/**
+ * This example shows how to use {@link Matrix} API.
+ */
+public final class MatrixExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Basic Matrix API usage example started.");
+
+        System.out.println("\n>>> Creating a matrix to be transposed.");
+        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
+        Matrix m = new DenseLocalOnHeapMatrix(data);
+        Matrix transposed = m.transpose();
+
+        System.out.println(">>> Matrix: ");
+        MatrixExampleUtil.print(m);
+        System.out.println(">>> Transposed matrix: ");
+        MatrixExampleUtil.print(transposed);
+
+        MatrixExampleUtil.verifyTransposition(m, transposed);
+
+        System.out.println("\n>>> Creating matrices to be multiplied.");
+        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
+        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
+
+        Matrix m1 = new DenseLocalOnHeapMatrix(data1);
+        Matrix m2 = new DenseLocalOnHeapMatrix(data2);
+        Matrix mult = m1.times(m2);
+
+        System.out.println(">>> First matrix: ");
+        MatrixExampleUtil.print(m1);
+        System.out.println(">>> Second matrix: ");
+        MatrixExampleUtil.print(m2);
+        System.out.println(">>> Matrix product: ");
+        MatrixExampleUtil.print(mult);
+
+        System.out.println("\n>>> Calculating matrices determinants.");
+        double det1 = m1.determinant();
+        double det2 = m2.determinant();
+        double detMult = mult.determinant();
+        boolean detMultIsAsExp = Math.abs(detMult - det1 * det2) < 0.0001d;
+
+        System.out.println(">>> First matrix determinant: [" + det1 + "].");
+        System.out.println(">>> Second matrix determinant: [" + det2 + "].");
+        System.out.println(">>> Matrix product determinant: [" + detMult
+            + "], equals product of two other matrices determinants: [" + detMultIsAsExp + "].");
+
+        assert detMultIsAsExp : "Determinant of product matrix [" + detMult
+            + "] should be equal to product of determinants [" + (det1 * det2) + "].";
+
+        System.out.println("\n>>> Basic Matrix API usage example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExampleUtil.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExampleUtil.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExampleUtil.java
new file mode 100644
index 0000000..f3b4a62
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/MatrixExampleUtil.java
@@ -0,0 +1,52 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Tracer;
+
+/**
+ * Utility functions for {@link Matrix} API examples.
+ */
+class MatrixExampleUtil {
+    /**
+     * Verifies matrix transposition.
+     *
+     * @param m Original matrix.
+     * @param transposed Transposed matrix.
+     */
+    static void verifyTransposition(Matrix m, Matrix transposed) {
+        for (int row = 0; row < m.rowSize(); row++)
+            for (int col = 0; col < m.columnSize(); col++) {
+                double val = m.get(row, col);
+                double valTransposed = transposed.get(col, row);
+
+                assert val == valTransposed : "Values not equal at (" + row + "," + col
+                    + "), original: " + val + " transposed: " + valTransposed;
+            }
+    }
+
+    /**
+     * Prints matrix values to console.
+     *
+     * @param m Matrix to print.
+     */
+    static void print(Matrix m) {
+        Tracer.showAscii(m);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/OffHeapMatrixExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/OffHeapMatrixExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/OffHeapMatrixExample.java
new file mode 100644
index 0000000..bf99da1
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/OffHeapMatrixExample.java
@@ -0,0 +1,84 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOffHeapMatrix;
+
+/**
+ * This example shows how to use off-heap {@link Matrix} API.
+ */
+public final class OffHeapMatrixExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Off-heap matrix API usage example started.");
+
+        System.out.println("\n>>> Creating a matrix to be transposed.");
+        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
+        Matrix m = new DenseLocalOffHeapMatrix(data.length, data[0].length);
+        m.assign(data);
+        Matrix transposed = m.transpose();
+
+        System.out.println(">>> Matrix: ");
+        MatrixExampleUtil.print(m);
+        System.out.println(">>> Transposed matrix: ");
+        MatrixExampleUtil.print(transposed);
+
+        MatrixExampleUtil.verifyTransposition(m, transposed);
+
+        System.out.println("\n>>> Creating matrices to be multiplied.");
+        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
+        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
+
+        Matrix m1 = new DenseLocalOffHeapMatrix(data1.length, data1[0].length);
+        Matrix m2 = new DenseLocalOffHeapMatrix(data2.length, data2[0].length);
+
+        m1.assign(data1);
+        m2.assign(data2);
+
+        Matrix mult = m1.times(m2);
+
+        System.out.println(">>> First matrix: ");
+        MatrixExampleUtil.print(m1);
+        System.out.println(">>> Second matrix: ");
+        MatrixExampleUtil.print(m2);
+        System.out.println(">>> Matrix product: ");
+        MatrixExampleUtil.print(mult);
+
+        System.out.println("\n>>> Calculating matrices determinants.");
+        double det1 = m1.determinant();
+        double det2 = m2.determinant();
+        double detMult = mult.determinant();
+        boolean detMultIsAsExp = Math.abs(detMult - det1 * det2) < 0.0001d;
+
+        System.out.println(">>> First matrix determinant: [" + det1 + "].");
+        System.out.println(">>> Second matrix determinant: [" + det2 + "].");
+        System.out.println(">>> Matrix product determinant: [" + detMult
+            + "], equals product of two other matrices determinants: [" + detMultIsAsExp + "].");
+
+        assert detMultIsAsExp : "Determinant of product matrix [" + detMult
+            + "] should be equal to product of determinants [" + (det1 * det2) + "].";
+
+        System.out.println("\n>>> Off-heap matrix API usage example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseDistributedMatrixExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseDistributedMatrixExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseDistributedMatrixExample.java
new file mode 100644
index 0000000..7e71eb0
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseDistributedMatrixExample.java
@@ -0,0 +1,65 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.impls.matrix.SparseDistributedMatrix;
+import org.apache.ignite.thread.IgniteThread;
+
+/**
+ * This example shows how to use {@link SparseDistributedMatrix} API.
+ */
+public class SparseDistributedMatrixExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) throws InterruptedException {
+        System.out.println();
+        System.out.println(">>> Sparse distributed matrix API usage example started.");
+        // Start ignite grid.
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println(">>> Ignite grid started.");
+            // Create IgniteThread, we must work with SparseDistributedMatrix inside IgniteThread
+            // because we create ignite cache internally.
+            IgniteThread igniteThread = new IgniteThread(ignite.configuration().getIgniteInstanceName(), SparseDistributedMatrixExample.class.getSimpleName(), () -> {
+
+                double[][] testValues = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}};
+
+                System.out.println(">>> Create new SparseDistributedMatrix inside IgniteThread.");
+                // Create SparseDistributedMatrix, new cache will be created automagically.
+                SparseDistributedMatrix distributedMatrix = new SparseDistributedMatrix(testValues.length, testValues[0].length,
+                    StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+                distributedMatrix.assign(testValues);
+
+                assert distributedMatrix.sum() == 3.0;
+
+                System.out.println(">>> Destroy SparseDistributedMatrix after using.");
+                // Destroy internal cache.
+                distributedMatrix.destroy();
+            });
+
+            igniteThread.start();
+
+            igniteThread.join();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseMatrixExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseMatrixExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseMatrixExample.java
new file mode 100644
index 0000000..ba4e72b
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/SparseMatrixExample.java
@@ -0,0 +1,84 @@
+/*
+ * 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.examples.java8.math.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.matrix.SparseLocalOnHeapMatrix;
+
+/**
+ * This example shows how to use sparse {@link Matrix} API.
+ */
+public final class SparseMatrixExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Sparse matrix API usage example started.");
+
+        System.out.println("\n>>> Creating a matrix to be transposed.");
+        double[][] data = new double[][] {{1, 2, 3}, {4, 5, 6}};
+        Matrix m = new SparseLocalOnHeapMatrix(data.length, data[0].length);
+        m.assign(data);
+        Matrix transposed = m.transpose();
+
+        System.out.println(">>> Matrix: ");
+        MatrixExampleUtil.print(m);
+        System.out.println(">>> Transposed matrix: ");
+        MatrixExampleUtil.print(transposed);
+
+        MatrixExampleUtil.verifyTransposition(m, transposed);
+
+        System.out.println("\n>>> Creating matrices to be multiplied.");
+        double[][] data1 = new double[][] {{1, 2}, {3, 4}};
+        double[][] data2 = new double[][] {{5, 6}, {7, 8}};
+
+        Matrix m1 = new SparseLocalOnHeapMatrix(data1.length, data1[0].length);
+        Matrix m2 = new SparseLocalOnHeapMatrix(data2.length, data2[0].length);
+
+        m1.assign(data1);
+        m2.assign(data2);
+
+        Matrix mult = m1.times(m2);
+
+        System.out.println(">>> First matrix: ");
+        MatrixExampleUtil.print(m1);
+        System.out.println(">>> Second matrix: ");
+        MatrixExampleUtil.print(m2);
+        System.out.println(">>> Matrix product: ");
+        MatrixExampleUtil.print(mult);
+
+        System.out.println("\n>>> Calculating matrices determinants.");
+        double det1 = m1.determinant();
+        double det2 = m2.determinant();
+        double detMult = mult.determinant();
+        boolean detMultIsAsExp = Math.abs(detMult - det1 * det2) < 0.0001d;
+
+        System.out.println(">>> First matrix determinant: [" + det1 + "].");
+        System.out.println(">>> Second matrix determinant: [" + det2 + "].");
+        System.out.println(">>> Matrix product determinant: [" + detMult
+            + "], equals product of two other matrices determinants: [" + detMultIsAsExp + "].");
+
+        assert detMultIsAsExp : "Determinant of product matrix [" + detMult
+            + "] should be equal to product of determinants [" + (det1 * det2) + "].";
+
+        System.out.println("\n>>> Sparse matrix API usage example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/package-info.java
new file mode 100644
index 0000000..9154518
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/matrix/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Core algebra matrix examples.
+ */
+package org.apache.ignite.examples.java8.math.matrix;

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/package-info.java
new file mode 100644
index 0000000..90dae33
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Core algebra examples.
+ */
+package org.apache.ignite.examples.java8.math;

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/TracerExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/TracerExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/TracerExample.java
new file mode 100644
index 0000000..f6e1baa
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/TracerExample.java
@@ -0,0 +1,63 @@
+/*
+ * 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.examples.java8.math.tracer;
+
+import java.awt.Color;
+import java.io.IOException;
+import org.apache.ignite.math.Tracer;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+
+/**
+ * Example of using {@link Tracer} utility API.
+ */
+public class TracerExample {
+    /**
+     * Double to color mapper example.
+     */
+    private static final Tracer.ColorMapper COLOR_MAPPER = d -> {
+        if (d <= 0.33)
+            return Color.RED;
+        else if (d <= 0.66)
+            return Color.GREEN;
+        else
+            return Color.BLUE;
+    };
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) throws IOException {
+        System.out.println(">>> Tracer utility example started.");
+
+        // Tracer is a simple utility class that allows pretty-printing of matrices/vectors
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
+            {1.12345, 2.12345},
+            {3.12345, 4.12345}
+        });
+
+        System.out.println("\n>>> Tracer output to console in ASCII.");
+        Tracer.showAscii(m, "%.3g");
+
+        System.out.println("\n>>> Tracer output to browser in HTML.");
+        Tracer.showHtml(m, COLOR_MAPPER);
+
+        System.out.println("\n>>> Tracer utility example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/package-info.java
new file mode 100644
index 0000000..5a08504
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/tracer/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Core algebra tracer example.
+ */
+package org.apache.ignite.examples.java8.math.tracer;

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/CacheVectorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/CacheVectorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/CacheVectorExample.java
new file mode 100644
index 0000000..dd0fcb3
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/CacheVectorExample.java
@@ -0,0 +1,102 @@
+/*
+ * 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.examples.java8.math.vector;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.math.IdentityValueMapper;
+import org.apache.ignite.math.ValueMapper;
+import org.apache.ignite.math.VectorKeyMapper;
+import org.apache.ignite.math.impls.vector.CacheVector;
+
+/**
+ * This example shows how to use {@link CacheVector} API.
+ */
+public class CacheVectorExample {
+    /** */ private static final String CACHE_NAME = CacheVectorExample.class.getSimpleName();
+    /** */ private static final int CARDINALITY = 10;
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+            System.out.println();
+            System.out.println(">>> CacheVector example started.");
+
+            CacheConfiguration<Integer, Double> cfg = new CacheConfiguration<>();
+
+            cfg.setName(CACHE_NAME);
+
+            try (IgniteCache<Integer, Double> cache = ignite.getOrCreateCache(cfg)) {
+                double[] testValues1 = {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+                double[] testValues2 = {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+
+                ValueMapper valMapper = new IdentityValueMapper();
+
+                // Map vector element index to cache keys.
+                VectorKeyMapper<Integer> keyMapper1 = new VectorKeyMapper<Integer>() {
+                    @Override public Integer apply(int i) {
+                        return i;
+                    }
+
+                    @Override public boolean isValid(Integer integer) {
+                        return integer >= 0 && CARDINALITY > integer;
+                    }
+                };
+
+                // Map vector element index to cache keys with shift.
+                VectorKeyMapper<Integer> keyMapper2 = new VectorKeyMapper<Integer>() {
+                    @Override public Integer apply(int i) {
+                        return i + CARDINALITY;
+                    }
+
+                    @Override public boolean isValid(Integer integer) {
+                        return integer >= 0 && CARDINALITY > integer;
+                    }
+                };
+
+                // Create two cache vectors over one cache.
+                CacheVector cacheVector1 = new CacheVector(CARDINALITY, cache, keyMapper1, valMapper);
+                System.out.println(">>> First cache vector created.");
+
+                CacheVector cacheVector2 = new CacheVector(CARDINALITY, cache, keyMapper2, valMapper);
+                System.out.println(">>> Second cache vector created.");
+
+                cacheVector1.assign(testValues1);
+                cacheVector2.assign(testValues2);
+
+                // Dot product for orthogonal vectors is 0.0.
+                assert cacheVector1.dot(cacheVector2) == 0.0;
+
+                System.out.println(">>>");
+                System.out.println(">>> Finished executing Ignite \"CacheVector\" example.");
+                System.out.println(">>> Dot product is 0.0 for orthogonal vectors.");
+                System.out.println(">>>");
+            }
+            finally {
+                // Distributed cache could be removed from cluster only by #destroyCache() call.
+                ignite.destroyCache(CACHE_NAME);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/ExampleVectorStorage.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/ExampleVectorStorage.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/ExampleVectorStorage.java
new file mode 100644
index 0000000..3b88e0a
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/ExampleVectorStorage.java
@@ -0,0 +1,126 @@
+/*
+ * 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.examples.java8.math.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * Example vector storage, modeled after {@link org.apache.ignite.math.impls.storage.vector.ArrayVectorStorage}.
+ */
+class ExampleVectorStorage implements VectorStorage {
+    /** */
+    private double[] data;
+
+    /**
+     * IMPL NOTE required by Externalizable
+     */
+    public ExampleVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param data backing data array.
+     */
+    ExampleVectorStorage(double[] data) {
+        assert data != null;
+
+        this.data = data;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return data == null ? 0 : data.length;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return data[i];
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        data[i] = v;
+    }
+
+    /** {@inheritDoc}} */
+    @Override public boolean isArrayBased() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[] data() {
+        return data;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(data);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        data = (double[])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + Arrays.hashCode(data);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        ExampleVectorStorage that = (ExampleVectorStorage)obj;
+
+        return Arrays.equals(data, (that.data));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/OffHeapVectorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/OffHeapVectorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/OffHeapVectorExample.java
new file mode 100644
index 0000000..7184245
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/OffHeapVectorExample.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.examples.java8.math.vector;
+
+import java.util.Arrays;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.vector.DenseLocalOffHeapVector;
+
+/**
+ * This example shows how to use off-heap {@link Vector} API.
+ */
+public final class OffHeapVectorExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Off-heap vector API usage example started.");
+
+        System.out.println("\n>>> Creating perpendicular off-heap vectors.");
+        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
+        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
+
+        Vector v1 = new DenseLocalOffHeapVector(data1.length);
+        Vector v2 = new DenseLocalOffHeapVector(data2.length);
+
+        v1.assign(data1);
+        v2.assign(data2);
+
+        System.out.println(">>> First vector: " + Arrays.toString(data1));
+        System.out.println(">>> Second vector: " + Arrays.toString(data2));
+
+        double dotProduct = v1.dot(v2);
+        boolean dotProductIsAsExp = dotProduct == 0;
+
+        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
+            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
+
+        assert dotProductIsAsExp : "Expect dot product of perpendicular vectors to be 0.";
+
+        Vector hypotenuse = v1.plus(v2);
+
+        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
+
+        double lenSquared1 = v1.getLengthSquared();
+        double lenSquared2 = v2.getLengthSquared();
+        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
+
+        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
+
+        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
+        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
+        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
+            + "], equals sum of squared lengths of two original vectors as expected: ["
+            + lenSquaredHypotenuseIsAsExp + "].");
+
+        assert lenSquaredHypotenuseIsAsExp : "Expect squared length of hypotenuse to be as per Pythagorean theorem.";
+
+        System.out.println("\n>>> Off-heap vector API usage example completed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/SparseVectorExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/SparseVectorExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/SparseVectorExample.java
new file mode 100644
index 0000000..79e0567
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/math/vector/SparseVectorExample.java
@@ -0,0 +1,80 @@
+/*
+ * 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.examples.java8.math.vector;
+
+import java.util.Arrays;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.vector.SparseLocalVector;
+
+import static org.apache.ignite.math.StorageConstants.RANDOM_ACCESS_MODE;
+
+/**
+ * This example shows how to use sparse {@link Vector} API.
+ */
+public final class SparseVectorExample {
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     */
+    public static void main(String[] args) {
+        System.out.println();
+        System.out.println(">>> Sparse vector API usage example started.");
+
+        System.out.println("\n>>> Creating perpendicular sparse vectors.");
+        double[] data1 = new double[] {1, 0, 3, 0, 5, 0};
+        double[] data2 = new double[] {0, 2, 0, 4, 0, 6};
+
+        Vector v1 = new SparseLocalVector(data1.length, RANDOM_ACCESS_MODE);
+        Vector v2 = new SparseLocalVector(data2.length, RANDOM_ACCESS_MODE);
+
+        v1.assign(data1);
+        v2.assign(data2);
+
+        System.out.println(">>> First vector: " + Arrays.toString(data1));
+        System.out.println(">>> Second vector: " + Arrays.toString(data2));
+
+        double dotProduct = v1.dot(v2);
+        boolean dotProductIsAsExp = dotProduct == 0;
+
+        System.out.println("\n>>> Dot product of vectors: [" + dotProduct
+            + "], it is 0 as expected: [" + dotProductIsAsExp + "].");
+
+        assert dotProductIsAsExp : "Expect dot product of perpendicular vectors to be 0.";
+
+        Vector hypotenuse = v1.plus(v2);
+
+        System.out.println("\n>>> Hypotenuse (sum of vectors): " + Arrays.toString(hypotenuse.getStorage().data()));
+
+        double lenSquared1 = v1.getLengthSquared();
+        double lenSquared2 = v2.getLengthSquared();
+        double lenSquaredHypotenuse = hypotenuse.getLengthSquared();
+
+        boolean lenSquaredHypotenuseIsAsExp = lenSquaredHypotenuse == lenSquared1 + lenSquared2;
+
+        System.out.println(">>> Squared length of first vector: [" + lenSquared1 + "].");
+        System.out.println(">>> Squared length of second vector: [" + lenSquared2 + "].");
+        System.out.println(">>> Squared length of hypotenuse: [" + lenSquaredHypotenuse
+            + "], equals sum of squared lengths of two original vectors as expected: ["
+            + lenSquaredHypotenuseIsAsExp + "].");
+
+        assert lenSquaredHypotenuseIsAsExp : "Expect squared length of hypotenuse to be as per Pythagorean theorem.";
+
+        System.out.println("\n>>> Sparse vector API usage example completed.");
+    }
+}


[25/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/decompositions/CholeskyDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/decompositions/CholeskyDecompositionTest.java b/modules/math/src/test/java/org/apache/ignite/math/decompositions/CholeskyDecompositionTest.java
new file mode 100644
index 0000000..fa311e0
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/decompositions/CholeskyDecompositionTest.java
@@ -0,0 +1,158 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.NonPositiveDefiniteMatrixException;
+import org.apache.ignite.math.exceptions.NonSymmetricMatrixException;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.matrix.PivotedMatrixView;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/** */
+public class CholeskyDecompositionTest {
+    /** */
+    @Test
+    public void basicTest() {
+        basicTest(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        }));
+    }
+
+    /**
+     * Test for {@link DecompositionSupport} features.
+     */
+    @Test
+    public void decompositionSupportTest() {
+        basicTest(new PivotedMatrixView(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        })));
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullMatrixTest() {
+        new CholeskyDecomposition(null);
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void wrongMatrixSizeTest() {
+        new CholeskyDecomposition(new DenseLocalOnHeapMatrix(2, 3));
+    }
+
+    /** */
+    @Test(expected = NonSymmetricMatrixException.class)
+    public void nonSymmetricMatrixTest() {
+        new CholeskyDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 10.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {-10.0d, -1.0d, 2.0d}
+        }));
+    }
+
+    /** */
+    @Test(expected = NonPositiveDefiniteMatrixException.class)
+    public void nonAbsPositiveMatrixTest() {
+        new CholeskyDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 0.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        }));
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void solveWrongVectorSizeTest() {
+        new CholeskyDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        })).solve(new DenseLocalOnHeapVector(2));
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void solveWrongMatrixSizeTest() {
+        new CholeskyDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        })).solve(new DenseLocalOnHeapMatrix(2, 3));
+    }
+
+    /** */
+    private void basicTest(Matrix m) {
+        // This decomposition is useful when dealing with systems of linear equations of the form
+        // m x = b where m is a Hermitian matrix.
+        // For such systems Cholesky decomposition provides
+        // more effective method of solving compared to LU decomposition.
+        // Suppose we want to solve system
+        // m x = b for various bs. Then after we computed Cholesky decomposition, we can feed various bs
+        // as a matrix of the form
+        // (b1, b2, ..., bm)
+        // to the method Cholesky::solve which returns solutions in the form
+        // (sol1, sol2, ..., solm)
+        CholeskyDecomposition dec = new CholeskyDecomposition(m);
+        assertEquals("Unexpected value for decomposition determinant.",
+            4d, dec.getDeterminant(), 0d);
+
+        Matrix l = dec.getL();
+        Matrix lt = dec.getLT();
+
+        assertNotNull("Matrix l is expected to be not null.", l);
+        assertNotNull("Matrix lt is expected to be not null.", lt);
+
+        for (int row = 0; row < l.rowSize(); row++)
+            for (int col = 0; col < l.columnSize(); col++)
+                assertEquals("Unexpected value transposed matrix at (" + row + "," + col + ").",
+                    l.get(row, col), lt.get(col, row), 0d);
+
+        Matrix bs = new DenseLocalOnHeapMatrix(new double[][] {
+            {4.0, -6.0, 7.0},
+            {1.0, 1.0, 1.0}
+        }).transpose();
+        Matrix sol = dec.solve(bs);
+
+        assertNotNull("Solution matrix is expected to be not null.", sol);
+        assertEquals("Solution rows are not as expected.", bs.rowSize(), sol.rowSize());
+        assertEquals("Solution columns are not as expected.", bs.columnSize(), sol.columnSize());
+
+        for (int i = 0; i < sol.columnSize(); i++)
+            assertNotNull("Solution matrix column is expected to be not null at index " + i, sol.viewColumn(i));
+
+        Vector b = new DenseLocalOnHeapVector(new double[] {4.0, -6.0, 7.0});
+        Vector solVec = dec.solve(b);
+
+        for (int idx = 0; idx < b.size(); idx++)
+            assertEquals("Unexpected value solution vector at " + idx,
+                b.get(idx), solVec.get(idx), 0d);
+
+        dec.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/decompositions/EigenDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/decompositions/EigenDecompositionTest.java b/modules/math/src/test/java/org/apache/ignite/math/decompositions/EigenDecompositionTest.java
new file mode 100644
index 0000000..e4e7b15
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/decompositions/EigenDecompositionTest.java
@@ -0,0 +1,193 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link EigenDecomposition}
+ */
+public class EigenDecompositionTest {
+    /** */
+    private static final double EPSILON = 1e-11;
+
+    /** */
+    @Test
+    public void testMatrixWithRealEigenvalues() {
+        test(new double[][] {
+                {1.0d, 0.0d, 0.0d, 0.0d},
+                {0.0d, 1.0d, 0.0d, 0.0d},
+                {0.0d, 0.0d, 2.0d, 0.0d},
+                {1.0d, 1.0d, 0.0d, 2.0d}},
+            new double[] {1, 2, 2, 1});
+    }
+
+    /** */
+    @Test
+    public void testSymmetricMatrix() {
+        EigenDecomposition decomposition = new EigenDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {1.0d, 0.0d, 0.0d, 1.0d},
+            {0.0d, 1.0d, 0.0d, 1.0d},
+            {0.0d, 0.0d, 2.0d, 0.0d},
+            {1.0d, 1.0d, 0.0d, 2.0d}}));
+
+        Matrix d = decomposition.getD();
+        Matrix v = decomposition.getV();
+
+        assertNotNull("Matrix d is expected to be not null.", d);
+        assertNotNull("Matrix v is expected to be not null.", v);
+
+        assertEquals("Unexpected rows in d matrix.", 4, d.rowSize());
+        assertEquals("Unexpected cols in d matrix.", 4, d.columnSize());
+
+        assertEquals("Unexpected rows in v matrix.", 4, v.rowSize());
+        assertEquals("Unexpected cols in v matrix.", 4, v.columnSize());
+
+        assertIsDiagonalNonZero(d);
+
+        decomposition.destroy();
+    }
+
+    /** */
+    @Test
+    public void testNonSquareMatrix() {
+        EigenDecomposition decomposition = new EigenDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {1.0d, 0.0d, 0.0d},
+            {0.0d, 1.0d, 0.0d},
+            {0.0d, 0.0d, 2.0d},
+            {1.0d, 1.0d, 0.0d}}));
+        // todo find out why decomposition of 3X4 matrix throws row index exception
+
+        Matrix d = decomposition.getD();
+        Matrix v = decomposition.getV();
+
+        assertNotNull("Matrix d is expected to be not null.", d);
+        assertNotNull("Matrix v is expected to be not null.", v);
+
+        assertEquals("Unexpected rows in d matrix.", 4, d.rowSize());
+        assertEquals("Unexpected cols in d matrix.", 4, d.columnSize());
+
+        assertEquals("Unexpected rows in v matrix.", 4, v.rowSize());
+        assertEquals("Unexpected cols in v matrix.", 3, v.columnSize());
+
+        assertIsDiagonal(d, true);
+
+        decomposition.destroy();
+    }
+
+    /** */
+    private void test(double[][] mRaw, double[] expRealEigenValues) {
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(mRaw);
+        EigenDecomposition decomposition = new EigenDecomposition(m);
+
+        Matrix d = decomposition.getD();
+        Matrix v = decomposition.getV();
+
+        assertIsDiagonalNonZero(d);
+
+        // check that d's diagonal consists of eigenvalues of m.
+        assertDiagonalConsistsOfEigenvalues(m, d, v);
+
+        // m = v d v^{-1} is equivalent to
+        // m v = v d
+        assertMatricesAreEqual(m.times(v), v.times(d));
+
+        assertEigenvalues(decomposition, expRealEigenValues);
+
+        decomposition.destroy();
+    }
+
+    /** */
+    private void assertEigenvalues(EigenDecomposition decomposition, double[] expRealEigenValues) {
+        Vector real = decomposition.getRealEigenValues();
+        Vector imag = decomposition.getImagEigenvalues();
+
+        assertEquals("Real values size differs from expected.", expRealEigenValues.length, real.size());
+        assertEquals("Imag values size differs from expected.", expRealEigenValues.length, imag.size());
+
+        for (int idx = 0; idx < expRealEigenValues.length; idx++) {
+            assertEquals("Real eigen value differs from expected at " + idx,
+                expRealEigenValues[idx], real.get(idx), 0d);
+
+            assertEquals("Imag eigen value differs from expected at " + idx,
+                0d, imag.get(idx), 0d);
+        }
+
+    }
+
+    /** */
+    private void assertDiagonalConsistsOfEigenvalues(DenseLocalOnHeapMatrix m, Matrix d, Matrix v) {
+        int n = m.columnSize();
+        for (int i = 0; i < n; i++) {
+            Vector eigenVector = v.viewColumn(i);
+            double eigenVal = d.getX(i, i);
+            assertVectorsAreEqual(m.times(eigenVector), eigenVector.times(eigenVal));
+        }
+
+    }
+
+    /** */
+    private void assertMatricesAreEqual(Matrix exp, Matrix actual) {
+        assertTrue("The row sizes of matrices are not equal", exp.rowSize() == actual.rowSize());
+        assertTrue("The col sizes of matrices are not equal", exp.columnSize() == actual.columnSize());
+
+        // Since matrix is square, we need only one dimension
+        int n = exp.columnSize();
+
+        for (int i = 0; i < n; i++)
+            for (int j = 0; j < n; j++)
+                assertEquals("Values should be equal", exp.getX(i, j), actual.getX(i, j), EPSILON);
+    }
+
+    /** */
+    private void assertVectorsAreEqual(Vector exp, Vector actual) {
+        assertTrue("Vectors sizes are not equal", exp.size() == actual.size());
+
+        // Since matrix is square, we need only one dimension
+        int n = exp.size();
+
+        for (int i = 0; i < n; i++)
+            assertEquals("Values should be equal", exp.getX(i), actual.getX(i), EPSILON);
+    }
+
+    /** */
+    private void assertIsDiagonalNonZero(Matrix m) {
+        assertIsDiagonal(m, false);
+    }
+
+    /** */
+    private void assertIsDiagonal(Matrix m, boolean zeroesAllowed) {
+        // Since matrix is square, we need only one dimension
+        int n = m.columnSize();
+
+        assertEquals("Diagonal matrix is not square", n, m.rowSize());
+
+        for (int i = 0; i < n; i++)
+            for (int j = 0; j < n; j++)
+                assertTrue("Matrix is not diagonal, violation at (" + i + "," + j + ")",
+                    ((i == j) && (zeroesAllowed || m.getX(i, j) != 0))
+                        || ((i != j) && m.getX(i, j) == 0));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/decompositions/LUDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/decompositions/LUDecompositionTest.java b/modules/math/src/test/java/org/apache/ignite/math/decompositions/LUDecompositionTest.java
new file mode 100644
index 0000000..0feb48f
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/decompositions/LUDecompositionTest.java
@@ -0,0 +1,250 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.SingularMatrixException;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.matrix.PivotedMatrixView;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link LUDecomposition}.
+ */
+public class LUDecompositionTest {
+    /** */
+    private Matrix testL;
+    /** */
+    private Matrix testU;
+    /** */
+    private Matrix testP;
+    /** */
+    private Matrix testMatrix;
+    /** */
+    private int[] rawPivot;
+
+    /** */
+    @Before
+    public void setUp() {
+        double[][] rawMatrix = new double[][] {
+            {2.0d, 1.0d, 1.0d, 0.0d},
+            {4.0d, 3.0d, 3.0d, 1.0d},
+            {8.0d, 7.0d, 9.0d, 5.0d},
+            {6.0d, 7.0d, 9.0d, 8.0d}};
+        double[][] rawL = {
+            {1.0d, 0.0d, 0.0d, 0.0d},
+            {3.0d / 4.0d, 1.0d, 0.0d, 0.0d},
+            {1.0d / 2.0d, -2.0d / 7.0d, 1.0d, 0.0d},
+            {1.0d / 4.0d, -3.0d / 7.0d, 1.0d / 3.0d, 1.0d}};
+        double[][] rawU = {
+            {8.0d, 7.0d, 9.0d, 5.0d},
+            {0.0d, 7.0d / 4.0d, 9.0d / 4.0d, 17.0d / 4.0d},
+            {0.0d, 0.0d, -6.0d / 7.0d, -2.0d / 7.0d},
+            {0.0d, 0.0d, 0.0d, 2.0d / 3.0d}};
+        double[][] rawP = new double[][] {
+            {0, 0, 1.0d, 0},
+            {0, 0, 0, 1.0d},
+            {0, 1.0d, 0, 0},
+            {1.0d, 0, 0, 0}};
+
+        rawPivot = new int[] {3, 4, 2, 1};
+
+        testMatrix = new DenseLocalOnHeapMatrix(rawMatrix);
+        testL = new DenseLocalOnHeapMatrix(rawL);
+        testU = new DenseLocalOnHeapMatrix(rawU);
+        testP = new DenseLocalOnHeapMatrix(rawP);
+    }
+
+    /** */
+    @Test
+    public void getL() throws Exception {
+        Matrix luDecompositionL = new LUDecomposition(testMatrix).getL();
+
+        assertEquals("Unexpected row size.", testL.rowSize(), luDecompositionL.rowSize());
+        assertEquals("Unexpected column size.", testL.columnSize(), luDecompositionL.columnSize());
+
+        for (int i = 0; i < testL.rowSize(); i++)
+            for (int j = 0; j < testL.columnSize(); j++)
+                assertEquals("Unexpected value at (" + i + "," + j + ").",
+                    testL.getX(i, j), luDecompositionL.getX(i, j), 0.0000001d);
+
+        luDecompositionL.destroy();
+    }
+
+    /** */
+    @Test
+    public void getU() throws Exception {
+        Matrix luDecompositionU = new LUDecomposition(testMatrix).getU();
+
+        assertEquals("Unexpected row size.", testU.rowSize(), luDecompositionU.rowSize());
+        assertEquals("Unexpected column size.", testU.columnSize(), luDecompositionU.columnSize());
+
+        for (int i = 0; i < testU.rowSize(); i++)
+            for (int j = 0; j < testU.columnSize(); j++)
+                assertEquals("Unexpected value at (" + i + "," + j + ").",
+                    testU.getX(i, j), luDecompositionU.getX(i, j), 0.0000001d);
+
+        luDecompositionU.destroy();
+    }
+
+    /** */
+    @Test
+    public void getP() throws Exception {
+        Matrix luDecompositionP = new LUDecomposition(testMatrix).getP();
+
+        assertEquals("Unexpected row size.", testP.rowSize(), luDecompositionP.rowSize());
+        assertEquals("Unexpected column size.", testP.columnSize(), luDecompositionP.columnSize());
+
+        for (int i = 0; i < testP.rowSize(); i++)
+            for (int j = 0; j < testP.columnSize(); j++)
+                assertEquals("Unexpected value at (" + i + "," + j + ").",
+                    testP.getX(i, j), luDecompositionP.getX(i, j), 0.0000001d);
+
+        luDecompositionP.destroy();
+    }
+
+    /** */
+    @Test
+    public void getPivot() throws Exception {
+        Vector pivot = new LUDecomposition(testMatrix).getPivot();
+
+        assertEquals("Unexpected pivot size.", rawPivot.length, pivot.size());
+
+        for (int i = 0; i < testU.rowSize(); i++)
+            assertEquals("Unexpected value at " + i, rawPivot[i], (int)pivot.get(i) + 1);
+    }
+
+    /**
+     * Test for {@link DecompositionSupport} features.
+     */
+    @Test
+    public void decompositionSupportTest() {
+        LUDecomposition dec = new LUDecomposition(new PivotedMatrixView(testMatrix));
+        Matrix luDecompositionL = dec.getL();
+
+        assertEquals("Unexpected L row size.", testL.rowSize(), luDecompositionL.rowSize());
+        assertEquals("Unexpected L column size.", testL.columnSize(), luDecompositionL.columnSize());
+
+        for (int i = 0; i < testL.rowSize(); i++)
+            for (int j = 0; j < testL.columnSize(); j++)
+                assertEquals("Unexpected L value at (" + i + "," + j + ").",
+                    testL.getX(i, j), luDecompositionL.getX(i, j), 0.0000001d);
+
+        Matrix luDecompositionU = dec.getU();
+
+        assertEquals("Unexpected U row size.", testU.rowSize(), luDecompositionU.rowSize());
+        assertEquals("Unexpected U column size.", testU.columnSize(), luDecompositionU.columnSize());
+
+        for (int i = 0; i < testU.rowSize(); i++)
+            for (int j = 0; j < testU.columnSize(); j++)
+                assertEquals("Unexpected U value at (" + i + "," + j + ").",
+                    testU.getX(i, j), luDecompositionU.getX(i, j), 0.0000001d);
+
+        Matrix luDecompositionP = dec.getP();
+
+        assertEquals("Unexpected P row size.", testP.rowSize(), luDecompositionP.rowSize());
+        assertEquals("Unexpected P column size.", testP.columnSize(), luDecompositionP.columnSize());
+
+        for (int i = 0; i < testP.rowSize(); i++)
+            for (int j = 0; j < testP.columnSize(); j++)
+                assertEquals("Unexpected P value at (" + i + "," + j + ").",
+                    testP.getX(i, j), luDecompositionP.getX(i, j), 0.0000001d);
+
+        dec.destroy();
+    }
+
+    /** */
+    @Test
+    public void singularDeterminant() throws Exception {
+        assertEquals("Unexpected determinant for singular matrix decomposition.",
+            0d, new LUDecomposition(new DenseLocalOnHeapMatrix(2, 2)).determinant(), 0d);
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void solveVecWrongSize() throws Exception {
+        new LUDecomposition(testMatrix).solve(new DenseLocalOnHeapVector(testMatrix.rowSize() + 1));
+    }
+
+    /** */
+    @Test(expected = SingularMatrixException.class)
+    public void solveVecSingularMatrix() throws Exception {
+        new LUDecomposition(new DenseLocalOnHeapMatrix(testMatrix.rowSize(), testMatrix.rowSize()))
+            .solve(new DenseLocalOnHeapVector(testMatrix.rowSize()));
+    }
+
+    /** */
+    @Test
+    public void solveVec() throws Exception {
+        Vector sol = new LUDecomposition(new PivotedMatrixView(testMatrix))
+            .solve(new DenseLocalOnHeapVector(testMatrix.rowSize()));
+
+        assertEquals("Wrong solution vector size.", testMatrix.rowSize(), sol.size());
+
+        for (int i = 0; i < sol.size(); i++)
+            assertEquals("Unexpected value at index " + i, 0d, sol.getX(i), 0.0000001d);
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void solveMtxWrongSize() throws Exception {
+        new LUDecomposition(testMatrix).solve(
+            new DenseLocalOnHeapMatrix(testMatrix.rowSize() + 1, testMatrix.rowSize()));
+    }
+
+    /** */
+    @Test(expected = SingularMatrixException.class)
+    public void solveMtxSingularMatrix() throws Exception {
+        new LUDecomposition(new DenseLocalOnHeapMatrix(testMatrix.rowSize(), testMatrix.rowSize()))
+            .solve(new DenseLocalOnHeapMatrix(testMatrix.rowSize(), testMatrix.rowSize()));
+    }
+
+    /** */
+    @Test
+    public void solveMtx() throws Exception {
+        Matrix sol = new LUDecomposition(new PivotedMatrixView(testMatrix))
+            .solve(new DenseLocalOnHeapMatrix(testMatrix.rowSize(), testMatrix.rowSize()));
+
+        assertEquals("Wrong solution matrix row size.", testMatrix.rowSize(), sol.rowSize());
+
+        assertEquals("Wrong solution matrix column size.", testMatrix.rowSize(), sol.columnSize());
+
+        for (int row = 0; row < sol.rowSize(); row++)
+            for (int col = 0; col < sol.columnSize(); col++)
+                assertEquals("Unexpected P value at (" + row + "," + col + ").",
+                    0d, sol.getX(row, col), 0.0000001d);
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullMatrixTest() {
+        new LUDecomposition(null);
+    }
+
+    /** */
+    @Test(expected = CardinalityException.class)
+    public void nonSquareMatrixTest() {
+        new LUDecomposition(new DenseLocalOnHeapMatrix(2, 3));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/decompositions/QRDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/decompositions/QRDecompositionTest.java b/modules/math/src/test/java/org/apache/ignite/math/decompositions/QRDecompositionTest.java
new file mode 100644
index 0000000..3bb92d1
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/decompositions/QRDecompositionTest.java
@@ -0,0 +1,139 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.matrix.PivotedMatrixView;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class QRDecompositionTest {
+    /** */
+    @Test
+    public void basicTest() {
+        basicTest(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        }));
+    }
+
+    /**
+     * Test for {@link DecompositionSupport} features.
+     */
+    @Test
+    public void decompositionSupportTest() {
+        basicTest(new PivotedMatrixView(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        })));
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullMatrixTest() {
+        new QRDecomposition(null);
+    }
+
+    /** */
+    @Test(expected = IllegalArgumentException.class)
+    public void solveWrongMatrixSizeTest() {
+        new QRDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        })).solve(new DenseLocalOnHeapMatrix(2, 3));
+    }
+
+    /** */
+    private void basicTest(Matrix m) {
+        QRDecomposition dec = new QRDecomposition(m);
+        assertTrue("Unexpected value for full rank in decomposition " + dec, dec.hasFullRank());
+
+        Matrix q = dec.getQ();
+        Matrix r = dec.getR();
+
+        assertNotNull("Matrix q is expected to be not null.", q);
+        assertNotNull("Matrix r is expected to be not null.", r);
+
+        Matrix qSafeCp = safeCopy(q);
+
+        Matrix expIdentity = qSafeCp.times(qSafeCp.transpose());
+
+        final double delta = 0.0001;
+
+        for (int row = 0; row < expIdentity.rowSize(); row++)
+            for (int col = 0; col < expIdentity.columnSize(); col++)
+                assertEquals("Unexpected identity matrix value at (" + row + "," + col + ").",
+                    row == col ? 1d : 0d, expIdentity.get(col, row), delta);
+
+        for (int row = 0; row < r.rowSize(); row++)
+            for (int col = 0; col < row - 1; col++)
+                assertEquals("Unexpected upper triangular matrix value at (" + row + "," + col + ").",
+                    0d, r.get(row, col), delta);
+
+        Matrix recomposed = qSafeCp.times(r);
+
+        for (int row = 0; row < m.rowSize(); row++)
+            for (int col = 0; col < m.columnSize(); col++)
+                assertEquals("Unexpected recomposed matrix value at (" + row + "," + col + ").",
+                    m.get(row, col), recomposed.get(row, col), delta);
+
+        Matrix sol = dec.solve(new DenseLocalOnHeapMatrix(3, 10));
+        assertEquals("Unexpected rows in solution matrix.", 3, sol.rowSize());
+        assertEquals("Unexpected cols in solution matrix.", 10, sol.columnSize());
+
+        for (int row = 0; row < sol.rowSize(); row++)
+            for (int col = 0; col < sol.columnSize(); col++)
+                assertEquals("Unexpected solution matrix value at (" + row + "," + col + ").",
+                    0d, sol.get(row, col), delta);
+
+        dec.destroy();
+
+        QRDecomposition dec1 = new QRDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d},
+            {-1.0d, 2.0d},
+            {0.0d, -1.0d}
+        }));
+
+        assertTrue("Unexpected value for full rank in decomposition " + dec1, dec1.hasFullRank());
+
+        dec1.destroy();
+
+        QRDecomposition dec2 = new QRDecomposition(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d, 0.0d},
+            {0.0d, -1.0d, 2.0d, 0.0d}
+        }));
+
+        assertTrue("Unexpected value for full rank in decomposition " + dec2, dec2.hasFullRank());
+
+        dec2.destroy();
+    }
+
+    /** */
+    private Matrix safeCopy(Matrix orig) {
+        return new DenseLocalOnHeapMatrix(orig.rowSize(), orig.columnSize()).assign(orig);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/decompositions/SingularValueDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/decompositions/SingularValueDecompositionTest.java b/modules/math/src/test/java/org/apache/ignite/math/decompositions/SingularValueDecompositionTest.java
new file mode 100644
index 0000000..d0b89f8
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/decompositions/SingularValueDecompositionTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.matrix.PivotedMatrixView;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class SingularValueDecompositionTest {
+    /** */
+    @Test
+    public void basicTest() {
+        basicTest(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        }));
+    }
+
+    /**
+     * Test for {@link DecompositionSupport} features.
+     */
+    @Test
+    public void decompositionSupportTest() {
+        basicTest(new PivotedMatrixView(new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d},
+            {0.0d, -1.0d, 2.0d}
+        })));
+    }
+
+    /** */
+    @Test
+    public void rowsLessThanColumnsTest() {
+        DenseLocalOnHeapMatrix m = new DenseLocalOnHeapMatrix(new double[][] {
+            {2.0d, -1.0d, 0.0d},
+            {-1.0d, 2.0d, -1.0d}
+        });
+
+        SingularValueDecomposition dec = new SingularValueDecomposition(m);
+        assertEquals("Unexpected value for singular values size.",
+            2, dec.getSingularValues().length);
+
+        Matrix s = dec.getS();
+        Matrix u = dec.getU();
+        Matrix v = dec.getV();
+        Matrix covariance = dec.getCovariance(0.5);
+
+        assertNotNull("Matrix s is expected to be not null.", s);
+        assertNotNull("Matrix u is expected to be not null.", u);
+        assertNotNull("Matrix v is expected to be not null.", v);
+        assertNotNull("Covariance matrix is expected to be not null.", covariance);
+
+        dec.destroy();
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullMatrixTest() {
+        new SingularValueDecomposition(null);
+    }
+
+    /** */
+    private void basicTest(Matrix m) {
+        SingularValueDecomposition dec = new SingularValueDecomposition(m);
+        assertEquals("Unexpected value for singular values size.",
+            3, dec.getSingularValues().length);
+
+        Matrix s = dec.getS();
+        Matrix u = dec.getU();
+        Matrix v = dec.getV();
+        Matrix covariance = dec.getCovariance(0.5);
+
+        assertNotNull("Matrix s is expected to be not null.", s);
+        assertNotNull("Matrix u is expected to be not null.", u);
+        assertNotNull("Matrix v is expected to be not null.", v);
+        assertNotNull("Covariance matrix is expected to be not null.", covariance);
+
+        assertTrue("Decomposition cond is expected to be positive.", dec.cond() > 0);
+        assertTrue("Decomposition norm2 is expected to be positive.", dec.norm2() > 0);
+        assertEquals("Decomposition rank differs from expected.", 3, dec.rank());
+        assertEquals("Decomposition singular values size differs from expected.",
+            3, dec.getSingularValues().length);
+
+        Matrix recomposed = (u.times(s).times(v.transpose()));
+
+        for (int row = 0; row < m.rowSize(); row++)
+            for (int col = 0; col < m.columnSize(); col++)
+                assertEquals("Unexpected recomposed matrix value at (" + row + "," + col + ").",
+                    m.get(row, col), recomposed.get(row, col), 0.001);
+
+        for (int row = 0; row < covariance.rowSize(); row++)
+            for (int col = row + 1; col < covariance.columnSize(); col++)
+                assertEquals("Unexpected covariance matrix value at (" + row + "," + col + ").",
+                    covariance.get(row, col), covariance.get(col, row), 0.001);
+
+        dec.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/MathTestConstants.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/MathTestConstants.java b/modules/math/src/test/java/org/apache/ignite/math/impls/MathTestConstants.java
new file mode 100644
index 0000000..122c62e
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/MathTestConstants.java
@@ -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.
+ */
+
+package org.apache.ignite.math.impls;
+
+/**
+ * Collect constants for org.apache.ignite.math tests
+ */
+public interface MathTestConstants {
+    /** */
+    public double SECOND_ARG = 1d;
+
+    /**
+     * We assume that we will check calculation precision in other tests.
+     */
+    public double EXP_DELTA = 0.1d;
+
+    /** */
+    public String UNEXPECTED_VAL = "Unexpected value.";
+
+    /** */
+    public String NULL_GUID = "Null GUID.";
+
+    /** */
+    public String UNEXPECTED_GUID_VAL = "Unexpected GUID value.";
+
+    /** */
+    public String EMPTY_GUID = "Empty GUID.";
+
+    /** */
+    public String VALUES_SHOULD_BE_NOT_EQUALS = "Values should be not equals.";
+
+    /** */
+    public String NULL_VAL = "Null value.";
+
+    /** */
+    public String NULL_VALUES = "Null values.";
+
+    /** */
+    public String NOT_NULL_VAL = "Not null value.";
+
+    /** */
+    public double TEST_VAL = 1d;
+
+    /** */
+    public String VAL_NOT_EQUALS = "Values not equals.";
+
+    /** */
+    public String NO_NEXT_ELEMENT = "No next element.";
+
+    /** */
+    public int STORAGE_SIZE = 100;
+
+    /** */
+    public String WRONG_ATTRIBUTE_VAL = "Wrong attribute value.";
+
+    /** */
+    public String NULL_DATA_ELEMENT = "Null data element.";
+
+    /** */
+    public String WRONG_DATA_ELEMENT = "Wrong data element.";
+
+    /** */
+    public double NIL_DELTA = 0d;
+
+    /** */
+    public String NULL_DATA_STORAGE = "Null data storage.";
+
+    /** */
+    public String WRONG_DATA_SIZE = "Wrong data size.";
+
+    /** */
+    public String UNEXPECTED_DATA_VAL = "Unexpected data value.";
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/CacheMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/CacheMatrixTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/CacheMatrixTest.java
new file mode 100644
index 0000000..8a6d077
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/CacheMatrixTest.java
@@ -0,0 +1,369 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.IdentityValueMapper;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixKeyMapper;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Tests for {@link CacheMatrix}.
+ */
+@GridCommonTest(group = "Distributed Models")
+public class CacheMatrixTest extends GridCommonAbstractTest {
+    /** Number of nodes in grid */
+    private static final int NODE_COUNT = 3;
+    /** Cache name. */
+    private static final String CACHE_NAME = "test-cache";
+    /** */
+    private static final String UNEXPECTED_ATTRIBUTE_VALUE = "Unexpected attribute value.";
+    /** Grid instance. */
+    private Ignite ignite;
+    /** Matrix rows */
+    private final int rows = MathTestConstants.STORAGE_SIZE;
+    /** Matrix cols */
+    private final int cols = MathTestConstants.STORAGE_SIZE;
+
+    /**
+     * Default constructor.
+     */
+    public CacheMatrixTest() {
+        super(false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        for (int i = 1; i <= NODE_COUNT; i++)
+            startGrid(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        ignite = grid(NODE_COUNT);
+
+        ignite.configuration().setPeerClassLoadingEnabled(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        ignite.destroyCache(CACHE_NAME);
+    }
+
+    /** */
+    public void testGetSet() throws Exception {
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        for (int i = 0; i < rows; i++) {
+            for (int j = 0; j < cols; j++) {
+                double v = Math.random();
+                cacheMatrix.set(i, j, v);
+
+                assert Double.compare(v, cacheMatrix.get(i, j)) == 0;
+                assert Double.compare(v, cache.get(keyMapper.apply(i, j))) == 0;
+            }
+        }
+    }
+
+    /** */
+    public void testCopy() throws Exception {
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        fillMatrix(cacheMatrix);
+
+        try {
+            cacheMatrix.copy();
+
+            fail("UnsupportedOperationException expected");
+        }
+        catch (UnsupportedOperationException e) {
+            // No-op.
+        }
+    }
+
+    /** */
+    public void testLike() throws Exception {
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        try {
+            cacheMatrix.like(rows, cols);
+
+            fail("UnsupportedOperationException expected");
+        }
+        catch (UnsupportedOperationException e) {
+            // No-op.
+        }
+    }
+
+    /** */
+    public void testLikeVector() throws Exception {
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        try {
+            cacheMatrix.likeVector(cols);
+
+            fail("UnsupportedOperationException expected");
+        }
+        catch (UnsupportedOperationException e) {
+            // No-op.
+        }
+    }
+
+    /** */
+    public void testPlus() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        double plusVal = 2;
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        initMatrix(cacheMatrix);
+
+        cacheMatrix.plus(plusVal);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                assertEquals(plusVal, cacheMatrix.get(i, j));
+    }
+
+    /** */
+    public void testDivide() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        double initVal = 1;
+        double divVal = 2;
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        initMatrix(cacheMatrix);
+        cacheMatrix.assign(initVal);
+        cacheMatrix.divide(divVal);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                assertTrue(Double.compare(cacheMatrix.get(i, j), initVal / divVal) == 0);
+    }
+
+    /** */
+    public void testTimes() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        double initVal = 1;
+        double timVal = 2;
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        initMatrix(cacheMatrix);
+        cacheMatrix.assign(initVal);
+        cacheMatrix.times(timVal);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                assertTrue(Double.compare(cacheMatrix.get(i, j), initVal * timVal) == 0);
+    }
+
+    /** */
+    public void testSum() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        double initVal = 1;
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        double sum = 0;
+
+        initMatrix(cacheMatrix);
+        sum = cacheMatrix.sum();
+
+        assertTrue(Double.compare(sum, 0d) == 0);
+
+        cacheMatrix.assign(1d);
+        sum = cacheMatrix.sum();
+
+        assertTrue(Double.compare(sum, rows * cols) == 0);
+    }
+
+    /** */
+    public void testAssignSingleValue() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        double initVal = 1;
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        initMatrix(cacheMatrix);
+
+        cacheMatrix.assign(initVal);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                assertEquals(initVal, cacheMatrix.get(i, j));
+    }
+
+    /** */
+    public void testAssignArray() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        double[][] initVal = new double[rows][cols];
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                initVal[i][j] = Math.random();
+
+        cacheMatrix.assign(initVal);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                assertEquals(initVal[i][j], cacheMatrix.get(i, j));
+    }
+
+    /** */
+    public void testAttributes() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        assertFalse(UNEXPECTED_ATTRIBUTE_VALUE, cacheMatrix.isSequentialAccess());
+        assertFalse(UNEXPECTED_ATTRIBUTE_VALUE, cacheMatrix.isDense());
+        assertFalse(UNEXPECTED_ATTRIBUTE_VALUE, cacheMatrix.isArrayBased());
+        assertTrue(UNEXPECTED_ATTRIBUTE_VALUE, cacheMatrix.isRandomAccess());
+        assertTrue(UNEXPECTED_ATTRIBUTE_VALUE, cacheMatrix.isDistributed());
+    }
+
+    /** */
+    public void testExternalization() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        final CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        ExternalizeTest<CacheMatrix<Integer, Double>> externalizeTest = new ExternalizeTest<CacheMatrix<Integer, Double>>() {
+
+            @Override public void externalizeTest() {
+                super.externalizeTest(cacheMatrix);
+            }
+        };
+
+        externalizeTest.externalizeTest();
+    }
+
+    /** */
+    public void testMinMax() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        final CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                cacheMatrix.set(i, j, i * rows + j);
+
+        assertEquals(0.0, cacheMatrix.minValue(), 0.0);
+        assertEquals(rows * cols - 1, cacheMatrix.maxValue(), 0.0);
+    }
+
+    /** */
+    public void testMap() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        MatrixKeyMapper<Integer> keyMapper = getKeyMapper(rows, cols);
+        IgniteCache<Integer, Double> cache = getCache();
+        final CacheMatrix<Integer, Double> cacheMatrix = new CacheMatrix<>(rows, cols, cache, keyMapper, new IdentityValueMapper());
+
+        initMatrix(cacheMatrix);
+
+        cacheMatrix.map(value -> value + 10);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                assertEquals(10.0, cacheMatrix.getX(i, j), 0.0);
+    }
+
+    /** */
+    private IgniteCache<Integer, Double> getCache() {
+        assert ignite != null;
+
+        CacheConfiguration cfg = new CacheConfiguration();
+        cfg.setName(CACHE_NAME);
+
+        IgniteCache<Integer, Double> cache = ignite.getOrCreateCache(CACHE_NAME);
+
+        assert cache != null;
+        return cache;
+    }
+
+    /** */
+    private MatrixKeyMapper<Integer> getKeyMapper(final int rows, final int cols) {
+        return new MatrixKeyMapperForTests(rows, cols);
+    }
+
+    /** Init the given matrix by random values. */
+    private void fillMatrix(Matrix m) {
+        for (int i = 0; i < m.rowSize(); i++)
+            for (int j = 0; j < m.columnSize(); j++)
+                m.set(i, j, Math.random());
+    }
+
+    /** Init the given matrix by zeros. */
+    private void initMatrix(Matrix m) {
+        for (int i = 0; i < m.rowSize(); i++)
+            for (int j = 0; j < m.columnSize(); j++)
+                m.set(i, j, 0d);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrixConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrixConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrixConstructorTest.java
new file mode 100644
index 0000000..1f0537c
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrixConstructorTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class DenseLocalOffHeapMatrixConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DenseLocalOffHeapMatrix(0, 1), "invalid row parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DenseLocalOffHeapMatrix(1, 0), "invalid col parameter");
+
+        //noinspection ConstantConditions
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DenseLocalOffHeapMatrix(null), "null matrix parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DenseLocalOffHeapMatrix(new double[][] {null, new double[1]}),
+            "null row in matrix");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        assertEquals("Expected number of rows, int parameters.", 1,
+            new DenseLocalOffHeapMatrix(1, 2).rowSize());
+
+        assertEquals("Expected number of rows, double[][] parameter.", 1,
+            new DenseLocalOffHeapMatrix(new double[][] {new double[2]}).rowSize());
+
+        assertEquals("Expected number of cols, int parameters.", 1,
+            new DenseLocalOffHeapMatrix(2, 1).columnSize());
+
+        assertEquals("Expected number of cols, double[][] parameter.", 1,
+            new DenseLocalOffHeapMatrix(new double[][] {new double[1], new double[1]}).columnSize());
+
+        double[][] data1 = new double[][] {{1, 2}, {3, 4}}, data2 = new double[][] {{1, 2}, {3, 5}};
+
+        assertTrue("Matrices with same values are expected to be equal",
+            new DenseLocalOffHeapMatrix(data1).equals(new DenseLocalOffHeapMatrix(data1)));
+
+        assertFalse("Matrices with same values are expected to be equal",
+            new DenseLocalOffHeapMatrix(data1).equals(new DenseLocalOffHeapMatrix(data2)));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrixConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrixConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrixConstructorTest.java
new file mode 100644
index 0000000..0a25e31
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrixConstructorTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.util.function.Supplier;
+import org.apache.ignite.math.Matrix;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+/** */
+public class DenseLocalOnHeapMatrixConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        verifyAssertionError(() -> new DenseLocalOnHeapMatrix(0, 1), "invalid row parameter");
+
+        verifyAssertionError(() -> new DenseLocalOnHeapMatrix(1, 0), "invalid col parameter");
+
+        //noinspection ConstantConditions
+        verifyAssertionError(() -> new DenseLocalOnHeapMatrix(null), "null matrix parameter");
+
+        verifyAssertionError(() -> new DenseLocalOnHeapMatrix(new double[][] {null, new double[1]}),
+            "null row in matrix");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        assertEquals("Expected number of rows, int parameters.", 1,
+            new DenseLocalOnHeapMatrix(1, 2).rowSize());
+
+        assertEquals("Expected number of rows, double[][] parameter.", 1,
+            new DenseLocalOnHeapMatrix(new double[][] {new double[2]}).rowSize());
+
+        assertEquals("Expected number of cols, int parameters.", 1,
+            new DenseLocalOnHeapMatrix(2, 1).columnSize());
+
+        assertEquals("Expected number of cols, double[][] parameter.", 1,
+            new DenseLocalOnHeapMatrix(new double[][] {new double[1], new double[1]}).columnSize());
+    }
+
+    /** */
+    static void verifyAssertionError(Supplier<Matrix> ctor, String desc) {
+        try {
+            assertNotNull("Unexpected null matrix in " + desc, ctor.get());
+        }
+        catch (AssertionError ae) {
+            return;
+        }
+
+        fail("Expected error not caught in " + desc);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DiagonalMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DiagonalMatrixTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DiagonalMatrixTest.java
new file mode 100644
index 0000000..c0c2af7
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/DiagonalMatrixTest.java
@@ -0,0 +1,209 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link DiagonalMatrix}.
+ */
+public class DiagonalMatrixTest extends ExternalizeTest<DiagonalMatrix> {
+    /** */
+    public static final String UNEXPECTED_VALUE = "Unexpected value";
+
+    /** */
+    private DiagonalMatrix testMatrix;
+
+    /** */
+    @Before
+    public void setup() {
+        DenseLocalOnHeapMatrix parent = new DenseLocalOnHeapMatrix(MathTestConstants.STORAGE_SIZE, MathTestConstants.STORAGE_SIZE);
+        fillMatrix(parent);
+        testMatrix = new DiagonalMatrix(parent);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void externalizeTest() {
+        externalizeTest(testMatrix);
+    }
+
+    /** */
+    @Test
+    public void testSetGetBasic() {
+        double testVal = 42;
+        for (int i = 0; i < MathTestConstants.STORAGE_SIZE; i++) {
+            testMatrix.set(i, i, testVal);
+
+            assertEquals(UNEXPECTED_VALUE + " at (" + i + "," + i + ")", testMatrix.get(i, i), testVal, 0d);
+        }
+
+        //noinspection EqualsWithItself
+        assertTrue("Matrix is expected to be equal to self.", testMatrix.equals(testMatrix));
+        //noinspection ObjectEqualsNull
+        assertFalse("Matrix is expected to be not equal to null.", testMatrix.equals(null));
+    }
+
+    /** */
+    @Test
+    public void testSetGet() {
+        verifyDiagonal(testMatrix);
+
+        final int size = MathTestConstants.STORAGE_SIZE;
+
+        for (Matrix m : new Matrix[] {
+            new DenseLocalOnHeapMatrix(size + 1, size),
+            new DenseLocalOnHeapMatrix(size, size + 1)}) {
+            fillMatrix(m);
+
+            verifyDiagonal(new DiagonalMatrix(m));
+        }
+
+        final double[] data = new double[size];
+
+        for (int i = 0; i < size; i++)
+            data[i] = 1 + i;
+
+        final Matrix m = new DiagonalMatrix(new DenseLocalOnHeapVector(data));
+
+        assertEquals("Rows in matrix constructed from vector", size, m.rowSize());
+        assertEquals("Cols in matrix constructed from vector", size, m.columnSize());
+
+        for (int i = 0; i < size; i++)
+            assertEquals(UNEXPECTED_VALUE + " at vector index " + i, data[i], m.get(i, i), 0d);
+
+        verifyDiagonal(m);
+
+        final Matrix m1 = new DiagonalMatrix(data);
+
+        assertEquals("Rows in matrix constructed from array", size, m1.rowSize());
+        assertEquals("Cols in matrix constructed from array", size, m1.columnSize());
+
+        for (int i = 0; i < size; i++)
+            assertEquals(UNEXPECTED_VALUE + " at array index " + i, data[i], m1.get(i, i), 0d);
+
+        verifyDiagonal(m1);
+    }
+
+    /** */
+    @Test
+    public void testConstant() {
+        final int size = MathTestConstants.STORAGE_SIZE;
+
+        for (double val : new double[] {-1.0, 0.0, 1.0}) {
+            Matrix m = new DiagonalMatrix(size, val);
+
+            assertEquals("Rows in matrix", size, m.rowSize());
+            assertEquals("Cols in matrix", size, m.columnSize());
+
+            for (int i = 0; i < size; i++)
+                assertEquals(UNEXPECTED_VALUE + " at index " + i, val, m.get(i, i), 0d);
+
+            verifyDiagonal(m, true);
+        }
+    }
+
+    /** */
+    @Test
+    public void testAttributes() {
+        assertTrue(UNEXPECTED_VALUE, testMatrix.rowSize() == MathTestConstants.STORAGE_SIZE);
+        assertTrue(UNEXPECTED_VALUE, testMatrix.columnSize() == MathTestConstants.STORAGE_SIZE);
+
+        assertFalse(UNEXPECTED_VALUE, testMatrix.isArrayBased());
+        assertTrue(UNEXPECTED_VALUE, testMatrix.isDense());
+        assertFalse(UNEXPECTED_VALUE, testMatrix.isDistributed());
+
+        assertEquals(UNEXPECTED_VALUE, testMatrix.isRandomAccess(), !testMatrix.isSequentialAccess());
+        assertTrue(UNEXPECTED_VALUE, testMatrix.isRandomAccess());
+    }
+
+    /** */
+    @Test
+    public void testNullParams() {
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DiagonalMatrix((Matrix)null), "Null Matrix parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DiagonalMatrix((Vector)null), "Null Vector parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new DiagonalMatrix((double[])null), "Null double[] parameter");
+    }
+
+    /** */
+    private void verifyDiagonal(Matrix m, boolean readonly) {
+        final int rows = m.rowSize(), cols = m.columnSize();
+
+        final String sizeDetails = "rows" + "X" + "cols " + rows + "X" + cols;
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++) {
+                final String details = " at (" + i + "," + j + "), " + sizeDetails;
+
+                final boolean diagonal = i == j;
+
+                final double old = m.get(i, j);
+
+                if (!diagonal)
+                    assertEquals(UNEXPECTED_VALUE + details, 0, old, 0d);
+
+                final double exp = diagonal && !readonly ? old + 1 : old;
+
+                boolean expECaught = false;
+
+                try {
+                    m.set(i, j, exp);
+                }
+                catch (UnsupportedOperationException uoe) {
+                    if (diagonal && !readonly)
+                        throw uoe;
+
+                    expECaught = true;
+                }
+
+                if ((!diagonal || readonly) && !expECaught)
+                    fail("Expected exception was not caught " + details);
+
+                assertEquals(UNEXPECTED_VALUE + details, exp, m.get(i, j), 0d);
+            }
+    }
+
+    /** */
+    private void verifyDiagonal(Matrix m) {
+        verifyDiagonal(m, false);
+    }
+
+    /** */
+    private void fillMatrix(Matrix m) {
+        final int rows = m.rowSize(), cols = m.columnSize();
+
+        boolean negative = false;
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                m.set(i, j, (negative = !negative) ? -(i * cols + j + 1) : i * cols + j + 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/FunctionMatrixConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/FunctionMatrixConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/FunctionMatrixConstructorTest.java
new file mode 100644
index 0000000..a5ac84a
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/FunctionMatrixConstructorTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class FunctionMatrixConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new FunctionMatrix(0, 1, (i, j) -> 0.0),
+            "Invalid row parameter.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new FunctionMatrix(1, 0, (i, j) -> 0.0),
+            "Invalid col parameter.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new FunctionMatrix(1, 1, null),
+            "Invalid func parameter.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new FunctionMatrix(0, 1, (i, j) -> 0.0, null),
+            "Invalid row parameter, with setter func.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new FunctionMatrix(1, 0, (i, j) -> 0.0, null),
+            "Invalid col parameter, with setter func.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new FunctionMatrix(1, 1, null, null),
+            "Invalid func parameter, with setter func.");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        for (int rows : new int[] {1, 2, 3})
+            for (int cols : new int[] {1, 2, 3})
+                basicTest(rows, cols);
+
+        Matrix m = new FunctionMatrix(1, 1, (i, j) -> 1d);
+        //noinspection EqualsWithItself
+        assertTrue("Matrix is expected to be equal to self.", m.equals(m));
+        //noinspection ObjectEqualsNull
+        assertFalse("Matrix is expected to be not equal to null.", m.equals(null));
+    }
+
+    /** */
+    private void basicTest(int rows, int cols) {
+        double[][] data = new double[rows][cols];
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++)
+                data[row][col] = row * cols + row;
+
+        Matrix mReadOnly = new FunctionMatrix(rows, cols, (i, j) -> data[i][j]);
+
+        assertEquals("Rows in matrix.", rows, mReadOnly.rowSize());
+        assertEquals("Cols in matrix.", cols, mReadOnly.columnSize());
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++) {
+                assertEquals("Unexpected value at " + row + "x" + col, data[row][col], mReadOnly.get(row, col), 0d);
+
+                boolean expECaught = false;
+
+                try {
+                    mReadOnly.set(row, col, 0.0);
+                }
+                catch (UnsupportedOperationException uoe) {
+                    expECaught = true;
+                }
+
+                assertTrue("Expected exception wasn't thrown at " + row + "x" + col, expECaught);
+            }
+
+        Matrix m = new FunctionMatrix(rows, cols, (i, j) -> data[i][j], (i, j, val) -> data[i][j] = val);
+
+        assertEquals("Rows in matrix, with setter function.", rows, m.rowSize());
+        assertEquals("Cols in matrix, with setter function.", cols, m.columnSize());
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++) {
+                assertEquals("Unexpected value at " + row + "x" + col, data[row][col], m.get(row, col), 0d);
+
+                m.set(row, col, -data[row][col]);
+            }
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++)
+                assertEquals("Unexpected value set at " + row + "x" + col, -(row * cols + row), m.get(row, col), 0d);
+
+        assertTrue("Incorrect copy for empty matrix.", m.copy().equals(m));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixAttributeTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixAttributeTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixAttributeTest.java
new file mode 100644
index 0000000..c9fb390
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixAttributeTest.java
@@ -0,0 +1,156 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import org.apache.ignite.math.Matrix;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Attribute tests for matrices.
+ *
+ * TODO: WIP
+ */
+public class MatrixAttributeTest {
+    /** */
+    private final List<MatrixAttributeTest.AttrCfg> attrCfgs = Arrays.asList(
+        new AttrCfg("isDense", Matrix::isDense,
+            DenseLocalOnHeapMatrix.class, DenseLocalOffHeapMatrix.class, RandomMatrix.class, DiagonalMatrix.class),
+        new AttrCfg("isArrayBased", Matrix::isArrayBased, DenseLocalOnHeapMatrix.class),
+        new AttrCfg("isDistributed", Matrix::isDistributed),
+        new AttrCfg("isRandomAccess", Matrix::isRandomAccess, DenseLocalOnHeapMatrix.class, DenseLocalOffHeapMatrix.class, RandomMatrix.class, DiagonalMatrix.class, SparseLocalOnHeapMatrix.class),
+        new AttrCfg("isSequentialAccess", Matrix::isSequentialAccess, DiagonalMatrix.class)
+    );
+
+    /** */
+    private final List<MatrixAttributeTest.Specification> specFixture = Arrays.asList(
+        new Specification(new DenseLocalOnHeapMatrix(1, 1)),
+        new Specification(new DenseLocalOffHeapMatrix(1, 1)),
+        new Specification(new RandomMatrix(1, 1)),
+        new Specification(new DiagonalMatrix(new double[] {1.0})),
+        new Specification(new FunctionMatrix(1, 1, (x, y) -> 1.0)),
+        new Specification(new SparseLocalOnHeapMatrix(1, 1))
+    );
+
+    /** */
+    @Test
+    public void isDenseTest() {
+        assertAttribute("isDense");
+    }
+
+    /** */
+    @Test
+    public void isArrayBasedTest() {
+        assertAttribute("isArrayBased");
+    }
+
+    /** */
+    @Test
+    public void isSequentialAccessTest() {
+        assertAttribute("isSequentialAccess");
+    }
+
+    /** */
+    @Test
+    public void isRandomAccessTest() {
+        assertAttribute("isRandomAccess");
+    }
+
+    /** */
+    @Test
+    public void isDistributedTest() {
+        assertAttribute("isDistributed");
+    }
+
+    /** */
+    private void assertAttribute(String name) {
+        final MatrixAttributeTest.AttrCfg attr = attrCfg(name);
+
+        for (MatrixAttributeTest.Specification spec : specFixture)
+            spec.verify(attr);
+    }
+
+    /** */
+    private MatrixAttributeTest.AttrCfg attrCfg(String name) {
+        for (MatrixAttributeTest.AttrCfg attr : attrCfgs)
+            if (attr.name.equals(name))
+                return attr;
+
+        throw new IllegalArgumentException("Undefined attribute " + name);
+    }
+
+    /** See http://en.wikipedia.org/wiki/Specification_pattern */
+    private static class Specification {
+        /** */
+        private final Matrix m;
+        /** */
+        private final Class<? extends Matrix> underlyingType;
+        /** */
+        private final List<String> attrsFromUnderlying;
+        /** */
+        final String desc;
+
+        /** */
+        Specification(Matrix m, Class<? extends Matrix> underlyingType, String... attrsFromUnderlying) {
+            this.m = m;
+            this.underlyingType = underlyingType;
+            this.attrsFromUnderlying = Arrays.asList(attrsFromUnderlying);
+            final Class<? extends Matrix> clazz = m.getClass();
+            desc = clazz.getSimpleName() + (clazz.equals(underlyingType)
+                ? "" : " (underlying type " + underlyingType.getSimpleName() + ")");
+        }
+
+        /** */
+        Specification(Matrix m) {
+            this(m, m.getClass());
+        }
+
+        /** */
+        void verify(MatrixAttributeTest.AttrCfg attr) {
+            final boolean obtained = attr.obtain.apply(m);
+
+            final Class<? extends Matrix> typeToCheck
+                = attrsFromUnderlying.contains(attr.name) ? underlyingType : m.getClass();
+
+            final boolean exp = attr.trueInTypes.contains(typeToCheck);
+
+            assertEquals("Unexpected " + attr.name + " value for " + desc, exp, obtained);
+        }
+    }
+
+    /** */
+    private static class AttrCfg {
+        /** */
+        final String name;
+        /** */
+        final Function<Matrix, Boolean> obtain;
+        /** */
+        final List<Class> trueInTypes;
+
+        /** */
+        AttrCfg(String name, Function<Matrix, Boolean> obtain, Class... trueInTypes) {
+            this.name = name;
+            this.obtain = obtain;
+            this.trueInTypes = Arrays.asList(trueInTypes);
+        }
+    }
+}


[48/50] [abbrv] ignite git commit: ignite-4955 - Correctly execute SQL queries started on replicated cache. - Fixes #1806.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ded599ae/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 43083a8..de341d0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -25,8 +25,8 @@ import org.apache.ignite.internal.processors.cache.CachePartitionedQueryDetailMe
 import org.apache.ignite.internal.processors.cache.CachePartitionedQueryDetailMetricsLocalSelfTest;
 import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsDistributedSelfTest;
 import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheQueryNewClientSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheQueryEvictDataLostTest;
+import org.apache.ignite.internal.processors.cache.CacheQueryNewClientSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryDetailMetricsDistributedSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryDetailMetricsLocalSelfTest;
 import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
@@ -77,6 +77,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheP
 import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheQueryAbstractDistributedJoinSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheQueryNoRebalanceSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedFieldsQueryP2PEnabledSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedFieldsQueryROSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedQueryP2PDisabledSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedQuerySelfTest;
@@ -188,6 +189,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(SqlFieldsQuerySelfTest.class);
         suite.addTestSuite(IgniteCacheLocalFieldsQuerySelfTest.class);
         suite.addTestSuite(IgniteCacheReplicatedFieldsQuerySelfTest.class);
+        suite.addTestSuite(IgniteCacheReplicatedFieldsQueryROSelfTest.class);
         suite.addTestSuite(IgniteCacheReplicatedFieldsQueryP2PEnabledSelfTest.class);
         suite.addTestSuite(IgniteCachePartitionedFieldsQuerySelfTest.class);
         suite.addTestSuite(IgniteCacheAtomicFieldsQuerySelfTest.class);


[26/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/MatrixVectorView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/MatrixVectorView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/MatrixVectorView.java
new file mode 100644
index 0000000..8f32a89
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/MatrixVectorView.java
@@ -0,0 +1,139 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.impls.storage.vector.MatrixVectorStorage;
+
+/**
+ * Row or column vector view off the matrix.
+ */
+public class MatrixVectorView extends AbstractVector {
+    /** */ private Matrix parent;
+
+    /** */ private int row;
+    /** */ private int col;
+    
+    /** */ private int rowStride;
+    /** */ private int colStride;
+
+    /**
+     *
+     */
+    public MatrixVectorView() {
+        // No-op.
+    }
+
+    /**
+     * @param parent
+     * @param row
+     * @param col
+     * @param rowStride
+     * @param colStride
+     */
+    public MatrixVectorView(Matrix parent, int row, int col, int rowStride, int colStride) {
+        assert parent != null;
+
+        if (row < 0 || row >= parent.rowSize())
+            throw new IndexException(row);
+        if (col < 0 || col >= parent.columnSize())
+            throw new IndexException(col);
+
+        this.parent = parent;
+
+        this.row = row;
+        this.col = col;
+
+        this.rowStride = rowStride;
+        this.colStride = colStride;
+
+        setStorage(new MatrixVectorStorage(parent, row, col, rowStride, colStride));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        return new MatrixVectorView(parent, row, col, rowStride, colStride);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        return parent.likeVector(crd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return parent.like(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(parent);
+        out.writeInt(row);
+        out.writeInt(col);
+        out.writeInt(rowStride);
+        out.writeInt(colStride);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        parent = (Matrix)in.readObject();
+        row = in.readInt();
+        col = in.readInt();
+        rowStride = in.readInt();
+        colStride = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + (parent == null ? 0 : parent.hashCode());
+        res = res * 37 + row;
+        res = res * 37 + col;
+        res = res * 37 + rowStride;
+        res = res * 37 + colStride;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        MatrixVectorView that = (MatrixVectorView)o;
+
+        return (parent != null ? parent.equals(that.parent) : that.parent == null) &&
+            row == that.row &&
+            col == that.col &&
+            rowStride == that.rowStride &&
+            colStride == that.colStride;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/PivotedVectorView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/PivotedVectorView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/PivotedVectorView.java
new file mode 100644
index 0000000..cc9e835
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/PivotedVectorView.java
@@ -0,0 +1,163 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.impls.storage.vector.PivotedVectorStorage;
+
+/**
+ * Pivoted (index mapped) view over another vector.
+ */
+public class PivotedVectorView extends AbstractVector {
+    /** */ private Vector vec;
+
+    /**
+     * @param vec
+     * @param pivot Mapping from external index to internal.
+     * @param unpivot Mapping from internal index to external.
+     */
+    public PivotedVectorView(Vector vec, int[] pivot, int[] unpivot) {
+        setStorage(new PivotedVectorStorage(vec.getStorage(), pivot, unpivot));
+
+        checkCardinality(pivot);
+        checkCardinality(unpivot);
+
+        this.vec = vec;
+    }
+
+    /**
+     * @param vec
+     * @param pivot
+     */
+    public PivotedVectorView(Vector vec, int[] pivot) {
+        setStorage(new PivotedVectorStorage(vec.getStorage(), pivot));
+
+        checkCardinality(pivot);
+
+        this.vec = vec;
+    }
+
+    /**
+     *
+     *
+     */
+    private PivotedVectorStorage storage() {
+        return (PivotedVectorStorage)getStorage();
+    }
+
+    /**
+     *
+     */
+    public PivotedVectorView() {
+        // No-op.
+    }
+
+    /**
+     *
+     *
+     */
+    public Vector getBaseVector() {
+        return vec;
+    }
+
+    /**
+     * @param i
+     */
+    public int pivot(int i) {
+        return storage().pivot()[i];
+    }
+
+    /**
+     * @param i
+     */
+    public int unpivot(int i) {
+        return storage().unpivot()[i];
+    }
+
+    /**
+     * @param idx
+     */
+    protected Vector.Element makeElement(int idx) {
+        checkIndex(idx);
+
+        // External index.
+        int exIdx = storage().pivot()[idx];
+
+        return new Vector.Element() {
+            /** {@inheritDoc */
+            @Override public double get() {
+                return storageGet(idx);
+            }
+
+            /** {@inheritDoc */
+            @Override public int index() {
+                return exIdx;
+            }
+
+            /** {@inheritDoc */
+            @Override public void set(double val) {
+                storageSet(idx, val);
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        PivotedVectorStorage sto = storage();
+
+        return new PivotedVectorView(vec, sto.pivot(), sto.unpivot());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return vec.likeMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        if (x == 0.0)
+            return copy().map(Functions.mult(x));
+        else
+            return super.times(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        vec = (Vector)in.readObject();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/RandomVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/RandomVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/RandomVector.java
new file mode 100644
index 0000000..c9121c9
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/RandomVector.java
@@ -0,0 +1,128 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.matrix.RandomMatrix;
+import org.apache.ignite.math.impls.storage.vector.RandomVectorStorage;
+
+/**
+ * Random vector. Each value is taken from {-1,0,1} with roughly equal probability. Note
+ * that by default, the value is determined by a relatively simple hash of the index.
+ */
+public class RandomVector extends AbstractReadOnlyVector {
+    /** */ private boolean fastHash;
+
+    /**
+     * @param size Vector cardinality.
+     * @param fastHash
+     */
+    private VectorStorage mkStorage(int size, boolean fastHash) {
+        this.fastHash = fastHash;
+
+        return new RandomVectorStorage(size, fastHash);
+    }
+
+    /**
+     * @param size
+     * @param fastHash
+     */
+    public RandomVector(int size, boolean fastHash) {
+        setStorage(mkStorage(size, fastHash));
+    }
+
+    /**
+     * @param size
+     */
+    public RandomVector(int size) {
+        this(size, true);
+    }
+
+    /**
+     * @param args
+     */
+    public RandomVector(Map<String, Object> args) {
+        assert args != null;
+
+        if (args.containsKey("size") && args.containsKey("fastHash"))
+            setStorage(mkStorage((int)args.get("size"), (boolean)args.get("fastHash")));
+        else if (args.containsKey("size"))
+            setStorage(mkStorage((int)args.get("size"), true));
+        else
+            throw new UnsupportedOperationException("Invalid constructor argument(s).");
+    }
+
+    /** */
+    public RandomVector() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public org.apache.ignite.math.Vector like(int crd) {
+        return new RandomVector(crd, fastHash);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return new RandomMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeBoolean(fastHash);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        fastHash = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + Boolean.hashCode(fastHash);
+        res = res * 37 + getStorage().hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        RandomVector that = (RandomVector)o;
+        VectorStorage sto = getStorage();
+
+        return fastHash == that.fastHash && (sto != null ? sto.equals(that.getStorage()) : that.getStorage() == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVector.java
new file mode 100644
index 0000000..8d19ee0
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVector.java
@@ -0,0 +1,102 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Map;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.storage.vector.SingleElementVectorStorage;
+
+/**
+ * Read-write vector holding a single non-zero value at some index.
+ */
+public class SingleElementVector extends AbstractVector {
+    /**
+     *
+     */
+    public SingleElementVector() {
+        // No-op
+    }
+
+    /**
+     * @param size
+     * @param idx
+     * @param val
+     */
+    public SingleElementVector(int size, int idx, double val) {
+        super(new SingleElementVectorStorage(size, idx, val));
+    }
+
+    /**
+     * @param args
+     */
+    public SingleElementVector(Map<String, Object> args) {
+        assert args != null;
+
+        if (args.containsKey("size") && args.containsKey("index") && args.containsKey("value")) {
+            int size = (int)args.get("size");
+            int idx = (int)args.get("index");
+            double val = (double)args.get("value");
+
+            setStorage(new SingleElementVectorStorage(size, idx, val));
+        }
+        else
+            throw new UnsupportedOperationException("Invalid constructor argument(s).");
+    }
+
+    /**
+     *
+     *
+     */
+    private SingleElementVectorStorage storage() {
+        return (SingleElementVectorStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element minElement() {
+        return makeElement(storage().index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element maxElement() {
+        return makeElement(storage().index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        return getX(storage().index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nonZeroElements() {
+        return isZero(get(storage().index())) ? 0 : 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        int idx = storage().index();
+
+        return new SingleElementVector(crd, idx, getX(idx));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVectorView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVectorView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVectorView.java
new file mode 100644
index 0000000..76a1c0a
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SingleElementVectorView.java
@@ -0,0 +1,97 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.impls.storage.vector.SingleElementVectorDelegateStorage;
+
+/**
+ * Single value vector view over another vector.
+ */
+public class SingleElementVectorView extends AbstractVector {
+    /**
+     *
+     */
+    public SingleElementVectorView() {
+        // No-op.
+    }
+
+    /**
+     * @param vec
+     * @param idx
+     */
+    public SingleElementVectorView(Vector vec, int idx) {
+        super(new SingleElementVectorDelegateStorage(vec, idx));
+    }
+
+    /**
+     *
+     *
+     */
+    private SingleElementVectorDelegateStorage storage() {
+        return (SingleElementVectorDelegateStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector.Element minElement() {
+        return makeElement(storage().index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector.Element maxElement() {
+        return makeElement(storage().index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        return getX(storage().index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nonZeroElements() {
+        return isZero(getX(storage().index())) ? 0 : 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        SingleElementVectorDelegateStorage sto = storage();
+
+        return new SingleElementVectorView(sto.delegate(), sto.index());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        if (x == 0.0)
+            return copy().map(Functions.mult(x));
+        else
+            return super.times(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalOffHeapVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalOffHeapVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalOffHeapVector.java
new file mode 100644
index 0000000..2fd1c57
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalOffHeapVector.java
@@ -0,0 +1,47 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.storage.vector.SparseLocalOffHeapVectorStorage;
+
+/**
+ * Implementation for {@link Vector} assuming sparse logic and local offheap JVM storage.
+ * It is suitable for data sets where local, non-distributed execution is satisfactory and on-heap JVM storage
+ * is not enough to keep the entire data set.
+ * <p>See also: <a href="https://en.wikipedia.org/wiki/Sparse_array">Wikipedia article</a>.</p>
+ */
+public class SparseLocalOffHeapVector extends AbstractVector {
+    /**
+     * @param crd Vector cardinality.
+     */
+    public SparseLocalOffHeapVector(int crd) {
+        setStorage(new SparseLocalOffHeapVectorStorage(crd));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        return new SparseLocalOffHeapVector(crd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalVector.java
new file mode 100644
index 0000000..ebb6731
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/SparseLocalVector.java
@@ -0,0 +1,71 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.SparseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.storage.vector.SparseLocalOnHeapVectorStorage;
+
+/**
+ * Local on-heap sparse vector based on hash map storage.
+ */
+public class SparseLocalVector extends AbstractVector implements StorageConstants {
+    /**
+     *
+     */
+    public SparseLocalVector() {
+        // No-op.
+    }
+
+    /**
+     * @param size
+     * @param acsMode
+     */
+    public SparseLocalVector(int size, int acsMode) {
+        assertAccessMode(acsMode);
+
+        setStorage(new SparseLocalOnHeapVectorStorage(size, acsMode));
+    }
+
+    /** */
+    private SparseLocalOnHeapVectorStorage storage() {
+        return (SparseLocalOnHeapVectorStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        SparseLocalOnHeapVectorStorage sto = storage();
+
+        return new SparseLocalVector(crd, sto.getAccessMode());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return new SparseLocalOnHeapMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        if (x == 0.0)
+            return assign(0);
+        else
+            return super.times(x);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/VectorView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/VectorView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/VectorView.java
new file mode 100644
index 0000000..ce51a45
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/VectorView.java
@@ -0,0 +1,85 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.Externalizable;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.storage.vector.DelegateVectorStorage;
+
+/**
+ * Implements the partial view into the parent {@link Vector}.
+ */
+public class VectorView extends AbstractVector {
+    /**
+     * Constructor for {@link Externalizable} interface.
+     */
+    public VectorView() {
+        // No-op.
+    }
+
+    /**
+     * @param parent Backing parent {@link Vector}.
+     * @param off Offset to parent vector.
+     * @param len Size of the view.
+     */
+    public VectorView(Vector parent, int off, int len) {
+        super(new DelegateVectorStorage(parent.getStorage(), off, len));
+    }
+
+    /**
+     * @param sto Backing parent {@link VectorStorage}.
+     * @param off Offset to parent vector.
+     * @param len Size of the view.
+     */
+    public VectorView(VectorStorage sto, int off, int len) {
+        super(new DelegateVectorStorage(sto, off, len));
+    }
+
+    /** */
+    private DelegateVectorStorage storage() {
+        return (DelegateVectorStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        DelegateVectorStorage sto = storage();
+
+        return new VectorView(sto.delegate(), sto.offset(), sto.length());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        return this == o ||
+            ((o != null)
+                && o.getClass() == getClass()
+                && (getStorage().equals(((VectorView)o).getStorage())));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/package-info.java
new file mode 100644
index 0000000..d6ca1f3
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains specific implementations for vectors.
+ */
+package org.apache.ignite.math.impls.vector;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/package-info.java
new file mode 100644
index 0000000..05ce651
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains main APIs for distributed code algebra.
+ */
+package org.apache.ignite.math;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/resources/org/apache/ignite/math/d3-matrix-template.html
----------------------------------------------------------------------
diff --git a/modules/math/src/main/resources/org/apache/ignite/math/d3-matrix-template.html b/modules/math/src/main/resources/org/apache/ignite/math/d3-matrix-template.html
new file mode 100644
index 0000000..19a907a
--- /dev/null
+++ b/modules/math/src/main/resources/org/apache/ignite/math/d3-matrix-template.html
@@ -0,0 +1,128 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<meta charset="utf-8">
+<title>IgniteML</title>
+<style>
+    body {
+        margin: 0 15px;
+    }
+
+    p {
+        margin: 10px 0 !important;
+    }
+
+    .name {
+        font-size: 20px;
+        font-weight: 400;
+        font-family: monospace;
+    }
+
+    .swatch {
+        display: inline-block;
+        width: 25px;
+        height: 25px;
+        margin-left: 5px;
+        vertical-align: bottom;
+    }
+</style>
+<body>
+<img style="margin-top: 15px" width="100px" src="https://ignite.apache.org/images/logo3.png">
+<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3.min.js"></script>
+<script>
+    /*@DATA@*/
+    var data = [[{d: 2.256, r: 198, g: 128, b: 128}, {d: 0.123, r: 218, g: 228, b: 18}], [{
+        d: 2.256,
+        r: 108,
+        g: 28,
+        b: 108
+    }, {d: 0.123, r: 228, g: 228, b: 228}]];
+    /*@MAX@*/
+    var max = {d: 2.256, r: 128, g: 128, b: 128};
+    /*@MIN@*/
+    var min = {d: 0.123, r: 228, g: 228, b: 228};
+    /*@NAME@*/
+    var name = "Matrix";
+
+    var rows = data.length;
+    var cols = data[0].length;
+
+    var range = max.d - min.d;
+
+    var rw, rh;
+    var W, H;
+
+    if (cols > W) {
+        rw = 1;
+        W = cols;
+    }
+    else {
+        W = 1000;
+        rw = Math.min(Math.round(W / cols), 10);
+    }
+
+    if (rows > H) {
+        rh = 1;
+        H = rows;
+    }
+    else {
+        H = 1000;
+        rh = Math.min(Math.round(H / rows), 10);
+    }
+
+    d3.selectAll("body")
+        .append("p")
+        .text(name + " (" + rows + "x" + cols + ")")
+        .attr("class", "name");
+
+    d3.selectAll("body")
+        .append("p")
+        .attr("class", "name")
+        .text("Max: " + max.d)
+        .append("span")
+        .attr("class", "swatch")
+        .attr("style", "background-color: rgb(" + max.r + ", " + max.g + ", " + max.b + ")");
+
+    d3.selectAll("body")
+        .append("p")
+        .attr("class", "name")
+        .text("Min: " + min.d)
+        .append("span")
+        .attr("class", "swatch")
+        .attr("style", "background-color: rgb(" + min.r + ", " + min.g + ", " + min.b + ")");
+
+    var svg = d3.select("body").append("svg")
+        .attr("width", W)
+        .attr("height", H);
+
+    var y = 0;
+
+    for (var row = 0; row < rows; row++)
+        svg.selectAll("div")
+            .data(data[row])
+            .enter()
+            .append("rect")
+            .attr("x", function (d, i) {
+                return i * rw
+            })
+            .attr("y", rh * row)
+            .attr("fill", function (d) {
+                return "rgb(" + d.r + ", " + d.g + ", " + d.b + ")";
+            })
+            .attr("width", rw)
+            .attr("height", rh);
+</script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/resources/org/apache/ignite/math/d3-vector-template.html
----------------------------------------------------------------------
diff --git a/modules/math/src/main/resources/org/apache/ignite/math/d3-vector-template.html b/modules/math/src/main/resources/org/apache/ignite/math/d3-vector-template.html
new file mode 100644
index 0000000..7644481
--- /dev/null
+++ b/modules/math/src/main/resources/org/apache/ignite/math/d3-vector-template.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<meta charset="utf-8">
+<title>IgniteML</title>
+<style>
+    body {
+        margin: 0 15px;
+    }
+
+    p {
+        margin: 10px 0 !important;
+    }
+
+    .name {
+        font-size: 20px;
+        font-weight: 400;
+        font-family: monospace;
+    }
+
+    .swatch {
+        display: inline-block;
+        width: 25px;
+        height: 25px;
+        margin-left: 5px;
+        vertical-align: bottom;
+    }
+</style>
+<body>
+<img style="margin-top: 15px" width="100px" src="https://ignite.apache.org/images/logo3.png">
+<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3.min.js"></script>
+<script>
+    /*@DATA@*/
+    var data = [{d: 2.256, r: 128, g: 128, b: 128}, {d: 0.123, r: 228, g: 228, b: 228}];
+    /*@MAX@*/
+    var max = {d: 2.256, r: 128, g: 128, b: 128};
+    /*@MIN@*/
+    var min = {d: 0.123, r: 228, g: 228, b: 228};
+    /*@NAME@*/
+    var name = "Vector";
+
+    var W, H = 1000;
+
+    var range = max.d - min.d;
+
+    var rh = 20; // Constant.
+
+    var rw;
+
+    if (data.length > W) {
+        rw = 1;
+        W = data.length;
+    }
+    else {
+        W = 1000;
+        rw = Math.min(Math.round(W / data.length), 5);
+    }
+
+    d3.selectAll("body")
+        .append("p")
+        .text(name + " (size: " + data.length + ")")
+        .attr("class", "name");
+
+    d3.selectAll("body")
+        .append("p")
+        .attr("class", "name")
+        .text("Max: " + max.d)
+        .append("span")
+        .attr("class", "swatch")
+        .attr("style", "background-color: rgb(" + max.r + ", " + max.g + ", " + max.b + ")");
+
+    d3.selectAll("body")
+        .append("p")
+        .attr("class", "name")
+        .text("Min: " + min.d)
+        .append("span")
+        .attr("class", "swatch")
+        .attr("style", "background-color: rgb(" + min.r + ", " + min.g + ", " + min.b + ")");
+
+    var svg = d3.select("body").append("svg")
+        .attr("width", W)
+        .attr("height", H);
+
+    svg.selectAll("rect")
+        .data(data)
+        .enter()
+        .append("rect")
+        .attr("x", function (d, i) {
+            return i * rw
+        })
+        .attr("y", 10)
+        .attr("fill", function (d) {
+            return "rgb(" + d.r + ", " + d.g + ", " + d.b + ")";
+        })
+        .attr("width", rw)
+        .attr("height", rh);
+</script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/ExternalizeTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/ExternalizeTest.java b/modules/math/src/test/java/org/apache/ignite/math/ExternalizeTest.java
new file mode 100644
index 0000000..218b7ff
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/ExternalizeTest.java
@@ -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.
+ */
+
+package org.apache.ignite.math;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Common test for externalization.
+ */
+public abstract class ExternalizeTest<T extends Externalizable & Destroyable> {
+    /** */
+    protected void externalizeTest(T initObj) {
+        T objRestored = null;
+
+        try {
+            ByteArrayOutputStream byteArrOutputStream = new ByteArrayOutputStream();
+            ObjectOutputStream objOutputStream = new ObjectOutputStream(byteArrOutputStream);
+
+            objOutputStream.writeObject(initObj);
+
+            ByteArrayInputStream byteArrInputStream = new ByteArrayInputStream(byteArrOutputStream.toByteArray());
+            ObjectInputStream objInputStream = new ObjectInputStream(byteArrInputStream);
+
+            objRestored = (T)objInputStream.readObject();
+
+            assertTrue(MathTestConstants.VAL_NOT_EQUALS, initObj.equals(objRestored));
+            assertTrue(MathTestConstants.VAL_NOT_EQUALS, Integer.compare(initObj.hashCode(), objRestored.hashCode()) == 0);
+        }
+        catch (ClassNotFoundException | IOException e) {
+            fail(e + " [" + e.getMessage() + "]");
+        }
+        finally {
+            if (objRestored != null)
+                objRestored.destroy();
+        }
+    }
+
+    /** */
+    @Test
+    public abstract void externalizeTest();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/MathImplDistributedTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/MathImplDistributedTestSuite.java b/modules/math/src/test/java/org/apache/ignite/math/MathImplDistributedTestSuite.java
new file mode 100644
index 0000000..318ea95
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/MathImplDistributedTestSuite.java
@@ -0,0 +1,39 @@
+/*
+ * 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.math;
+
+import org.apache.ignite.math.impls.matrix.CacheMatrixTest;
+import org.apache.ignite.math.impls.matrix.SparseDistributedMatrixTest;
+import org.apache.ignite.math.impls.storage.matrix.SparseDistributedMatrixStorageTest;
+import org.apache.ignite.math.impls.vector.CacheVectorTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for all distributed tests located in org.apache.ignite.math.impls.* package.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    CacheVectorTest.class,
+    CacheMatrixTest.class,
+    SparseDistributedMatrixStorageTest.class,
+    SparseDistributedMatrixTest.class,
+})
+public class MathImplDistributedTestSuite {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/MathImplLocalTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/MathImplLocalTestSuite.java b/modules/math/src/test/java/org/apache/ignite/math/MathImplLocalTestSuite.java
new file mode 100644
index 0000000..a652e7f
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/MathImplLocalTestSuite.java
@@ -0,0 +1,123 @@
+/*
+ * 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.math;
+
+import org.apache.ignite.math.decompositions.CholeskyDecompositionTest;
+import org.apache.ignite.math.decompositions.EigenDecompositionTest;
+import org.apache.ignite.math.decompositions.LUDecompositionTest;
+import org.apache.ignite.math.decompositions.QRDecompositionTest;
+import org.apache.ignite.math.decompositions.SingularValueDecompositionTest;
+import org.apache.ignite.math.impls.matrix.DenseLocalOffHeapMatrixConstructorTest;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrixConstructorTest;
+import org.apache.ignite.math.impls.matrix.DiagonalMatrixTest;
+import org.apache.ignite.math.impls.matrix.FunctionMatrixConstructorTest;
+import org.apache.ignite.math.impls.matrix.MatrixAttributeTest;
+import org.apache.ignite.math.impls.matrix.MatrixImplementationsTest;
+import org.apache.ignite.math.impls.matrix.MatrixViewConstructorTest;
+import org.apache.ignite.math.impls.matrix.PivotedMatrixViewConstructorTest;
+import org.apache.ignite.math.impls.matrix.RandomMatrixConstructorTest;
+import org.apache.ignite.math.impls.matrix.SparseLocalOnHeapMatrixConstructorTest;
+import org.apache.ignite.math.impls.matrix.TransposedMatrixViewTest;
+import org.apache.ignite.math.impls.storage.matrix.MatrixArrayStorageTest;
+import org.apache.ignite.math.impls.storage.matrix.MatrixOffHeapStorageTest;
+import org.apache.ignite.math.impls.storage.matrix.MatrixStorageImplementationTest;
+import org.apache.ignite.math.impls.storage.vector.RandomAccessSparseVectorStorageTest;
+import org.apache.ignite.math.impls.storage.vector.SparseLocalOffHeapVectorStorageTest;
+import org.apache.ignite.math.impls.storage.vector.VectorArrayStorageTest;
+import org.apache.ignite.math.impls.storage.vector.VectorOffheapStorageTest;
+import org.apache.ignite.math.impls.vector.AbstractVectorTest;
+import org.apache.ignite.math.impls.vector.ConstantVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.DelegatingVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.DenseLocalOffHeapVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.FunctionVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.MatrixVectorViewTest;
+import org.apache.ignite.math.impls.vector.PivotedVectorViewConstructorTest;
+import org.apache.ignite.math.impls.vector.RandomVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.SingleElementVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.SingleElementVectorViewConstructorTest;
+import org.apache.ignite.math.impls.vector.SparseLocalVectorConstructorTest;
+import org.apache.ignite.math.impls.vector.VectorAttributesTest;
+import org.apache.ignite.math.impls.vector.VectorFoldMapTest;
+import org.apache.ignite.math.impls.vector.VectorImplementationsTest;
+import org.apache.ignite.math.impls.vector.VectorIterableTest;
+import org.apache.ignite.math.impls.vector.VectorNormTest;
+import org.apache.ignite.math.impls.vector.VectorToMatrixTest;
+import org.apache.ignite.math.impls.vector.VectorViewTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for all local tests located in org.apache.ignite.math.impls.* package.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    // Vector constructors tests.
+    DenseLocalOnHeapVectorConstructorTest.class,
+    DenseLocalOffHeapVectorConstructorTest.class,
+    SparseLocalVectorConstructorTest.class,
+    RandomVectorConstructorTest.class,
+    ConstantVectorConstructorTest.class,
+    FunctionVectorConstructorTest.class,
+    SingleElementVectorConstructorTest.class,
+    PivotedVectorViewConstructorTest.class,
+    SingleElementVectorViewConstructorTest.class,
+    DelegatingVectorConstructorTest.class,
+    // Various vectors tests.
+    AbstractVectorTest.class,
+    VectorImplementationsTest.class,
+    VectorViewTest.class,
+    MatrixVectorViewTest.class,
+    // Vector particular features tests.
+    VectorIterableTest.class,
+    VectorAttributesTest.class,
+    VectorToMatrixTest.class,
+    VectorNormTest.class,
+    VectorFoldMapTest.class,
+    // Vector storage tests
+    VectorArrayStorageTest.class,
+    VectorOffheapStorageTest.class,
+    RandomAccessSparseVectorStorageTest.class,
+    SparseLocalOffHeapVectorStorageTest.class,
+    // Matrix storage tests.
+    MatrixStorageImplementationTest.class,
+    MatrixOffHeapStorageTest.class,
+    MatrixArrayStorageTest.class,
+    // Matrix constructors tests.
+    DenseLocalOnHeapMatrixConstructorTest.class,
+    DenseLocalOffHeapMatrixConstructorTest.class,
+    RandomMatrixConstructorTest.class,
+    FunctionMatrixConstructorTest.class,
+    MatrixViewConstructorTest.class,
+    PivotedMatrixViewConstructorTest.class,
+    SparseLocalOnHeapMatrixConstructorTest.class,
+    // Matrix tests.
+    MatrixImplementationsTest.class,
+    DiagonalMatrixTest.class,
+    MatrixAttributeTest.class,
+    TransposedMatrixViewTest.class,
+    // Decomposes
+    LUDecompositionTest.class,
+    EigenDecompositionTest.class,
+    CholeskyDecompositionTest.class,
+    QRDecompositionTest.class,
+    SingularValueDecompositionTest.class
+})
+public class MathImplLocalTestSuite {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/MathImplMainTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/MathImplMainTestSuite.java b/modules/math/src/test/java/org/apache/ignite/math/MathImplMainTestSuite.java
new file mode 100644
index 0000000..44fa8e6
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/MathImplMainTestSuite.java
@@ -0,0 +1,33 @@
+/*
+ * 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.math;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for local and distributed tests
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    MathImplLocalTestSuite.class,
+    MathImplDistributedTestSuite.class
+})
+public class MathImplMainTestSuite {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/TracerTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/TracerTest.java b/modules/math/src/test/java/org/apache/ignite/math/TracerTest.java
new file mode 100644
index 0000000..35d2f60
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/TracerTest.java
@@ -0,0 +1,195 @@
+/*
+ * 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.math;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Optional;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.junit.Test;
+
+import static java.nio.file.Files.createTempFile;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link Tracer}.
+ */
+public class TracerTest {
+    /** */ private static final String DEFAULT_FORMAT = "%.10f";
+    /** */ private static final double DEFAULT_DELTA = 0.000000001d;
+
+    /**
+     * Color mapper that maps [0, 1] range into three distinct RGB segments.
+     */
+    private static final Tracer.ColorMapper COLOR_MAPPER = new Tracer.ColorMapper() {
+        /** {@inheritDoc} */
+        @Override public Color apply(Double d) {
+            if (d <= 0.33)
+                return Color.RED;
+            else if (d <= 0.66)
+                return Color.GREEN;
+            else
+                return Color.BLUE;
+        }
+    };
+
+    /**
+     * @param size Vector size.
+     */
+    private Vector makeRandomVector(int size) {
+        DenseLocalOnHeapVector vec = new DenseLocalOnHeapVector(size);
+
+        vec.assign((idx) -> Math.random());
+
+        return vec;
+    }
+
+    /**
+     * @param rows Amount of rows in matrix.
+     * @param cols Amount of columns in matrix.
+     */
+    private Matrix makeRandomMatrix(int rows, int cols) {
+        DenseLocalOnHeapMatrix mtx = new DenseLocalOnHeapMatrix(rows, cols);
+
+        // Missing assign(f)?
+        mtx.map((d) -> Math.random());
+
+        return mtx;
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testAsciiVectorTracer() {
+        Vector vec = makeRandomVector(20);
+
+        Tracer.showAscii(vec);
+        Tracer.showAscii(vec, "%2f");
+        Tracer.showAscii(vec, "%.3g");
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testAsciiMatrixTracer() {
+        Matrix mtx = makeRandomMatrix(10, 10);
+
+        Tracer.showAscii(mtx);
+        Tracer.showAscii(mtx, "%2f");
+        Tracer.showAscii(mtx, "%.3g");
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testHtmlVectorTracer() throws IOException {
+        Vector vec1 = makeRandomVector(1000);
+
+        // Default color mapping.
+        Tracer.showHtml(vec1);
+
+        // Custom color mapping.
+        Tracer.showHtml(vec1, COLOR_MAPPER);
+
+        // Default color mapping with sorted vector.
+        Tracer.showHtml(vec1.sort());
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void testHtmlMatrixTracer() throws IOException {
+        Matrix mtx1 = makeRandomMatrix(100, 100);
+
+        // Custom color mapping.
+        Tracer.showHtml(mtx1, COLOR_MAPPER);
+
+        Matrix mtx2 = new DenseLocalOnHeapMatrix(100, 100);
+
+        double MAX = (double)(mtx2.rowSize() * mtx2.columnSize());
+
+        mtx2.assign((x, y) -> (double)(x * y) / MAX);
+
+        Tracer.showHtml(mtx2);
+    }
+
+    /** */
+    @Test
+    public void testWriteVectorToCSVFile() throws IOException {
+        DenseLocalOnHeapVector vector = new DenseLocalOnHeapVector(MathTestConstants.STORAGE_SIZE);
+
+        for (int i = 0; i < vector.size(); i++)
+            vector.set(i, Math.random());
+
+        Path file = createTempFile("vector", ".csv");
+
+        Tracer.saveAsCsv(vector, DEFAULT_FORMAT, file.toString());
+
+        System.out.println("Vector exported: " + file.getFileName());
+
+        List<String> strings = Files.readAllLines(file);
+        Optional<String> reduce = strings.stream().reduce((s1, s2) -> s1 + s2);
+        String[] csvVals = reduce.get().split(",");
+
+        for (int i = 0; i < vector.size(); i++) {
+            Double csvVal = Double.valueOf(csvVals[i]);
+
+            assertEquals("Unexpected value.", csvVal, vector.get(i), DEFAULT_DELTA);
+        }
+
+        Files.deleteIfExists(file);
+    }
+
+    /** */
+    @Test
+    public void testWriteMatrixToCSVFile() throws IOException {
+        DenseLocalOnHeapMatrix matrix = new DenseLocalOnHeapMatrix(MathTestConstants.STORAGE_SIZE, MathTestConstants.STORAGE_SIZE);
+
+        for (int i = 0; i < matrix.rowSize(); i++)
+            for (int j = 0; j < matrix.columnSize(); j++)
+                matrix.set(i, j, Math.random());
+
+        Path file = createTempFile("matrix", ".csv");
+
+        Tracer.saveAsCsv(matrix, DEFAULT_FORMAT, file.toString());
+
+        System.out.println("Matrix exported: " + file.getFileName());
+
+        List<String> strings = Files.readAllLines(file);
+        Optional<String> reduce = strings.stream().reduce((s1, s2) -> s1 + s2);
+        String[] csvVals = reduce.get().split(",");
+
+        for (int i = 0; i < matrix.rowSize(); i++)
+            for (int j = 0; j < matrix.columnSize(); j++) {
+                Double csvVal = Double.valueOf(csvVals[i * matrix.rowSize() + j]);
+
+                assertEquals("Unexpected value.", csvVal, matrix.get(i, j), DEFAULT_DELTA);
+            }
+
+        Files.deleteIfExists(file);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmark.java b/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmark.java
new file mode 100644
index 0000000..4c3718a
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmark.java
@@ -0,0 +1,205 @@
+/*
+ * 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.math.benchmark;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/** Refer {@link MathBenchmarkSelfTest} for usage examples. */
+class MathBenchmark {
+    /** */
+    private final boolean outputToConsole;
+
+    /** */
+    private final String benchmarkName;
+
+    /** */
+    private final int measurementTimes;
+
+    /** */
+    private final int warmUpTimes;
+
+    /** */
+    private final String tag;
+
+    /** */
+    private final String comments;
+
+    /** Constructor strictly for use within this class. */
+    private MathBenchmark(String benchmarkName, boolean outputToConsole, int measurementTimes, int warmUpTimes,
+        String tag, String comments) {
+        this.benchmarkName = benchmarkName;
+        this.outputToConsole = outputToConsole;
+        this.measurementTimes = measurementTimes;
+        this.warmUpTimes = warmUpTimes;
+        this.tag = tag;
+        this.comments = comments;
+        validate();
+    }
+
+    /**
+     * Benchmark with specified name and default parameters, in particular, default output file.
+     *
+     * @param benchmarkName name
+     */
+    MathBenchmark(String benchmarkName) {
+        this(benchmarkName, false, 100, 1, "", "");
+    }
+
+    /**
+     * Executes the code using config of this benchmark.
+     *
+     * @param code code to execute
+     * @throws Exception if something goes wrong
+     */
+    void execute(BenchmarkCode code) throws Exception {
+        System.out.println("Started benchmark [" + benchmarkName + "].");
+
+        for (int cnt = 0; cnt < warmUpTimes; cnt++)
+            code.call();
+
+        final long start = System.currentTimeMillis();
+
+        for (int cnt = 0; cnt < measurementTimes; cnt++)
+            code.call();
+
+        final long end = System.currentTimeMillis();
+
+        writeResults(formatResults(start, end));
+
+        System.out.println("Finished benchmark [" + benchmarkName + "].");
+    }
+
+    /**
+     * Set optional output mode for using stdout.
+     *
+     * @return configured benchmark
+     */
+    MathBenchmark outputToConsole() {
+        return new MathBenchmark(benchmarkName, true, measurementTimes, warmUpTimes, tag, comments);
+    }
+
+    /**
+     * Set optional measurement times.
+     *
+     * @param param times
+     * @return configured benchmark
+     */
+    MathBenchmark measurementTimes(int param) {
+        return new MathBenchmark(benchmarkName, outputToConsole, param, warmUpTimes, tag, comments);
+    }
+
+    /**
+     * Set optional warm-up times.
+     *
+     * @param param times
+     * @return configured benchmark
+     */
+    MathBenchmark warmUpTimes(int param) {
+        return new MathBenchmark(benchmarkName, outputToConsole, measurementTimes, param, tag, comments);
+    }
+
+    /**
+     * Set optional tag to help filtering specific kind of benchmark results.
+     *
+     * @param param name
+     * @return configured benchmark
+     */
+    MathBenchmark tag(String param) {
+        return new MathBenchmark(benchmarkName, outputToConsole, measurementTimes, warmUpTimes, param, comments);
+    }
+
+    /**
+     * Set optional comments.
+     *
+     * @param param name
+     * @return configured benchmark
+     */
+    MathBenchmark comments(String param) {
+        return new MathBenchmark(benchmarkName, outputToConsole, measurementTimes, warmUpTimes, tag, param);
+    }
+
+    /** */
+    private void writeResults(String results) throws Exception {
+        if (outputToConsole) {
+            System.out.println(results);
+
+            return;
+        }
+
+        new ResultsWriter().append(results);
+    }
+
+    /** */
+    private String formatResults(long start, long end) {
+        final String delim = ",";
+
+        assert !formatDouble(1000_000_001.1).contains(delim) : "Formatted results contain [" + delim + "].";
+
+        final String ts = formatTs(start);
+
+        assert !ts.contains(delim) : "Formatted timestamp contains [" + delim + "].";
+
+        return benchmarkName +
+            delim +
+            ts + // IMPL NOTE timestamp
+            delim +
+            formatDouble((double)(end - start) / measurementTimes) +
+            delim +
+            measurementTimes +
+            delim +
+            warmUpTimes +
+            delim +
+            tag +
+            delim +
+            comments;
+    }
+
+    /** */
+    private String formatDouble(double val) {
+        return String.format(Locale.US, "%f", val);
+    }
+
+    /** */
+    private String formatTs(long ts) {
+        final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
+
+        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+        return sdf.format(new Date(ts));
+    }
+
+    /** */
+    private void validate() {
+        if (benchmarkName == null || benchmarkName.isEmpty())
+            throw new IllegalArgumentException("Invalid benchmark name: [" + benchmarkName + "].");
+
+        if (measurementTimes < 1)
+            throw new IllegalArgumentException("Invalid measurement times: [" + measurementTimes + "].");
+    }
+
+    /** */
+    interface BenchmarkCode {
+        // todo find out why Callable<Void> failed to work here
+
+        /** */
+        void call() throws Exception;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmarkSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmarkSelfTest.java b/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmarkSelfTest.java
new file mode 100644
index 0000000..7a86461
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/benchmark/MathBenchmarkSelfTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.math.benchmark;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class MathBenchmarkSelfTest {
+    /** */
+    @Test
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void demoTest() throws Exception {
+        for (int i = 0; i < 2; i++)
+            new MathBenchmark("demo test")
+                .outputToConsole() // IMPL NOTE this is to write output into console instead of a file
+                .tag(null) // IMPL NOTE try null for tag, expect it to be formatted reasonably
+                .comments(null) // IMPL NOTE try null for comments, expect it to be formatted reasonably
+                .execute(() -> {
+                    double seed = 1.1;
+
+                    for (int cnt = 0; cnt < 1000; cnt++) {
+                        seed = Math.pow(seed, 2);
+
+                        assertTrue(seed > 0);
+                    }
+                });
+    }
+
+    /** */
+    @Test
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void configTest() throws Exception {
+        new MathBenchmark("demo config test")
+            .outputToConsole()
+            .measurementTimes(2)
+            .warmUpTimes(0)
+            .tag("demo tag")
+            .comments("demo comments")
+            .execute(() -> System.out.println("config test"));
+    }
+
+    /** */
+    @Test(expected = IllegalArgumentException.class)
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void emptyNameTest() throws Exception {
+        new MathBenchmark("")
+            .outputToConsole()
+            .measurementTimes(1)
+            .warmUpTimes(1)
+            .tag("empty name test tag")
+            .comments("empty name test comments")
+            .execute(() -> System.out.println("empty name test"));
+    }
+
+    /** */
+    @Test(expected = IllegalArgumentException.class)
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void nullDropboxPathTest() throws Exception {
+        new ResultsWriter(null, "whatever", "whatever");
+    }
+
+    /** */
+    @Test(expected = IllegalArgumentException.class)
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void nullDropboxUrlTest() throws Exception {
+        new ResultsWriter("whatever", null, "whatever");
+    }
+
+    /** */
+    @Test(expected = IllegalArgumentException.class)
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void nullDropboxTokenTest() throws Exception {
+        new ResultsWriter("whatever", "whatever", null);
+    }
+
+    /** */
+    @Test(expected = IllegalArgumentException.class)
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void nullResultsTest() throws Exception {
+        new ResultsWriter("whatever", "whatever", "whatever").append(null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/benchmark/ResultsWriter.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/benchmark/ResultsWriter.java b/modules/math/src/test/java/org/apache/ignite/math/benchmark/ResultsWriter.java
new file mode 100644
index 0000000..aeec156
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/benchmark/ResultsWriter.java
@@ -0,0 +1,127 @@
+/*
+ * 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.math.benchmark;
+
+import com.dropbox.core.DbxException;
+import com.dropbox.core.DbxRequestConfig;
+import com.dropbox.core.v2.DbxClientV2;
+import com.dropbox.core.v2.files.WriteMode;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.UUID;
+
+/** */
+class ResultsWriter {
+    /** */
+    private static final String DROPBOX_PATH
+        = "/benchmarks/math.benchmark.results.csv";
+
+    /** */
+    private static final String DROPBOX_URL
+        = "https://www.dropbox.com/s/r7tcle31r7gaty8/math.benchmark.results.csv";
+
+    /** */
+    private static final String ACCESS_TOKEN
+        = "1MMmQjEyzGAAAAAAAAAAfDFrQ6oBPPi4NX-iU_VrgmXB2JDXqRHGa125cTkkEQ0V";
+
+    /** */
+    private final String dropboxPath;
+    /** */
+    private final String dropboxUrl;
+    /** */
+    private final String accessTok;
+
+    /** */
+    ResultsWriter(String dropboxPath, String dropboxUrl, String accessTok) {
+        this.dropboxPath = dropboxPath;
+        this.dropboxUrl = dropboxUrl;
+        this.accessTok = accessTok;
+
+        if (dropboxPath == null || dropboxUrl == null || accessTok == null)
+            throw new IllegalArgumentException("Neither of dropbox path, URL, access token can be null.");
+    }
+
+    /** **/
+    ResultsWriter() {
+        this(DROPBOX_PATH, DROPBOX_URL, ACCESS_TOKEN);
+    }
+
+    /** */
+    void append(String res) throws DbxException, IOException {
+        if (res == null)
+            throw new IllegalArgumentException("benchmark result is null");
+
+        if (dropboxPath == null) {
+            System.out.println(res);
+
+            return;
+        }
+
+        append(res, client());
+    }
+
+    /** */
+    private void append(String res, DbxClientV2 client) throws DbxException, IOException {
+        File tmp = createTmpFile();
+
+        try (FileOutputStream out = new FileOutputStream(tmp)) {
+            client.files().download(dropboxPath).download(out);
+        }
+
+        writeResults(res, tmp);
+
+        try (FileInputStream in = new FileInputStream(tmp)) {
+            client.files().uploadBuilder(dropboxPath).withMode(WriteMode.OVERWRITE).uploadAndFinish(in);
+        }
+
+        if (!tmp.delete())
+            System.out.println("Failed to delete " + tmp.getAbsolutePath());
+
+        System.out.println("Uploaded benchmark results to: " + dropboxUrl);
+    }
+
+    /** */
+    private void writeResults(String res, File tmp) throws IOException {
+        final String unixLineSeparator = "\n";
+
+        try (final PrintWriter writer = new PrintWriter(Files.newBufferedWriter(Paths.get(tmp.toURI()),
+            StandardOpenOption.APPEND, StandardOpenOption.CREATE))) {
+            writer.write(res + unixLineSeparator);
+        }
+    }
+
+    /** */
+    private File createTmpFile() throws IOException {
+        File tmp = File.createTempFile(UUID.randomUUID().toString(), ".csv");
+
+        tmp.deleteOnExit();
+
+        return tmp;
+    }
+
+    /** */
+    private DbxClientV2 client() {
+        return new DbxClientV2(DbxRequestConfig.newBuilder("dropbox/MathBenchmark").build(), accessTok);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/benchmark/VectorBenchmarkTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/benchmark/VectorBenchmarkTest.java b/modules/math/src/test/java/org/apache/ignite/math/benchmark/VectorBenchmarkTest.java
new file mode 100644
index 0000000..1f7b204
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/benchmark/VectorBenchmarkTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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.math.benchmark;
+
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.vector.DenseLocalOffHeapVector;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/** */
+public class VectorBenchmarkTest {
+    // todo add benchmarks for other methods in Vector and for other types of Vector and Matrix
+
+    /** */
+    @Test
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void testDenseLocalOnHeapVector() throws Exception {
+        benchmark("DenseLocalOnHeapVector basic mix", DenseLocalOnHeapVector::new, this::basicMix);
+
+        benchmark("DenseLocalOnHeapVector fold map", DenseLocalOnHeapVector::new, this::foldMapMix);
+    }
+
+    /** */
+    @Test
+    @Ignore("Benchmark tests are intended only for manual execution")
+    public void testDenseLocalOffHeapVector() throws Exception {
+        benchmark("DenseLocalOffHeapVector basic mix", DenseLocalOffHeapVector::new, this::basicMix);
+
+        benchmark("DenseLocalOffHeapVector fold map", DenseLocalOffHeapVector::new, this::foldMapMix);
+    }
+
+    /** */
+    private void benchmark(String namePrefix, Function<Integer, Vector> constructor,
+        BiConsumer<Integer, Function<Integer, Vector>> consumer) throws Exception {
+        assertNotNull(namePrefix);
+
+        new MathBenchmark(namePrefix + " small sizes").execute(() -> {
+            for (int size : new int[] {2, 3, 4, 5, 6, 7})
+                consumer.accept(size, constructor);
+        });
+
+        new MathBenchmark(namePrefix + " sizes powers of 2").execute(() -> {
+            for (int power : new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14})
+                consumer.accept(1 << power, constructor);
+        });
+
+        new MathBenchmark(namePrefix + " large sizes").execute(() -> {
+            for (int power : new int[] {10, 12, 14, 16})
+                for (int delta : new int[] {-1, 0, 1})
+                    consumer.accept((1 << power) + delta, constructor);
+        });
+
+        new MathBenchmark(namePrefix + " extra large sizes")
+            .measurementTimes(10)
+            .execute(() -> { // IMPL NOTE trying below with power 22 almost killed my IDEA and laptop
+                for (int power : new int[] {17, 18, 19, 20, 21})
+                    for (int delta : new int[] {-1, 0}) // IMPL NOTE delta +1 is not intended for use here
+                        consumer.accept((1 << power) + delta, constructor);
+            });
+    }
+
+    /** */
+    private void basicMix(int size, Function<Integer, Vector> constructor) {
+        final Vector v1 = constructor.apply(size), v2 = constructor.apply(size);
+
+        for (int idx = 0; idx < size; idx++) {
+            v1.set(idx, idx);
+
+            v2.set(idx, size - idx);
+        }
+
+        assertNotNull(v1.sum());
+
+        assertNotNull(v1.copy());
+
+        assertFalse(v1.getLengthSquared() < 0);
+
+        assertNotNull(v1.normalize());
+
+        assertNotNull(v1.logNormalize());
+
+        assertFalse(v1.getDistanceSquared(v2) < 0);
+
+        assertNotNull(v1.divide(2));
+
+        assertNotNull(v1.minus(v2));
+
+        assertNotNull(v1.plus(v2));
+
+        assertNotNull(v1.dot(v2));
+
+        assertNotNull(v1.assign(v2));
+
+        assertNotNull(v1.assign(1)); // IMPL NOTE this would better be last test for it sets all values the same
+    }
+
+    /** */
+    private void foldMapMix(int size, Function<Integer, Vector> constructor) {
+        final Vector v1 = constructor.apply(size), v2 = constructor.apply(size);
+
+        for (int idx = 0; idx < size; idx++) {
+            v1.set(idx, idx);
+
+            v2.set(idx, size - idx);
+        }
+
+        assertNotNull(v1.map((val) -> (val + 1)));
+
+        assertNotNull(v1.map(v2, (one, other) -> one + other / 2.0));
+
+        assertNotNull(v1.map((val, val1) -> (val + val1), 2.0));
+
+        assertNotNull(v1.foldMap((sum, val) -> (val + sum), (val) -> val, 0.0));
+
+        assertNotNull(v1.foldMap(v2, (sum, val) -> (val + sum), (val1, val2) -> val1 + val2, 0.0));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/benchmark/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/benchmark/package-info.java b/modules/math/src/test/java/org/apache/ignite/math/benchmark/package-info.java
new file mode 100644
index 0000000..cbf5d36
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/benchmark/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * 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.math.benchmark;


[02/50] [abbrv] ignite git commit: Added missing package info for o.a.i.hadoop package.

Posted by sb...@apache.org.
Added missing package info for o.a.i.hadoop package.


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

Branch: refs/heads/ignite-1561-1
Commit: 1708ffb9b48b6a876ac82b191080763e4f964417
Parents: e96682f
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 16:09:59 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 16:09:59 2017 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/hadoop/package-info.java  | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1708ffb9/modules/core/src/main/java/org/apache/ignite/hadoop/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/hadoop/package-info.java b/modules/core/src/main/java/org/apache/ignite/hadoop/package-info.java
new file mode 100644
index 0000000..abf4b76
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/hadoop/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains Hadoop Accelerator APIs.
+ */
+package org.apache.ignite.hadoop;
\ No newline at end of file


[07/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/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 6d49a3b..3fd9555 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
@@ -17,8 +17,7 @@
 
 package org.apache.ignite.visor.commands.cache
 
-import java.lang.{Boolean => JavaBoolean}
-import java.util.{Collection => JavaCollection, Collections, UUID}
+import java.util.{Collection => JavaCollection, List => JavaList, Collections, UUID}
 
 import org.apache.ignite._
 import org.apache.ignite.cluster.ClusterNode
@@ -26,7 +25,6 @@ import org.apache.ignite.internal.util.lang.{GridFunc => F}
 import org.apache.ignite.internal.util.typedef.X
 import org.apache.ignite.internal.visor.cache._
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
-import org.apache.ignite.lang.IgniteBiTuple
 import org.apache.ignite.visor.VisorTag
 import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
 import org.apache.ignite.visor.commands.common.VisorTextTable
@@ -270,7 +268,7 @@ class VisorCacheCommand {
                     if (hasArgFlag("scan", argLst))
                         VisorCacheScanCommand().scan(argLst, node)
                     else {
-                        if (aggrData.nonEmpty && !aggrData.exists(cache => F.eq(cache.name(), name) && cache.system())) {
+                        if (aggrData.nonEmpty && !aggrData.exists(cache => F.eq(cache.getName, name) && cache.isSystem)) {
                             if (hasArgFlag("clear", argLst))
                                 VisorCacheClearCommand().clear(argLst, node)
                             else if (hasArgFlag("stop", argLst))
@@ -323,39 +321,39 @@ class VisorCacheCommand {
             sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
                 ad => {
                     // Add cache host as visor variable.
-                    registerCacheName(ad.name())
+                    registerCacheName(ad.getName)
 
                     sumT += (
-                        mkCacheName(ad.name()),
-                        ad.mode(),
-                        ad.nodes.size(),
+                        mkCacheName(ad.getName),
+                        ad.getMode,
+                        ad.getNodes.size(),
                         (
-                            "min: " + (ad.minimumHeapSize() + ad.minimumOffHeapSize()) +
-                                " (" + ad.minimumHeapSize() + " / " + ad.minimumOffHeapSize() + ")",
-                            "avg: " + formatDouble(ad.averageHeapSize() + ad.averageOffHeapSize()) +
-                                " (" + formatDouble(ad.averageHeapSize()) + " / " + formatDouble(ad.averageOffHeapSize()) + ")",
-                            "max: " + (ad.maximumHeapSize() + ad.maximumOffHeapSize()) +
-                                " (" + ad.maximumHeapSize() + " / " + ad.maximumOffHeapSize() + ")"
+                            "min: " + (ad.getMinimumHeapSize + ad.getMinimumOffHeapSize) +
+                                " (" + ad.getMinimumHeapSize + " / " + ad.getMinimumOffHeapSize + ")",
+                            "avg: " + formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapSize) +
+                                " (" + formatDouble(ad.getAverageHeapSize) + " / " + formatDouble(ad.getAverageOffHeapSize) + ")",
+                            "max: " + (ad.getMaximumHeapSize + ad.getMaximumOffHeapSize) +
+                                " (" + ad.getMaximumHeapSize + " / " + ad.getMaximumOffHeapSize + ")"
                             ),
                         (
-                            "min: " + ad.minimumHits,
-                            "avg: " + formatDouble(ad.averageHits),
-                            "max: " + ad.maximumHits
+                            "min: " + ad.getMinimumHits,
+                            "avg: " + formatDouble(ad.getAverageHits),
+                            "max: " + ad.getMaximumHits
                             ),
                         (
-                            "min: " + ad.minimumMisses,
-                            "avg: " + formatDouble(ad.averageMisses),
-                            "max: " + ad.maximumMisses
+                            "min: " + ad.getMinimumMisses,
+                            "avg: " + formatDouble(ad.getAverageMisses),
+                            "max: " + ad.getMaximumMisses
                             ),
                         (
-                            "min: " + ad.minimumReads,
-                            "avg: " + formatDouble(ad.averageReads),
-                            "max: " + ad.maximumReads
+                            "min: " + ad.getMinimumReads,
+                            "avg: " + formatDouble(ad.getAverageReads),
+                            "max: " + ad.getMaximumReads
                             ),
                         (
-                            "min: " + ad.minimumWrites,
-                            "avg: " + formatDouble(ad.averageWrites),
-                            "max: " + ad.maximumWrites
+                            "min: " + ad.getMinimumWrites,
+                            "avg: " + formatDouble(ad.getAverageWrites),
+                            "max: " + ad.getMaximumWrites
                             )
                         )
                 }
@@ -365,11 +363,11 @@ class VisorCacheCommand {
 
             if (all) {
                 val sorted = aggrData.sortWith((k1, k2) => {
-                    if (k1.name() == null)
+                    if (k1.getName == null)
                         true
-                    else if (k2.name() == null)
+                    else if (k2.getName == null)
                         false
-                    else k1.name().compareTo(k2.name()) < 0
+                    else k1.getName.compareTo(k2.getName) < 0
                 })
 
                 val gCfg = node.map(config).collect {
@@ -377,23 +375,23 @@ class VisorCacheCommand {
                 }
 
                 sorted.foreach(ad => {
-                    val cacheNameVar = mkCacheName(ad.name())
+                    val cacheNameVar = mkCacheName(ad.getName)
 
                     println("\nCache '" + cacheNameVar + "':")
 
-                    val m = ad.metrics()
+                    val m = ad.getMetrics
 
                     val csT = VisorTextTable()
 
                     csT += ("Name(@)", cacheNameVar)
                     csT += ("Nodes", m.size())
-                    csT += ("Total size Min/Avg/Max", (ad.minimumHeapSize() + ad.minimumOffHeapSize()) + " / " +
-                        formatDouble(ad.averageHeapSize() + ad.averageOffHeapSize()) + " / " +
-                        (ad.maximumHeapSize() + ad.maximumOffHeapSize()))
-                    csT += ("  Heap size Min/Avg/Max", ad.minimumHeapSize() + " / " +
-                        formatDouble(ad.averageHeapSize()) + " / " + ad.maximumHeapSize())
-                    csT += ("  Off-heap size Min/Avg/Max", ad.minimumOffHeapSize() + " / " +
-                        formatDouble(ad.averageOffHeapSize()) + " / " + ad.maximumOffHeapSize())
+                    csT += ("Total size Min/Avg/Max", (ad.getMinimumHeapSize + ad.getMinimumOffHeapSize) + " / " +
+                        formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapSize) + " / " +
+                        (ad.getMaximumHeapSize + ad.getMaximumOffHeapSize))
+                    csT += ("  Heap size Min/Avg/Max", ad.getMinimumHeapSize + " / " +
+                        formatDouble(ad.getAverageHeapSize) + " / " + ad.getMaximumHeapSize)
+                    csT += ("  Off-heap size Min/Avg/Max", ad.getMinimumOffHeapSize + " / " +
+                        formatDouble(ad.getAverageOffHeapSize) + " / " + ad.getMaximumOffHeapSize)
 
                     val ciT = VisorTextTable()
 
@@ -410,16 +408,16 @@ class VisorCacheCommand {
                             formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
                             X.timeSpan2HMSM(nm.getUpTime),
                             (
-                                "Total: " + (cm.keySize() + cm.offHeapEntriesCount()),
-                                "  Heap: " + cm.keySize(),
+                                "Total: " + (cm.getKeySize + cm.offHeapEntriesCount()),
+                                "  Heap: " + cm.getKeySize,
                                 "  Off-Heap: " + cm.offHeapEntriesCount(),
-                                "  Off-Heap Memory: " + formatMemory(cm.offHeapAllocatedSize())
+                                "  Off-Heap Memory: " + formatMemory(cm.getOffHeapAllocatedSize)
                             ),
                             (
-                                "Hi: " + cm.hits(),
-                                "Mi: " + cm.misses(),
-                                "Rd: " + cm.reads(),
-                                "Wr: " + cm.writes()
+                                "Hi: " + cm.getHits,
+                                "Mi: " + cm.getMisses,
+                                "Rd: " + cm.getReads,
+                                "Wr: " + cm.getWrites
                             )
                         )
                     }
@@ -434,19 +432,19 @@ 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.
                     nl()
                     println("Aggregated queries metrics:")
-                    println("  Minimum execution time: " + X.timeSpan2HMSM(ad.minimumQueryTime()))
-                    println("  Maximum execution time: " + X.timeSpan2HMSM(ad.maximumQueryTime))
-                    println("  Average execution time: " + X.timeSpan2HMSM(ad.averageQueryTime.toLong))
-                    println("  Total number of executions: " + ad.execsQuery)
-                    println("  Total number of failures:   " + ad.failsQuery)
+                    println("  Minimum execution time: " + X.timeSpan2HMSM(ad.getMinimumQueryTime))
+                    println("  Maximum execution time: " + X.timeSpan2HMSM(ad.getMaximumQueryTime))
+                    println("  Average execution time: " + X.timeSpan2HMSM(ad.getAverageQueryTime.toLong))
+                    println("  Total number of executions: " + ad.getQueryExecutions)
+                    println("  Total number of failures:   " + ad.getQueryFailures)
 
-                    gCfg.foreach(ccfgs => ccfgs.find(ccfg => F.eq(ccfg.name(), ad.name()))
+                    gCfg.foreach(ccfgs => ccfgs.find(ccfg => F.eq(ccfg.getName, ad.getName))
                         .foreach(ccfg => {
                             nl()
 
@@ -509,9 +507,9 @@ class VisorCacheCommand {
         assert(node != null)
 
         try {
-            val caches: JavaCollection[String] = name.fold(Collections.emptyList[String]())(Collections.singletonList)
+            val caches: JavaList[String] = name.fold(Collections.emptyList[String]())(Collections.singletonList)
 
-            val arg = new IgniteBiTuple(JavaBoolean.valueOf(systemCaches), caches)
+            val arg = new VisorCacheMetricsCollectorTaskArg(systemCaches, caches)
 
             node match {
                 case Some(n) => executeOne(n.id(), classOf[VisorCacheMetricsCollectorTask], arg).toList
@@ -565,10 +563,10 @@ class VisorCacheCommand {
         assert(arg != null)
 
         val sorted = arg.trim match {
-            case "hi" => data.toSeq.sortBy(_._2.hits)
-            case "mi" => data.toSeq.sortBy(_._2.misses)
-            case "rd" => data.toSeq.sortBy(_._2.reads)
-            case "wr" => data.toSeq.sortBy(_._2.writes)
+            case "hi" => data.toSeq.sortBy(_._2.getHits)
+            case "mi" => data.toSeq.sortBy(_._2.getMisses)
+            case "rd" => data.toSeq.sortBy(_._2.getReads)
+            case "wr" => data.toSeq.sortBy(_._2.getWrites)
             case "cn" => data.toSeq.sortBy(_._1)
 
             case _ =>
@@ -592,12 +590,12 @@ class VisorCacheCommand {
         List[VisorCacheAggregatedMetrics] = {
 
         val sorted = arg.trim match {
-            case "hi" => data.toList.sortBy(_.averageHits)
-            case "mi" => data.toList.sortBy(_.averageMisses)
-            case "rd" => data.toList.sortBy(_.averageReads)
-            case "wr" => data.toList.sortBy(_.averageWrites)
+            case "hi" => data.toList.sortBy(_.getAverageHits)
+            case "mi" => data.toList.sortBy(_.getAverageMisses)
+            case "rd" => data.toList.sortBy(_.getAverageReads)
+            case "wr" => data.toList.sortBy(_.getAverageWrites)
             case "cn" => data.toList.sortWith((x, y) =>
-                x.name() == null || (y.name() != null && x.name().toLowerCase < y.name().toLowerCase))
+                x.getName == null || (y.getName != null && x.getName.toLowerCase < y.getName.toLowerCase))
 
             case _ =>
                 assert(false, "Unknown sorting type: " + arg)
@@ -639,19 +637,19 @@ class VisorCacheCommand {
             val ad = sortedAggrData(i)
 
             // Add cache host as visor variable.
-            registerCacheName(ad.name())
+            registerCacheName(ad.getName)
 
             sumT += (
                 i,
-                mkCacheName(ad.name()),
-                ad.mode(),
+                mkCacheName(ad.getName),
+                ad.getMode,
                 (
-                    "min: " + (ad.minimumHeapSize() + ad.minimumOffHeapSize()) +
-                        " (" + ad.minimumHeapSize() + " / " + ad.minimumOffHeapSize() + ")",
-                    "avg: " + formatDouble(ad.averageHeapSize() + ad.averageOffHeapSize()) +
-                        " (" + formatDouble(ad.averageHeapSize()) + " / " + formatDouble(ad.averageOffHeapSize()) + ")",
-                    "max: " + (ad.maximumHeapSize() + ad.maximumOffHeapSize()) +
-                        " (" + ad.maximumHeapSize() + " / " + ad.maximumOffHeapSize() + ")"
+                    "min: " + (ad.getMinimumHeapSize + ad.getMinimumOffHeapSize) +
+                        " (" + ad.getMinimumHeapSize + " / " + ad.getMinimumOffHeapSize + ")",
+                    "avg: " + formatDouble(ad.getAverageHeapSize + ad.getAverageOffHeapSize) +
+                        " (" + formatDouble(ad.getAverageHeapSize) + " / " + formatDouble(ad.getAverageOffHeapSize) + ")",
+                    "max: " + (ad.getMaximumHeapSize + ad.getMaximumOffHeapSize) +
+                        " (" + ad.getMaximumHeapSize + " / " + ad.getMaximumOffHeapSize + ")"
                 ))
         })
 
@@ -663,7 +661,7 @@ class VisorCacheCommand {
             None
         else {
             try
-                Some(sortedAggrData(a.toInt).name())
+                Some(sortedAggrData(a.toInt).getName)
             catch {
                 case e: Throwable =>
                     warn("Invalid selection: " + a)
@@ -828,94 +826,87 @@ object VisorCacheCommand {
      * @param cfg Config to show information.
      */
     private[commands] def printCacheConfiguration(title: String, cfg: VisorCacheConfiguration) {
-        val affinityCfg = cfg.affinityConfiguration()
-        val nearCfg = cfg.nearConfiguration()
-        val rebalanceCfg = cfg.rebalanceConfiguration()
-        val evictCfg = cfg.evictConfiguration()
-        val defaultCfg = cfg.defaultConfiguration()
-        val storeCfg = cfg.storeConfiguration()
-        val queryCfg = cfg.queryConfiguration()
+        val affinityCfg = cfg.getAffinityConfiguration
+        val nearCfg = cfg.getNearConfiguration
+        val rebalanceCfg = cfg.getRebalanceConfiguration
+        val evictCfg = cfg.getEvictionConfiguration
+        val storeCfg = cfg.getStoreConfiguration
+        val queryCfg = cfg.getQueryConfiguration
 
         val cacheT = VisorTextTable()
 
         cacheT #= ("Name", "Value")
 
-        cacheT += ("Mode", cfg.mode)
-        cacheT += ("Atomicity Mode", safe(cfg.atomicityMode))
-        cacheT += ("Atomic Write Ordering Mode", safe(cfg.atomicWriteOrderMode))
-        cacheT += ("Statistic Enabled", bool2Str(cfg.statisticsEnabled()))
-        cacheT += ("Management Enabled", bool2Str(cfg.managementEnabled()))
-
-        cacheT += ("Time To Live Eager Flag", cfg.eagerTtl)
-
-        cacheT += ("Write Synchronization Mode", safe(cfg.writeSynchronizationMode))
-        cacheT += ("Invalidate", bool2Str(cfg.invalidate()))
-        cacheT += ("Start Size", cfg.startSize())
-
-        cacheT += ("Affinity Function", safe(affinityCfg.function()))
-        cacheT += ("Affinity Backups", affinityCfg.partitionedBackups())
-        cacheT += ("Affinity Partitions", safe(affinityCfg.partitions()))
-        cacheT += ("Affinity Exclude Neighbors", safe(affinityCfg.excludeNeighbors()))
-        cacheT += ("Affinity Mapper", safe(affinityCfg.mapper()))
-
-        cacheT += ("Rebalance Mode", rebalanceCfg.mode())
-        cacheT += ("Rebalance Batch Size", rebalanceCfg.batchSize())
-        cacheT += ("Rebalance Thread Pool size", rebalanceCfg.threadPoolSize())
-        cacheT += ("Rebalance Timeout", rebalanceCfg.timeout())
-        cacheT += ("Rebalance Delay", rebalanceCfg.partitionedDelay())
-        cacheT += ("Time Between Rebalance Messages", rebalanceCfg.throttle())
-
-        cacheT += ("Eviction Policy Enabled", bool2Str(evictCfg.policy() != null))
-        cacheT += ("Eviction Policy", safe(evictCfg.policy()))
-        cacheT += ("Eviction Policy Max Size", safe(evictCfg.policyMaxSize()))
-        cacheT += ("Eviction Filter", safe(evictCfg.filter()))
-
-        cacheT += ("Near Cache Enabled", bool2Str(nearCfg.nearEnabled()))
-        cacheT += ("Near Start Size", nearCfg.nearStartSize())
-        cacheT += ("Near Eviction Policy", safe(nearCfg.nearEvictPolicy()))
-        cacheT += ("Near Eviction Policy Max Size", safe(nearCfg.nearEvictMaxSize()))
-
-        cacheT += ("Default Lock Timeout", defaultCfg.txLockTimeout())
-        cacheT += ("Metadata type count", cfg.typeMeta().size())
-        cacheT += ("Cache Interceptor", safe(cfg.interceptor()))
-
-        cacheT += ("Store Enabled", bool2Str(storeCfg.enabled()))
-        cacheT += ("Store Class", safe(storeCfg.store()))
-        cacheT += ("Store Factory Class", storeCfg.storeFactory())
-        cacheT += ("Store Keep Binary", storeCfg.storeKeepBinary())
-        cacheT += ("Store Read Through", bool2Str(storeCfg.readThrough()))
-        cacheT += ("Store Write Through", bool2Str(storeCfg.writeThrough()))
-
-        cacheT += ("Write-Behind Enabled", bool2Str(storeCfg.enabled()))
-        cacheT += ("Write-Behind Flush Size", storeCfg.flushSize())
-        cacheT += ("Write-Behind Frequency", storeCfg.flushFrequency())
-        cacheT += ("Write-Behind Flush Threads Count", storeCfg.flushThreadCount())
-        cacheT += ("Write-Behind Batch Size", storeCfg.batchSize())
-
-        cacheT += ("Concurrent Asynchronous Operations Number", cfg.maxConcurrentAsyncOperations())
-        cacheT += ("Off-Heap Size", cfg.offsetHeapMaxMemory() match {
-            case 0 => "UNLIMITED"
-            case size if size < 0 => NA
-            case size => size
-        })
-
-        cacheT += ("Loader Factory Class Name", safe(cfg.loaderFactory()))
-        cacheT += ("Writer Factory Class Name", safe(cfg.writerFactory()))
-        cacheT += ("Expiry Policy Factory Class Name", safe(cfg.expiryPolicyFactory()))
-
-        cacheT +=("Query Execution Time Threshold", queryCfg.longQueryWarningTimeout())
-        cacheT +=("Query Schema Name", queryCfg.sqlSchema())
-        cacheT +=("Query Escaped Names", bool2Str(queryCfg.sqlEscapeAll()))
-        cacheT +=("Query Onheap Cache Size", queryCfg.sqlOnheapRowCacheSize())
-
-        val sqlFxs = queryCfg.sqlFunctionClasses()
+        cacheT += ("Mode", cfg.getMode)
+        cacheT += ("Atomicity Mode", safe(cfg.getAtomicityMode))
+        cacheT += ("Atomic Write Ordering Mode", safe(cfg.getAtomicWriteOrderMode))
+        cacheT += ("Statistic Enabled", bool2Str(cfg.isStatisticsEnabled))
+        cacheT += ("Management Enabled", bool2Str(cfg.isManagementEnabled))
+
+        cacheT += ("Time To Live Eager Flag", cfg.isEagerTtl)
+
+        cacheT += ("Write Synchronization Mode", safe(cfg.getWriteSynchronizationMode))
+        cacheT += ("Invalidate", bool2Str(cfg.isInvalidate))
+        cacheT += ("Start Size", cfg.getStartSize)
+
+        cacheT += ("Affinity Function", safe(affinityCfg.getFunction))
+        cacheT += ("Affinity Backups", affinityCfg.getPartitionedBackups)
+        cacheT += ("Affinity Partitions", safe(affinityCfg.getPartitions))
+        cacheT += ("Affinity Exclude Neighbors", safe(affinityCfg.isExcludeNeighbors))
+        cacheT += ("Affinity Mapper", safe(affinityCfg.getMapper))
+
+        cacheT += ("Rebalance Mode", rebalanceCfg.getMode)
+        cacheT += ("Rebalance Batch Size", rebalanceCfg.getBatchSize)
+        cacheT += ("Rebalance Timeout", rebalanceCfg.getTimeout)
+        cacheT += ("Rebalance Delay", rebalanceCfg.getPartitionedDelay)
+        cacheT += ("Time Between Rebalance Messages", rebalanceCfg.getThrottle)
+
+        cacheT += ("Eviction Policy Enabled", bool2Str(evictCfg.getPolicy != null))
+        cacheT += ("Eviction Policy", safe(evictCfg.getPolicy))
+        cacheT += ("Eviction Policy Max Size", safe(evictCfg.getPolicyMaxSize))
+        cacheT += ("Eviction Filter", safe(evictCfg.getFilter))
+
+        cacheT += ("Near Cache Enabled", bool2Str(nearCfg.isNearEnabled))
+        cacheT += ("Near Start Size", nearCfg.getNearStartSize)
+        cacheT += ("Near Eviction Policy", safe(nearCfg.getNearEvictPolicy))
+        cacheT += ("Near Eviction Policy Max Size", safe(nearCfg.getNearEvictMaxSize))
+
+        cacheT += ("Default Lock Timeout", cfg.getDefaultLockTimeout)
+        cacheT += ("Metadata type count", cfg.getJdbcTypes.size())
+        cacheT += ("Cache Interceptor", safe(cfg.getInterceptor))
+
+        cacheT += ("Store Enabled", bool2Str(storeCfg.isEnabled))
+        cacheT += ("Store Class", safe(storeCfg.getStore))
+        cacheT += ("Store Factory Class", storeCfg.getStoreFactory)
+        cacheT += ("Store Keep Binary", storeCfg.isStoreKeepBinary)
+        cacheT += ("Store Read Through", bool2Str(storeCfg.isReadThrough))
+        cacheT += ("Store Write Through", bool2Str(storeCfg.isWriteThrough))
+
+        cacheT += ("Write-Behind Enabled", bool2Str(storeCfg.isEnabled))
+        cacheT += ("Write-Behind Flush Size", storeCfg.getFlushSize)
+        cacheT += ("Write-Behind Frequency", storeCfg.getFlushFrequency)
+        cacheT += ("Write-Behind Flush Threads Count", storeCfg.getFlushThreadCount)
+        cacheT += ("Write-Behind Batch Size", storeCfg.getBatchSize)
+
+        cacheT += ("Concurrent Asynchronous Operations Number", cfg.getMaxConcurrentAsyncOperations)
+
+        cacheT += ("Loader Factory Class Name", safe(cfg.getLoaderFactory))
+        cacheT += ("Writer Factory Class Name", safe(cfg.getWriterFactory))
+        cacheT += ("Expiry Policy Factory Class Name", safe(cfg.getExpiryPolicyFactory))
+
+        cacheT +=("Query Execution Time Threshold", queryCfg.getLongQueryWarningTimeout)
+        cacheT +=("Query Schema Name", queryCfg.getSqlSchema)
+        cacheT +=("Query Escaped Names", bool2Str(queryCfg.isSqlEscapeAll))
+        cacheT +=("Query Onheap Cache Size", queryCfg.getSqlOnheapRowCacheSize)
+
+        val sqlFxs = queryCfg.getSqlFunctionClasses
 
         val hasSqlFxs = sqlFxs != null && sqlFxs.nonEmpty
 
         if (!hasSqlFxs)
             cacheT +=("Query SQL functions", NA)
 
-        val indexedTypes = queryCfg.indexedTypes()
+        val indexedTypes = queryCfg.getIndexedTypes
 
         val hasIndexedTypes = indexedTypes != null && indexedTypes.nonEmpty
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
index 9668072..a6bec15 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
@@ -140,11 +140,11 @@ class VisorCacheScanCommand {
             try
                 executeRandom(groupForDataNode(node, cacheName),
                     classOf[VisorQueryTask], new VisorQueryArg(cacheName, null, false, false, false, pageSize)) match {
-                    case x if x.get1() != null =>
-                        error(x.get1())
+                    case x if x.getError != null =>
+                        error(x.getError)
 
                         return
-                    case x => x.get2()
+                    case x => x.getResult
                 }
             catch {
                 case e: ClusterGroupEmptyException =>
@@ -157,7 +157,7 @@ class VisorCacheScanCommand {
                     return
             }
 
-        if (firstPage.rows.isEmpty) {
+        if (firstPage.getRows.isEmpty) {
             println(s"Cache: ${escapeName(cacheName)} is empty")
 
             return
@@ -172,19 +172,19 @@ class VisorCacheScanCommand {
 
             t #= ("Key Class", "Key", "Value Class", "Value")
 
-            nextPage.rows.foreach(r => t += (r(0), r(1), r(2), r(3)))
+            nextPage.getRows.foreach(r => t += (r(0), r(1), r(2), r(3)))
 
             t.render()
         }
 
         render()
 
-        while (nextPage.hasMore) {
+        while (nextPage.isHasMore) {
             ask("\nFetch more objects (y/n) [y]:", "y") match {
                 case "y" | "Y" =>
                     try {
-                        nextPage = executeOne(firstPage.responseNodeId(), classOf[VisorQueryNextPageTask],
-                            new IgniteBiTuple[String, Integer](firstPage.queryId(), pageSize))
+                        nextPage = executeOne(firstPage.getResponseNodeId, classOf[VisorQueryNextPageTask],
+                            new VisorQueryNextPageTaskArg(firstPage.getQueryId, pageSize))
 
                         render()
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
index f7d83a3..75c34ab 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
@@ -29,7 +29,7 @@ import org.apache.ignite.visor.visor._
 import java.lang.System._
 import java.util.UUID
 
-import org.apache.ignite.internal.visor.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
+import org.apache.ignite.internal.visor.node.{VisorSpiDescription, VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
 
 import scala.collection.JavaConversions._
@@ -139,7 +139,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
             cacheConfigurations(nid).foreach(ccfg => {
                 println()
 
-                printCacheConfiguration(s"Cache '${escapeName(ccfg.name())}':", ccfg)
+                printCacheConfiguration(s"Cache '${escapeName(ccfg.getName)}':", ccfg)
             })
         }
         catch {
@@ -157,45 +157,46 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val cmnT = VisorTextTable()
 
-        val basic = cfg.basic()
-
-        cmnT += ("Ignite instance name", escapeName(basic.igniteInstanceName()))
-        cmnT += ("Ignite home", safe(basic.ggHome()))
-        cmnT += ("Localhost", safe(basic.localHost()))
-        cmnT += ("Node ID", safe(basic.nodeId()))
-        cmnT += ("Marshaller", basic.marshaller())
-        cmnT += ("Deployment mode", safe(basic.deploymentMode()))
-        cmnT += ("ClientMode", javaBoolToStr(basic.clientMode()))
-        cmnT += ("Daemon", bool2Str(basic.daemon()))
-        cmnT += ("Remote JMX", bool2Str(basic.jmxRemote()))
-        cmnT += ("Restart", bool2Str(basic.restart()))
-        cmnT += ("Network timeout", basic.networkTimeout() + "ms")
-        cmnT += ("Grid logger", safe(basic.logger()))
-        cmnT += ("Discovery startup delay", basic.discoStartupDelay() + "ms")
-        cmnT += ("MBean server", safe(basic.mBeanServer()))
-        cmnT += ("ASCII logo disabled", bool2Str(basic.noAscii()))
-        cmnT += ("Discovery order not required", bool2Str(basic.noDiscoOrder()))
-        cmnT += ("Shutdown hook disabled", bool2Str(basic.noShutdownHook()))
-        cmnT += ("Program name", safe(basic. programName()))
-        cmnT += ("Quiet mode", bool2Str(basic.quiet()))
-        cmnT += ("Success filename", safe(basic.successFile()))
-        cmnT += ("Update notification", bool2Str(basic.updateNotifier()))
-        cmnT += ("Include properties", safe(cfg.includeProperties()))
-
-        val atomic = cfg.atomic()
-
-        cmnT += ("Atomic Cache Mode", atomic.cacheMode())
-        cmnT += ("Atomic Sequence Reservation Size", atomic.atomicSequenceReserveSize())
-        cmnT += ("Atomic Number Of Backup Nodes", atomic.backups())
-
-        val trn = cfg.transaction()
-
-        cmnT += ("Transaction Concurrency", trn.defaultTxConcurrency())
-        cmnT += ("Transaction Isolation", trn.defaultTxIsolation())
-        cmnT += ("Transaction Timeout", trn.defaultTxTimeout() + "ms")
-        cmnT += ("Transaction Log Cleanup Delay", trn.pessimisticTxLogLinger() + "ms")
+        val basic = cfg.getBasic
+
+        cmnT += ("Grid name", escapeName(basic.getIgniteInstanceName))
+        cmnT += ("Ignite home", safe(basic.getGgHome))
+        cmnT += ("Localhost", safe(basic.getLocalHost))
+        cmnT += ("Node ID", safe(basic.getNodeId))
+        cmnT += ("Marshaller", basic.getMarshaller)
+        cmnT += ("Deployment mode", safe(basic.getDeploymentMode))
+        cmnT += ("ClientMode", javaBoolToStr(basic.isClientMode))
+        cmnT += ("Daemon", bool2Str(basic.isDaemon))
+        cmnT += ("Remote JMX enabled", bool2Str(basic.isJmxRemote))
+        cmnT += ("Node restart enabled", bool2Str(basic.isRestart))
+        cmnT += ("Network timeout", basic.getNetworkTimeout + "ms")
+        cmnT += ("Grid logger", safe(basic.getLogger))
+        cmnT += ("Discovery startup delay", basic.getDiscoStartupDelay + "ms")
+        cmnT += ("MBean server", safe(basic.getMBeanServer))
+        cmnT += ("ASCII logo disabled", bool2Str(basic.isNoAscii))
+        cmnT += ("Discovery order not required", bool2Str(basic.isNoDiscoOrder))
+        cmnT += ("Shutdown hook disabled", bool2Str(basic.isNoShutdownHook))
+        cmnT += ("Program name", safe(basic.getProgramName))
+        cmnT += ("Quiet mode", bool2Str(basic.isQuiet))
+        cmnT += ("Success filename", safe(basic.getSuccessFile))
+        cmnT += ("Update notification enabled", bool2Str(basic.isUpdateNotifier))
+        cmnT += ("Include properties", safe(cfg.getIncludeProperties))
+
+        val atomic = cfg.getAtomic
+
+        cmnT += ("Atomic Cache Mode", atomic.getCacheMode)
+        cmnT += ("Atomic Sequence Reservation Size", atomic.getAtomicSequenceReserveSize)
+        cmnT += ("Atomic Number Of Backup Nodes", atomic.getBackups)
+
+        val trn = cfg.getTransaction
+
+        cmnT += ("Transaction Concurrency", trn.getDefaultTxConcurrency)
+        cmnT += ("Transaction Isolation", trn.getDefaultTxIsolation)
+        cmnT += ("Transaction Timeout", trn.getDefaultTxTimeout + "ms")
+        cmnT += ("Transaction Log Cleanup Delay", trn.getPessimisticTxLogLinger + "ms")
         cmnT += ("Transaction Log Size", trn.getPessimisticTxLogSize)
-        cmnT += ("Transaction Serializable Enabled", bool2Str(trn.txSerializableEnabled()))
+        cmnT += ("Transaction Manager Factory", trn.getTxManagerFactory)
+        cmnT += ("Transaction Use JTA", bool2Str(trn.isUseJtaSync))
 
         cmnT.render()
 
@@ -203,11 +204,13 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val metricsT = VisorTextTable()
 
-        val expTime = cfg.metrics().expireTime()
+        val metricsCfg = cfg.getMetrics
+
+        val expTime = metricsCfg.getExpireTime
 
         metricsT += ("Metrics expire time", if (expTime != Long.MaxValue) expTime + "ms" else "<never>")
-        metricsT += ("Metrics history size", cfg.metrics().historySize())
-        metricsT += ("Metrics log frequency", cfg.metrics().loggerFrequency())
+        metricsT += ("Metrics history size", metricsCfg.getHistorySize)
+        metricsT += ("Metrics log frequency", metricsCfg.getLoggerFrequency)
 
         metricsT.render()
 
@@ -215,23 +218,25 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val spisT = VisorTextTable()
 
-        def spiClass(spi: IgniteBiTuple[String, java.util.Map[String, AnyRef]]) = {
-            if (spi != null) spi.get2().getOrElse("Class Name", NA) else NA
+        def spiClass(spi: VisorSpiDescription) = {
+            if (spi != null) spi.getFieldDescriptions.getOrElse("Class Name", NA) else NA
         }
 
-        def spisClass(spis: Array[IgniteBiTuple[String, java.util.Map[String, AnyRef]]]) = {
+        def spisClass(spis: Array[VisorSpiDescription]) = {
             spis.map(spiClass).mkString("[", ", ", "]")
         }
 
-        spisT += ("Discovery", spiClass(cfg.spis().discoverySpi()))
-        spisT += ("Communication", spiClass(cfg.spis().communicationSpi()))
-        spisT += ("Event storage", spiClass(cfg.spis().eventStorageSpi()))
-        spisT += ("Collision", spiClass(cfg.spis().collisionSpi()))
-        spisT += ("Deployment", spiClass(cfg.spis().deploymentSpi()))
-        spisT += ("Checkpoints", spisClass(cfg.spis().checkpointSpis()))
-        spisT += ("Failovers", spisClass(cfg.spis().failoverSpis()))
-        spisT += ("Load balancings", spisClass(cfg.spis().loadBalancingSpis()))
-        spisT += ("Indexing", spisClass(cfg.spis().indexingSpis()))
+        val spisCfg = cfg.getSpis
+
+        spisT += ("Discovery", spiClass(spisCfg.getDiscoverySpi))
+        spisT += ("Communication", spiClass(spisCfg.getCommunicationSpi))
+        spisT += ("Event storage", spiClass(spisCfg.getEventStorageSpi))
+        spisT += ("Collision", spiClass(spisCfg.getCollisionSpi))
+        spisT += ("Deployment", spiClass(spisCfg.getDeploymentSpi))
+        spisT += ("Checkpoints", spisClass(spisCfg.getCheckpointSpis))
+        spisT += ("Failovers", spisClass(spisCfg.getFailoverSpis))
+        spisT += ("Load balancings", spisClass(spisCfg.getLoadBalancingSpis))
+        spisT += ("Indexing", spisClass(spisCfg.getIndexingSpis))
 
         spisT.render()
 
@@ -239,9 +244,11 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val p2pT = VisorTextTable()
 
-        p2pT += ("Peer class loading enabled", bool2Str(cfg.p2p().p2pEnabled()))
-        p2pT += ("Missed resources cache size", cfg.p2p().p2pMissedResponseCacheSize())
-        p2pT += ("Peer-to-Peer loaded packages", safe(cfg.p2p().p2pLocalClassPathExclude()))
+        val p2pCfg = cfg.getP2p
+
+        p2pT += ("Peer class loading enabled", bool2Str(p2pCfg.isPeerClassLoadingEnabled))
+        p2pT += ("Missed resources cache size", p2pCfg.getPeerClassLoadingMissedResourcesCacheSize)
+        p2pT += ("Peer-to-Peer loaded packages", safe(p2pCfg.getPeerClassLoadingLocalClassPathExclude))
 
         p2pT.render()
 
@@ -249,7 +256,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val lifecycleT = VisorTextTable()
 
-        lifecycleT += ("Beans", safe(cfg.lifecycle().beans()))
+        lifecycleT += ("Beans", safe(cfg.getLifecycle.getBeans))
 
         lifecycleT.render()
 
@@ -257,14 +264,15 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val execSvcT = VisorTextTable()
 
-        val execCfg = cfg.executeService()
+        val execCfg = cfg.getExecutorService
 
-        execSvcT += ("Public thread pool size", safe(execCfg.publicThreadPoolSize()))
-        execSvcT += ("System thread pool size", safe(execCfg.systemThreadPoolSize()))
-        execSvcT += ("Management thread pool size", safe(execCfg.managementThreadPoolSize()))
-        execSvcT += ("IGFS thread pool size", safe(execCfg.igfsThreadPoolSize()))
-        execSvcT += ("Peer-to-Peer thread pool size", safe(execCfg.peerClassLoadingThreadPoolSize()))
-        execSvcT += ("REST thread pool size", safe(execCfg.restThreadPoolSize()))
+        execSvcT += ("Public thread pool size", safe(execCfg.getPublicThreadPoolSize))
+        execSvcT += ("System thread pool size", safe(execCfg.getSystemThreadPoolSize))
+        execSvcT += ("Management thread pool size", safe(execCfg.getManagementThreadPoolSize))
+        execSvcT += ("IGFS thread pool size", safe(execCfg.getIgfsThreadPoolSize))
+        execSvcT += ("Peer-to-Peer thread pool size", safe(execCfg.getPeerClassLoadingThreadPoolSize))
+        execSvcT += ("Rebalance Thread Pool size", execCfg.getRebalanceThreadPoolSize)
+        execSvcT += ("REST thread pool size", safe(execCfg.getRestThreadPoolSize))
 
         execSvcT.render()
 
@@ -272,11 +280,13 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val segT = VisorTextTable()
 
-        segT += ("Segmentation policy", safe(cfg.segmentation().policy()))
-        segT += ("Segmentation resolvers", safe(cfg.segmentation().resolvers()))
-        segT += ("Segmentation check frequency", cfg.segmentation().checkFrequency())
-        segT += ("Wait for segmentation on start", bool2Str(cfg.segmentation().waitOnStart()))
-        segT += ("All resolvers pass required", bool2Str(cfg.segmentation().passRequired()))
+        val segmentationCfg = cfg.getSegmentation
+
+        segT += ("Segmentation policy", safe(segmentationCfg.getPolicy))
+        segT += ("Segmentation resolvers", safe(segmentationCfg.getResolvers))
+        segT += ("Segmentation check frequency", segmentationCfg.getCheckFrequency)
+        segT += ("Wait for segmentation on start", bool2Str(segmentationCfg.isWaitOnStart))
+        segT += ("All resolvers pass required", bool2Str(segmentationCfg.isAllSegmentationResolversPassRequired))
 
         segT.render()
 
@@ -284,7 +294,7 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val evtsT = VisorTextTable()
 
-        val inclEvtTypes = Option(cfg.includeEventTypes()).fold(NA)(et => arr2Str(et.map(U.gridEventName)))
+        val inclEvtTypes = Option(cfg.getIncludeEventTypes).fold(NA)(et => arr2Str(et.map(U.gridEventName)))
 
         evtsT += ("Included event types", inclEvtTypes)
 
@@ -294,32 +304,33 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
         val restT = VisorTextTable()
 
-        restT += ("REST enabled", bool2Str(cfg.rest().restEnabled()))
-        restT += ("Rest accessible folders", safe(cfg.rest().accessibleFolders()))
-        restT += ("Jetty path", safe(cfg.rest().jettyPath()))
-        restT += ("Jetty host", safe(cfg.rest().jettyHost()))
-        restT += ("Jetty port", safe(cfg.rest().jettyPort()))
-        restT += ("Tcp ssl enabled", bool2Str(cfg.rest().tcpSslEnabled()))
-        restT += ("Tcp ssl context factory", safe(cfg.rest().tcpSslContextFactory()))
-        restT += ("Tcp host", safe(cfg.rest().tcpHost()))
-        restT += ("Tcp port", safe(cfg.rest().tcpPort()))
+        val restCfg = cfg.getRest
+
+        restT += ("REST enabled", bool2Str(restCfg.isRestEnabled))
+        restT += ("Jetty path", safe(restCfg.getJettyPath))
+        restT += ("Jetty host", safe(restCfg.getJettyHost))
+        restT += ("Jetty port", safe(restCfg.getJettyPort))
+        restT += ("Tcp ssl enabled", bool2Str(restCfg.isTcpSslEnabled))
+        restT += ("Tcp ssl context factory", safe(restCfg.getTcpSslContextFactory))
+        restT += ("Tcp host", safe(restCfg.getTcpHost))
+        restT += ("Tcp port", safe(restCfg.getTcpPort))
 
         restT.render()
 
-        if (cfg.userAttributes().nonEmpty) {
+        if (cfg.getUserAttributes.nonEmpty) {
             println("\nUser attributes:")
 
             val uaT = VisorTextTable()
 
             uaT #= ("Name", "Value")
 
-            cfg.userAttributes().foreach(a => uaT += (a._1, a._2))
+            cfg.getUserAttributes.foreach(a => uaT += (a._1, a._2))
 
             uaT.render()
         } else
             println("\nNo user attributes defined.")
 
-        if (cfg.env().nonEmpty) {
+        if (cfg.getEnv.nonEmpty) {
             println("\nEnvironment variables:")
 
             val envT = VisorTextTable()
@@ -328,13 +339,13 @@ class VisorConfigurationCommand extends VisorConsoleCommand {
 
             envT #= ("Name", "Value")
 
-            cfg.env().foreach(v => envT += (v._1, compactProperty(v._1, v._2)))
+            cfg.getEnv.foreach(v => envT += (v._1, compactProperty(v._1, v._2)))
 
             envT.render()
         } else
             println("\nNo environment variables defined.")
 
-        val sysProps = cfg.systemProperties().toMap
+        val sysProps = cfg.getSystemProperties.toMap
 
         if (sysProps.nonEmpty) {
             println("\nSystem properties:")

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
index 0ea88ad..de69cd7 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
@@ -28,7 +28,7 @@ import org.apache.ignite.visor.visor._
 
 import org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
 import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
 
 import scala.collection.JavaConversions._
 import scala.collection.immutable._
@@ -42,7 +42,7 @@ import scala.language.{implicitConversions, reflectiveCalls}
  * {{{
  * +---------------------------------------------------------------------------------------+
  * | disco | Prints topology change log as seen from the oldest node.                      |
- * |       | Timeframe for querying events can be specified in arguments.                  |
+ * |       | Time frame for querying events can be specified in arguments.                 |
  * |       |                                                                               |
  * |       | Note that this command depends on Ignite events.                              |
  * |       |                                                                               |
@@ -66,7 +66,7 @@ import scala.language.{implicitConversions, reflectiveCalls}
  * ====Arguments====
  * {{{
  *     -t=<num>s|m|h|d
- *         Defines timeframe for querying events:
+ *         Defines time frame for querying events:
  *            =<num>s Events fired during last <num> seconds.
  *            =<num>m Events fired during last <num> minutes.
  *            =<num>h Events fired during last <num> hours.
@@ -107,7 +107,7 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
 
     /**
      * ===Command===
-     * Prints discovery events within specified timeframe.
+     * Prints discovery events within specified time frame.
      *
      * ===Examples===
      * <ex>disco "-r"</ex>
@@ -143,7 +143,7 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
                     try
                         cntOpt.fold(Int.MaxValue)(_.toInt)
                     catch {
-                        case e: NumberFormatException =>
+                        case _: NumberFormatException =>
                             scold("Invalid count: " + cntOpt.get)
 
                             return
@@ -184,9 +184,9 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
 
                 evts.take(cnt).foreach {
                     case de: VisorGridDiscoveryEvent =>
-                        t +=(formatDateTime(de.timestamp()), de.name(),
-                            nodeId8(de.evtNodeId()) + (if (de.isDaemon) "(daemon)" else ""),
-                            if (F.isEmpty(de.address())) NA else de.address())
+                        t +=(formatDateTime(de.getTimestamp), de.getName,
+                            nodeId8(de.getEventNodeId) + (if (de.isDaemon) "(daemon)" else ""),
+                            if (F.isEmpty(de.getAddress)) NA else de.getAddress)
                     case _ =>
                 }
 
@@ -221,7 +221,7 @@ class VisorDiscoveryCommand extends VisorConsoleCommand {
             evts = Seq(root) ++ evts
         }
 
-        evts = evts.sortBy(_.timestamp())
+        evts = evts.sortBy(_.getTimestamp)
 
         if (reverse) evts.reverse else evts
     }
@@ -239,7 +239,7 @@ object VisorDiscoveryCommand {
         shortInfo = "Prints topology change log.",
         longInfo = List(
             "Prints topology change log as seen from the oldest node.",
-            "Timeframe for querying events can be specified in arguments.",
+            "Time frame for querying events can be specified in arguments.",
             " ",
             "Note that this command depends on Ignite events.",
             " ",
@@ -257,7 +257,7 @@ object VisorDiscoveryCommand {
         ),
         args = List(
             "-t=<num>s|m|h|d" -> List(
-                "Defines timeframe for quering events:",
+                "Defines time frame for querying events:",
                 "   =<num>s Events fired during last <num> seconds.",
                 "   =<num>m Events fired during last <num> minutes.",
                 "   =<num>h Events fired during last <num> hours.",

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
index f56740c..c41eca1 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
@@ -28,7 +28,7 @@ import java.util.UUID
 
 import org.apache.ignite.internal.visor.event.VisorGridEvent
 import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
 
 import scala.collection.JavaConversions._
 import scala.collection.immutable._
@@ -182,7 +182,7 @@ class VisorEventsCommand extends VisorConsoleCommand {
     protected def mnemonic(e: VisorGridEvent) = {
         assert(e != null)
 
-        e.typeId() match {
+        e.getTypeId match {
             case t if EVTS_CHECKPOINT.contains(t) => "ch"
             case t if EVTS_DEPLOYMENT.contains(t) => "de"
             case t if EVTS_DISCOVERY_ALL.contains(t) => "di"
@@ -264,8 +264,8 @@ class VisorEventsCommand extends VisorConsoleCommand {
 
                     st += ("Node ID8(@ID)", nodeId8Addr(nid))
                     st += ("Total", sorted.size)
-                    st += ("Earliest timestamp", formatDateTime(evts.maxBy(_.timestamp).timestamp))
-                    st += ("Oldest timestamp", formatDateTime(evts.minBy(_.timestamp).timestamp))
+                    st += ("Earliest timestamp", formatDateTime(evts.maxBy(_.getTimestamp).getTimestamp))
+                    st += ("Oldest timestamp", formatDateTime(evts.minBy(_.getTimestamp).getTimestamp))
 
                     st.render()
 
@@ -276,13 +276,13 @@ class VisorEventsCommand extends VisorConsoleCommand {
                     var sum = Map[Int, (String, Int, Long, Long)]()
 
                     evts.foreach(evt => {
-                        val info = sum.getOrElse(evt.typeId(), (null, 0, Long.MinValue, Long.MaxValue))
+                        val info = sum.getOrElse(evt.getTypeId, (null, 0, Long.MinValue, Long.MaxValue))
 
-                        sum += (evt.typeId -> (
-                            "(" + mnemonic(evt) + ") " + evt.name(),
+                        sum += (evt.getTypeId -> (
+                            "(" + mnemonic(evt) + ") " + evt.getName,
                             info._2 + 1,
-                            if (evt.timestamp() > info._3) evt.timestamp() else info._3,
-                            if (evt.timestamp() < info._4) evt.timestamp() else info._4)
+                            if (evt.getTimestamp > info._3) evt.getTimestamp else info._3,
+                            if (evt.getTimestamp < info._4) evt.getTimestamp else info._4)
                             )
                     })
 
@@ -322,7 +322,7 @@ class VisorEventsCommand extends VisorConsoleCommand {
                     all #= ("Timestamp", "Description")
 
                     sorted.take(cnt).foreach(evt =>
-                        all += (formatDateTime(evt.timestamp()), U.compact(evt.shortDisplay))
+                        all += (formatDateTime(evt.getTimestamp), U.compact(evt.getShortDisplay))
                     )
 
                     all.render()
@@ -365,8 +365,8 @@ class VisorEventsCommand extends VisorConsoleCommand {
             Some(evts)
         else
             arg.get.trim match {
-                case "e" => Some(if (reverse) evts.sortBy(_.name).reverse else evts.sortBy(_.name))
-                case "t" => Some(if (reverse) evts.sortBy(_.timestamp).reverse else evts.sortBy(_.timestamp))
+                case "e" => Some(if (reverse) evts.sortBy(_.getName).reverse else evts.sortBy(_.getName))
+                case "t" => Some(if (reverse) evts.sortBy(_.getTimestamp).reverse else evts.sortBy(_.getTimestamp))
                 case a: String =>
                     scold("Invalid sorting argument: " + a)
 
@@ -400,7 +400,7 @@ object VisorEventsCommand {
         ),
         spec = List(
             "events",
-            "events {-id=<node-id>|-id8=<node-id8>} {-e=<ch,de,di,jo,ta,ca,cr,sw>}",
+            "events {-id=<node-id>|-id8=<node-id8>} {-e=<ch,de,di,jo,ta,ca,cr>}",
             "    {-t=<num>s|m|h|d} {-s=e|t} {-r} {-c=<n>}"
         ),
         args = List(
@@ -417,7 +417,7 @@ object VisorEventsCommand {
                 "Either '-id' or '-id8' can be specified.",
                 "If called without the arguments - starts in interactive mode."
             ),
-            "-e=<ch,de,di,jo,ta,ca,cr,sw>" -> List(
+            "-e=<ch,de,di,jo,ta,ca,cr>" -> List(
                 "Comma separated list of event types that should be queried:",
                 "   ch Checkpoint events.",
                 "   de Deployment events.",
@@ -428,7 +428,7 @@ object VisorEventsCommand {
                 "   cr Cache rebalance events."
             ),
             "-t=<num>s|m|h|d" -> List(
-                "Defines time frame for quering events:",
+                "Defines time frame for querying events:",
                 "   =<num>s Queries events fired during last <num> seconds.",
                 "   =<num>m Queries events fired during last <num> minutes.",
                 "   =<num>h Queries events fired during last <num> hours.",

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
index 990fd00..5f642d7 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
@@ -104,8 +104,8 @@ class VisorGcCommand extends VisorConsoleCommand {
 
                 res.foreach {
                     case (nid, stat) =>
-                        val roundHb = stat.get1() / (1024L * 1024L)
-                        val roundHa = stat.get2() / (1024L * 1024L)
+                        val roundHb = stat.getSizeBefore / (1024L * 1024L)
+                        val roundHa = stat.getSizeAfter / (1024L * 1024L)
 
                         val sign = if (roundHa > roundHb) "+" else ""
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
index 0468e80..4d9b795 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
@@ -31,7 +31,7 @@ import java.util.UUID
 
 import org.apache.ignite.internal.visor.event.{VisorGridEvent, VisorGridJobEvent, VisorGridTaskEvent}
 import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
 
 import scala.collection.JavaConversions._
 import scala.language.implicitConversions
@@ -91,37 +91,37 @@ private case class VisorExecution(
      * Gets number of job rejections in this session.
      */
     lazy val rejections: Int =
-        evts.count(_.typeId() == EVT_JOB_REJECTED)
+        evts.count(_.getTypeId == EVT_JOB_REJECTED)
 
     /**
      * Gets number of job cancellations in this session.
      */
     lazy val cancels: Int =
-        evts.count(_.typeId() == EVT_JOB_CANCELLED)
+        evts.count(_.getTypeId == EVT_JOB_CANCELLED)
 
     /**
      * Gets number of job finished in this session.
      */
     lazy val finished: Int =
-        evts.count(_.typeId() == EVT_JOB_FINISHED)
+        evts.count(_.getTypeId == EVT_JOB_FINISHED)
 
     /**
      * Gets number of job started in this session.
      */
     lazy val started: Int =
-        evts.count(_.typeId() == EVT_JOB_STARTED)
+        evts.count(_.getTypeId == EVT_JOB_STARTED)
 
     /**
      * Gets number of job failures in this session.
      */
     lazy val failures: Int =
-        evts.count(_.typeId() == EVT_JOB_FAILED)
+        evts.count(_.getTypeId == EVT_JOB_FAILED)
 
     /**
      * Gets number of job failovers in this session.
      */
     lazy val failovers: Int =
-        evts.count(_.typeId() == EVT_JOB_FAILED_OVER)
+        evts.count(_.getTypeId == EVT_JOB_FAILED_OVER)
 
     /**
      * Gets duration of the session.
@@ -420,7 +420,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
             else if (hasArgName("n", argLst)) {
                 val n = argValue("n", argLst)
 
-                if (!n.isDefined)
+                if (n.isEmpty)
                     scold("Invalid arguments: " + args)
                 else
                     task(n.get, hasArgFlag("r", argLst), hasArgFlag("a", argLst))
@@ -428,7 +428,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
             else if (hasArgName("e", argLst)) {
                 val s = argValue("e", argLst)
 
-                if (!s.isDefined)
+                if (s.isEmpty)
                     scold("Invalid arguments: " + args)
                 else
                     exec(s.get, hasArgFlag("r", argLst))
@@ -541,28 +541,28 @@ class VisorTasksCommand extends VisorConsoleCommand {
 
         evts.foreach {
             case te: VisorGridTaskEvent =>
-                val displayedTaskName = taskSimpleName(te.taskName(), te.taskClassName())
+                val displayedTaskName = taskSimpleName(te.getTaskName(), te.getTaskClassName())
 
-                val s = getSession(te.taskSessionId(), displayedTaskName)
+                val s = getSession(te.getTaskSessionId(), displayedTaskName)
                 val t = getTask(displayedTaskName)
 
                 t.execs = t.execs + s
 
                 s.evts = s.evts :+ te
-                s.nodeIds = s.nodeIds + te.nid()
-                s.startTs = math.min(s.startTs, te.timestamp())
-                s.endTs = math.max(s.endTs, te.timestamp())
+                s.nodeIds = s.nodeIds + te.getNid
+                s.startTs = math.min(s.startTs, te.getTimestamp)
+                s.endTs = math.max(s.endTs, te.getTimestamp)
 
-                te.typeId() match {
+                te.getTypeId match {
                     case EVT_TASK_STARTED =>
                         if (s.state == UNDEFINED) s.state = STARTED
 
-                        s.origNodeId = te.nid()
+                        s.origNodeId = te.getNid
 
                     case EVT_TASK_FINISHED =>
                         if (s.state == UNDEFINED || s.state == STARTED) s.state = FINISHED
 
-                        s.origNodeId = te.nid()
+                        s.origNodeId = te.getNid
 
                     case EVT_TASK_FAILED => if (s.state == UNDEFINED || s.state == STARTED) s.state = FAILED
                     case EVT_TASK_TIMEDOUT => if (s.state == UNDEFINED || s.state == STARTED) s.state = TIMEDOUT
@@ -570,23 +570,23 @@ class VisorTasksCommand extends VisorConsoleCommand {
                 }
 
             case je: VisorGridJobEvent =>
-                val displayedTaskName = taskSimpleName(je.taskName(), je.taskClassName())
-                val s = getSession(je.taskSessionId(), displayedTaskName)
+                val displayedTaskName = taskSimpleName(je.getTaskName(), je.getTaskClassName())
+                val s = getSession(je.getTaskSessionId(), displayedTaskName)
                 val t = getTask(displayedTaskName)
 
                 t.execs = t.execs + s
 
                 // Collect node IDs where jobs didn't finish ok.
-                je.typeId() match {
+                je.getTypeId match {
                     case EVT_JOB_CANCELLED | EVT_JOB_FAILED | EVT_JOB_REJECTED | EVT_JOB_TIMEDOUT =>
-                        s.failedNodeIds = s.failedNodeIds + je.nid()
+                        s.failedNodeIds = s.failedNodeIds + je.getNid
                     case _ =>
                 }
 
                 s.evts = s.evts :+ je
-                s.nodeIds = s.nodeIds + je.nid()
-                s.startTs = math.min(s.startTs, je.timestamp())
-                s.endTs = math.max(s.endTs, je.timestamp())
+                s.nodeIds = s.nodeIds + je.getNid
+                s.startTs = math.min(s.startTs, je.getTimestamp)
+                s.endTs = math.max(s.endTs, je.getTimestamp)
 
             case _ =>
         }
@@ -1063,13 +1063,12 @@ class VisorTasksCommand extends VisorConsoleCommand {
 
                 evtsT #= ("Timestamp", "Node ID8(@)", "Event")
 
-                val se = if (!reverse) e.evts.sortBy(_.timestamp()) else e.evts.sortBy(_.timestamp()).reverse
+                val se = if (!reverse) e.evts.sortBy(_.getTimestamp) else e.evts.sortBy(_.getTimestamp).reverse
 
                 se.foreach(e => evtsT += (
-                    formatDateTime(e.timestamp()),
-                    nodeId8Addr(e.nid()),
-                    e.name()
-                    ))
+                    formatDateTime(e.getTimestamp),
+                    nodeId8Addr(e.getNid),
+                    e.getName))
 
                 println("\nTrace:")
 
@@ -1142,7 +1141,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
                     }
 
                     sortedNames.foreach(taskName => {
-                        val t = VisorTask(taskName, execsMap.get(taskName).get)
+                        val t = VisorTask(taskName, execsMap(taskName))
 
                         val sE = t.execsFor(STARTED)
                         val fE = t.execsFor(FINISHED)
@@ -1256,7 +1255,7 @@ class VisorTasksCommand extends VisorConsoleCommand {
                     }
 
                     sortedNames.foreach(taskName => {
-                        val t = VisorTask(taskName, execsMap.get(taskName).get)
+                        val t = VisorTask(taskName, execsMap(taskName))
 
                         val sE = t.execsFor(STARTED)
                         val fE = t.execsFor(FINISHED)

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index ea60c87..e1dd14e 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -43,7 +43,7 @@ import java.util.concurrent._
 import java.util.{Collection => JavaCollection, HashSet => JavaHashSet, _}
 
 import org.apache.ignite.internal.visor.cache._
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
+import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
 import org.apache.ignite.internal.visor.node._
 import org.apache.ignite.internal.visor.util.VisorEventMapper
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
@@ -152,16 +152,16 @@ object visor extends VisorTag {
     private var cmdLst: Seq[VisorCommandHolder] = Nil
 
     /** Node left listener. */
-    private var nodeLeftLsnr: IgnitePredicate[Event] = null
+    private var nodeLeftLsnr: IgnitePredicate[Event] = _
 
     /** Node join listener. */
-    private var nodeJoinLsnr: IgnitePredicate[Event] = null
+    private var nodeJoinLsnr: IgnitePredicate[Event] = _
 
     /** Node segmentation listener. */
-    private var nodeSegLsnr: IgnitePredicate[Event] = null
+    private var nodeSegLsnr: IgnitePredicate[Event] = _
 
     /** Node stop listener. */
-    private var nodeStopLsnr: IgnitionListener = null
+    private var nodeStopLsnr: IgnitionListener = _
 
     /** */
     @volatile private var isCon: Boolean = false
@@ -209,13 +209,13 @@ object visor extends VisorTag {
     private final val DFLT_LOG_PATH = "visor/visor-log"
 
     /** Log file. */
-    private var logFile: File = null
+    private var logFile: File = _
 
     /** Log timer. */
-    private var logTimer: Timer = null
+    private var logTimer: Timer = _
 
     /** Topology log timer. */
-    private var topTimer: Timer = null
+    private var topTimer: Timer = _
 
     /** Log started flag. */
     @volatile private var logStarted = false
@@ -224,15 +224,15 @@ object visor extends VisorTag {
     @volatile var pool: ExecutorService = new IgniteThreadPoolExecutor()
 
     /** Configuration file path, if any. */
-    @volatile var cfgPath: String = null
+    @volatile var cfgPath: String = _
 
     /** */
-    @volatile var ignite: IgniteEx = null
+    @volatile var ignite: IgniteEx = _
 
     /** */
     @volatile var prevIgnite: Option[IgniteEx] = None
 
-    private var reader: ConsoleReader = null
+    private var reader: ConsoleReader = _
 
     var batchMode: Boolean = false
 
@@ -1674,7 +1674,7 @@ object visor extends VisorTag {
             val id8 = nid8(id)
             var v = mfindHead(id8)
 
-            if(!v.isDefined){
+            if(v.isEmpty){
                v = assignNodeValue(n)
             }
 
@@ -2454,15 +2454,15 @@ object visor extends VisorTag {
                             try {
                                 out = new FileWriter(logFile, true)
 
-                                evts.toList.sortBy(_.timestamp).foreach(e => {
+                                evts.toList.sortBy(_.getTimestamp).foreach(e => {
                                     logImpl(
                                         out,
-                                        formatDateTime(e.timestamp),
-                                        nodeId8Addr(e.nid()),
-                                        U.compact(e.shortDisplay())
+                                        formatDateTime(e.getTimestamp),
+                                        nodeId8Addr(e.getNid),
+                                        U.compact(e.getShortDisplay)
                                     )
 
-                                    if (EVTS_DISCOVERY.contains(e.typeId()))
+                                    if (EVTS_DISCOVERY.contains(e.getTypeId))
                                         snapshot()
                                 })
                             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/backend/app/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agent.js b/modules/web-console/backend/app/agent.js
index f65eabb..758d31b 100644
--- a/modules/web-console/backend/app/agent.js
+++ b/modules/web-console/backend/app/agent.js
@@ -236,32 +236,43 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
             const cmd = new Command(demo, 'exe')
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', nid)
-                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryTask');
-
-            if (enforceJoinOrder) {
-                cmd.addParam('p3', 'org.apache.ignite.internal.visor.query.VisorQueryArgV3')
-                    .addParam('p4', cacheName)
-                    .addParam('p5', query)
-                    .addParam('p6', nonCollocatedJoins)
-                    .addParam('p7', enforceJoinOrder)
-                    .addParam('p8', local)
-                    .addParam('p9', pageSize);
-            }
-            else if (nonCollocatedJoins) {
-                cmd.addParam('p3', 'org.apache.ignite.internal.visor.query.VisorQueryArgV2')
-                    .addParam('p4', cacheName)
-                    .addParam('p5', query)
-                    .addParam('p6', true)
-                    .addParam('p7', local)
-                    .addParam('p8', pageSize);
-            }
-            else {
-                cmd.addParam('p3', 'org.apache.ignite.internal.visor.query.VisorQueryArg')
-                    .addParam('p4', cacheName)
-                    .addParam('p5', query)
-                    .addParam('p6', local)
-                    .addParam('p7', pageSize);
-            }
+                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryTask')
+                .addParam('p3', 'org.apache.ignite.internal.visor.query.VisorQueryArg')
+                .addParam('p4', cacheName)
+                .addParam('p5', query)
+                .addParam('p6', nonCollocatedJoins)
+                .addParam('p7', enforceJoinOrder)
+                .addParam('p8', local)
+                .addParam('p9', pageSize);
+
+            return this.executeRest(cmd);
+        }
+
+        /**
+         * @param {Boolean} demo Is need run command on demo node.
+         * @param {String} nid Node id.
+         * @param {String} cacheName Cache name.
+         * @param {String} filter Filter text.
+         * @param {Boolean} regEx Flag whether filter by regexp.
+         * @param {Boolean} caseSensitive Case sensitive filtration.
+         * @param {Boolean} near Scan near cache.
+         * @param {Boolean} local Flag whether to execute query locally.
+         * @param {int} pageSize Page size.
+         * @returns {Promise}
+         */
+        queryScan(demo, nid, cacheName, filter, regEx, caseSensitive, near, local, pageSize) {
+            const cmd = new Command(demo, 'exe')
+                .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
+                .addParam('p1', nid)
+                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorScanQueryTask')
+                .addParam('p3', 'org.apache.ignite.internal.visor.query.VisorScanQueryArg')
+                .addParam('p4', cacheName)
+                .addParam('p5', filter)
+                .addParam('p6', regEx)
+                .addParam('p7', caseSensitive)
+                .addParam('p8', near)
+                .addParam('p9', local)
+                .addParam('p10', pageSize);
 
             return this.executeRest(cmd);
         }
@@ -278,7 +289,7 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', nid)
                 .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryNextPageTask')
-                .addParam('p3', 'org.apache.ignite.lang.IgniteBiTuple')
+                .addParam('p3', 'org.apache.ignite.lang.VisorQueryNextPageTaskArg')
                 .addParam('p4', 'java.lang.String')
                 .addParam('p5', 'java.lang.Integer')
                 .addParam('p6', queryId)
@@ -316,7 +327,7 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
             const cmd = new Command(demo, 'exe')
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', nids)
-                .addParam('p2', 'org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask')
+                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTask')
                 .addParam('p3', 'java.lang.Long')
                 .addParam('p4', since);
 
@@ -332,7 +343,7 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
             const cmd = new Command(demo, 'exe')
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', nids)
-                .addParam('p2', 'org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask')
+                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryResetDetailMetricsTask')
                 .addParam('p3', 'java.lang.Void');
 
             return this.executeRest(cmd);
@@ -348,7 +359,7 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
             const cmd = new Command(demo, 'exe')
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', '')
-                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorCollectRunningQueriesTask')
+                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTask')
                 .addParam('p3', 'java.lang.Long')
                 .addParam('p4', duration);
 
@@ -366,10 +377,9 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
             const cmd = new Command(demo, 'exe')
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', nid)
-                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorCancelQueriesTask')
-                .addParam('p3', 'java.util.Collection')
-                .addParam('p4', 'java.lang.Long')
-                .addParam('p5', queryId);
+                .addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryCancelTask')
+                .addParam('p3', 'java.lang.Long')
+                .addParam('p4', queryId);
 
             return this.executeRest(cmd);
         }
@@ -471,7 +481,7 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
                 .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
                 .addParam('p1', nids)
                 .addParam('p2', 'org.apache.ignite.internal.visor.cache.VisorCacheStartTask')
-                .addParam('p3', 'org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg')
+                .addParam('p3', 'org.apache.ignite.internal.visor.cache.VisorCacheStartArg')
                 .addParam('p4', near)
                 .addParam('p5', cacheName)
                 .addParam('p6', cfg);
@@ -515,24 +525,6 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
 
         /**
          * @param {Boolean} demo Is need run command on demo node.
-         * @param {String} nid Node id.
-         * @param {String} cacheNames Cache names separated by comma.
-         * @returns {Promise}
-         */
-        cacheSwapBackups(demo, nid, cacheNames) {
-            const cmd = new Command(demo, 'exe')
-                .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
-                .addParam('p1', nid)
-                .addParam('p2', 'org.apache.ignite.internal.visor.cache.VisorCacheSwapBackupsTask')
-                .addParam('p3', 'java.util.Set')
-                .addParam('p4', 'java.lang.String')
-                .addParam('p5', cacheNames);
-
-            return this.executeRest(cmd);
-        }
-
-        /**
-         * @param {Boolean} demo Is need run command on demo node.
          * @param {String} nids Node ids.
          * @returns {Promise}
          */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/backend/app/browser.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browser.js b/modules/web-console/backend/app/browser.js
index 00ae751..e9266a8 100644
--- a/modules/web-console/backend/app/browser.js
+++ b/modules/web-console/backend/app/browser.js
@@ -113,6 +113,19 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
                         .catch((err) => cb(_errorToJson(err)));
                 });
 
+                const fetchResult = (acc) => {
+                    if (!acc.hasMore)
+                        return acc;
+
+                    return agent.queryFetch(demo, acc.responseNodeId, acc.queryId, pageSize)
+                        .then(({result}) => {
+                            acc.rows = acc.rows.concat(result.rows);
+                            acc.hasMore = result.hasMore;
+
+                            return fetchResult(acc);
+                        });
+                };
+
                 // Execute query on node and return full result to browser.
                 socket.on('node:query:getAll', (nid, cacheName, query, distributedJoins, enforceJoinOrder, local, cb) => {
                     // Set page size for query.
@@ -122,26 +135,12 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
                         .then((agent) => {
                             const firstPage = agent.fieldsQuery(demo, nid, cacheName, query, distributedJoins, enforceJoinOrder, local, pageSize)
                                 .then(({result}) => {
-                                    if (result.key)
-                                        return Promise.reject(result.key);
+                                    if (result.error)
+                                        return Promise.reject(result.error);
 
-                                    return result.value;
+                                    return result.result;
                                 });
 
-                            const fetchResult = (acc) => {
-                                if (!acc.hasMore)
-                                    return acc;
-
-                                return agent.queryFetch(demo, acc.responseNodeId, acc.queryId, pageSize)
-                                    .then(({result}) => {
-                                        acc.rows = acc.rows.concat(result.rows);
-
-                                        acc.hasMore = result.hasMore;
-
-                                        return fetchResult(acc);
-                                    });
-                            };
-
                             return firstPage
                                 .then(fetchResult);
                         })
@@ -203,6 +202,36 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
                         .catch((err) => cb(_errorToJson(err)));
                 });
 
+                // Execute scan query on node and return first page to browser.
+                socket.on('node:scan', (nid, cacheName, filter, regEx, caseSensitive, near, local, pageSize, cb) => {
+                    agentMgr.findAgent(accountId())
+                        .then((agent) => agent.queryScan(demo, nid, cacheName, filter, regEx, caseSensitive, near, local, pageSize))
+                        .then((res) => cb(null, res))
+                        .catch((err) => cb(_errorToJson(err)));
+                });
+
+                // Execute scan on node and return full result to browser.
+                socket.on('node:scan:getAll', (nid, cacheName, filter, regEx, caseSensitive, near, local, cb) => {
+                    // Set page size for query.
+                    const pageSize = 1024;
+
+                    agentMgr.findAgent(accountId())
+                        .then((agent) => {
+                            const firstPage = agent.queryScan(demo, nid, cacheName, filter, regEx, caseSensitive, near, local, pageSize)
+                                .then(({result}) => {
+                                    if (result.error)
+                                        return Promise.reject(result.error);
+
+                                    return result.result;
+                                });
+
+                            return firstPage
+                                .then(fetchResult);
+                        })
+                        .then((res) => cb(null, res))
+                        .catch((err) => cb(_errorToJson(err)));
+                });
+
                 // Return cache metadata from all nodes in grid.
                 socket.on('node:cache:metadata', (cacheName, cb) => {
                     agentMgr.findAgent(accountId())
@@ -339,19 +368,6 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
                         .catch((err) => cb(_errorToJson(err)));
                 });
 
-                // Swap backups specified caches on specified node and return result to browser.
-                socket.on('node:cache:swap:backups', (nid, cacheNames, cb) => {
-                    agentMgr.findAgent(accountId())
-                        .then((agent) => agent.cacheSwapBackups(demo, nid, cacheNames))
-                        .then((data) => {
-                            if (data.finished)
-                                return cb(null, data.result);
-
-                            cb(_errorToJson(data.error));
-                        })
-                        .catch((err) => cb(_errorToJson(err)));
-                });
-
                 // Reset metrics specified cache on specified node and return result to browser.
                 socket.on('node:cache:reset:metrics', (nid, cacheName, cb) => {
                     agentMgr.findAgent(accountId())

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index f4a62b1..0da9aa9 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -144,6 +144,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
         domains: [{type: ObjectId, ref: 'DomainModel'}],
         cacheMode: {type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL']},
         atomicityMode: {type: String, enum: ['ATOMIC', 'TRANSACTIONAL']},
+        partitionLossPolicy: {type: String, enum: ['READ_ONLY_SAFE', 'READ_ONLY_ALL', 'READ_WRITE_SAFE', 'READ_WRITE_ALL', 'IGNORE']},
 
         affinity: {
             kind: {type: String, enum: ['Default', 'Rendezvous', 'Fair', 'Custom']},
@@ -178,10 +179,9 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
         },
 
         backups: Number,
-        memoryMode: {type: String, enum: ['ONHEAP_TIERED', 'OFFHEAP_TIERED', 'OFFHEAP_VALUES']},
-        offHeapMaxMemory: Number,
         startSize: Number,
-        swapEnabled: Boolean,
+
+        onheapCacheEnabled: Boolean,
 
         evictionPolicy: {
             kind: {type: String, enum: ['LRU', 'FIFO', 'SORTED']},
@@ -272,6 +272,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
         sqlFunctionClasses: [String],
         snapshotableIndex: Boolean,
         queryDetailMetricsSize: Number,
+        queryParallelism: Number,
         statisticsEnabled: Boolean,
         managementEnabled: Boolean,
         readFromBackup: Boolean,
@@ -334,7 +335,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
         clusters: [{type: ObjectId, ref: 'Cluster'}],
         affinnityGroupSize: Number,
         blockSize: Number,
-        streamBufferSize: Number,
+        bufferSize: Number,
         dataCacheName: String,
         metaCacheName: String,
         defaultMode: {type: String, enum: ['PRIMARY', 'PROXY', 'DUAL_SYNC', 'DUAL_ASYNC']},
@@ -582,8 +583,6 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
             }
         },
         marshalLocalJobs: Boolean,
-        marshallerCacheKeepAliveTime: Number,
-        marshallerCacheThreadPoolSize: Number,
         metricsExpireTime: Number,
         metricsHistorySize: Number,
         metricsLogFrequency: Number,
@@ -641,16 +640,6 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
         peerClassLoadingMissedResourcesCacheSize: Number,
         peerClassLoadingThreadPoolSize: Number,
         publicThreadPoolSize: Number,
-        swapSpaceSpi: {
-            kind: {type: String, enum: ['FileSwapSpaceSpi']},
-            FileSwapSpaceSpi: {
-                baseDirectory: String,
-                readStripesNumber: Number,
-                maximumSparsity: Number,
-                maxWriteQueueSize: Number,
-                writeBufferSize: Number
-            }
-        },
         systemThreadPoolSize: Number,
         timeServerPortBase: Number,
         timeServerPortRange: Number,

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/agent/agent.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/agent.module.js b/modules/web-console/frontend/app/modules/agent/agent.module.js
index 724fc6c..b20a5bc 100644
--- a/modules/web-console/frontend/app/modules/agent/agent.module.js
+++ b/modules/web-console/frontend/app/modules/agent/agent.module.js
@@ -273,10 +273,10 @@ class IgniteAgentMonitor {
     query(nid, cacheName, query, nonCollocatedJoins, enforceJoinOrder, local, pageSize) {
         return this._rest('node:query', nid, maskNull(cacheName), maskNull(query), nonCollocatedJoins, enforceJoinOrder, local, pageSize)
             .then(({result}) => {
-                if (_.isEmpty(result.key))
-                    return result.value;
+                if (_.isEmpty(result.error))
+                    return result.result;
 
-                return Promise.reject(result.key);
+                return Promise.reject(result.error);
             });
     }
 
@@ -295,6 +295,41 @@ class IgniteAgentMonitor {
 
     /**
      * @param {String} nid Node id.
+     * @param {String} cacheName Cache name.
+     * @param {String} filter Optional filter for scan query.
+     * @param {Boolean} regEx Flag whether filter by regexp.
+     * @param {Boolean} caseSensitive Case sensitive filtration.
+     * @param {Boolean} near Scan near cache.
+     * @param {Boolean} local Flag whether to execute query locally.
+     * @param {int} pageSize
+     * @returns {Promise}
+     */
+    scan(nid, cacheName, filter, regEx, caseSensitive, near, local, pageSize) {
+        return this._rest('node:scan', nid, maskNull(cacheName), maskNull(filter), regEx, caseSensitive, near, local, pageSize)
+            .then(({result}) => {
+                if (_.isEmpty(result.error))
+                    return result.result;
+
+                return Promise.reject(result.error);
+            });
+    }
+
+    /**
+     * @param {String} nid Node id.
+     * @param {String} cacheName Cache name.
+     * @param {String} filter Optional filter for scan query.
+     * @param {Boolean} regEx Flag whether filter by regexp.
+     * @param {Boolean} caseSensitive Case sensitive filtration.
+     * @param {Boolean} near Scan near cache.
+     * @param {Boolean} local Flag whether to execute query locally.
+     * @returns {Promise}
+     */
+    scanGetAll(nid, cacheName, filter, regEx, caseSensitive, near, local) {
+        return this._rest('node:scan:getAll', nid, maskNull(cacheName), maskNull(filter), regEx, caseSensitive, near, local);
+    }
+
+    /**
+     * @param {String} nid Node id.
      * @param {int} queryId
      * @param {int} pageSize
      * @returns {Promise}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
index 40d937e..40641d9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -150,11 +150,6 @@ export default class AbstractTransformer {
         return this.toSection(this.generator.clusterSsl(cluster));
     }
 
-    // Generate swap group.
-    static clusterSwap(cluster) {
-        return this.toSection(this.generator.clusterSwap(cluster));
-    }
-
     // Generate time group.
     static clusterTime(cluster) {
         return this.toSection(this.generator.clusterTime(cluster));


[20/50] [abbrv] ignite git commit: ignite-4173 Fix test. Permits must be released on node fail.

Posted by sb...@apache.org.
ignite-4173 Fix test. Permits must be released on node fail.


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

Branch: refs/heads/ignite-1561-1
Commit: 1f867c60335acb8477c12382fa54d2cbf9d05600
Parents: ecadf6a
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Apr 14 17:54:02 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Fri Apr 14 17:54:02 2017 +0300

----------------------------------------------------------------------
 .../GridCacheAbstractDataStructuresFailoverSelfTest.java           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1f867c60/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
index f918acd..cb4f6fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
@@ -419,7 +419,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig
 
             stopGrid(NEW_IGNITE_INSTANCE_NAME);
 
-            assertEquals(10, semaphore.availablePermits());
+            assertEquals(20, semaphore.availablePermits());
         }
     }
 


[38/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
index e305f35..f86da12 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
@@ -40,7 +40,6 @@ import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -75,7 +74,6 @@ public class EntryVersionConsistencyReadThroughTest extends GridCommonAbstractTe
 
         cc.setCacheMode(PARTITIONED);
         cc.setAtomicityMode(atomicityMode);
-        cc.setAtomicWriteOrderMode(PRIMARY);
         cc.setWriteSynchronizationMode(FULL_SYNC);
 
         cc.setReadThrough(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridAbstractCacheInterceptorRebalanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridAbstractCacheInterceptorRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridAbstractCacheInterceptorRebalanceTest.java
index 52c98c2..adfe085 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridAbstractCacheInterceptorRebalanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridAbstractCacheInterceptorRebalanceTest.java
@@ -41,7 +41,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -84,7 +83,6 @@ public abstract class GridAbstractCacheInterceptorRebalanceTest extends GridComm
 
         ccfg.setInterceptor(interceptor);
         ccfg.setAtomicityMode(atomicityMode());
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setRebalanceMode(SYNC);
         ccfg.setBackups(2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index af80e00..f7054b7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -104,7 +104,6 @@ import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -287,7 +286,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         // Concurrent invoke can not be used for ATOMIC cache in CLOCK mode.
         if (atomicityMode() == ATOMIC &&
             cacheMode() != LOCAL &&
-            cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode() == CLOCK)
+            false)
             return;
 
         final Set<String> keys = Collections.singleton("myKey");
@@ -3326,8 +3325,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         checkSize(F.asSet("key1", "key2", "key3"));
 
-        atomicClockModeDelay(cache);
-
         IgniteCache<String, Integer> asyncCache = cache.withAsync();
 
         if (async) {
@@ -3349,8 +3346,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         cache.put("key2", 2);
         cache.put("key3", 3);
 
-        atomicClockModeDelay(cache);
-
         if (async) {
             IgniteCache<String, Integer> asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync();
 
@@ -3370,8 +3365,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         for (int i = 0; i < entryCnt; i++)
             assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i)));
 
-        atomicClockModeDelay(cache);
-
         if (async) {
             asyncCache.removeAll();
 
@@ -3397,8 +3390,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         checkSize(F.asSet("key1", "key2", "key3"));
 
-        atomicClockModeDelay(cache);
-
         if (async)
             cache.removeAllAsync(F.asSet("key1", "key2")).get();
         else
@@ -3415,8 +3406,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         cache.put("key2", 2);
         cache.put("key3", 3);
 
-        atomicClockModeDelay(cache);
-
         if (async)
             jcache(gridCount() > 1 ? 1 : 0).removeAllAsync().get();
         else
@@ -3431,8 +3420,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         for (int i = 0; i < entryCnt; i++)
             assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i)));
 
-        atomicClockModeDelay(cache);
-
         if (async)
             cache.removeAllAsync().get();
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
index 64c60fe..83d2674 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
@@ -62,7 +62,6 @@ import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_LOCAL_STORE_KEEPS_PRIMARY_ONLY;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -102,9 +101,6 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
     public static final String BACKUP_CACHE_2 = "backup_2";
 
     /** */
-    public static volatile boolean primaryWriteOrderMode = false;
-
-    /** */
     public static volatile boolean near = false;
 
     /**
@@ -171,9 +167,6 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
         cacheCfg.setNearConfiguration(nearConfiguration());
         cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
 
-        if (primaryWriteOrderMode)
-            cacheCfg.setAtomicWriteOrderMode(PRIMARY);
-
         cacheCfg.setRebalanceMode(SYNC);
 
         if (igniteInstanceName.endsWith("1"))
@@ -298,14 +291,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
      * @throws Exception If failed.
      */
     public void testBackupRestorePrimary() throws Exception {
-        try {
-            primaryWriteOrderMode = true;
-
-            testBackupRestore();
-        }
-        finally {
-            primaryWriteOrderMode = false;
-        }
+        testBackupRestore();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
index 8606f7c..0a36b75 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
@@ -33,7 +33,6 @@ import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteTransactions;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -147,13 +146,6 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
     protected abstract NearCacheConfiguration nearCache();
 
     /**
-     * @return Atomic cache write order mode.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return null;
-    }
-
-    /**
      * @return {@code True} if test updates from client node.
      */
     protected boolean testClientNode() {
@@ -210,7 +202,6 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
             ccfg.setBackups(1);
 
         ccfg.setAtomicityMode(atomicityMode());
-        ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
         ccfg.setNearConfiguration(nearCache());
 
         final IgniteCache<Integer, Integer> sndCache0 = grid(0).createCache(ccfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index a12b6b9..1365577 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -21,7 +21,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -40,8 +39,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -58,9 +55,6 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
     /** Client mode flag. */
     private boolean client;
 
-    /** Write sync mode. */
-    private CacheAtomicWriteOrderMode writeOrderMode;
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -77,7 +71,6 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
         cCfg.setCacheMode(PARTITIONED);
         cCfg.setBackups(1);
         cCfg.setWriteSynchronizationMode(FULL_SYNC);
-        cCfg.setAtomicWriteOrderMode(writeOrderMode);
 
         if (idx == 0 && client)
             cfg.setClientMode(true);
@@ -94,27 +87,24 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
     /**
      * @throws Exception If failed.
      */
-    public void testPartitionedPrimary() throws Exception {
-        checkMessages(false, PRIMARY);
+    public void testPartitioned() throws Exception {
+        checkMessages(false);
     }
 
     /**
      * @throws Exception If failed.
      */
-    public void testClientPrimary() throws Exception {
-        checkMessages(true, PRIMARY);
+    public void testClient() throws Exception {
+        checkMessages(true);
     }
 
     /**
      * @param clientMode Client mode flag.
-     * @param orderMode Write ordering mode.
      * @throws Exception If failed.
      */
-    protected void checkMessages(boolean clientMode,
-        CacheAtomicWriteOrderMode orderMode) throws Exception {
+    protected void checkMessages(boolean clientMode) throws Exception {
 
         client = clientMode;
-        writeOrderMode = orderMode;
 
         startGrids(4);
 
@@ -141,18 +131,10 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
                 Affinity<Object> affinity = ignite(0).affinity(null);
 
-                if (writeOrderMode == CLOCK) {
-                    if (affinity.isPrimary(locNode, i) || affinity.isBackup(locNode, i))
-                        expNearCnt++;
-                    else
-                        expNearCnt += 2;
-                }
-                else {
-                    if (affinity.isPrimary(locNode, i))
-                        expDhtCnt++;
-                    else
-                        expNearSingleCnt++;
-                }
+                if (affinity.isPrimary(locNode, i))
+                    expDhtCnt++;
+                else
+                    expNearSingleCnt++;
 
                 jcache(0).put(i, i);
             }
@@ -161,23 +143,13 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
             assertEquals(expNearSingleCnt, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
             assertEquals(expDhtCnt, commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class));
 
-            if (writeOrderMode == CLOCK) {
-                for (int i = 1; i < 4; i++) {
-                    commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
+            for (int i = 1; i < 4; i++) {
+                commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
 
-                    assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
-                    assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
-                    assertEquals(0, commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class));
-                }
+                assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+                assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
             }
-            else {
-                for (int i = 1; i < 4; i++) {
-                    commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
 
-                    assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
-                    assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
-                }
-            }
         }
         finally {
             stopAllGrids();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
index 3e5ece5..79b77ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
@@ -29,7 +29,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -57,7 +56,6 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
         CacheConfiguration ccfg = new CacheConfiguration();
 
         ccfg.setCacheMode(PARTITIONED);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setBackups(1);
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
index 16f0c5d..d926d40 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
@@ -36,7 +36,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -66,7 +65,6 @@ public class GridCacheIncrementTransformTest extends GridCommonAbstractTest {
 
         cache.setCacheMode(PARTITIONED);
         cache.setAtomicityMode(ATOMIC);
-        cache.setAtomicWriteOrderMode(PRIMARY);
         cache.setWriteSynchronizationMode(FULL_SYNC);
         cache.setBackups(1);
         cache.setRebalanceMode(SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
index 26c69e8..d247831 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
@@ -29,7 +29,6 @@ import javax.cache.Cache;
 import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheEntry;
 import org.apache.ignite.cache.CacheInterceptor;
 import org.apache.ignite.cache.CacheMode;
@@ -47,8 +46,6 @@ import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -89,8 +86,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
         interceptor.disabled = false;
 
         assertEquals(0, interceptor.invokeCnt.get());
-
-        atomicClockModeDelay(jcache(0));
     }
 
     /** {@inheritDoc} */
@@ -116,12 +111,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
 
         ccfg.setInterceptor(interceptor);
 
-        if (ccfg.getAtomicityMode() == ATOMIC) {
-            assertNotNull(writeOrderMode());
-
-            ccfg.setAtomicWriteOrderMode(writeOrderMode());
-        }
-
         if (!storeEnabled()) {
             ccfg.setCacheStoreFactory(null);
             ccfg.setReadThrough(false);
@@ -137,13 +126,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
     }
 
     /**
-     * @return Atomic cache write order mode.
-     */
-    @Nullable protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return null;
-    }
-
-    /**
      * @return {@code True} if cache store is enabled.
      */
     protected boolean storeEnabled() {
@@ -450,7 +432,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
             return dataNodes + (storeEnabled() ? 1 : 0); // One call before store is updated.
         else {
             // If update goes through primary node and it is cancelled then backups aren't updated.
-            return (writeOrderMode() == PRIMARY || op == Operation.TRANSFORM) ? 1 : dataNodes;
+            return op == Operation.TRANSFORM ? 1 : dataNodes;
         }
     }
 
@@ -465,7 +447,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
             // Update + after update + one call before store is updated.
             return dataNodes * 2 + (storeEnabled() ? 1 : 0);
         else
-            return (writeOrderMode() == PRIMARY || op == Operation.TRANSFORM) ? 2 : dataNodes * 2;
+            return op == Operation.TRANSFORM ? 2 : dataNodes * 2;
     }
 
     /**
@@ -890,8 +872,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
         // Put from grid 1 to be sure grid 0 does not have value for near key.
         jcache(1).putAll(F.asMap(key1, 1, key2, 2, key3, 3));
 
-        atomicClockModeDelay(jcache(1));
-
         interceptor.disabled = false;
 
         log.info("Update [op=" + op + ", key1=" + key1 + ", key2=" + key2 + ", key3=" + key3 +

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicPrimaryWriteOrderSelfTest.java
deleted file mode 100644
index 04f18a78c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicPrimaryWriteOrderSelfTest.java
+++ /dev/null
@@ -1,47 +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.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheInterceptor;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-
-/**
- * Tests {@link CacheInterceptor}.
- */
-public class GridCacheInterceptorAtomicPrimaryWriteOrderSelfTest extends GridCacheInterceptorAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedPrimaryWriteOrderSelfTest.java
deleted file mode 100644
index 28a080c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedPrimaryWriteOrderSelfTest.java
+++ /dev/null
@@ -1,48 +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.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-
-/**
- * Tests {@link org.apache.ignite.cache.CacheInterceptor}.
- */
-public class GridCacheInterceptorAtomicReplicatedPrimaryWriteOrderSelfTest
-    extends GridCacheInterceptorAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return REPLICATED;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedSelfTest.java
index 69af38f..24bc342 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicReplicatedSelfTest.java
@@ -17,12 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
-import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 
@@ -39,9 +36,4 @@ public class GridCacheInterceptorAtomicReplicatedSelfTest extends GridCacheInter
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return CLOCK;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicSelfTest.java
index 270d2da..de3847e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAtomicSelfTest.java
@@ -17,13 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheInterceptor;
 import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -39,9 +36,4 @@ public class GridCacheInterceptorAtomicSelfTest extends GridCacheInterceptorAbst
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return CLOCK;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorLocalAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorLocalAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorLocalAtomicSelfTest.java
index 4580251..f12c92e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorLocalAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorLocalAtomicSelfTest.java
@@ -17,12 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
-import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 
@@ -36,11 +33,6 @@ public class GridCacheInterceptorLocalAtomicSelfTest extends GridCacheIntercepto
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected int gridCount() {
         return 1;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
index ff2d62d..827b0a5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
@@ -73,7 +73,7 @@ public class GridCacheMvccFlagsTest extends GridCommonAbstractTest {
 
         UUID id = UUID.randomUUID();
 
-        GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0, 0);
+        GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0);
 
         GridCacheMvccCandidate c = new GridCacheMvccCandidate(
             entry,
@@ -114,7 +114,7 @@ public class GridCacheMvccFlagsTest extends GridCommonAbstractTest {
 
         UUID id = UUID.randomUUID();
 
-        GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0, 0);
+        GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0);
 
         GridCacheMvccCandidate c = new GridCacheMvccCandidate(
             entry,

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
index 9da6ea6..2fb5d25 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
@@ -604,9 +604,9 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
     public void testSerializableReadLocksAdd() throws Exception {
         GridCacheAdapter<String, String> cache = grid.internalCache();
 
-        GridCacheVersion serOrder1 = new GridCacheVersion(0, 0, 10, 1);
-        GridCacheVersion serOrder2 = new GridCacheVersion(0, 0, 20, 1);
-        GridCacheVersion serOrder3 = new GridCacheVersion(0, 0, 15, 1);
+        GridCacheVersion serOrder1 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder2 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder3 = new GridCacheVersion(0, 0, 1);
 
         {
             GridCacheMvcc mvcc = new GridCacheMvcc(cache.context());
@@ -681,9 +681,9 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
     public void testSerializableReadLocksAssign() throws Exception {
         GridCacheAdapter<String, String> cache = grid.internalCache();
 
-        GridCacheVersion serOrder1 = new GridCacheVersion(0, 0, 10, 1);
-        GridCacheVersion serOrder2 = new GridCacheVersion(0, 0, 20, 1);
-        GridCacheVersion serOrder3 = new GridCacheVersion(0, 0, 15, 1);
+        GridCacheVersion serOrder1 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder2 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder3 = new GridCacheVersion(0, 0, 1);
 
         {
             GridCacheMvcc mvcc = new GridCacheMvcc(cache.context());
@@ -859,7 +859,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
             1,
             version(2),
             0,
-            new GridCacheVersion(0, 0, 30, 1),
+            new GridCacheVersion(0, 0, 1),
             false,
             true,
             false,
@@ -883,10 +883,10 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
 
         GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1");
 
-        GridCacheVersion serOrder1 = new GridCacheVersion(0, 0, 10, 1);
-        GridCacheVersion serOrder2 = new GridCacheVersion(0, 0, 20, 1);
-        GridCacheVersion serOrder3 = new GridCacheVersion(0, 0, 15, 1);
-        GridCacheVersion serOrder4 = new GridCacheVersion(0, 0, 30, 1);
+        GridCacheVersion serOrder1 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder2 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder3 = new GridCacheVersion(0, 0, 1);
+        GridCacheVersion serOrder4 = new GridCacheVersion(0, 0, 1);
 
         GridCacheVersion ver1 = incVer ? version(1) : version(4);
         GridCacheVersion ver2 = incVer ? version(2) : version(3);
@@ -991,7 +991,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @return Version.
      */
     private GridCacheVersion version(int order) {
-        return new GridCacheVersion(1, 0, order, order, 0);
+        return new GridCacheVersion(1, order, order, 0);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
index d352e26..e15a20f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
@@ -174,8 +174,8 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
         checkOrder(cands, ver1, ver5, ver3, ver2);
 
         entry.orderCompleted(
-            new GridCacheVersion(1, 0, 2, 0, 0),
-            Arrays.asList(new GridCacheVersion(1, 0, 3, 4, 0), ver2, new GridCacheVersion(1, 0, 5, 6, 0)),
+            new GridCacheVersion(1, 2, 0, 0),
+            Arrays.asList(new GridCacheVersion(1, 3, 4, 0), ver2, new GridCacheVersion(1, 5, 6, 0)),
             Collections.<GridCacheVersion>emptyList()
         );
 
@@ -1053,7 +1053,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
 
         entry.orderCompleted(
             ver2 /*local version.*/,
-            Arrays.asList(new GridCacheVersion(1, 0, 1, 2, 0), ver3, new GridCacheVersion(1, 0, 5, 6, 0)),
+            Arrays.asList(new GridCacheVersion(1, 1, 2, 0), ver3, new GridCacheVersion(1, 5, 6, 0)),
             Collections.<GridCacheVersion>emptyList()
         );
 
@@ -1619,7 +1619,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * @return Version.
      */
     private GridCacheVersion version(int order) {
-        return new GridCacheVersion(1, 0, order, order, 0);
+        return new GridCacheVersion(1, order, order, 0);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
index a806b7f..fbf8546 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.testframework.GridTestUtils;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -53,7 +52,6 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         return ccfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
index 49a4d30..77b1c01 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
@@ -27,14 +27,12 @@ import java.util.Set;
 import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -48,9 +46,6 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
     /** Atomicity mode. */
     private CacheAtomicityMode atomicityMode;
 
-    /** Atomic write order mode. */
-    private CacheAtomicWriteOrderMode writeOrderMode;
-
     /** Number of backups. */
     private int backups;
 
@@ -66,7 +61,6 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
         ccfg.setBackups(backups);
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode);
-        ccfg.setAtomicWriteOrderMode(writeOrderMode);
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -86,7 +80,7 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
         // Test works too long and fails.
         fail("https://issues.apache.org/jira/browse/IGNITE-581");
 
-        checkTransform(TRANSACTIONAL, PRIMARY, 0);
+        checkTransform(TRANSACTIONAL, 0);
     }
 
     /**
@@ -97,24 +91,21 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
         // Test works too long and fails.
         fail("https://issues.apache.org/jira/browse/IGNITE-581");
 
-        checkTransform(TRANSACTIONAL, PRIMARY, 1);
+        checkTransform(TRANSACTIONAL, 1);
     }
 
     /**
      * @param mode Atomicity mode.
-     * @param order Atomic cache write order mode.
      * @param b Number of backups.
      * @throws Exception If failed.
      */
-    private void checkTransform(CacheAtomicityMode mode, CacheAtomicWriteOrderMode order, int b)
+    private void checkTransform(CacheAtomicityMode mode, int b)
         throws Exception {
         try {
             atomicityMode = mode;
 
             backups = b;
 
-            writeOrderMode = order;
-
             cache = true;
 
             startGrids(2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
index ee1c9e5..9b08f4d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
@@ -27,7 +27,6 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteDataStreamer;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectBuilder;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -45,7 +44,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jsr166.ConcurrentHashMap8;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -76,13 +74,6 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
     }
 
     /**
-     * @return Cache write order mode.
-     */
-    private CacheAtomicWriteOrderMode cacheAtomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /**
      * @return Cache synchronization mode.
      */
     private CacheWriteSynchronizationMode cacheWriteSynchronizationMode() {
@@ -126,7 +117,6 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
         cc.setStoreKeepBinary(true);
 
         cc.setCacheMode(cacheMode());
-        cc.setAtomicWriteOrderMode(cacheAtomicWriteOrderMode());
         cc.setWriteSynchronizationMode(cacheWriteSynchronizationMode());
 
         cc.setBackups(0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index adbd6f1..1545b8c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -51,7 +51,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
     private long ttl;
 
     /** Version. */
-    private GridCacheVersion ver = new GridCacheVersion(0, 0, 0, 1, 0);
+    private GridCacheVersion ver = new GridCacheVersion(0, 0, 1, 0);
 
     /** Obsolete version. */
     private GridCacheVersion obsoleteVer = ver;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
index 30cc937..8de9748 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
@@ -22,14 +22,12 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -60,7 +58,6 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
 
         cCfg.setCacheMode(PARTITIONED);
         cCfg.setAtomicityMode(atomicityMode());
-        cCfg.setAtomicWriteOrderMode(writeOrderMode());
         cCfg.setNearConfiguration(nearConfiguration());
         cCfg.setRebalanceMode(SYNC);
         cCfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -94,13 +91,6 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
     }
 
     /**
-     * @return Atomic write order mode.
-     */
-    protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return CLOCK;
-    }
-
-    /**
      * @return Consistency test iteration count.
      */
     protected abstract int iterationCount();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
index af6d37a..1d602c9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -32,8 +31,6 @@ import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -49,9 +46,6 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
     private CacheAtomicityMode atomicityMode;
 
     /** */
-    private CacheAtomicWriteOrderMode atomicWriteOrder;
-
-    /** */
     private boolean near;
 
     /** {@inheritDoc} */
@@ -67,12 +61,6 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
 
         ccfg.setAtomicityMode(atomicityMode);
 
-        if (atomicityMode == null) {
-            assert atomicWriteOrder != null;
-
-            ccfg.setAtomicWriteOrderMode(atomicWriteOrder);
-        }
-
         ccfg.setNearConfiguration(near ? new NearCacheConfiguration() : null);
 
         return ccfg;
@@ -121,35 +109,9 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
     /**
      * @throws Exception If failed.
      */
-    public void testVersionAtomicClock() throws Exception {
-        atomicityMode = ATOMIC;
-
-        atomicWriteOrder = CLOCK;
-
-        checkVersion();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testVersionAtomicClockNearEnabled() throws Exception {
-        atomicityMode = ATOMIC;
-
-        atomicWriteOrder = CLOCK;
-
-        near = true;
-
-        checkVersion();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testVersionAtomicPrimary() throws Exception {
         atomicityMode = ATOMIC;
 
-        atomicWriteOrder = PRIMARY;
-
         checkVersion();
     }
 
@@ -159,8 +121,6 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
     public void testVersionAtomicPrimaryNearEnabled() throws Exception {
         atomicityMode = ATOMIC;
 
-        atomicWriteOrder = PRIMARY;
-
         near = true;
 
         checkVersion();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionSelfTest.java
index 9bf1c43..b69255f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionSelfTest.java
@@ -79,7 +79,7 @@ public class GridCacheVersionSelfTest extends GridCommonAbstractTest {
      */
     public void testMarshalling() throws Exception {
         GridCacheVersion ver = version(1, 1);
-        GridCacheVersionEx verEx = new GridCacheVersionEx(2, 2, 0, 0, ver);
+        GridCacheVersionEx verEx = new GridCacheVersionEx(2, 2, 0, ver);
 
         OptimizedMarshaller marsh = new OptimizedMarshaller(false);
 
@@ -101,6 +101,6 @@ public class GridCacheVersionSelfTest extends GridCommonAbstractTest {
      * @return Cache version.
      */
     private GridCacheVersion version(int nodeOrder, int drId) {
-        return new GridCacheVersion(0, 0, 0, nodeOrder, drId);
+        return new GridCacheVersion(0, 0, nodeOrder, drId);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
index 491e4dc..9101fc7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
@@ -37,7 +37,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -233,7 +232,6 @@ public class GridCacheVersionTopologyChangeTest extends GridCommonAbstractTest {
         ccfg.setName(name);
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setAffinity(aff);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index a43e85b..688e1cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -23,7 +23,6 @@ import javax.cache.configuration.Factory;
 import javax.cache.integration.CacheLoader;
 import javax.cache.integration.CacheWriter;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -125,12 +124,6 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
         cfg.setCacheMode(cacheMode());
         cfg.setAtomicityMode(atomicityMode());
 
-        if (atomicityMode() == ATOMIC && cacheMode() != LOCAL) {
-            assert atomicWriteOrderMode() != null;
-
-            cfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
-        }
-
         cfg.setWriteSynchronizationMode(writeSynchronization());
         cfg.setNearConfiguration(nearConfiguration());
 
@@ -193,13 +186,6 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
     protected abstract CacheAtomicityMode atomicityMode();
 
     /**
-     * @return Atomic cache write order mode.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return null;
-    }
-
-    /**
      * @return Partitioned mode.
      */
     protected abstract NearCacheConfiguration nearConfiguration();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicInvokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicInvokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicInvokeTest.java
index 186d1e7..cb05da4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicInvokeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicInvokeTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -46,11 +44,6 @@ public class IgniteCacheAtomicInvokeTest extends IgniteCacheInvokeAbstractTest {
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPeekModesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPeekModesTest.java
index 8b7859a..e8eda9a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPeekModesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPeekModesTest.java
@@ -17,11 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -43,9 +41,4 @@ public class IgniteCacheAtomicPeekModesTest extends IgniteCachePeekModesAbstract
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderInvokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderInvokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderInvokeTest.java
deleted file mode 100644
index 9891b3b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderInvokeTest.java
+++ /dev/null
@@ -1,57 +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.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class IgniteCacheAtomicPrimaryWriteOrderInvokeTest extends IgniteCacheInvokeAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderNearEnabledStoreValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderNearEnabledStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderNearEnabledStoreValueTest.java
deleted file mode 100644
index 38e544d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderNearEnabledStoreValueTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
-/**
- *
- */
-public class IgniteCacheAtomicPrimaryWriteOrderNearEnabledStoreValueTest
-    extends IgniteCacheAtomicPrimaryWriteOrderStoreValueTest {
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return new NearCacheConfiguration();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderStoreValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderStoreValueTest.java
deleted file mode 100644
index 2833030..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderStoreValueTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class IgniteCacheAtomicPrimaryWriteOrderStoreValueTest extends IgniteCacheAtomicStoreValueTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest.java
deleted file mode 100644
index 792cc1a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import javax.cache.configuration.Factory;
-import org.apache.ignite.cache.store.CacheStore;
-
-/**
- *
- */
-public class IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest extends
-    IgniteCacheAtomicPrimaryWriteOrderInvokeTest {
-    /** {@inheritDoc} */
-    @Override protected Factory<CacheStore> cacheStoreFactory() {
-        return new TestStoreFactory();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStoreValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStoreValueTest.java
index 34acb9b..47f0163 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStoreValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStoreValueTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -46,11 +44,6 @@ public class IgniteCacheAtomicStoreValueTest extends IgniteCacheStoreValueAbstra
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicWithStoreInvokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicWithStoreInvokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicWithStoreInvokeTest.java
new file mode 100644
index 0000000..661c0ed
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicWithStoreInvokeTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.internal.processors.cache;
+
+import javax.cache.configuration.Factory;
+import org.apache.ignite.cache.store.CacheStore;
+
+/**
+ *
+ */
+public class IgniteCacheAtomicWithStoreInvokeTest extends
+    IgniteCacheAtomicInvokeTest {
+    /** {@inheritDoc} */
+    @Override protected Factory<CacheStore> cacheStoreFactory() {
+        return new TestStoreFactory();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index a9098e8..674996d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -3404,8 +3404,6 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
 
         checkSize(F.asSet("key1", "key2", "key3"));
 
-        atomicClockModeDelay(cache);
-
         IgniteCache<String, Integer> asyncCache = cache.withAsync();
 
         if (async) {
@@ -3431,8 +3429,6 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
         cache.put("key2", 2);
         cache.put("key3", 3);
 
-        atomicClockModeDelay(cache);
-
         if (async) {
             if (oldAsync) {
                 IgniteCache asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync();
@@ -3456,8 +3452,6 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar
         for (int i = 0; i < entryCnt; i++)
             assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i)));
 
-        atomicClockModeDelay(cache);
-
         if (async) {
             if (oldAsync) {
                 asyncCache.removeAll();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAtomicTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAtomicTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAtomicTest.java
index 57be54c..cddb446 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAtomicTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAtomicTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -46,11 +44,6 @@ public class IgniteCacheEntryListenerAtomicTest extends IgniteCacheEntryListener
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
index b0be14e..c0e1a76 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
@@ -40,7 +40,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -151,7 +150,6 @@ public class IgniteCacheEntryListenerExpiredEventsTest extends GridCommonAbstrac
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
index d257605..9a84473 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
@@ -35,7 +35,6 @@ import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -113,7 +112,6 @@ public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
             ccfg.setBackups(1);
             ccfg.setWriteSynchronizationMode(FULL_SYNC);
             ccfg.setAtomicityMode(ATOMIC);
-            ccfg.setAtomicWriteOrderMode(PRIMARY);
 
             checkEntryProcessorCallCount(ccfg, 1);
         }
@@ -123,7 +121,6 @@ public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
             ccfg.setBackups(0);
             ccfg.setWriteSynchronizationMode(FULL_SYNC);
             ccfg.setAtomicityMode(ATOMIC);
-            ccfg.setAtomicWriteOrderMode(PRIMARY);
 
             checkEntryProcessorCallCount(ccfg, 1);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInterceptorSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInterceptorSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInterceptorSelfTestSuite.java
index 0549df7..f457e5d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInterceptorSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInterceptorSelfTestSuite.java
@@ -39,11 +39,9 @@ public class IgniteCacheInterceptorSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheInterceptorAtomicSelfTest.class);
         suite.addTestSuite(GridCacheInterceptorAtomicNearEnabledSelfTest.class);
         suite.addTestSuite(GridCacheInterceptorAtomicWithStoreSelfTest.class);
-        suite.addTestSuite(GridCacheInterceptorAtomicPrimaryWriteOrderSelfTest.class);
 
         suite.addTestSuite(GridCacheInterceptorAtomicReplicatedSelfTest.class);
         suite.addTestSuite(GridCacheInterceptorAtomicWithStoreReplicatedSelfTest.class);
-        suite.addTestSuite(GridCacheInterceptorAtomicReplicatedPrimaryWriteOrderSelfTest.class);
 
         suite.addTestSuite(GridCacheInterceptorSelfTest.class);
         suite.addTestSuite(GridCacheInterceptorNearEnabledSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
index 8d2db44..c74039c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
@@ -45,7 +45,6 @@ import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -339,7 +338,6 @@ public abstract class IgniteCacheInvokeReadThroughAbstractTest extends GridCommo
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (nearCache)
             ccfg.setNearConfiguration(new NearCacheConfiguration());

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
index 600dd23..f321453 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
@@ -24,7 +24,6 @@ import java.io.ObjectOutput;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 import javax.cache.CacheException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
@@ -63,11 +62,6 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CacheAtomicWriteOrderMode.PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }


[27/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/RandomVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/RandomVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/RandomVectorStorage.java
new file mode 100644
index 0000000..58f0fb4
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/RandomVectorStorage.java
@@ -0,0 +1,152 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.nio.ByteBuffer;
+import java.util.Random;
+import org.apache.ignite.math.MurmurHash;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * {@link VectorStorage} implementation with random values in the vector elements.
+ */
+public class RandomVectorStorage implements VectorStorage {
+    /** */
+    private static final long SCALE = 1L << 32;
+    /** */
+    private static final int PRIME = 104047;
+
+    /** Random generation seed. */
+    private int seed;
+
+    /** Vector size. */
+    private int size;
+
+    /** Whether fast hash is used, in {@link #get(int)}. */
+    private boolean fastHash;
+
+    /** */
+    public RandomVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size Size of the storage.
+     * @param fastHash Whether or not to use fast hashing or Murmur hashing.
+     */
+    public RandomVectorStorage(int size, boolean fastHash) {
+        assert size > 0;
+
+        this.size = size;
+        this.fastHash = fastHash;
+
+        seed = new Random().nextInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        if (!fastHash) {
+            ByteBuffer buf = ByteBuffer.allocate(4);
+
+            buf.putInt(i);
+            buf.flip();
+
+            return (MurmurHash.hash64A(buf, seed) & (SCALE - 1)) / (double)SCALE;
+        }
+        else
+            // This isn't a fantastic random number generator, but it is just fine for random projections.
+            return (((i * PRIME) & 8) * 0.25) - 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        throw new UnsupportedOperationException("Random vector storage is a read-only storage.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(size);
+        out.writeInt(seed);
+        out.writeBoolean(fastHash);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        size = in.readInt();
+        seed = in.readInt();
+        fastHash = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + Boolean.hashCode(fastHash);
+        res = res * 37 + seed;
+        res = res * 37 + size;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        RandomVectorStorage that = (RandomVectorStorage)o;
+
+        return size == that.size && seed == that.seed && fastHash == that.fastHash;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorDelegateStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorDelegateStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorDelegateStorage.java
new file mode 100644
index 0000000..c5a4350
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorDelegateStorage.java
@@ -0,0 +1,145 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * Single value view storage over another vector.
+ */
+public class SingleElementVectorDelegateStorage implements VectorStorage {
+    /** */ private int idx;
+    /** */ private Vector vec;
+
+    /**
+     *
+     */
+    public SingleElementVectorDelegateStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param vec Parent vector.
+     * @param idx Element index.
+     */
+    public SingleElementVectorDelegateStorage(Vector vec, int idx) {
+        assert vec != null;
+        assert idx >= 0;
+
+        this.vec = vec;
+        this.idx = idx;
+    }
+
+    /**
+     *
+     *
+     */
+    public int index() {
+        return idx;
+    }
+
+    /**
+     *
+     *
+     */
+    public Vector delegate() {
+        return vec;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return vec.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return i == idx ? vec.get(i) : 0.0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        if (i == idx)
+            vec.set(i, v);
+        else
+            throw new UnsupportedOperationException("Can't set element outside of index: " + idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(vec);
+        out.writeInt(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        vec = (Vector)in.readObject();
+        idx = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        SingleElementVectorDelegateStorage that = (SingleElementVectorDelegateStorage)o;
+
+        return idx == that.idx && (vec != null ? vec.equals(that.vec) : that.vec == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = idx;
+
+        res = 31 * res + (vec != null ? vec.hashCode() : 0);
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorStorage.java
new file mode 100644
index 0000000..3378817
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SingleElementVectorStorage.java
@@ -0,0 +1,143 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * Vector storage holding a single non-zero value at some index.
+ */
+public class SingleElementVectorStorage implements VectorStorage {
+    /** */ private int idx;
+    /** */ private double val;
+    /** */ private int size;
+
+    /**
+     *
+     */
+    public SingleElementVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size Parent vector size.
+     * @param idx Element index in the parent vector.
+     * @param val Value of the element.
+     */
+    public SingleElementVectorStorage(int size, int idx, double val) {
+        assert size > 0;
+        assert idx >= 0;
+
+        this.size = size;
+        this.idx = idx;
+        this.val = val;
+    }
+
+    /**
+     *
+     * @return Index of the element in the parent vector.
+     */
+    public int index() {
+        return idx;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return i == idx ? val : 0.0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        if (i == idx)
+            val = v;
+        else
+            throw new UnsupportedOperationException("Can't set element outside of index: " + idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(size);
+        out.writeInt(idx);
+        out.writeDouble(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        size = in.readInt();
+        idx = in.readInt();
+        val = in.readDouble();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        SingleElementVectorStorage that = (SingleElementVectorStorage)o;
+
+        return idx == that.idx && Double.compare(that.val, val) == 0 && size == that.size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = idx;
+        long temp = Double.doubleToLongBits(val);
+
+        res = 31 * res + (int)(temp ^ (temp >>> 32));
+        res = 31 * res + size;
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
new file mode 100644
index 0000000..9b912cb
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
@@ -0,0 +1,148 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.nio.ByteBuffer;
+import org.apache.ignite.internal.util.offheap.GridOffHeapMap;
+import org.apache.ignite.internal.util.offheap.GridOffHeapMapFactory;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * {@link VectorStorage} implementation for {@link org.apache.ignite.math.impls.vector.SparseLocalOffHeapVector}.
+ */
+public class SparseLocalOffHeapVectorStorage implements VectorStorage {
+    /** Assume 10% density. */
+    private static final int INIT_DENSITY = 10;
+    /** Storage capacity. */
+    private int size;
+    /** Local off heap map. */
+    private GridOffHeapMap gridOffHeapMap;
+
+    /** */
+    public SparseLocalOffHeapVectorStorage() {
+        //No-op.
+    }
+
+    /** */
+    public SparseLocalOffHeapVectorStorage(int cap) {
+        assert cap > 0;
+
+        gridOffHeapMap = GridOffHeapMapFactory.unsafeMap(cap / INIT_DENSITY);
+        size = cap;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        byte[] bytes = gridOffHeapMap.get(hash(i), intToByteArray(i));
+        return bytes == null ? 0 : ByteBuffer.wrap(bytes).getDouble();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        if (v != 0.0)
+            gridOffHeapMap.put(hash(i), intToByteArray(i), doubleToByteArray(v));
+        else if (gridOffHeapMap.contains(hash(i), intToByteArray(i)))
+            gridOffHeapMap.remove(hash(i), intToByteArray(i));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        throw new UnsupportedOperationException(); // TODO: add externalization support.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        gridOffHeapMap.destruct();
+    }
+
+    /** */
+    private int hash(int h) {
+        // Apply base step of MurmurHash; see http://code.google.com/p/smhasher/
+        // Despite two multiplies, this is often faster than others
+        // with comparable bit-spread properties.
+        h ^= h >>> 16;
+        h *= 0x85ebca6b;
+        h ^= h >>> 13;
+        h *= 0xc2b2ae35;
+
+        return (h >>> 16) ^ h;
+    }
+
+    /** */
+    private byte[] intToByteArray(int val) {
+        return new byte[] {
+            (byte)(val >>> 24),
+            (byte)(val >>> 16),
+            (byte)(val >>> 8),
+            (byte)val};
+    }
+
+    /** */
+    private byte[] doubleToByteArray(double val) {
+        long l = Double.doubleToRawLongBits(val);
+        return new byte[] {
+            (byte)((l >> 56) & 0xff),
+            (byte)((l >> 48) & 0xff),
+            (byte)((l >> 40) & 0xff),
+            (byte)((l >> 32) & 0xff),
+            (byte)((l >> 24) & 0xff),
+            (byte)((l >> 16) & 0xff),
+            (byte)((l >> 8) & 0xff),
+            (byte)((l) & 0xff),
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
new file mode 100644
index 0000000..b3a8a3c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
@@ -0,0 +1,152 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap;
+import it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * Sparse, local, on-heap vector storage.
+ */
+public class SparseLocalOnHeapVectorStorage implements VectorStorage, StorageConstants {
+    /** */ private int size;
+    /** */ private int acsMode;
+
+    /** Actual map storage. */
+    private Map<Integer, Double> sto;
+
+    /**
+     *
+     */
+    public SparseLocalOnHeapVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size Vector size.
+     * @param acsMode Access mode.
+     */
+    public SparseLocalOnHeapVectorStorage(int size, int acsMode) {
+        assert size > 0;
+        assertAccessMode(acsMode);
+
+        this.size = size;
+        this.acsMode = acsMode;
+
+        if (acsMode == SEQUENTIAL_ACCESS_MODE)
+            sto = new Int2DoubleRBTreeMap();
+        else
+            sto = new Int2DoubleOpenHashMap();
+    }
+
+    /**
+     *
+     *
+     */
+    public int getAccessMode() {
+        return acsMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return sto.getOrDefault(i, 0.0);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        if (v != 0.0)
+            sto.put(i, v);
+        else if (sto.containsKey(i))
+            sto.remove(i);
+
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(size);
+        out.writeInt(acsMode);
+        out.writeObject(sto);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked"})
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        size = in.readInt();
+        acsMode = in.readInt();
+        sto = (Map<Integer, Double>)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return acsMode == SEQUENTIAL_ACCESS_MODE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        SparseLocalOnHeapVectorStorage that = (SparseLocalOnHeapVectorStorage)o;
+
+        return size == that.size && acsMode == that.acsMode && (sto != null ? sto.equals(that.sto) : that.sto == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = size;
+
+        res = 31 * res + acsMode;
+        res = 31 * res + (sto != null ? sto.hashCode() : 0);
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/package-info.java
new file mode 100644
index 0000000..a716e6a
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains specific implementations for vector storage models.
+ */
+package org.apache.ignite.math.impls.storage.vector;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractReadOnlyVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractReadOnlyVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractReadOnlyVector.java
new file mode 100644
index 0000000..58c583a
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractReadOnlyVector.java
@@ -0,0 +1,108 @@
+package org.apache.ignite.math.impls.vector;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.impls.matrix.FunctionMatrix;
+
+/**
+ * This class provides a helper implementation of the read-only implementation of {@link Vector}
+ * interface to minimize the effort required to implement it.
+ * Subclasses may override some of the implemented methods if a more
+ * specific or optimized implementation is desirable.
+ */
+public abstract class AbstractReadOnlyVector extends AbstractVector {
+    /** */
+    public AbstractReadOnlyVector() {
+        // No-op.
+    }
+
+    /**
+     * @param sto Storage.
+     */
+    public AbstractReadOnlyVector(VectorStorage sto) {
+        super(true, sto);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix cross(Vector vec) {
+        return new FunctionMatrix(size(), vec.size(),
+            (row, col) -> vec.get(col) * get(row));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix toMatrix(boolean rowLike) {
+        return new FunctionMatrix(rowLike ? 1 : size(), rowLike ? size() : 1,
+            (row, col) -> rowLike ? get(col) : get(row));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix toMatrixPlusOne(boolean rowLike, double zeroVal) {
+        return new FunctionMatrix(rowLike ? 1 : size() + 1, rowLike ? size() + 1 : 1, (row, col) -> {
+            if (row == 0 && col == 0)
+                return zeroVal;
+
+            return rowLike ? get(col - 1) : get(row - 1);
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        return this; // This exploits read-only feature of this type vector.
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector logNormalize() {
+        return logNormalize(2.0, Math.sqrt(getLengthSquared()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector logNormalize(double power) {
+        return logNormalize(power, kNorm(power));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteDoubleFunction<Double> fun) {
+        return new FunctionVector(size(), (i) -> fun.apply(get(i)));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(Vector vec, IgniteBiFunction<Double, Double, Double> fun) {
+        checkCardinality(vec);
+
+        return new FunctionVector(size(), (i) -> fun.apply(get(i), vec.get(i)));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteBiFunction<Double, Double, Double> fun, double y) {
+        return new FunctionVector(size(), (i) -> fun.apply(get(i), y));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector divide(double x) {
+        if (x == 1.0)
+            return this;
+
+        return new FunctionVector(size(), (i) -> get(i) / x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        return x == 0 ? new ConstantVector(size(), 0) : new FunctionVector(size(), (i) -> get(i) * x);
+    }
+
+    /**
+     * @param power Power.
+     * @param normLen Normalized length.
+     * @return logNormalized value.
+     */
+    private Vector logNormalize(double power, double normLen) {
+        assert !(Double.isInfinite(power) || power <= 1.0);
+
+        double denominator = normLen * Math.log(power);
+
+        return new FunctionVector(size(), (idx) -> Math.log1p(get(idx)) / denominator);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractVector.java
new file mode 100644
index 0000000..d84c0f3
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/AbstractVector.java
@@ -0,0 +1,903 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.function.IntToDoubleFunction;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.impls.matrix.MatrixView;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * This class provides a helper implementation of the {@link Vector}
+ * interface to minimize the effort required to implement it.
+ * Subclasses may override some of the implemented methods if a more
+ * specific or optimized implementation is desirable.
+ */
+public abstract class AbstractVector implements Vector {
+    /** Vector storage implementation. */
+    private VectorStorage sto;
+
+    /** Meta attribute storage. */
+    private Map<String, Object> meta = new HashMap<>();
+
+    /** Vector's GUID. */
+    private IgniteUuid guid = IgniteUuid.randomUuid();
+
+    /** Cached value for length squared. */
+    private double lenSq = 0.0;
+
+    /** Maximum cached element. */
+    private Element maxElm = null;
+    /** Minimum cached element. */
+    private Element minElm = null;
+
+    /** Readonly flag (false by default). */
+    private boolean readOnly = false;
+
+    /** Read-only error message. */
+    private static final String RO_MSG = "Vector is read-only.";
+
+    /**
+     *
+     */
+    private void ensureReadOnly() {
+        if (readOnly)
+            throw new UnsupportedOperationException(RO_MSG);
+    }
+
+    /**
+     * @param sto Storage.
+     */
+    public AbstractVector(VectorStorage sto) {
+        this(false, sto);
+    }
+
+    /**
+     * @param readOnly Is read only.
+     * @param sto Storage.
+     */
+    public AbstractVector(boolean readOnly, VectorStorage sto) {
+        assert sto != null;
+
+        this.readOnly = readOnly;
+        this.sto = sto;
+    }
+
+    /**
+     *
+     */
+    public AbstractVector() {
+        // No-op.
+    }
+
+    /**
+     * Set storage.
+     *
+     * @param sto Storage.
+     */
+    protected void setStorage(VectorStorage sto) {
+        this.sto = sto;
+    }
+
+    /**
+     * @param i Index.
+     * @param v Value.
+     */
+    protected void storageSet(int i, double v) {
+        ensureReadOnly();
+
+        sto.set(i, v);
+
+        // Reset cached values.
+        lenSq = 0.0;
+        maxElm = minElm = null;
+    }
+
+    /**
+     * @param i Index.
+     * @return Value.
+     */
+    protected double storageGet(int i) {
+        return sto.get(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return sto.size();
+    }
+
+    /**
+     * Check index bounds.
+     *
+     * @param idx Index to check.
+     */
+    protected void checkIndex(int idx) {
+        if (idx < 0 || idx >= sto.size())
+            throw new IndexException(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int idx) {
+        checkIndex(idx);
+
+        return storageGet(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getX(int idx) {
+        return storageGet(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return sto.isArrayBased();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector sort() {
+        if (isArrayBased())
+            Arrays.parallelSort(sto.data());
+        else
+            throw new UnsupportedOperationException();
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteDoubleFunction<Double> fun) {
+        if (sto.isArrayBased()) {
+            double[] data = sto.data();
+
+            Arrays.setAll(data, (idx) -> fun.apply(data[idx]));
+        }
+        else {
+            int len = size();
+
+            for (int i = 0; i < len; i++)
+                storageSet(i, fun.apply(storageGet(i)));
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(Vector vec, IgniteBiFunction<Double, Double, Double> fun) {
+        checkCardinality(vec);
+
+        int len = size();
+
+        for (int i = 0; i < len; i++)
+            storageSet(i, fun.apply(storageGet(i), vec.get(i)));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteBiFunction<Double, Double, Double> fun, double y) {
+        int len = size();
+
+        for (int i = 0; i < len; i++)
+            storageSet(i, fun.apply(storageGet(i), y));
+
+        return this;
+    }
+
+    /**
+     * @param idx Index.
+     * @return Value.
+     */
+    protected Element makeElement(int idx) {
+        checkIndex(idx);
+
+        return new Element() {
+            /** {@inheritDoc} */
+            @Override public double get() {
+                return storageGet(idx);
+            }
+
+            /** {@inheritDoc} */
+            @Override public int index() {
+                return idx;
+            }
+
+            /** {@inheritDoc} */
+            @Override public void set(double val) {
+                storageSet(idx, val);
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element minElement() {
+        if (minElm == null) {
+            int minIdx = 0;
+            int len = size();
+
+            for (int i = 0; i < len; i++)
+                if (storageGet(i) < storageGet(minIdx))
+                    minIdx = i;
+
+            minElm = makeElement(minIdx);
+        }
+
+        return minElm;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element maxElement() {
+        if (maxElm == null) {
+            int maxIdx = 0;
+            int len = size();
+
+            for (int i = 0; i < len; i++)
+                if (storageGet(i) > storageGet(maxIdx))
+                    maxIdx = i;
+
+            maxElm = makeElement(maxIdx);
+        }
+
+        return maxElm;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double minValue() {
+        return minElement().get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxValue() {
+        return maxElement().get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector set(int idx, double val) {
+        checkIndex(idx);
+
+        storageSet(idx, val);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector setX(int idx, double val) {
+        storageSet(idx, val);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector increment(int idx, double val) {
+        checkIndex(idx);
+
+        storageSet(idx, storageGet(idx) + val);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector incrementX(int idx, double val) {
+        storageSet(idx, storageGet(idx) + val);
+
+        return this;
+    }
+
+    /**
+     * Tests if given value is considered a zero value.
+     *
+     * @param val Value to check.
+     */
+    protected boolean isZero(double val) {
+        return val == 0.0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        double sum = 0;
+        int len = size();
+
+        for (int i = 0; i < len; i++)
+            sum += storageGet(i);
+
+        return sum;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteUuid guid() {
+        return guid;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterable<Element> all() {
+        return new Iterable<Element>() {
+            private int idx = 0;
+
+            /** {@inheritDoc} */
+            @NotNull
+            @Override public Iterator<Element> iterator() {
+                return new Iterator<Element>() {
+                    /** {@inheritDoc} */
+                    @Override public boolean hasNext() {
+                        return size() > 0 && idx < size();
+                    }
+
+                    /** {@inheritDoc} */
+                    @Override public Element next() {
+                        if (hasNext())
+                            return getElement(idx++);
+
+                        throw new NoSuchElementException();
+                    }
+                };
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nonZeroElements() {
+        int cnt = 0;
+
+        for (Element ignored : nonZeroes())
+            cnt++;
+
+        return cnt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T foldMap(IgniteBiFunction<T, Double, T> foldFun, IgniteDoubleFunction<Double> mapFun,
+        T zeroVal) {
+        T res = zeroVal;
+        int len = size();
+
+        for (int i = 0; i < len; i++)
+            res = foldFun.apply(res, mapFun.apply(storageGet(i)));
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T foldMap(Vector vec, IgniteBiFunction<T, Double, T> foldFun,
+        IgniteBiFunction<Double, Double, Double> combFun, T zeroVal) {
+        checkCardinality(vec);
+
+        T res = zeroVal;
+        int len = size();
+
+        for (int i = 0; i < len; i++)
+            res = foldFun.apply(res, combFun.apply(storageGet(i), vec.getX(i)));
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterable<Element> nonZeroes() {
+        return new Iterable<Element>() {
+            private int idx = 0;
+            private int idxNext = -1;
+
+            /** {@inheritDoc} */
+            @NotNull
+            @Override public Iterator<Element> iterator() {
+                return new Iterator<Element>() {
+                    @Override public boolean hasNext() {
+                        findNext();
+
+                        return !over();
+                    }
+
+                    @Override public Element next() {
+                        if (hasNext()) {
+                            idx = idxNext;
+
+                            return getElement(idxNext);
+                        }
+
+                        throw new NoSuchElementException();
+                    }
+
+                    private void findNext() {
+                        if (over())
+                            return;
+
+                        if (idxNextInitialized() && idx != idxNext)
+                            return;
+
+                        if (idxNextInitialized())
+                            idx = idxNext + 1;
+
+                        while (idx < size() && isZero(get(idx)))
+                            idx++;
+
+                        idxNext = idx++;
+                    }
+
+                    private boolean over() {
+                        return idxNext >= size();
+                    }
+
+                    private boolean idxNextInitialized() {
+                        return idxNext != -1;
+                    }
+                };
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<String, Object> getMetaStorage() {
+        return meta;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(double val) {
+        if (sto.isArrayBased()) {
+            ensureReadOnly();
+
+            Arrays.fill(sto.data(), val);
+        }
+        else {
+            int len = size();
+
+            for (int i = 0; i < len; i++)
+                storageSet(i, val);
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(double[] vals) {
+        checkCardinality(vals);
+
+        if (sto.isArrayBased()) {
+            ensureReadOnly();
+
+            System.arraycopy(vals, 0, sto.data(), 0, vals.length);
+
+            lenSq = 0.0;
+        }
+        else {
+            int len = size();
+
+            for (int i = 0; i < len; i++)
+                storageSet(i, vals[i]);
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(Vector vec) {
+        checkCardinality(vec);
+
+        for (Vector.Element x : vec.all())
+            storageSet(x.index(), x.get());
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(IntToDoubleFunction fun) {
+        assert fun != null;
+
+        if (sto.isArrayBased()) {
+            ensureReadOnly();
+
+            Arrays.setAll(sto.data(), fun);
+        }
+        else {
+            int len = size();
+
+            for (int i = 0; i < len; i++)
+                storageSet(i, fun.applyAsDouble(i));
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Spliterator<Double> allSpliterator() {
+        return new Spliterator<Double>() {
+            /** {@inheritDoc} */
+            @Override public boolean tryAdvance(Consumer<? super Double> act) {
+                int len = size();
+
+                for (int i = 0; i < len; i++)
+                    act.accept(storageGet(i));
+
+                return true;
+            }
+
+            /** {@inheritDoc} */
+            @Override public Spliterator<Double> trySplit() {
+                return null; // No Splitting.
+            }
+
+            /** {@inheritDoc} */
+            @Override public long estimateSize() {
+                return size();
+            }
+
+            /** {@inheritDoc} */
+            @Override public int characteristics() {
+                return ORDERED | SIZED;
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public Spliterator<Double> nonZeroSpliterator() {
+        return new Spliterator<Double>() {
+            /** {@inheritDoc} */
+            @Override public boolean tryAdvance(Consumer<? super Double> act) {
+                int len = size();
+
+                for (int i = 0; i < len; i++) {
+                    double val = storageGet(i);
+
+                    if (!isZero(val))
+                        act.accept(val);
+                }
+
+                return true;
+            }
+
+            /** {@inheritDoc} */
+            @Override public Spliterator<Double> trySplit() {
+                return null; // No Splitting.
+            }
+
+            /** {@inheritDoc} */
+            @Override public long estimateSize() {
+                return nonZeroElements();
+            }
+
+            /** {@inheritDoc} */
+            @Override public int characteristics() {
+                return ORDERED | SIZED;
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public double dot(Vector vec) {
+        checkCardinality(vec);
+
+        double sum = 0.0;
+        int len = size();
+
+        for (int i = 0; i < len; i++)
+            sum += storageGet(i) * vec.getX(i);
+
+        return sum;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getLengthSquared() {
+        if (lenSq == 0.0)
+            lenSq = dotSelf();
+
+        return lenSq;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return sto.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return sto.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return sto.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return sto.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public VectorStorage getStorage() {
+        return sto;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewPart(int off, int len) {
+        return new VectorView(this, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix cross(Vector vec) {
+        Matrix res = likeMatrix(size(), vec.size());
+
+        if (res == null)
+            return null;
+
+        for (Element e : nonZeroes()) {
+            int row = e.index();
+
+            res.assignRow(row, vec.times(getX(row)));
+        }
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix toMatrix(boolean rowLike) {
+        Matrix res = likeMatrix(rowLike ? 1 : size(), rowLike ? size() : 1);
+
+        if (res == null)
+            return null;
+
+        if (rowLike)
+            res.assignRow(0, this);
+        else
+            res.assignColumn(0, this);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix toMatrixPlusOne(boolean rowLike, double zeroVal) {
+        Matrix res = likeMatrix(rowLike ? 1 : size() + 1, rowLike ? size() + 1 : 1);
+
+        if (res == null)
+            return null;
+
+        res.set(0, 0, zeroVal);
+
+        if (rowLike)
+            new MatrixView(res, 0, 1, 1, size()).assignRow(0, this);
+        else
+            new MatrixView(res, 1, 0, size(), 1).assignColumn(0, this);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getDistanceSquared(Vector vec) {
+        checkCardinality(vec);
+
+        double thisLenSq = getLengthSquared();
+        double thatLenSq = vec.getLengthSquared();
+        double dot = dot(vec);
+        double distEst = thisLenSq + thatLenSq - 2 * dot;
+
+        if (distEst > 1.0e-3 * (thisLenSq + thatLenSq))
+            // The vectors are far enough from each other that the formula is accurate.
+            return Math.max(distEst, 0);
+        else
+            return foldMap(vec, Functions.PLUS, Functions.MINUS_SQUARED, 0d);
+    }
+
+    /** */
+    protected void checkCardinality(Vector vec) {
+        if (vec.size() != size())
+            throw new CardinalityException(size(), vec.size());
+    }
+
+    /** */
+    protected void checkCardinality(double[] vec) {
+        if (vec.length != size())
+            throw new CardinalityException(size(), vec.length);
+    }
+
+    /** */
+    protected void checkCardinality(int[] arr) {
+        if (arr.length != size())
+            throw new CardinalityException(size(), arr.length);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector minus(Vector vec) {
+        checkCardinality(vec);
+
+        Vector cp = copy();
+
+        return cp.map(vec, Functions.MINUS);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector plus(double x) {
+        Vector cp = copy();
+
+        return x != 0.0 ? cp.map(Functions.plus(x)) : cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector divide(double x) {
+        Vector cp = copy();
+
+        if (x != 1.0)
+            for (Element element : cp.all())
+                element.set(element.get() / x);
+
+        return cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        if (x == 0.0)
+            return like(size());
+        else
+            return copy().map(Functions.mult(x));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(Vector vec) {
+        checkCardinality(vec);
+
+        return copy().map(vec, Functions.MULT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector plus(Vector vec) {
+        checkCardinality(vec);
+
+        Vector cp = copy();
+
+        return cp.map(vec, Functions.PLUS);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector logNormalize() {
+        return logNormalize(2.0, Math.sqrt(getLengthSquared()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector logNormalize(double power) {
+        return logNormalize(power, kNorm(power));
+    }
+
+    /**
+     * @param power Power.
+     * @param normLen Normalized length.
+     * @return logNormalized value.
+     */
+    private Vector logNormalize(double power, double normLen) {
+        assert !(Double.isInfinite(power) || power <= 1.0);
+
+        double denominator = normLen * Math.log(power);
+
+        Vector cp = copy();
+
+        for (Element element : cp.all())
+            element.set(Math.log1p(element.get()) / denominator);
+
+        return cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double kNorm(double power) {
+        assert power >= 0.0;
+
+        // Special cases.
+        if (Double.isInfinite(power))
+            return foldMap(Math::max, Math::abs, 0d);
+        else if (power == 2.0)
+            return Math.sqrt(getLengthSquared());
+        else if (power == 1.0)
+            return foldMap(Functions.PLUS, Math::abs, 0d);
+        else if (power == 0.0)
+            return nonZeroElements();
+        else
+            // Default case.
+            return Math.pow(foldMap(Functions.PLUS, Functions.pow(power), 0d), 1.0 / power);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector normalize() {
+        return divide(Math.sqrt(getLengthSquared()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector normalize(double power) {
+        return divide(kNorm(power));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        return like(size()).assign(this);
+    }
+
+    /**
+     * @return Result of dot with self.
+     */
+    protected double dotSelf() {
+        double sum = 0.0;
+        int len = size();
+
+        for (int i = 0; i < len; i++) {
+            double v = storageGet(i);
+
+            sum += v * v;
+        }
+
+        return sum;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element getElement(int idx) {
+        return makeElement(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(sto);
+        out.writeObject(meta);
+        out.writeObject(guid);
+        out.writeBoolean(readOnly);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        sto = (VectorStorage)in.readObject();
+        meta = (Map<String, Object>)in.readObject();
+        guid = (IgniteUuid)in.readObject();
+        readOnly = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        sto.destroy();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+        res += res * 37 + guid.hashCode();
+        res += sto == null ? 0 : res * 37 + sto.hashCode();
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        AbstractVector that = (AbstractVector)obj;
+
+        return (sto != null ? sto.equals(that.sto) : that.sto == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/CacheVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/CacheVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/CacheVector.java
new file mode 100644
index 0000000..0e9b26f
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/CacheVector.java
@@ -0,0 +1,140 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.ValueMapper;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorKeyMapper;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.impls.CacheUtils;
+import org.apache.ignite.math.impls.storage.vector.CacheVectorStorage;
+
+/**
+ * Vector based on existing cache and index and value mapping functions.
+ */
+public class CacheVector<K, V> extends AbstractVector {
+    /**
+     *
+     */
+    public CacheVector() {
+        // No-op.
+    }
+
+    /**
+     * Creates new vector over existing cache.
+     *
+     * @param size
+     * @param cache
+     * @param keyFunc
+     * @param valMapper
+     */
+    public CacheVector(
+        int size,
+        IgniteCache<K, V> cache,
+        VectorKeyMapper<K> keyFunc,
+        ValueMapper<V> valMapper) {
+        setStorage(new CacheVectorStorage<>(size, cache, keyFunc, valMapper));
+    }
+
+    /**
+     * @param mapper
+     */
+    private Vector mapOverCache(IgniteFunction<Double, Double> mapper) {
+        CacheVectorStorage<K, V> sto = storage();
+
+        CacheUtils.map(sto.cache().getName(), sto.keyMapper(), sto.valueMapper(), mapper);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double minValue() {
+        CacheVectorStorage<K, V> sto = storage();
+
+        return CacheUtils.min(sto.cache().getName(), sto.keyMapper(), sto.valueMapper());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxValue() {
+        CacheVectorStorage<K, V> sto = storage();
+
+        return CacheUtils.max(sto.cache().getName(), sto.keyMapper(), sto.valueMapper());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteDoubleFunction<Double> fun) {
+        return mapOverCache(fun::apply);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteBiFunction<Double, Double, Double> fun, double y) {
+        // TODO: provide cache-optimized implementation.
+        return super.map(fun, y); // TODO
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        CacheVectorStorage<K, V> sto = storage();
+
+        return CacheUtils.sum(sto.cache().getName(), sto.keyMapper(), sto.valueMapper());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(double val) {
+        return mapOverCache((Double d) -> val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector plus(double x) {
+        return mapOverCache((Double d) -> d + x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector divide(double x) {
+        return mapOverCache((Double d) -> d / x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        return mapOverCache((Double d) -> d * x);
+    }
+
+    /**
+     *
+     *
+     */
+    @SuppressWarnings({"unchecked"})
+    private CacheVectorStorage<K, V> storage() {
+        return (CacheVectorStorage<K, V>)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/ConstantVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/ConstantVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/ConstantVector.java
new file mode 100644
index 0000000..0fddfd6
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/ConstantVector.java
@@ -0,0 +1,84 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.storage.vector.ConstantVectorStorage;
+
+/**
+ * Constant value, read-only vector.
+ */
+public class ConstantVector extends AbstractReadOnlyVector {
+    /**
+     *
+     */
+    public ConstantVector() {
+        // No-op.
+    }
+
+    /**
+     * @param size
+     * @param val
+     */
+    public ConstantVector(int size, double val) {
+        super(new ConstantVectorStorage(size, val));
+    }
+
+    /**
+     *
+     *
+     */
+    private ConstantVectorStorage storage() {
+        return (ConstantVectorStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        ConstantVectorStorage sto = storage();
+
+        return new ConstantVector(sto.size(), sto.constant());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        return new ConstantVector(crd, storage().constant());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        ConstantVector that = (ConstantVector)o;
+
+        VectorStorage sto = getStorage();
+
+        return (sto != null ? sto.equals(that.getStorage()) : that.getStorage() == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DelegatingVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DelegatingVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DelegatingVector.java
new file mode 100644
index 0000000..a10fa45
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DelegatingVector.java
@@ -0,0 +1,391 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Spliterator;
+import java.util.function.IntToDoubleFunction;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+
+/**
+ * Convenient class that can be used to add decorations to an existing vector. Subclasses
+ * can add weights, indices, etc. while maintaining full vector functionality.
+ */
+public class DelegatingVector implements Vector {
+    /** Delegating vector. */
+    private Vector dlg;
+
+    /** Meta attribute storage. */
+    private Map<String, Object> meta = new HashMap<>();
+
+    /** GUID. */
+    private IgniteUuid guid = IgniteUuid.randomUuid();
+
+    /** */
+    public DelegatingVector() {
+        // No-op.
+    }
+
+    /**
+     * @param dlg
+     */
+    public DelegatingVector(Vector dlg) {
+        assert dlg != null;
+
+        this.dlg = dlg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(dlg);
+        out.writeObject(meta);
+        out.writeObject(guid);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        dlg = (Vector)in.readObject();
+        meta = (Map<String, Object>)in.readObject();
+        guid = (IgniteUuid)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<String, Object> getMetaStorage() {
+        return meta;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return dlg.likeMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix toMatrix(boolean rowLike) {
+        return dlg.toMatrix(rowLike);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix toMatrixPlusOne(boolean rowLike, double zeroVal) {
+        return dlg.toMatrixPlusOne(rowLike, zeroVal);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return dlg.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return dlg.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double minValue() {
+        return dlg.minValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxValue() {
+        return dlg.maxValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return dlg.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return dlg.isArrayBased();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector copy() {
+        return new DelegatingVector(dlg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterable<Element> all() {
+        return dlg.all();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterable<Element> nonZeroes() {
+        return dlg.nonZeroes();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector sort() {
+        return dlg.sort();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Spliterator<Double> allSpliterator() {
+        return dlg.allSpliterator();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Spliterator<Double> nonZeroSpliterator() {
+        return dlg.nonZeroSpliterator();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element getElement(int idx) {
+        return dlg.getElement(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(double val) {
+        return dlg.assign(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(double[] vals) {
+        return dlg.assign(vals);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(Vector vec) {
+        return dlg.assign(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(IntToDoubleFunction fun) {
+        return dlg.assign(fun);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteDoubleFunction<Double> fun) {
+        return dlg.map(fun);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(Vector vec, IgniteBiFunction<Double, Double, Double> fun) {
+        return dlg.map(vec, fun);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector map(IgniteBiFunction<Double, Double, Double> fun, double y) {
+        return dlg.map(fun, y);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector divide(double x) {
+        return dlg.divide(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double dot(Vector vec) {
+        return dlg.dot(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int idx) {
+        return dlg.get(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getX(int idx) {
+        return dlg.getX(idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        return dlg.like(crd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector minus(Vector vec) {
+        return dlg.minus(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector normalize() {
+        return dlg.normalize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector normalize(double power) {
+        return dlg.normalize(power);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector logNormalize() {
+        return dlg.logNormalize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector logNormalize(double power) {
+        return dlg.logNormalize(power);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double kNorm(double power) {
+        return dlg.kNorm(power);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element minElement() {
+        return dlg.minElement();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element maxElement() {
+        return dlg.maxElement();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector plus(double x) {
+        return dlg.plus(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector plus(Vector vec) {
+        return dlg.plus(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector set(int idx, double val) {
+        return dlg.set(idx, val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector setX(int idx, double val) {
+        return dlg.setX(idx, val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector incrementX(int idx, double val) {
+        return dlg.incrementX(idx, val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector increment(int idx, double val) {
+        return dlg.increment(idx, val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nonZeroElements() {
+        return dlg.nonZeroElements();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        return dlg.times(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(Vector vec) {
+        return dlg.times(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewPart(int off, int len) {
+        return dlg.viewPart(off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public VectorStorage getStorage() {
+        return dlg.getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        return dlg.sum();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix cross(Vector vec) {
+        return dlg.cross(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T foldMap(IgniteBiFunction<T, Double, T> foldFun, IgniteDoubleFunction<Double> mapFun,
+        T zeroVal) {
+        return dlg.foldMap(foldFun, mapFun, zeroVal);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T foldMap(Vector vec, IgniteBiFunction<T, Double, T> foldFun,
+        IgniteBiFunction<Double, Double, Double> combFun, T zeroVal) {
+        return dlg.foldMap(vec, foldFun, combFun, zeroVal);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getLengthSquared() {
+        return dlg.getLengthSquared();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getDistanceSquared(Vector vec) {
+        return dlg.getDistanceSquared(vec);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return dlg.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return dlg.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteUuid guid() {
+        return guid;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        dlg.destroy();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + meta.hashCode();
+        res = res * 37 + dlg.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        DelegatingVector that = (DelegatingVector)o;
+
+        return meta.equals(that.meta) && dlg.equals(that.dlg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVector.java
new file mode 100644
index 0000000..4e7eb21
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVector.java
@@ -0,0 +1,89 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.stream.IntStream;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.matrix.DenseLocalOffHeapMatrix;
+import org.apache.ignite.math.impls.storage.vector.DenseLocalOffHeapVectorStorage;
+
+/**
+ * Implementation for {@link Vector} assuming dense logic and local offheap JVM storage.
+ * It is suitable for data sets where local, non-distributed execution is satisfactory and on-heap JVM storage
+ * is not enough to keep the entire data set.
+ */
+public class DenseLocalOffHeapVector extends AbstractVector {
+    /** */
+    public DenseLocalOffHeapVector() {
+        // No-op.
+    }
+
+    /** */
+    private void makeOffheapStorage(int size) {
+        setStorage(new DenseLocalOffHeapVectorStorage(size));
+    }
+
+    /**
+     * @param arr Array to copy to offheap storage.
+     */
+    public DenseLocalOffHeapVector(double[] arr) {
+        makeOffheapStorage(arr.length);
+
+        assign(arr);
+    }
+
+    /**
+     * @param size Vector cardinality.
+     */
+    public DenseLocalOffHeapVector(int size) {
+        makeOffheapStorage(size);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector assign(Vector vec) {
+        checkCardinality(vec);
+
+        IntStream.range(0, size()).parallel().forEach(idx -> set(idx, vec.get(idx)));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        if (x == 0.0)
+            return like(size()).assign(0);
+        else
+            return super.times(x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        return new DenseLocalOffHeapVector(crd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return new DenseLocalOffHeapMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        return o != null && getClass().equals(o.getClass()) && (getStorage().equals(((Vector)o).getStorage()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVector.java
new file mode 100644
index 0000000..5827998
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVector.java
@@ -0,0 +1,104 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Map;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.storage.vector.ArrayVectorStorage;
+
+/**
+ * Basic implementation for vector.
+ * <p>
+ * This is a trivial implementation for vector assuming dense logic, local on-heap JVM storage
+ * based on {@code double[]} array. It is only suitable for data sets where
+ * local, non-distributed execution is satisfactory and on-heap JVM storage is enough
+ * to keep the entire data set.
+ */
+public class DenseLocalOnHeapVector extends AbstractVector {
+    /**
+     * @param size Vector cardinality.
+     */
+    private VectorStorage mkStorage(int size) {
+        return new ArrayVectorStorage(size);
+    }
+
+    /**
+     * @param arr Source array.
+     * @param cp {@code true} to clone array, reuse it otherwise.
+     */
+    private VectorStorage mkStorage(double[] arr, boolean cp) {
+        assert arr != null;
+
+        return new ArrayVectorStorage(cp ? arr.clone() : arr);
+    }
+
+    /**
+     * @param args Parameters for new Vector.
+     */
+    public DenseLocalOnHeapVector(Map<String, Object> args) {
+        assert args != null;
+
+        if (args.containsKey("size"))
+            setStorage(mkStorage((int)args.get("size")));
+        else if (args.containsKey("arr") && args.containsKey("copy"))
+            setStorage(mkStorage((double[])args.get("arr"), (boolean)args.get("copy")));
+        else
+            throw new UnsupportedOperationException("Invalid constructor argument(s).");
+    }
+
+    /** */
+    public DenseLocalOnHeapVector() {
+        // No-op.
+    }
+
+    /**
+     * @param size Vector cardinality.
+     */
+    public DenseLocalOnHeapVector(int size) {
+        setStorage(mkStorage(size));
+    }
+
+    /**
+     * @param arr Source array.
+     * @param shallowCp {@code true} to use shallow copy.
+     */
+    public DenseLocalOnHeapVector(double[] arr, boolean shallowCp) {
+        setStorage(mkStorage(arr, shallowCp));
+    }
+
+    /**
+     * @param arr Source array.
+     */
+    public DenseLocalOnHeapVector(double[] arr) {
+        this(arr, false);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        return new DenseLocalOnHeapMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector like(int crd) {
+        return new DenseLocalOnHeapVector(crd);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/vector/FunctionVector.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/vector/FunctionVector.java b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/FunctionVector.java
new file mode 100644
index 0000000..0e7cfad
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/vector/FunctionVector.java
@@ -0,0 +1,112 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Map;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.functions.IntDoubleToVoidFunction;
+import org.apache.ignite.math.impls.storage.vector.FunctionVectorStorage;
+
+/**
+ * Implementation of {@link Vector} that maps vector element index to {@link java.util.function} interfaces.
+ */
+public class FunctionVector extends AbstractVector {
+    /**
+     *
+     */
+    public FunctionVector() {
+        // No-op.
+    }
+
+    /**
+     * Creates read-write or read-only function vector.
+     *
+     * @param size Vector size.
+     * @param getFunc Function that returns value corresponding to given element index.
+     * @param setFunc Set function. If {@code null} - this will be a read-only vector.
+     */
+    public FunctionVector(int size, IgniteFunction<Integer, Double> getFunc, IntDoubleToVoidFunction setFunc) {
+        setStorage(new FunctionVectorStorage(size, getFunc, setFunc));
+    }
+
+    /**
+     * Creates read-only function vector.
+     *
+     * @param size Vector size.
+     * @param getFunc Function that returns value corresponding to given element index.
+     */
+    public FunctionVector(int size, IgniteFunction<Integer, Double> getFunc) {
+        setStorage(new FunctionVectorStorage(size, getFunc));
+    }
+
+    /**
+     * @param args Arguments for vector constructor.
+     */
+    public FunctionVector(Map<String, Object> args) {
+        assert args != null;
+
+        if (args.containsKey("size") && args.containsKey("getFunc") && args.containsKey("setFunc")) {
+            @SuppressWarnings("unchecked")
+            IgniteFunction<Integer, Double> getFunc = (IgniteFunction<Integer, Double>)args.get("getFunc");
+            IntDoubleToVoidFunction setFunc = (IntDoubleToVoidFunction)args.get("setFunc");
+            int size = (int)args.get("size");
+
+            setStorage(new FunctionVectorStorage(size, getFunc, setFunc));
+        }
+        else if (args.containsKey("size") && args.containsKey("getFunc")) {
+            @SuppressWarnings("unchecked")
+            IgniteFunction<Integer, Double> getFunc = (IgniteFunction<Integer, Double>)args.get("getFunc");
+            int size = (int)args.get("size");
+
+            setStorage(new FunctionVectorStorage(size, getFunc));
+        }
+        else
+            throw new UnsupportedOperationException("Invalid constructor argument(s).");
+    }
+
+    /**
+     *
+     *
+     */
+    private FunctionVectorStorage storage() {
+        return (FunctionVectorStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public org.apache.ignite.math.Vector like(int crd) {
+        FunctionVectorStorage sto = storage();
+
+        return new FunctionVector(crd, sto.getFunction(), sto.setFunction());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix likeMatrix(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(double x) {
+        if (x == 0.0)
+            return like(size()).assign(0);
+        else
+            return super.times(x);
+    }
+}


[47/50] [abbrv] ignite git commit: Memory policies example and documentation fixes.

Posted by sb...@apache.org.
Memory policies example and documentation fixes.


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

Branch: refs/heads/ignite-1561-1
Commit: 86c405873fd32ea859afa29ed1e403f7320631e6
Parents: 0c0cf2c
Author: Denis Magda <dm...@gridgain.com>
Authored: Sun Apr 16 12:57:29 2017 -0700
Committer: Denis Magda <dm...@gridgain.com>
Committed: Sun Apr 16 12:57:29 2017 -0700

----------------------------------------------------------------------
 examples/config/example-memory-policies.xml     | 105 +++++++++++++++++
 .../datagrid/MemoryPoliciesExample.java         | 114 +++++++++++++++++++
 .../ignite/examples/CacheExamplesSelfTest.java  |   8 ++
 .../configuration/CacheConfiguration.java       |   5 +-
 .../configuration/IgniteConfiguration.java      |  18 +--
 .../configuration/MemoryConfiguration.java      |   4 +-
 .../MemoryPolicyConfiguration.java              |  22 ++--
 .../apache/ignite/internal/IgniteKernal.java    |   7 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |   6 +-
 .../processors/cache/GridCacheProcessor.java    |   3 +-
 .../IgniteCacheDatabaseSharedManager.java       |  14 +--
 11 files changed, 266 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/examples/config/example-memory-policies.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-memory-policies.xml b/examples/config/example-memory-policies.xml
new file mode 100644
index 0000000..9390a20
--- /dev/null
+++ b/examples/config/example-memory-policies.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    Ignite configuration with all defaults, enabled p2p deployment and special memory policies.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        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 class="org.apache.ignite.configuration.IgniteConfiguration">
+        <!-- Set to true to enable distributed class loading for examples, default is false. -->
+        <property name="peerClassLoadingEnabled" value="true"/>
+
+        <property name="memoryConfiguration">
+            <bean class="org.apache.ignite.configuration.MemoryConfiguration">
+                <!-- Setting a name of the default memory policy -->
+                <property name="defaultMemoryPolicyName" value="Default_Region"/>
+                <!-- Setting the page size to 4 KB -->
+                <property name="pageSize" value="4096"/>
+
+                <!-- Defining several memory policies for different memory regions -->
+                <property name="memoryPolicies">
+                    <list>
+                        <!--
+                            Default memory region that grows endlessly. A cache is bound to this memory region
+                            unless it sets another one in its CacheConfiguration.
+                        -->
+                        <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
+                            <property name="name" value="Default_Region"/>
+                            <!-- 100 MB memory region with disabled eviction -->
+                            <property name="size" value="#{100 * 1024 * 1024}"/>
+                        </bean>
+
+                        <!--
+                            Memory region of 10 MBs in size with an eviction enabled.
+                        -->
+                        <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
+                            <property name="name" value="10MB_Region_Eviction"/>
+                            <!-- 10 MB memory region. -->
+                            <property name="size" value="#{10 * 1024 * 1024}"/>
+                            <!-- Enabling eviction for this memory region -->
+                            <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
+                        </bean>
+
+                        <!--
+                            This memory region is backed by a memory-mapped file which names is passed via
+                            'swapFilePath' parameter.
+                        -->
+                        <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration">
+                            <property name="name" value="5MB_Region_Swapping"/>
+                            <!-- 5 MB memory region. -->
+                            <property name="size" value="#{5 * 1024 * 1024}"/>
+                            <!-- Setting a name of the swapping file. -->
+                            <property name="swapFilePath" value="memoryPolicyExampleSwap"/>
+                        </bean>
+                    </list>
+                </property>
+            </bean>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignite provides several options for automatic discovery that can be used
+                        instead os static IP based discovery. For information on all options refer
+                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
+                    -->
+                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java
new file mode 100644
index 0000000..3f27d3e
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/MemoryPoliciesExample.java
@@ -0,0 +1,114 @@
+/*
+ * 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.examples.datagrid;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+
+/**
+ * This example demonstrates how to tweak particular settings of Apache Ignite page memory using
+ * {@link MemoryConfiguration} and set up several memory policies for different caches with
+ * {@link MemoryPolicyConfiguration}.
+ * <p>
+ * Additional remote nodes can be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} example-memory-policies.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleNodeStartup} in another JVM which passing
+ * {@code examples/config/example-memory-policies.xml} configuration to it.
+ */
+public class MemoryPoliciesExample {
+    /** Name of the default memory policy defined in 'example-memory-policies.xml'. */
+    public static final String POLICY_DEFAULT = "Default_Region";
+
+    /** Name of the memory policy that creates a memory region limited by 10 MB with eviction enabled */
+    public static final String POLICY_10MB_EVICTION = "10MB_Region_Eviction";
+
+    /** Name of the memory policy that creates a memory region mapped to a memory-mapped file. */
+    public static final String POLICY_5MB_MEMORY_MAPPED_FILE = "5MB_Region_Swapping";
+
+    /**
+     * Executes example.
+     *
+     * @param args Command line arguments, none required.
+     * @throws IgniteException If example execution failed.
+     */
+    public static void main(String[] args) throws IgniteException {
+        try (Ignite ignite = Ignition.start("examples/config/example-memory-policies.xml")) {
+            System.out.println();
+            System.out.println(">>> Memory policies example started.");
+
+            /**
+             * Preparing configurations for 2 caches that will be bound to the memory region defined by
+             * '10MB_Region_Eviction' memory policy from 'example-memory-policies.xml' configuration.
+             */
+            CacheConfiguration<Integer, Integer> firstCacheCfg = new CacheConfiguration<>("firstCache");
+
+            firstCacheCfg.setMemoryPolicyName(POLICY_10MB_EVICTION);
+            firstCacheCfg.setCacheMode(CacheMode.PARTITIONED);
+            firstCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+            CacheConfiguration<Integer, Integer> secondCacheCfg = new CacheConfiguration<>("secondCache");
+            secondCacheCfg.setMemoryPolicyName(POLICY_10MB_EVICTION);
+            secondCacheCfg.setCacheMode(CacheMode.REPLICATED);
+            secondCacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+
+            IgniteCache<Integer, Integer> firstCache = ignite.createCache(firstCacheCfg);
+            IgniteCache<Integer, Integer> secondCache = ignite.createCache(secondCacheCfg);
+
+            System.out.println(">>> Started two caches bound to '" + POLICY_10MB_EVICTION + "' memory region.");
+
+            /**
+             * Preparing a configuration for a cache that will be bound to the memory region defined by
+             * '5MB_Region_Swapping' memory policy from 'example-memory-policies.xml' configuration.
+             */
+            CacheConfiguration<Integer, Integer> thirdCacheCfg = new CacheConfiguration<>("thirdCache");
+
+            thirdCacheCfg.setMemoryPolicyName(POLICY_5MB_MEMORY_MAPPED_FILE);
+
+            IgniteCache<Integer, Integer> thirdCache = ignite.createCache(thirdCacheCfg);
+
+            System.out.println(">>> Started a cache bound to '" + POLICY_5MB_MEMORY_MAPPED_FILE + "' memory region.");
+
+
+            /**
+             * Preparing a configuration for a cache that will be bound to the default memory region defined by
+             * default 'Default_Region' memory policy from 'example-memory-policies.xml' configuration.
+             */
+            CacheConfiguration<Integer, Integer> fourthCacheCfg = new CacheConfiguration<>("fourthCache");
+
+            IgniteCache<Integer, Integer> fourthCache = ignite.createCache(fourthCacheCfg);
+
+            System.out.println(">>> Started a cache bound to '" + POLICY_DEFAULT + "' memory region.");
+
+            System.out.println(">>> Destroying caches...");
+
+            firstCache.destroy();
+            secondCache.destroy();
+            thirdCache.destroy();
+            fourthCache.destroy();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
index 4bec419..3447dff 100644
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.examples.datagrid.CachePutGetExample;
 import org.apache.ignite.examples.datagrid.CacheQueryDmlExample;
 import org.apache.ignite.examples.datagrid.CacheQueryExample;
 import org.apache.ignite.examples.datagrid.CacheTransactionExample;
+import org.apache.ignite.examples.datagrid.MemoryPoliciesExample;
 import org.apache.ignite.examples.datagrid.starschema.CacheStarSchemaExample;
 import org.apache.ignite.examples.datagrid.store.CacheLoadOnlyStoreExample;
 import org.apache.ignite.examples.datastructures.IgniteAtomicLongExample;
@@ -182,4 +183,11 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
     public void testCacheLoadOnlyStoreExample() throws Exception {
         CacheLoadOnlyStoreExample.main(EMPTY_ARGS);
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMemoryPolicyExample() throws Exception {
+        MemoryPoliciesExample.main(EMPTY_ARGS);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/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 34b3951..dc64c26 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
@@ -494,9 +494,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
-     * Sets name of {@link MemoryPolicyConfiguration} for this cache.
+     * Sets a name of {@link MemoryPolicyConfiguration} for this cache.
      *
-     * @param memPlcName MemoryPolicyConfiguration name. Can be null (default MemoryPolicyConfiguration will be used) but should not be empty.
+     * @param memPlcName MemoryPolicyConfiguration name. Can be null (default MemoryPolicyConfiguration will be used)
+     *                   but should not be empty.
      * @return {@code this} for chaining.
      */
     public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 5d29e0e..fe08ddf 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -440,8 +440,8 @@ public class IgniteConfiguration {
     /** */
     private boolean lateAffAssignment = DFLT_LATE_AFF_ASSIGNMENT;
 
-    /** Database configuration. */
-    private MemoryConfiguration dbCfg;
+    /** Page memory configuration. */
+    private MemoryConfiguration memCfg;
 
     /** Active on start flag. */
     private boolean activeOnStart = DFLT_ACTIVE_ON_START;
@@ -481,7 +481,7 @@ public class IgniteConfiguration {
         allResolversPassReq = cfg.isAllSegmentationResolversPassRequired();
         atomicCfg = cfg.getAtomicConfiguration();
         binaryCfg = cfg.getBinaryConfiguration();
-        dbCfg = cfg.getMemoryConfiguration();
+        memCfg = cfg.getMemoryConfiguration();
         cacheCfg = cfg.getCacheConfiguration();
         cacheKeyCfg = cfg.getCacheKeyConfiguration();
         cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled();
@@ -2091,22 +2091,22 @@ public class IgniteConfiguration {
     }
 
     /**
-     * Gets memory configuration.
+     * Gets page memory configuration.
      *
      * @return Memory configuration.
      */
     public MemoryConfiguration getMemoryConfiguration() {
-        return dbCfg;
+        return memCfg;
     }
 
     /**
-     * Sets memory configuration.
+     * Sets page memory configuration.
      *
-     * @param dbCfg Memory configuration.
+     * @param memCfg Memory configuration.
      * @return {@code this} for chaining.
      */
-    public IgniteConfiguration setMemoryConfiguration(MemoryConfiguration dbCfg) {
-        this.dbCfg = dbCfg;
+    public IgniteConfiguration setMemoryConfiguration(MemoryConfiguration memCfg) {
+        this.memCfg = memCfg;
 
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
index 3ef876b..fce6894 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
@@ -22,9 +22,9 @@ import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
- * Database configuration used to configure database and manage offheap memory of Ignite Node.
+ * Page memory configuration of an Apache Ignite node.
  *
- * <p>It may be configured under {@link IgniteConfiguration XML configuration} as follows:</p>
+ * <p>It can be configured using {@link IgniteConfiguration} as follows:</p>
  * <pre>
  *     {@code
  *     <property name="memoryConfiguration">

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
index 6fe373d..c838756 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
@@ -22,28 +22,21 @@ import org.apache.ignite.internal.pagemem.PageMemory;
 import org.apache.ignite.internal.processors.cache.database.MemoryPolicy;
 
 /**
- * Configuration bean used for creating {@link MemoryPolicy} instances.
+ * This class defines {@code MemoryPolicy} configuration.
  */
 public final class MemoryPolicyConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Unique name of MemoryPolicy. */
+    /** Memory policy name. */
     private String name;
 
-    /** Size in bytes of {@link PageMemory} in bytes that will be created for this configuration. */
+    /** Memory policy size. */
     private long size;
 
-    /** Path for memory mapped file (won't be created if not configured). */
+    /** An optional path to a memory mapped file for this memory policy. */
     private String swapFilePath;
 
-    /**
-     * Unique name of MemoryPolicy.
-     */
-    public String getName() {
-        return name;
-    }
-
     /** Algorithm for per-page eviction. If {@link DataPageEvictionMode#DISABLED} set, eviction is not performed. */
     private DataPageEvictionMode pageEvictionMode = DataPageEvictionMode.DISABLED;
 
@@ -64,6 +57,13 @@ public final class MemoryPolicyConfiguration implements Serializable {
     private int emptyPagesPoolSize = 100;
 
     /**
+     * Unique name of MemoryPolicy.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
      * @param name Unique name of MemoryPolicy.
      */
     public MemoryPolicyConfiguration setName(String name) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index b35f9bb..eb2ae6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2429,10 +2429,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         if (memCfg == null)
             return;
 
-        U.log(log, "System cache MemoryPolicy size is configured to " +
-                (memCfg.getSystemCacheMemorySize() / (1024 * 1024)) +
-        "MB size. " +
-                "Use MemoryConfiguration.systemCacheMemorySize property to change it.");
+        U.log(log, "System cache's MemoryPolicy size is configured to " +
+            (memCfg.getSystemCacheMemorySize() / (1024 * 1024)) + " MB. " +
+            "Use MemoryConfiguration.systemCacheMemorySize property to change the setting.");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index d145374..61e93cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -2103,11 +2103,11 @@ public class IgnitionEx {
             initializeDefaultCacheConfiguration(myCfg);
 
             if (!myCfg.isClientMode() && myCfg.getMemoryConfiguration() == null) {
-                MemoryConfiguration dbCfg = new MemoryConfiguration();
+                MemoryConfiguration memCfg = new MemoryConfiguration();
 
-                dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+                memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
 
-                myCfg.setMemoryConfiguration(dbCfg);
+                myCfg.setMemoryConfiguration(memCfg);
             }
 
             return myCfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/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 3f7184e..7841f06 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
@@ -362,8 +362,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      */
     private boolean storesLocallyOnClient(IgniteConfiguration c,
                                           CacheConfiguration cc) {
-        if (c.isClientMode()
-                && c.getMemoryConfiguration() == null) {
+        if (c.isClientMode() && c.getMemoryConfiguration() == null) {
             if (cc.getCacheMode() == LOCAL)
                 return true;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/86c40587/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
index 2d2295c..a34aed2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
@@ -98,20 +98,20 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
      */
     public void init() throws IgniteCheckedException {
         if (memPlcMap == null) {
-            MemoryConfiguration dbCfg = cctx.kernalContext().config().getMemoryConfiguration();
+            MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
 
-            if (dbCfg == null)
-                dbCfg = new MemoryConfiguration();
+            if (memCfg == null)
+                memCfg = new MemoryConfiguration();
 
-            validateConfiguration(dbCfg);
+            validateConfiguration(memCfg);
 
-            pageSize = dbCfg.getPageSize();
+            pageSize = memCfg.getPageSize();
 
-            initPageMemoryPolicies(dbCfg);
+            initPageMemoryPolicies(memCfg);
 
             startMemoryPolicies();
 
-            initPageMemoryDataStructures(dbCfg);
+            initPageMemoryDataStructures(memCfg);
         }
     }
 


[28/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DiagonalMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DiagonalMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DiagonalMatrixStorage.java
new file mode 100644
index 0000000..099db38
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DiagonalMatrixStorage.java
@@ -0,0 +1,136 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * {@link MatrixStorage} implementation for diagonal Matrix view.
+ */
+public class DiagonalMatrixStorage implements MatrixStorage {
+    /** Backing vector for matrix diagonal. */
+    private Vector diagonal;
+
+    /**
+     *
+     */
+    public DiagonalMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param diagonal Backing {@link Vector} for matrix diagonal.
+     */
+    public DiagonalMatrixStorage(Vector diagonal) {
+        assert diagonal != null;
+
+        this.diagonal = diagonal;
+    }
+
+    /**
+     *
+     */
+    public Vector diagonal() {
+        return diagonal;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return x == y ? diagonal.get(x) : 0.0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        if (x == y)
+            diagonal.set(x, v);
+        else
+            throw new UnsupportedOperationException("Can't set off-diagonal element.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return diagonal.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return diagonal.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(diagonal);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        diagonal = (Vector)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return diagonal.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return diagonal.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return diagonal.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return diagonal.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + diagonal.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        DiagonalMatrixStorage that = (DiagonalMatrixStorage)o;
+
+        return diagonal.equals(that.diagonal);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/FunctionMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/FunctionMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/FunctionMatrixStorage.java
new file mode 100644
index 0000000..6b0c6b4
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/FunctionMatrixStorage.java
@@ -0,0 +1,175 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IntIntDoubleToVoidFunction;
+import org.apache.ignite.math.functions.IntIntToDoubleFunction;
+
+/**
+ * Read-only or read-write function-based matrix storage.
+ */
+public class FunctionMatrixStorage implements MatrixStorage {
+    /** */ private int rows;
+    /** */ private int cols;
+
+    /** */ private IntIntToDoubleFunction getFunc;
+    /** */ private IntIntDoubleToVoidFunction setFunc;
+
+    /**
+     *
+     */
+    public FunctionMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param getFunc Function that returns value corresponding to given row and column index.
+     * @param setFunc Set function. If {@code null} - this will be a read-only matrix.
+     */
+    public FunctionMatrixStorage(int rows, int cols, IntIntToDoubleFunction getFunc,
+        IntIntDoubleToVoidFunction setFunc) {
+        assert rows > 0;
+        assert cols > 0;
+        assert getFunc != null;
+
+        this.rows = rows;
+        this.cols = cols;
+        this.getFunc = getFunc;
+        this.setFunc = setFunc;
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param getFunc Function that returns value corresponding to given row and column index.
+     */
+    public FunctionMatrixStorage(int rows, int cols, IntIntToDoubleFunction getFunc) {
+        this(rows, cols, getFunc, null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return getFunc.apply(x, y);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        if (setFunc != null)
+            setFunc.apply(x, y, v);
+        else
+            throw new UnsupportedOperationException("Cannot set into read-only matrix.");
+    }
+
+    /**
+     *
+     */
+    public IntIntToDoubleFunction getFunction() {
+        return getFunc;
+    }
+
+    /**
+     *
+     */
+    public IntIntDoubleToVoidFunction setFunction() {
+        return setFunc;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(setFunc);
+        out.writeObject(getFunc);
+        out.writeInt(rows);
+        out.writeInt(cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        setFunc = (IntIntDoubleToVoidFunction)in.readObject();
+        getFunc = (IntIntToDoubleFunction)in.readObject();
+        rows = in.readInt();
+        cols = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        FunctionMatrixStorage that = (FunctionMatrixStorage)o;
+
+        return rows == that.rows && cols == that.cols
+            && (getFunc != null ? getFunc.equals(that.getFunc) : that.getFunc == null)
+            && (setFunc != null ? setFunc.equals(that.setFunc) : that.setFunc == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = rows;
+
+        res = 31 * res + cols;
+        res = 31 * res + (getFunc != null ? getFunc.hashCode() : 0);
+        res = 31 * res + (setFunc != null ? setFunc.hashCode() : 0);
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/MatrixDelegateStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/MatrixDelegateStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/MatrixDelegateStorage.java
new file mode 100644
index 0000000..2e1fc12
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/MatrixDelegateStorage.java
@@ -0,0 +1,205 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.MatrixStorage;
+
+/**
+ * {@link MatrixStorage} implementation that delegates to parent matrix.
+ */
+public class MatrixDelegateStorage implements MatrixStorage {
+    /** Parent matrix storage. */
+    private MatrixStorage sto;
+
+    /** Row offset in the parent matrix. */
+    private int rowOff;
+    /** Column offset in the parent matrix. */
+    private int colOff;
+
+    /** Amount of rows in the matrix. */
+    private int rows;
+    /** Amount of columns in the matrix. */
+    private int cols;
+
+    /**
+     *
+     */
+    public MatrixDelegateStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param sto Backing parent storage.
+     * @param rowOff Row offset to parent matrix.
+     * @param colOff Column offset to parent matrix.
+     * @param rows Amount of rows in the view.
+     * @param cols Amount of columns in the view.
+     */
+    public MatrixDelegateStorage(MatrixStorage sto, int rowOff, int colOff, int rows, int cols) {
+        assert sto != null;
+        assert rowOff >= 0;
+        assert colOff >= 0;
+        assert rows > 0;
+        assert cols > 0;
+
+        this.sto = sto;
+
+        this.rowOff = rowOff;
+        this.colOff = colOff;
+
+        this.rows = rows;
+        this.cols = cols;
+    }
+
+    /**
+     *
+     */
+    public MatrixStorage delegate() {
+        return sto;
+    }
+
+    /**
+     *
+     */
+    public int rowOffset() {
+        return rowOff;
+    }
+
+    /**
+     *
+     */
+    public int columnOffset() {
+        return colOff;
+    }
+
+    /**
+     *
+     */
+    public int rowsLength() {
+        return rows;
+    }
+
+    /**
+     *
+     */
+    public int columnsLength() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return sto.get(rowOff + x, colOff + y);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        sto.set(rowOff + x, colOff + y, v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return sto.isArrayBased() && rowOff == 0 && colOff == 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return sto.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return sto.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return sto.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return sto.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[][] data() {
+        return sto.data();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(sto);
+
+        out.writeInt(rowOff);
+        out.writeInt(colOff);
+
+        out.writeInt(rows);
+        out.writeInt(cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        sto = (MatrixStorage)in.readObject();
+
+        rowOff = in.readInt();
+        colOff = in.readInt();
+
+        rows = in.readInt();
+        cols = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + rows;
+        res = res * 37 + cols;
+        res = res * 37 + rowOff;
+        res = res * 37 + colOff;
+        res = res * 37 + sto.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        MatrixDelegateStorage that = (MatrixDelegateStorage)o;
+
+        return rows == that.rows && cols == that.cols && rowOff == that.rowOff && colOff == that.colOff &&
+            (sto != null ? sto.equals(that.sto) : that.sto == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/PivotedMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/PivotedMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/PivotedMatrixStorage.java
new file mode 100644
index 0000000..32c8624
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/PivotedMatrixStorage.java
@@ -0,0 +1,256 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import org.apache.ignite.math.MatrixStorage;
+
+/**
+ * Pivoted (index mapped) view over another matrix storage implementation.
+ */
+public class PivotedMatrixStorage implements MatrixStorage {
+    /** Matrix storage. */
+    private MatrixStorage sto;
+
+    /** */
+    private int[] rowPivot;
+    /** */
+    private int[] colPivot;
+    /** */
+    private int[] rowUnpivot;
+    /** */
+    private int[] colUnpivot;
+
+    /**
+     *
+     */
+    public PivotedMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param sto Matrix storage.
+     * @param rowPivot Pivot array for rows.
+     * @param colPivot Pivot array for columns.
+     */
+    public PivotedMatrixStorage(MatrixStorage sto, int[] rowPivot, int[] colPivot) {
+        assert sto != null;
+        assert rowPivot != null;
+        assert colPivot != null;
+
+        this.sto = sto;
+        this.rowPivot = rowPivot;
+        this.colPivot = colPivot;
+
+        rowUnpivot = invert(rowPivot);
+        colUnpivot = invert(colPivot);
+    }
+
+    /**
+     *
+     */
+    public int[] rowPivot() {
+        return rowPivot;
+    }
+
+    /**
+     *
+     */
+    public int[] columnPivot() {
+        return colPivot;
+    }
+
+    /**
+     *
+     */
+    public int[] rowUnpivot() {
+        return rowUnpivot;
+    }
+
+    /**
+     *
+     */
+    public int[] columnUnpivot() {
+        return colUnpivot;
+    }
+
+    /**
+     * @param sto Matrix storage.
+     * @param pivot Pivot array.
+     */
+    public PivotedMatrixStorage(MatrixStorage sto, int[] pivot) {
+        this(sto, pivot, pivot == null ? null : java.util.Arrays.copyOf(pivot, pivot.length));
+    }
+
+    /**
+     * @param sto Matrix storage.
+     */
+    public PivotedMatrixStorage(MatrixStorage sto) {
+        this(sto, sto == null ? null : identityPivot(sto.rowSize()), sto == null ? null : identityPivot(sto.columnSize()));
+    }
+
+    /**
+     * @param i First row index to swap.
+     * @param j Second row index to swap.
+     */
+    public void swapRows(int i, int j) {
+        if (i != j) {
+            int tmp = rowPivot[i];
+
+            rowPivot[i] = rowPivot[j];
+            rowPivot[j] = tmp;
+
+            rowUnpivot[rowPivot[i]] = i;
+            rowUnpivot[rowPivot[j]] = j;
+        }
+    }
+
+    /**
+     * @param i First column index to swap.
+     * @param j Second column index to swap.
+     */
+    public void swapColumns(int i, int j) {
+        if (i != j) {
+            int tmp = colPivot[i];
+
+            colPivot[i] = colPivot[j];
+            colPivot[j] = tmp;
+
+            colUnpivot[colPivot[i]] = i;
+            colUnpivot[colPivot[j]] = j;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return sto.get(rowPivot[x], colPivot[y]);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        sto.set(rowPivot[x], colPivot[y], v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return sto.columnSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return sto.rowSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(sto);
+        out.writeObject(rowPivot);
+        out.writeObject(colPivot);
+        out.writeObject(rowUnpivot);
+        out.writeObject(colUnpivot);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        sto = (MatrixStorage)in.readObject();
+        rowPivot = (int[])in.readObject();
+        colPivot = (int[])in.readObject();
+        rowUnpivot = (int[])in.readObject();
+        colUnpivot = (int[])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return sto.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return sto.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return sto.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return sto.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + sto.hashCode();
+        res = res * 37 + Arrays.hashCode(rowPivot);
+        res = res * 37 + Arrays.hashCode(rowUnpivot);
+        res = res * 37 + Arrays.hashCode(colPivot);
+        res = res * 37 + Arrays.hashCode(colUnpivot);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        PivotedMatrixStorage that = (PivotedMatrixStorage)obj;
+
+        return Arrays.equals(rowPivot, that.rowPivot) && Arrays.equals(rowUnpivot, that.rowUnpivot)
+            && Arrays.equals(colPivot, that.colPivot) && Arrays.equals(colUnpivot, that.colUnpivot)
+            && (sto != null ? sto.equals(that.sto) : that.sto == null);
+    }
+
+    /**
+     * @param n Pivot array length.
+     */
+    private static int[] identityPivot(int n) {
+        int[] pivot = new int[n];
+
+        for (int i = 0; i < n; i++)
+            pivot[i] = i;
+
+        return pivot;
+    }
+
+    /**
+     * @param pivot Pivot array to be inverted.
+     */
+    private static int[] invert(int[] pivot) {
+        int[] x = new int[pivot.length];
+
+        for (int i = 0; i < pivot.length; i++)
+            x[pivot[i]] = i;
+
+        return x;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/RandomMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/RandomMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/RandomMatrixStorage.java
new file mode 100644
index 0000000..8283201
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/RandomMatrixStorage.java
@@ -0,0 +1,176 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.nio.ByteBuffer;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.MurmurHash;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * {@link MatrixStorage} implementation with random values in the matrix elements.
+ */
+public class RandomMatrixStorage implements MatrixStorage {
+    /** */
+    private static final int PRIME1 = 104047;
+    /** */
+    private static final int PRIME2 = 101377;
+    /** */
+    private static final int PRIME3 = 64661;
+    /** */
+    private static final long SCALE = 1L << 32;
+
+    /** Random generation seed. */
+    private int seed;
+
+    /** Amount of rows in the matrix. */
+    private int rows;
+    /** Amount of columns in the matrix. */
+    private int cols;
+
+    /** Whether fast hash is used, in {@link #get(int, int)}. */
+    private boolean fastHash;
+
+    /**
+     * For externalization.
+     */
+    public RandomMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param fastHash Whether fast hash is used.
+     */
+    public RandomMatrixStorage(int rows, int cols, boolean fastHash) {
+        assert rows > 0;
+        assert cols > 0;
+
+        this.rows = rows;
+        this.cols = cols;
+        this.fastHash = fastHash;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        if (!fastHash) {
+            ByteBuffer buf = ByteBuffer.allocate(8);
+
+            buf.putInt(x);
+            buf.putInt(y);
+            buf.flip();
+
+            return (MurmurHash.hash64A(buf, seed) & (SCALE - 1)) / (double)SCALE;
+        }
+        else
+            // This isn't a fantastic random number generator, but it is just fine for random projections.
+            return ((((x * PRIME1) + y * PRIME2 + x * y * PRIME3) & 8) * 0.25) - 1;
+    }
+
+    /**
+     *
+     */
+    public boolean isFastHash() {
+        return fastHash;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        throw new UnsupportedOperationException("Random matrix storage is a read-only storage.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+        out.writeInt(seed);
+        out.writeBoolean(fastHash);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+        seed = in.readInt();
+        fastHash = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + Boolean.hashCode(fastHash);
+        res = res * 37 + seed;
+        res = res * 37 + cols;
+        res = res * 37 + rows;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        RandomMatrixStorage that = (RandomMatrixStorage)o;
+
+        return rows == that.rows && cols == that.cols && seed == that.seed && fastHash == that.fastHash;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
new file mode 100644
index 0000000..936f893
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
@@ -0,0 +1,283 @@
+// @java.file.header
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.math.impls.storage.matrix;
+
+import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap;
+import it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.impls.CacheUtils;
+
+/**
+ * {@link MatrixStorage} implementation for {@link org.apache.ignite.math.impls.matrix.SparseDistributedMatrix}.
+ */
+public class SparseDistributedMatrixStorage extends CacheUtils implements MatrixStorage, StorageConstants {
+    /** Amount of rows in the matrix. */
+    private int rows;
+    /** Amount of columns in the matrix. */
+    private int cols;
+
+    /** Row or column based storage mode. */
+    private int stoMode;
+    /** Random or sequential access mode. */
+    private int acsMode;
+
+    /** Actual distributed storage. */
+    private IgniteCache<
+        Integer /* Row or column index. */,
+        Map<Integer, Double> /* Map-based row or column. */
+        > cache = null;
+
+    /**
+     *
+     */
+    public SparseDistributedMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param stoMode Row or column based storage mode.
+     * @param acsMode Random or sequential access mode.
+     */
+    public SparseDistributedMatrixStorage(int rows, int cols, int stoMode, int acsMode) {
+        assert rows > 0;
+        assert cols > 0;
+        assertAccessMode(acsMode);
+        assertStorageMode(stoMode);
+
+        this.rows = rows;
+        this.cols = cols;
+        this.stoMode = stoMode;
+        this.acsMode = acsMode;
+
+        cache = newCache();
+    }
+
+    /**
+     *
+     *
+     */
+    private IgniteCache<Integer, Map<Integer, Double>> newCache() {
+        CacheConfiguration<Integer, Map<Integer, Double>> cfg = new CacheConfiguration<>();
+
+        // Assume 10% density.
+        cfg.setStartSize(Math.max(1024, (rows * cols) / 10));
+
+        // Write to primary.
+        cfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.PRIMARY);
+        cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
+
+        // Atomic transactions only.
+        cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+
+        // No eviction.
+        cfg.setEvictionPolicy(null);
+
+        // No copying of values.
+        cfg.setCopyOnRead(false);
+
+        // Cache is partitioned.
+        cfg.setCacheMode(CacheMode.PARTITIONED);
+
+        // Random cache name.
+        cfg.setName(new IgniteUuid().shortString());
+
+        return Ignition.localIgnite().getOrCreateCache(cfg);
+    }
+
+    /**
+     *
+     *
+     */
+    public IgniteCache<Integer, Map<Integer, Double>> cache() {
+        return cache;
+    }
+
+    /**
+     *
+     *
+     */
+    public int accessMode() {
+        return acsMode;
+    }
+
+    /**
+     *
+     *
+     */
+    public int storageMode() {
+        return stoMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        if (stoMode == ROW_STORAGE_MODE)
+            return matrixGet(cache.getName(), x, y);
+        else
+            return matrixGet(cache.getName(), y, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        if (stoMode == ROW_STORAGE_MODE)
+            matrixSet(cache.getName(), x, y, v);
+        else
+            matrixSet(cache.getName(), y, x, v);
+    }
+
+    /**
+     * Distributed matrix get.
+     *
+     * @param cacheName Matrix's cache.
+     * @param a Row or column index.
+     * @param b Row or column index.
+     * @return Matrix value at (a, b) index.
+     */
+    private double matrixGet(String cacheName, int a, int b) {
+        // Remote get from the primary node (where given row or column is stored locally).
+        return ignite().compute(groupForKey(cacheName, a)).call(() -> {
+            IgniteCache<Integer, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(cacheName);
+
+            // Local get.
+            Map<Integer, Double> map = cache.localPeek(a, CachePeekMode.PRIMARY);
+
+            return (map == null || !map.containsKey(b)) ? 0.0 : map.get(b);
+        });
+    }
+
+    /**
+     * Distributed matrix set.
+     *
+     * @param cacheName Matrix's cache.
+     * @param a Row or column index.
+     * @param b Row or column index.
+     * @param v New value to set.
+     */
+    private void matrixSet(String cacheName, int a, int b, double v) {
+        // Remote set on the primary node (where given row or column is stored locally).
+        ignite().compute(groupForKey(cacheName, a)).run(() -> {
+            IgniteCache<Integer, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(cacheName);
+
+            // Local get.
+            Map<Integer, Double> map = cache.localPeek(a, CachePeekMode.PRIMARY);
+
+            if (map == null)
+                map = acsMode == SEQUENTIAL_ACCESS_MODE ? new Int2DoubleRBTreeMap() : new Int2DoubleOpenHashMap();
+
+            if (v != 0.0)
+                map.put(b, v);
+            else if (map.containsKey(b))
+                map.remove(b);
+
+            // Local put.
+            cache.put(a, map);
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+        out.writeInt(acsMode);
+        out.writeInt(stoMode);
+        out.writeUTF(cache.getName());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+        acsMode = in.readInt();
+        stoMode = in.readInt();
+        cache = ignite().getOrCreateCache(in.readUTF());
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return acsMode == SEQUENTIAL_ACCESS_MODE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return acsMode == RANDOM_ACCESS_MODE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** Destroy underlying cache. */
+    @Override public void destroy() {
+        cache.destroy();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + cols;
+        res = res * 37 + rows;
+        res = res * 37 + acsMode;
+        res = res * 37 + stoMode;
+        res = res * 37 + cache.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        SparseDistributedMatrixStorage that = (SparseDistributedMatrixStorage)obj;
+
+        return rows == that.rows && cols == that.cols && acsMode == that.acsMode && stoMode == that.stoMode
+            && (cache != null ? cache.equals(that.cache) : that.cache == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
new file mode 100644
index 0000000..e72da70
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
@@ -0,0 +1,226 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap;
+import it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.StorageConstants;
+
+/**
+ * Storage for sparse, local, on-heap matrix.
+ */
+public class SparseLocalOnHeapMatrixStorage implements MatrixStorage, StorageConstants {
+    /** Default zero value. */
+    private static final double DEFAULT_VALUE = 0.0;
+
+    /** */ private int rows;
+    /** */ private int cols;
+
+    /** */ private int acsMode;
+    /** */ private int stoMode;
+
+    /** Actual map storage. */
+    private Map<Integer, Map<Integer, Double>> sto;
+
+    /** */
+    public SparseLocalOnHeapMatrixStorage() {
+        // No-op.
+    }
+
+    /** */
+    public SparseLocalOnHeapMatrixStorage(int rows, int cols, int acsMode, int stoMode) {
+        assert rows > 0;
+        assert cols > 0;
+        assertAccessMode(acsMode);
+        assertStorageMode(stoMode);
+
+        this.rows = rows;
+        this.cols = cols;
+        this.acsMode = acsMode;
+        this.stoMode = stoMode;
+
+        sto = new HashMap<>();
+    }
+
+    /**
+     *
+     *
+     */
+    public int getStorageMode() {
+        return stoMode;
+    }
+
+    /**
+     *
+     *
+     */
+    public int getAccessMode() {
+        return acsMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        if (stoMode == ROW_STORAGE_MODE) {
+            Map<Integer, Double> row = sto.get(x);
+
+            if (row != null) {
+                Double val = row.get(y);
+
+                if (val != null)
+                    return val;
+            }
+
+            return DEFAULT_VALUE;
+        }
+        else {
+            Map<Integer, Double> col = sto.get(y);
+
+            if (col != null) {
+                Double val = col.get(x);
+
+                if (val != null)
+                    return val;
+            }
+
+            return DEFAULT_VALUE;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        // Ignore default values (currently 0.0).
+        if (v != DEFAULT_VALUE) {
+            if (stoMode == ROW_STORAGE_MODE) {
+                Map<Integer, Double> row = sto.computeIfAbsent(x, k ->
+                    acsMode == SEQUENTIAL_ACCESS_MODE ? new Int2DoubleRBTreeMap() : new Int2DoubleOpenHashMap());
+
+                row.put(y, v);
+            }
+            else {
+                Map<Integer, Double> col = sto.computeIfAbsent(y, k ->
+                    acsMode == SEQUENTIAL_ACCESS_MODE ? new Int2DoubleRBTreeMap() : new Int2DoubleOpenHashMap());
+
+                col.put(x, v);
+            }
+        }
+        else {
+            if (stoMode == ROW_STORAGE_MODE) {
+                if (sto.containsKey(x)) {
+                    Map<Integer, Double> row = sto.get(x);
+
+                    if (row.containsKey(y))
+                        row.remove(y);
+                }
+
+            }
+            else {
+                if (sto.containsKey(y)) {
+                    Map<Integer, Double> col = sto.get(y);
+
+                    if (col.containsKey(x))
+                        col.remove(x);
+                }
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+        out.writeInt(acsMode);
+        out.writeInt(stoMode);
+        out.writeObject(sto);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked"})
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+        acsMode = in.readInt();
+        stoMode = in.readInt();
+        sto = (Map<Integer, Map<Integer, Double>>)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return acsMode == SEQUENTIAL_ACCESS_MODE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return acsMode == RANDOM_ACCESS_MODE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + rows;
+        res = res * 37 + cols;
+        res = res * 37 + sto.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        SparseLocalOnHeapMatrixStorage that = (SparseLocalOnHeapMatrixStorage)o;
+
+        return rows == that.rows && cols == that.cols && acsMode == that.acsMode && stoMode == that.stoMode
+            && (sto != null ? sto.equals(that.sto) : that.sto == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/package-info.java
new file mode 100644
index 0000000..aba47db
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains specific implementations for matrix storage models.
+ */
+package org.apache.ignite.math.impls.storage.matrix;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ArrayVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ArrayVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ArrayVectorStorage.java
new file mode 100644
index 0000000..ef59c62
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ArrayVectorStorage.java
@@ -0,0 +1,135 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * Array based {@link VectorStorage} implementation.
+ */
+public class ArrayVectorStorage implements VectorStorage {
+    /** Backing data array. */
+    private double[] data;
+
+    /**
+     * IMPL NOTE required by {@link Externalizable}.
+     */
+    public ArrayVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size Vector size.
+     */
+    public ArrayVectorStorage(int size) {
+        assert size > 0;
+
+        data = new double[size];
+    }
+
+    /**
+     * @param data Backing data array.
+     */
+    public ArrayVectorStorage(double[] data) {
+        assert data != null;
+
+        this.data = data;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return data == null ? 0 : data.length;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return data[i];
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        data[i] = v;
+    }
+
+    /** {@inheritDoc}} */
+    @Override public boolean isArrayBased() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[] data() {
+        return data;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(data);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        data = (double[])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + Arrays.hashCode(data);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        ArrayVectorStorage that = (ArrayVectorStorage)obj;
+
+        return Arrays.equals(data, (that.data));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/CacheVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/CacheVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/CacheVectorStorage.java
new file mode 100644
index 0000000..670deef
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/CacheVectorStorage.java
@@ -0,0 +1,175 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.math.ValueMapper;
+import org.apache.ignite.math.VectorKeyMapper;
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * Vector storage based on existing cache and index and value mapping functions.
+ */
+public class CacheVectorStorage<K, V> implements VectorStorage {
+    /** Storage size. */
+    private int size;
+    /** Key mapper. */
+    private VectorKeyMapper<K> keyMapper;
+    /** Value mapper. */
+    private ValueMapper<V> valMapper;
+    /** Underlying ignite cache. */
+    private IgniteCache<K, V> cache;
+
+    /**
+     *
+     */
+    public CacheVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size
+     * @param cache
+     * @param keyMapper
+     * @param valMapper
+     */
+    public CacheVectorStorage(int size, IgniteCache<K, V> cache, VectorKeyMapper<K> keyMapper,
+        ValueMapper<V> valMapper) {
+        assert size > 0;
+        assert cache != null;
+        assert keyMapper != null;
+        assert valMapper != null;
+
+        this.size = size;
+        this.cache = cache;
+        this.keyMapper = keyMapper;
+        this.valMapper = valMapper;
+    }
+
+    /**
+     *
+     *
+     */
+    public IgniteCache<K, V> cache() {
+        return cache;
+    }
+
+    /**
+     *
+     *
+     */
+    public VectorKeyMapper<K> keyMapper() {
+        return keyMapper;
+    }
+
+    /**
+     *
+     *
+     */
+    public ValueMapper<V> valueMapper() {
+        return valMapper;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return valMapper.toDouble(cache.get(keyMapper.apply(i)));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        cache.put(keyMapper.apply(i), valMapper.fromDouble(v));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(size);
+        out.writeObject(keyMapper);
+        out.writeObject(valMapper);
+        out.writeUTF(cache.getName());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        size = in.readInt();
+        keyMapper = (VectorKeyMapper<K>)in.readObject();
+        valMapper = (ValueMapper<V>)in.readObject();
+        cache = Ignition.localIgnite().getOrCreateCache(in.readUTF());
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + size();
+        res = res * 37 + keyMapper.hashCode();
+        res = res * 37 + valMapper.hashCode();
+        res = res * 37 + cache.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        CacheVectorStorage that = (CacheVectorStorage)obj;
+
+        return size == that.size
+            && (keyMapper != null ? keyMapper.getClass().equals(that.keyMapper.getClass()) : that.keyMapper == null)
+            && (valMapper != null ? valMapper.getClass().equals(that.valMapper.getClass()) : that.valMapper == null)
+            && (cache != null ? cache.equals(that.cache) : that.cache == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ConstantVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ConstantVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ConstantVectorStorage.java
new file mode 100644
index 0000000..ff5ab26
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/ConstantVectorStorage.java
@@ -0,0 +1,133 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+
+/**
+ * Constant read-only vector storage.
+ */
+public class ConstantVectorStorage implements VectorStorage {
+    /** */ private int size;
+    /** */ private double val;
+
+    /**
+     *
+     */
+    public ConstantVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size Vector size.
+     * @param val Value to set for vector elements.
+     */
+    public ConstantVectorStorage(int size, double val) {
+        assert size > 0;
+
+        this.size = size;
+        this.val = val;
+    }
+
+    /**
+     *
+     *
+     */
+    public double constant() {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        throw new UnsupportedOperationException("Can't set value into constant vector.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(size);
+        out.writeDouble(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        size = in.readInt();
+        val = in.readDouble();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + size;
+        res = res * 37 + Double.hashCode(val);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        ConstantVectorStorage that = (ConstantVectorStorage)o;
+
+        return size == that.size && val == that.val;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DelegateVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DelegateVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DelegateVectorStorage.java
new file mode 100644
index 0000000..aa6018c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DelegateVectorStorage.java
@@ -0,0 +1,157 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * {@link VectorStorage} implementation that delegates to parent matrix.
+ */
+public class DelegateVectorStorage implements VectorStorage {
+    /** Parent vector storage. */
+    private VectorStorage sto;
+
+    /** Offset in the parent vector. */
+    private int off;
+
+    /** Size of the vector. */
+    private int len;
+
+    /**
+     *
+     */
+    public DelegateVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param sto Vector storage to delegate to.
+     * @param off Offset in the parent vector.
+     * @param len Size of the vector.
+     */
+    public DelegateVectorStorage(VectorStorage sto, int off, int len) {
+        assert sto != null;
+        assert off >= 0;
+        assert len > 0;
+
+        this.sto = sto;
+        this.off = off;
+        this.len = len;
+    }
+
+    /** */
+    public VectorStorage delegate() {
+        return sto;
+    }
+
+    /** */
+    public int offset() {
+        return off;
+    }
+
+    /** */
+    public int length() {
+        return len;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return len;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return sto.get(off + i);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        sto.set(off + i, v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[] data() {
+        return sto.data();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return sto.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return sto.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return sto.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return sto.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return sto.isArrayBased();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(sto);
+        out.writeInt(off);
+        out.writeInt(len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        sto = (VectorStorage)in.readObject();
+        off = in.readInt();
+        len = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        DelegateVectorStorage that = (DelegateVectorStorage)o;
+
+        return len == that.len && off == that.off && (sto != null ? sto.equals(that.sto) : that.sto == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + off;
+        res = res * 37 + len;
+        res = res * 37 + sto.hashCode();
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
new file mode 100644
index 0000000..2e7cdc9
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
@@ -0,0 +1,172 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * Local, dense off-heap vector storage.
+ */
+public class DenseLocalOffHeapVectorStorage implements VectorStorage {
+    /** Vector size. */
+    private int size;
+
+    /** */
+    private transient long ptr;
+    //TODO: temp solution.
+    /** */
+    private int ptrInitHash;
+
+    /**
+     *
+     */
+    public DenseLocalOffHeapVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param size Vector size.
+     */
+    public DenseLocalOffHeapVectorStorage(int size) {
+        assert size > 0;
+
+        this.size = size;
+
+        allocateMemory(size);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return GridUnsafe.getDouble(pointerOffset(i));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        GridUnsafe.putDouble(pointerOffset(i), v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[] data() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(size);
+        out.writeInt(ptrInitHash);
+
+        for (int i = 0; i < size; i++)
+            out.writeDouble(get(i));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        size = in.readInt();
+
+        allocateMemory(size);
+
+        ptrInitHash = in.readInt();
+
+        for (int i = 0; i < size; i++)
+            set(i, in.readDouble());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        GridUnsafe.freeMemory(ptr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + size;
+        res = res * 37 + ptrInitHash;
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        DenseLocalOffHeapVectorStorage that = (DenseLocalOffHeapVectorStorage)o;
+
+        return size == that.size && isMemoryEquals(that);
+    }
+
+    /** */
+    private boolean isMemoryEquals(DenseLocalOffHeapVectorStorage otherStorage) {
+        return IntStream.range(0, size).parallel().noneMatch(idx -> Double.compare(get(idx), otherStorage.get(idx)) != 0);
+    }
+
+    /**
+     * Pointer offset for specific index.
+     *
+     * @param i Offset index.
+     */
+    private long pointerOffset(int i) {
+        return ptr + i * Double.BYTES;
+    }
+
+    /** */
+    private void allocateMemory(int size) {
+        ptr = GridUnsafe.allocateMemory(size * Double.BYTES);
+
+        ptrInitHash = Long.hashCode(ptr);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/FunctionVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/FunctionVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/FunctionVectorStorage.java
new file mode 100644
index 0000000..df8fa12
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/FunctionVectorStorage.java
@@ -0,0 +1,141 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.functions.IntDoubleToVoidFunction;
+
+/**
+ * Read-only or read-write function-based vector storage.
+ */
+public class FunctionVectorStorage implements VectorStorage {
+    /** */ private IgniteFunction<Integer, Double> getFunc;
+    /** */ private IntDoubleToVoidFunction setFunc;
+    /** */ private int size;
+
+    /**
+     *
+     */
+    public FunctionVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * Creates read-only or read-write storage.
+     *
+     * @param size Cardinality of this vector storage.
+     * @param getFunc Get function.
+     * @param setFunc Optional set function ({@code null} for read-only storage).
+     */
+    public FunctionVectorStorage(int size, IgniteFunction<Integer, Double> getFunc, IntDoubleToVoidFunction setFunc) {
+        assert size > 0;
+        assert getFunc != null; // At least get function is required.
+
+        this.size = size;
+        this.getFunc = getFunc;
+        this.setFunc = setFunc;
+    }
+
+    /**
+     *
+     *
+     */
+    public IgniteFunction<Integer, Double> getFunction() {
+        return getFunc;
+    }
+
+    /**
+     *
+     *
+     */
+    public IntDoubleToVoidFunction setFunction() {
+        return setFunc;
+    }
+
+    /**
+     * Creates read-only storage.
+     *
+     * @param size Cardinality of this vector storage.
+     * @param getFunc Get function.
+     */
+    public FunctionVectorStorage(int size, IgniteFunction<Integer, Double> getFunc) {
+        this(size, getFunc, null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return getFunc.apply(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        if (setFunc != null)
+            setFunc.accept(i, v);
+        else
+            throw new UnsupportedOperationException("Cannot set into read-only vector.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(setFunc);
+        out.writeObject(getFunc);
+        out.writeInt(size);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        setFunc = (IntDoubleToVoidFunction)in.readObject();
+        getFunc = (IgniteFunction<Integer, Double>)in.readObject();
+        size = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/MatrixVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/MatrixVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/MatrixVectorStorage.java
new file mode 100644
index 0000000..ece0003
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/MatrixVectorStorage.java
@@ -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.
+ */
+
+package org.apache.ignite.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.IndexException;
+
+/**
+ * Row, column or diagonal vector-based view of the matrix
+ */
+public class MatrixVectorStorage implements VectorStorage {
+    /** */ private Matrix parent;
+
+    /** */ private int row;
+    /** */ private int col;
+
+    /** */ private int rowStride;
+    /** */  private int colStride;
+
+    /** */ private int size;
+
+    /**
+     *
+     */
+    public MatrixVectorStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param parent
+     * @param row
+     * @param col
+     * @param rowStride
+     * @param colStride
+     */
+    public MatrixVectorStorage(Matrix parent, int row, int col, int rowStride, int colStride) {
+        assert parent != null;
+        assert rowStride >= 0;
+        assert colStride >= 0;
+        assert rowStride > 0 || colStride > 0;
+
+        if (row < 0 || row >= parent.rowSize())
+            throw new IndexException(row);
+        if (col < 0 || col >= parent.columnSize())
+            throw new IndexException(col);
+
+        this.parent = parent;
+
+        this.row = row;
+        this.col = col;
+
+        this.rowStride = rowStride;
+        this.colStride = colStride;
+
+        this.size = getSize();
+    }
+
+    /**
+     *
+     *
+     */
+    int row() {
+        return row;
+    }
+
+    /**
+     *
+     *
+     */
+    int column() {
+        return col;
+    }
+
+    /**
+     *
+     *
+     */
+    int rowStride() {
+        return rowStride;
+    }
+
+    /**
+     *
+     *
+     */
+    int columnStride() {
+        return colStride;
+    }
+
+    /**
+     *
+     *
+     */
+    private int getSize() {
+        if (rowStride != 0 && colStride != 0) {
+            int n1 = (parent.rowSize() - row) / rowStride;
+            int n2 = (parent.columnSize() - col) / colStride;
+
+            return Math.min(n1, n2);
+        }
+        else if (rowStride > 0)
+            return (parent.rowSize() - row) / rowStride;
+        else
+            return (parent.columnSize() - col) / colStride;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return size;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return parent.get(row + i * rowStride, col + i * colStride);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        parent.set(row + i * rowStride, col + i * colStride, v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return parent.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return parent.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return parent.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return parent.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(parent);
+        out.writeInt(row);
+        out.writeInt(col);
+        out.writeInt(rowStride);
+        out.writeInt(colStride);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        parent = (Matrix)in.readObject();
+        row = in.readInt();
+        col = in.readInt();
+        rowStride = in.readInt();
+        colStride = in.readInt();
+
+        size = getSize();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/PivotedVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/PivotedVectorStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/PivotedVectorStorage.java
new file mode 100644
index 0000000..f69e959
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/vector/PivotedVectorStorage.java
@@ -0,0 +1,175 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import org.apache.ignite.math.VectorStorage;
+
+/**
+ * Pivoted (index mapped) view over another vector storage implementation.
+ */
+public class PivotedVectorStorage implements VectorStorage {
+    /** */ private VectorStorage sto;
+
+    /** */ private int[] pivot;
+    /** */ private int[] unpivot;
+
+    /**
+     * @param pivot Pivot array.
+     */
+    private static int[] reverse(int[] pivot) {
+        int[] res = new int[pivot.length];
+
+        for (int i = 0; i < pivot.length; i++)
+            res[pivot[i]] = i;
+
+        return res;
+    }
+
+    /**
+     *
+     *
+     */
+    public int[] pivot() {
+        return pivot;
+    }
+
+    /**
+     *
+     *
+     */
+    public int[] unpivot() {
+        return unpivot;
+    }
+
+    /**
+     * @param sto Backing vector storage.
+     * @param pivot Mapping from external index to internal.
+     * @param unpivot Mapping from internal index to external.
+     */
+    public PivotedVectorStorage(VectorStorage sto, int[] pivot, int[] unpivot) {
+        assert sto != null;
+        assert pivot != null;
+        assert unpivot != null;
+
+        this.sto = sto;
+        this.pivot = pivot;
+        this.unpivot = unpivot;
+    }
+
+    /**
+     * @param sto Backing vector storage.
+     * @param pivot Mapping from external index to internal.
+     */
+    public PivotedVectorStorage(VectorStorage sto, int[] pivot) {
+        this(sto, pivot, reverse(pivot));
+    }
+
+    /**
+     *
+     */
+    public PivotedVectorStorage() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return sto.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int i) {
+        return sto.get(pivot[i]);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int i, double v) {
+        sto.set(pivot[i], v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(sto);
+        out.writeObject(pivot);
+        out.writeObject(unpivot);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        sto = (VectorStorage)in.readObject();
+        pivot = (int[])in.readObject();
+        unpivot = (int[])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return sto.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return sto.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return sto.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return sto.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return sto.isArrayBased();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[] data() {
+        return isArrayBased() ? sto.data() : null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        PivotedVectorStorage that = (PivotedVectorStorage)o;
+
+        return (sto != null ? sto.equals(that.sto) : that.sto == null) && Arrays.equals(pivot, that.pivot)
+            && Arrays.equals(unpivot, that.unpivot);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = sto != null ? sto.hashCode() : 0;
+
+        res = 31 * res + Arrays.hashCode(pivot);
+        res = 31 * res + Arrays.hashCode(unpivot);
+
+        return res;
+    }
+}


[35/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicSelfTest.java
new file mode 100644
index 0000000..3cab9e0
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicSelfTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.internal.processors.cache.query.continuous;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+
+/**
+ *
+ */
+public class CacheContinuousQueryAsyncFailoverAtomicSelfTest
+    extends CacheContinuousQueryFailoverAbstractSelfTest {
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean asyncCallback() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
index 22b8653..1345dfe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
@@ -55,7 +55,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -775,7 +774,6 @@ public class CacheContinuousQueryAsyncFilterListenerTest extends GridCommonAbstr
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
index bcc58c0..c713bb5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
@@ -48,7 +48,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -88,7 +87,6 @@ public class CacheContinuousQueryExecuteInPrimaryTest extends GridCommonAbstract
         ccfg.setAtomicityMode(cacheAtomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         return ccfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index 36c777b..6b1a498 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -53,7 +53,6 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
 import org.apache.ignite.cache.CacheEntryProcessor;
@@ -106,7 +105,6 @@ import org.apache.ignite.transactions.Transaction;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.MINUTES;
 import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
@@ -155,7 +153,6 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         ccfg.setCacheMode(cacheMode());
         ccfg.setAtomicityMode(atomicityMode());
-        ccfg.setAtomicWriteOrderMode(writeOrderMode());
         ccfg.setBackups(backups);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setNearConfiguration(nearCacheConfiguration());
@@ -211,13 +208,6 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
     protected abstract CacheAtomicityMode atomicityMode();
 
     /**
-     * @return Write order mode for atomic cache.
-     */
-    protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-
-    /**
      * @throws Exception If failed.
      */
     public void testFirstFilteredEvent() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicNearEnabledSelfSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicNearEnabledSelfSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicNearEnabledSelfSelfTest.java
index b3c18a9..4dd7c05 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicNearEnabledSelfSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicNearEnabledSelfSelfTest.java
@@ -17,29 +17,22 @@
 
 package org.apache.ignite.internal.processors.cache.query.continuous;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
 /**
  *
  */
 public class CacheContinuousQueryFailoverAtomicNearEnabledSelfSelfTest
-    extends CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest {
+    extends CacheContinuousQueryFailoverAtomicSelfTest {
     /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return PARTITIONED;
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearCacheConfiguration() {
         return super.nearCacheConfiguration();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicOffheapTieredTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicOffheapTieredTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicOffheapTieredTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest.java
deleted file mode 100644
index e33db45..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest.java
+++ /dev/null
@@ -1,44 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.query.continuous;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest extends CacheContinuousQueryFailoverAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicReplicatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicReplicatedSelfTest.java
index 84c9131..4d9b701 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicReplicatedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicReplicatedSelfTest.java
@@ -17,24 +17,17 @@
 
 package org.apache.ignite.internal.processors.cache.query.continuous;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheMode;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 
 /**
  *
  */
 public class CacheContinuousQueryFailoverAtomicReplicatedSelfTest
-    extends CacheContinuousQueryFailoverAtomicPrimaryWriteOrderSelfTest {
+    extends CacheContinuousQueryFailoverAtomicSelfTest {
     /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicSelfTest.java
new file mode 100644
index 0000000..a7c7cc7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.internal.processors.cache.query.continuous;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+
+/**
+ *
+ */
+public class CacheContinuousQueryFailoverAtomicSelfTest extends CacheContinuousQueryFailoverAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
index cd7b7bc..beb8882 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
@@ -61,7 +61,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -526,7 +525,6 @@ public class CacheContinuousQueryOperationFromCallbackTest extends GridCommonAbs
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(writeMode);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
index 4fa0424..0d88ef1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
@@ -40,7 +40,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -280,7 +279,6 @@ public class CacheContinuousQueryOperationP2PTest extends GridCommonAbstractTest
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
index 9f5cfd5..dba995e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
@@ -60,7 +60,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -523,7 +522,6 @@ public class CacheContinuousQueryOrderingEventTest extends GridCommonAbstractTes
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(writeMode);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
index 6d8b4e4..66454fa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
@@ -76,7 +76,6 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static javax.cache.event.EventType.CREATED;
 import static javax.cache.event.EventType.REMOVED;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -1404,7 +1403,6 @@ public class CacheContinuousQueryRandomOperationsTest extends GridCommonAbstract
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
index 46df90d..95cd3fd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
@@ -38,7 +38,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.config.GridTestProperties;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -284,7 +283,6 @@ public class CacheKeepBinaryIterationTest extends GridCommonAbstractTest {
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAtomicTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAtomicTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAtomicTest.java
index 4eb2f2b..1bcaba0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAtomicTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAtomicTest.java
@@ -17,10 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache.store;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -31,9 +29,4 @@ public class IgnteCacheClientWriteBehindStoreAtomicTest extends IgnteCacheClient
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/DepthFirstSearchTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/DepthFirstSearchTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/DepthFirstSearchTest.java
index b0a407c..3d1064c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/DepthFirstSearchTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/DepthFirstSearchTest.java
@@ -38,22 +38,22 @@ import static org.apache.ignite.internal.processors.cache.transactions.TxDeadloc
  */
 public class DepthFirstSearchTest extends TestCase {
     /** Tx 1. */
-    private static final GridCacheVersion T1 = new GridCacheVersion(1, 0, 0, 0);
+    private static final GridCacheVersion T1 = new GridCacheVersion(1, 0, 0);
 
     /** Tx 2. */
-    private static final GridCacheVersion T2 = new GridCacheVersion(2, 0, 0, 0);
+    private static final GridCacheVersion T2 = new GridCacheVersion(2, 0, 0);
 
     /** Tx 3. */
-    private static final GridCacheVersion T3 = new GridCacheVersion(3, 0, 0, 0);
+    private static final GridCacheVersion T3 = new GridCacheVersion(3, 0, 0);
 
     /** Tx 4. */
-    private static final GridCacheVersion T4 = new GridCacheVersion(4, 0, 0, 0);
+    private static final GridCacheVersion T4 = new GridCacheVersion(4, 0, 0);
 
     /** Tx 5. */
-    private static final GridCacheVersion T5 = new GridCacheVersion(5, 0, 0, 0);
+    private static final GridCacheVersion T5 = new GridCacheVersion(5, 0, 0);
 
     /** Tx 6. */
-    private static final GridCacheVersion T6 = new GridCacheVersion(6, 0, 0, 0);
+    private static final GridCacheVersion T6 = new GridCacheVersion(6, 0, 0);
 
     /** All transactions. */
     private static final List<GridCacheVersion> ALL = Arrays.asList(T1, T2, T3, T4, T5, T6);
@@ -291,19 +291,19 @@ public class DepthFirstSearchTest extends TestCase {
                             int n = rnd.nextInt(nodesCnt);
 
                             if (n != j) {
-                                waitForNodes.add(new GridCacheVersion(n, 0, 0, 0));
+                                waitForNodes.add(new GridCacheVersion(n, 0, 0));
                                 k++;
                             }
                         }
                     }
 
-                    wfg.put(new GridCacheVersion(j, 0, 0, 0), waitForNodes);
+                    wfg.put(new GridCacheVersion(j, 0, 0), waitForNodes);
                 }
             }
 
             for (int j = 0; j < nodesCnt; j++) {
                 try {
-                    List<GridCacheVersion> cycle = findCycle(wfg, new GridCacheVersion(j, 0, 0, 0));
+                    List<GridCacheVersion> cycle = findCycle(wfg, new GridCacheVersion(j, 0, 0));
 
                     if (cycle == null)
                         cyclesNotFound++;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 38297a4..b58d831 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -142,7 +142,6 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
             });
 
         assert ver1.version().compareTo(ver2.version()) < 0;
-        assert ver1.updateTime() <= ver2.updateTime();
     }
 
     /**
@@ -152,7 +151,6 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
         assertNotNull(entry);
 
         assertNotNull(entry.version());
-        assert entry.updateTime() > 0;
 
         assertNotNull(entry.getKey());
         assertNotNull(entry.getValue());

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java
index 2d00d21..e69de29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java
@@ -1,224 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.util.NavigableMap;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.GridKernalContextImpl;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.util.typedef.PA;
-import org.apache.ignite.lifecycle.LifecycleBean;
-import org.apache.ignite.lifecycle.LifecycleEventType;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Time sync processor self test.
- */
-public class GridTimeSyncProcessorSelfTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Number of grids in test. */
-    public static final int GRID_CNT = 4;
-
-    /** Starting grid index. */
-    private int idx;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setLifecycleBeans(new TimeShiftLifecycleBean(idx * 2000));
-
-        idx++;
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTimeSync() throws Exception {
-        startGrids(GRID_CNT);
-
-        try {
-            // Check coordinator time deltas.
-            final IgniteKernal kernal = (IgniteKernal)grid(0);
-
-            // Wait for latest time sync history.
-            GridTestUtils.waitForCondition(new PA() {
-                @Override public boolean apply() {
-                    NavigableMap<GridClockDeltaVersion, GridClockDeltaSnapshot> hist = kernal.context().clockSync()
-                        .timeSyncHistory();
-
-                    info("Checking time sync history: " + hist);
-
-                    for (GridClockDeltaVersion ver : hist.keySet()) {
-                        if (ver.topologyVersion() == 4)
-                            return true;
-                    }
-
-                    return false;
-                }
-            }, 10000);
-
-            NavigableMap<GridClockDeltaVersion, GridClockDeltaSnapshot> history = kernal.context().clockSync()
-                .timeSyncHistory();
-
-            GridClockDeltaSnapshot snap = history.lastEntry().getValue();
-
-            assertEquals(3, snap.deltas().size());
-
-            for (int i = 1; i < GRID_CNT; i++) {
-                Long delta = snap.deltas().get(grid(i).localNode().id());
-
-                // Give 300ms range for test?
-                int idealDelta = - i * 2000;
-
-                int threshold = 100;
-
-                assertTrue("Invalid time delta for node [expected=" + idealDelta + ", " +
-                    "actual=" + delta + ", threshold=" + threshold,
-                    delta <= idealDelta + threshold && delta >= idealDelta - threshold);
-            }
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTimeSyncChangeCoordinator() throws Exception {
-        startGrids(GRID_CNT);
-
-        try {
-            for (int i = 0; i < GRID_CNT; i++) {
-                // Not coordinator now.
-                stopGrid(i);
-
-                startGrid(i);
-            }
-
-            // Check coordinator time deltas.
-            final IgniteKernal kernal = (IgniteKernal)grid(0);
-
-            assertEquals(6, kernal.localNode().order());
-
-            // Wait for latest time sync history.
-            GridTestUtils.waitForCondition(new PA() {
-                @Override public boolean apply() {
-                    NavigableMap<GridClockDeltaVersion, GridClockDeltaSnapshot> hist = kernal.context().clockSync()
-                        .timeSyncHistory();
-
-                    info("Checking time sync history: " + hist);
-
-                    for (GridClockDeltaVersion ver : hist.keySet()) {
-                        if (ver.topologyVersion() == 12)
-                            return true;
-                    }
-
-                    return false;
-                }
-            }, 10000);
-
-            NavigableMap<GridClockDeltaVersion, GridClockDeltaSnapshot> history = kernal.context().clockSync()
-                .timeSyncHistory();
-
-            GridClockDeltaSnapshot snap = history.lastEntry().getValue();
-
-            assertEquals(3, snap.deltas().size());
-
-            for (int i = 1; i < GRID_CNT; i++) {
-                Long delta = snap.deltas().get(grid(i).localNode().id());
-
-                // Give 300ms range for test?
-                int idealDelta = - i * 2000;
-
-                int threshold = 100;
-
-                assertTrue("Invalid time delta for node [expected=" + idealDelta + ", " +
-                    "actual=" + delta + ", threshold=" + threshold,
-                    delta <= idealDelta + threshold && delta >= idealDelta - threshold);
-            }
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * Time bean that sets shifted time source to context.
-     */
-    private static class TimeShiftLifecycleBean implements LifecycleBean {
-        /** Injected grid. */
-        @IgniteInstanceResource
-        private Ignite g;
-
-        /** Time delta. */
-        private int delta;
-
-        /**
-         * Constructs lifecycle bean.
-         *
-         * @param delta Time delta.
-         */
-        private TimeShiftLifecycleBean(int delta) {
-            this.delta = delta;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onLifecycleEvent(LifecycleEventType evt) {
-            if (evt == LifecycleEventType.BEFORE_NODE_START)
-                ((GridKernalContextImpl)((IgniteKernal)g).context()).timeSource(new TimeShiftClockSource(delta));
-        }
-    }
-
-    /**
-     * Time shift time source.
-     */
-    private static class TimeShiftClockSource implements GridClockSource {
-        /** Time shift delta. */
-        private int delta;
-
-        /**
-         * @param delta Time shift delta.
-         */
-        private TimeShiftClockSource(int delta) {
-            this.delta = delta;
-        }
-
-        /** {@inheritDoc} */
-        @Override public long currentTimeMillis() {
-            return System.currentTimeMillis() + delta;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
index d5011a8..a3bce8b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java
@@ -366,7 +366,7 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest {
         private TestDataRow(int keySize, int valSize) {
             key = new TestCacheObject(keySize);
             val = new TestCacheObject(valSize);
-            ver = new GridCacheVersion(keySize, valSize, 0L, 1);
+            ver = new GridCacheVersion(keySize, valSize, 1);
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
index 82db51e..a5a7155 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
@@ -22,7 +22,6 @@ import java.util.List;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -31,8 +30,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
 /**
@@ -118,9 +115,6 @@ public class DataStreamerUpdateAfterLoadTest extends GridCommonAbstractTest {
 
                 IgniteCache<Integer, Integer> cache = updateIgnite.cache(cacheName);
 
-                if (allowOverwrite)
-                    atomicClockModeDelay(cache);
-
                 updateIgnite.cache(cacheName).put(key, key + 1);
 
                 checkValue(key, key + 1, cacheName);
@@ -151,24 +145,21 @@ public class DataStreamerUpdateAfterLoadTest extends GridCommonAbstractTest {
     private List<CacheConfiguration<Integer, Integer>> cacheConfigurations() {
         List<CacheConfiguration<Integer, Integer>> ccfgs = new ArrayList<>();
 
-        ccfgs.add(cacheConfiguration(CacheAtomicityMode.ATOMIC, PRIMARY, 1, "cache-" + ccfgs.size()));
-        ccfgs.add(cacheConfiguration(CacheAtomicityMode.ATOMIC, PRIMARY, 0, "cache-" + ccfgs.size()));
-        ccfgs.add(cacheConfiguration(CacheAtomicityMode.ATOMIC, CLOCK, 1, "cache-" + ccfgs.size()));
-        ccfgs.add(cacheConfiguration(CacheAtomicityMode.TRANSACTIONAL, null, 1, "cache-" + ccfgs.size()));
-        ccfgs.add(cacheConfiguration(CacheAtomicityMode.TRANSACTIONAL, null, 0, "cache-" + ccfgs.size()));
+        ccfgs.add(cacheConfiguration(CacheAtomicityMode.ATOMIC, 1, "cache-" + ccfgs.size()));
+        ccfgs.add(cacheConfiguration(CacheAtomicityMode.ATOMIC, 0, "cache-" + ccfgs.size()));
+        ccfgs.add(cacheConfiguration(CacheAtomicityMode.TRANSACTIONAL, 1, "cache-" + ccfgs.size()));
+        ccfgs.add(cacheConfiguration(CacheAtomicityMode.TRANSACTIONAL, 0, "cache-" + ccfgs.size()));
 
         return ccfgs;
     }
 
     /**
      * @param atomicityMode Cache atomicity mode.
-     * @param writeOrderMode Cache write order mode.
      * @param backups Number of backups.
      * @param name Cache name.
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode,
-        CacheAtomicWriteOrderMode writeOrderMode,
         int backups,
         String name) {
         CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
@@ -176,7 +167,6 @@ public class DataStreamerUpdateAfterLoadTest extends GridCommonAbstractTest {
         ccfg.setName(name);
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setBackups(backups);
-        ccfg.setAtomicWriteOrderMode(writeOrderMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
index 7858390..189d7a4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
@@ -37,7 +37,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -87,8 +86,7 @@ public class ServicePredicateAccessCacheTest extends GridCommonAbstractTest {
             .setName("testCache")
             .setAtomicityMode(ATOMIC)
             .setCacheMode(REPLICATED)
-            .setWriteSynchronizationMode(FULL_SYNC)
-            .setAtomicWriteOrderMode(PRIMARY));
+            .setWriteSynchronizationMode(FULL_SYNC));
 
         latch = new CountDownLatch(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
index 2b49d53..ddebd40 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
@@ -65,7 +65,6 @@ public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setClockSyncFrequency(300000);
         cfg.setFailureDetectionTimeout(1000);
 
         TestCommunicationSpi spi = new TestCommunicationSpi();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
index 4fe67c1..0015701 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
@@ -70,7 +70,6 @@ public class TcpCommunicationSpiFaultyClientTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setClockSyncFrequency(300000);
         cfg.setFailureDetectionTimeout(1000);
         cfg.setClientMode(clientMode);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java b/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
index 1d08c48..c787d19 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
@@ -26,7 +26,6 @@ import javax.cache.event.CacheEntryCreatedListener;
 import javax.cache.event.CacheEntryEventFilter;
 import javax.cache.event.CacheEntryListener;
 import javax.cache.event.CacheEntryListenerException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheInterceptorAdapter;
 import org.apache.ignite.cache.CacheMode;
@@ -98,7 +97,6 @@ public class ConfigVariations {
         Parameters.objectParameters("setLoadPreviousValue", true),
         asArray(SIMPLE_CACHE_STORE_PARAM),
         Parameters.objectParameters("setWriteSynchronizationMode", CacheWriteSynchronizationMode.FULL_SYNC),
-        Parameters.objectParameters("setAtomicWriteOrderMode", CacheAtomicWriteOrderMode.PRIMARY),
         Parameters.objectParameters("setStartSize", 1024),
         Parameters.booleanParameters("setOnheapCacheEnabled")
     };
@@ -126,7 +124,6 @@ public class ConfigVariations {
         ),
         // Set default parameters.
         Parameters.objectParameters("setWriteSynchronizationMode", CacheWriteSynchronizationMode.FULL_SYNC),
-        Parameters.objectParameters("setAtomicWriteOrderMode", CacheAtomicWriteOrderMode.PRIMARY),
         Parameters.objectParameters("setStartSize", 1024),
         Parameters.booleanParameters("setOnheapCacheEnabled")
     };

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 0ffad0e..af623da 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -110,7 +110,6 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.FileSystemXmlApplicationContext;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.testframework.config.GridTestProperties.BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER;
@@ -1521,7 +1520,6 @@ public abstract class GridAbstractTest extends TestCase {
         CacheConfiguration cfg = new CacheConfiguration();
 
         cfg.setStartSize(1024);
-        cfg.setAtomicWriteOrderMode(PRIMARY);
         cfg.setAtomicityMode(TRANSACTIONAL);
         cfg.setNearConfiguration(new NearCacheConfiguration());
         cfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 9e46040..81f5caf 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -46,7 +46,6 @@ import org.apache.ignite.IgniteEvents;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteMessaging;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.affinity.Affinity;
@@ -1409,23 +1408,6 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
     }
 
     /**
-     * In ATOMIC cache with CLOCK mode if key is updated from different nodes at same time
-     * only one update wins others are ignored (can happen in test even when updates are executed from
-     * different nodes sequentially), this delay is used to avoid lost updates.
-     *
-     * @param cache Cache.
-     * @throws Exception If failed.
-     */
-    protected void atomicClockModeDelay(IgniteCache cache) throws Exception {
-        CacheConfiguration ccfg = (CacheConfiguration)cache.getConfiguration(CacheConfiguration.class);
-
-        if (ccfg.getCacheMode() != LOCAL &&
-            ccfg.getAtomicityMode() == CacheAtomicityMode.ATOMIC &&
-            ccfg.getAtomicWriteOrderMode() == CacheAtomicWriteOrderMode.CLOCK)
-            U.sleep(50);
-    }
-
-    /**
      * @param exp Expected.
      * @param act Actual.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index 3b42f16..046e6b5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -35,10 +35,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.Atomic
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicClientInvalidPartitionHandlingSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicClientRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicInvalidPartitionHandlingSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicPrimaryWriteOrderRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearRemoveFailureTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingPartitionDistributionTest;
 import org.apache.ignite.testframework.GridTestUtils;
@@ -71,7 +69,6 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
 
         // Failure consistency tests.
         suite.addTestSuite(GridCacheAtomicRemoveFailureTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.class);
         suite.addTestSuite(GridCacheAtomicClientRemoveFailureTest.class);
 
         suite.addTestSuite(GridCacheDhtAtomicRemoveFailureTest.class);
@@ -79,7 +76,6 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheDhtClientRemoveFailureTest.class);
         suite.addTestSuite(GridCacheNearRemoveFailureTest.class);
         suite.addTestSuite(GridCacheAtomicNearRemoveFailureTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeJoinTest.class);
         suite.addTestSuite(IgniteCacheTxNodeJoinTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
index 60ada78..1150286 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailov
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheCrossCacheTxFailoverTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicFailoverSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicPrimaryWriteOrderFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicReplicatedFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxSalvageSelfTest;
@@ -47,7 +46,6 @@ public class IgniteCacheFailoverTestSuite2 {
         suite.addTestSuite(CacheGetFromJobTest.class);
 
         suite.addTestSuite(GridCacheAtomicFailoverSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.class);
         suite.addTestSuite(GridCacheAtomicReplicatedFailoverSelfTest.class);
 
         suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
index 85b6e93..f1cf267 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
@@ -21,7 +21,6 @@ import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.distributed.CacheGetInsideLockChangingTopologyTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryAtomicSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryTransactionalSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest;
 
 /**
  * Test suite.
@@ -35,7 +34,6 @@ public class IgniteCacheFailoverTestSuite3 extends TestSuite {
         TestSuite suite = new TestSuite("Cache Failover Test Suite3");
 
         suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
-        suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class);
         suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
         suite.addTestSuite(CacheGetInsideLockChangingTopologyTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
index e9813dd..daab8c6 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
@@ -24,13 +24,9 @@ import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicCopyO
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicOnheapMultiJvmFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.multijvm.GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheNearOnlyMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest;
@@ -42,7 +38,6 @@ import org.apache.ignite.internal.processors.cache.multijvm.GridCachePartitioned
 import org.apache.ignite.internal.processors.cache.multijvm.GridCachePartitionedNearDisabledOnheapMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCachePartitionedOnheapMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheReplicatedAtomicMultiJvmFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.multijvm.GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheReplicatedMultiJvmFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.multijvm.GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest;
@@ -65,18 +60,14 @@ public class IgniteCacheFullApiMultiJvmSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheReplicatedMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedAtomicMultiJvmFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.class);
 
         suite.addTestSuite(GridCachePartitionedMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.class);
 
         suite.addTestSuite(GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.class);
@@ -96,7 +87,6 @@ public class IgniteCacheFullApiMultiJvmSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCachePartitionedNearDisabledOnheapMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedOnheapMultiJvmFullApiSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedOnheapMultiJvmFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest.class);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
index 1a1bfe7..710b2a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
@@ -21,9 +21,6 @@ import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.GridCacheClearSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicNearEnabledFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicPrimaryWriteOrderFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicReloadAllSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedReloadAllSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledAtomicOnheapFullApiSelfTest;
@@ -38,19 +35,14 @@ import org.apache.ignite.internal.processors.cache.distributed.near.CachePartiti
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicClientOnlyMultiNodeP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicCopyOnReadDisabledMultiNodeFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearOnlyMultiNodeP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicOnheapFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicOnheapMultiNodeFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlyMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlyMultiNodeP2PDisabledFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearReloadAllSelfTest;
@@ -73,7 +65,6 @@ import org.apache.ignite.internal.processors.cache.distributed.replicated.CacheR
 import org.apache.ignite.internal.processors.cache.distributed.replicated.CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedAtomicFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedAtomicMultiNodeFullApiSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedFullApiMultithreadedSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedFullApiSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMultiNodeFullApiSelfTest;
@@ -100,14 +91,11 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheReplicatedFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedNearDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedFilteredPutSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedAtomicFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicNearEnabledFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicOnheapFullApiSelfTest.class);;
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.class);;
+        suite.addTestSuite(GridCacheAtomicOnheapFullApiSelfTest.class);
 
         suite.addTestSuite(GridCachePartitionedOnheapFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedAtomicOnheapFullApiSelfTest.class);
@@ -122,18 +110,14 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheReplicatedMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedMultiNodeP2PDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedAtomicMultiNodeFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.class);
 
         suite.addTestSuite(GridCachePartitionedMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedCopyOnReadDisabledMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicCopyOnReadDisabledMultiNodeFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(CachePartitionedMultiNodeLongTxTimeoutFullApiTest.class);
         suite.addTestSuite(CachePartitionedNearEnabledMultiNodeLongTxTimeoutFullApiTest.class);
 
@@ -156,7 +140,6 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheNearReloadAllSelfTest.class);
         suite.addTestSuite(GridCacheColocatedReloadAllSelfTest.class);
         suite.addTestSuite(GridCacheAtomicReloadAllSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.class);
         suite.addTestSuite(GridCacheNearTxMultiNodeSelfTest.class);
         suite.addTestSuite(GridCachePartitionedMultiNodeCounterSelfTest.class);
 
@@ -165,11 +148,10 @@ public class IgniteCacheFullApiSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCachePartitionedNearDisabledOnheapMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCachePartitionedNearDisabledAtomicOnheapMultiNodeFullApiSelfTest.class);
         suite.addTestSuite(GridCacheAtomicOnheapMultiNodeFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.class);;
 
         // Old affinity assignment mode.
         suite.addTestSuite(GridCachePartitionedLateAffDisabledMultiNodeFullApiSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.class);
+        suite.addTestSuite(GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest.class);
 
         // Multithreaded.
         suite.addTestSuite(GridCacheLocalFullApiMultithreadedSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 0c310a7..d338bf8 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -79,8 +79,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicInvokeTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalInvokeTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicLocalWithStoreInvokeTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicNearEnabledInvokeTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPrimaryWriteOrderInvokeTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicWithStoreInvokeTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicStopBusySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerAtomicLocalTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerAtomicReplicatedTest;
@@ -172,8 +171,7 @@ public class IgniteCacheTestSuite extends TestSuite {
 
         suite.addTestSuite(IgniteCacheAtomicInvokeTest.class);
         suite.addTestSuite(IgniteCacheAtomicNearEnabledInvokeTest.class);
-        suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderInvokeTest.class);
-        suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderWithStoreInvokeTest.class);
+        suite.addTestSuite(IgniteCacheAtomicWithStoreInvokeTest.class);
         suite.addTestSuite(IgniteCacheAtomicLocalInvokeTest.class);
         suite.addTestSuite(IgniteCacheAtomicLocalWithStoreInvokeTest.class);
         suite.addTestSuite(IgniteCacheTxInvokeTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index caa18d0..3876951 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -43,8 +43,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePart
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedTransformWriteThroughBatchUpdateSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteTxReentryColocatedSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheValueConsistencyAtomicNearEnabledSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheValueConsistencyAtomicSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearPartitionedP2PDisabledByteArrayValuesSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearPartitionedP2PEnabledByteArrayValuesSelfTest;
@@ -95,9 +93,7 @@ public class IgniteCacheTestSuite3 extends TestSuite {
 
         // Value consistency tests.
         suite.addTestSuite(GridCacheValueConsistencyAtomicSelfTest.class);
-        suite.addTestSuite(GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest.class);
         suite.addTestSuite(GridCacheValueConsistencyAtomicNearEnabledSelfTest.class);
-        suite.addTestSuite(GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest.class);
         suite.addTestSuite(GridCacheValueConsistencyTransactionalSelfTest.class);
         suite.addTestSuite(GridCacheValueConsistencyTransactionalNearEnabledSelfTest.class);
         suite.addTestSuite(GridCacheValueBytesPreloadingSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
index 0c06190..d5496af 100644
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
+++ b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
@@ -17,15 +17,12 @@
 
 package org.apache.ignite.cache.store.hibernate;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.integration.IgniteCacheStoreNodeRestartAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
 public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
     /** {@inheritDoc} */
     @Override protected CacheStore getStore() {
@@ -46,9 +43,4 @@ public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNode
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
index 33c82b7..90d2f6e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
@@ -38,7 +38,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
 
@@ -62,7 +61,6 @@ public class CacheOperationsWithExpirationTest extends GridCommonAbstractTest {
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setBackups(1);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
         ccfg.setStatisticsEnabled(true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
index 9861153..4240441 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
@@ -47,7 +47,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -346,7 +345,6 @@ public class CacheRandomOperationsMultithreadedTest extends GridCommonAbstractTe
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setEvictionPolicy(evictionPlc);
         ccfg.setOnheapCacheEnabled(evictionPlc != null);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
index 4b6b395..b3525f4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
@@ -43,7 +43,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -178,7 +177,6 @@ public class IgniteCacheCrossCacheJoinRandomTest extends AbstractH2CompareQueryT
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setCacheMode(cacheMode);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
index f10840c..647ddc6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
@@ -40,7 +40,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -155,7 +154,6 @@ public class IgniteCacheDistributedJoinCollocatedAndNotTest extends GridCommonAb
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setBackups(1);
 


[50/50] [abbrv] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-1561-1

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1561-1


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

Branch: refs/heads/ignite-1561-1
Commit: 045a1b29f285027a322e6c1462259a4d0b981c8f
Parents: ead80c0 ded599a
Author: sboikov <sb...@gridgain.com>
Authored: Mon Apr 17 11:20:02 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Apr 17 11:20:02 2017 +0300

----------------------------------------------------------------------
 doap_Ignite.rdf                                 |   11 +-
 examples/config/example-memory-policies.xml     |  105 +
 examples/config/filesystem/example-igfs.xml     |    7 -
 examples/pom-standalone-lgpl.xml                |    6 +
 examples/pom-standalone.xml                     |    6 +
 examples/pom.xml                                |    6 +
 .../datagrid/MemoryPoliciesExample.java         |  114 +
 .../MemcacheRestExampleNodeStartup.java         |    7 -
 .../CholeskyDecompositionExample.java           |   80 +
 .../EigenDecompositionExample.java              |   69 +
 .../decompositions/LUDecompositionExample.java  |   83 +
 .../SingularValueDecompositionExample.java      |   70 +
 .../java8/math/decompositions/package-info.java |   22 +
 .../java8/math/matrix/CacheMatrixExample.java   |   91 +
 .../java8/math/matrix/ExampleMatrixStorage.java |  162 ++
 .../math/matrix/MatrixCustomStorageExample.java |  141 ++
 .../java8/math/matrix/MatrixExample.java        |   79 +
 .../java8/math/matrix/MatrixExampleUtil.java    |   52 +
 .../java8/math/matrix/OffHeapMatrixExample.java |   84 +
 .../matrix/SparseDistributedMatrixExample.java  |   65 +
 .../java8/math/matrix/SparseMatrixExample.java  |   84 +
 .../java8/math/matrix/package-info.java         |   22 +
 .../examples/java8/math/package-info.java       |   22 +
 .../java8/math/tracer/TracerExample.java        |   63 +
 .../java8/math/tracer/package-info.java         |   22 +
 .../java8/math/vector/CacheVectorExample.java   |  102 +
 .../java8/math/vector/ExampleVectorStorage.java |  126 +
 .../java8/math/vector/OffHeapVectorExample.java |   78 +
 .../java8/math/vector/SparseVectorExample.java  |   80 +
 .../math/vector/VectorCustomStorageExample.java |  124 +
 .../java8/math/vector/VectorExample.java        |   75 +
 .../java8/math/vector/package-info.java         |   22 +
 .../examples/ScalarCacheAffinityExample.scala   |    2 +-
 .../ignite/examples/CacheExamplesSelfTest.java  |    8 +
 .../optimized/OptimizedMarshallerAopTest.java   |  105 +
 .../optimized/OptimizedMarshallerAopTest.java   |  104 -
 .../ignite/ignite-cassandra-server-template.xml |    6 -
 .../tests/ignite-cassandra-client-template.xml  |    6 -
 modules/clients/src/test/config/jdbc-config.xml |    2 +-
 .../JettyRestProcessorAbstractSelfTest.java     |   12 +-
 .../ignite/codegen/MessageCodeGenerator.java    |    4 +
 .../java/org/apache/ignite/IgniteCache.java     |   13 -
 .../java/org/apache/ignite/IgniteCluster.java   |   52 -
 .../apache/ignite/IgniteSystemProperties.java   |    2 +-
 .../ignite/cache/CacheAtomicWriteOrderMode.java |   64 -
 .../org/apache/ignite/cache/CacheEntry.java     |   12 -
 .../ignite/cache/PartitionLossPolicy.java       |   16 +-
 .../org/apache/ignite/cache/QueryIndexType.java |   17 +-
 .../AffinityNodeAddressHashResolver.java        |   44 -
 .../affinity/AffinityNodeHashResolver.java      |   47 -
 .../affinity/AffinityNodeIdHashResolver.java    |   45 -
 .../rendezvous/RendezvousAffinityFunction.java  |   51 +-
 .../ignite/cache/query/SqlFieldsQuery.java      |   25 +
 .../org/apache/ignite/cache/query/SqlQuery.java |   31 +-
 .../configuration/CacheConfiguration.java       |   33 +-
 .../configuration/IgniteConfiguration.java      |  102 +-
 .../configuration/MemoryConfiguration.java      |    4 +-
 .../MemoryPolicyConfiguration.java              |   22 +-
 .../org/apache/ignite/hadoop/package-info.java  |   22 +
 .../java/org/apache/ignite/igfs/IgfsPath.java   |   31 +-
 .../ignite/internal/GridKernalContext.java      |   16 -
 .../ignite/internal/GridKernalContextImpl.java  |   31 -
 .../apache/ignite/internal/IgniteKernal.java    |   53 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |    6 +-
 .../apache/ignite/internal/LessNamingBean.java  |   28 -
 .../internal/binary/BinaryClassDescriptor.java  |    2 +-
 .../ignite/internal/binary/BinaryContext.java   |    2 +-
 .../GridClientOptimizedMarshaller.java          |    2 +-
 .../GridClientZipOptimizedMarshaller.java       |    2 +-
 .../cluster/IgniteClusterAsyncImpl.java         |   11 -
 .../internal/cluster/IgniteClusterImpl.java     |   38 -
 .../ignite/internal/jdbc2/JdbcQueryTask.java    |   41 +-
 .../ignite/internal/jdbc2/JdbcQueryTaskV2.java  |  406 ----
 .../ignite/internal/jdbc2/JdbcResultSet.java    |   64 +-
 .../ignite/internal/jdbc2/JdbcStatement.java    |   12 +-
 .../communication/GridIoMessageFactory.java     |   12 -
 .../optimized/OptimizedClassDescriptor.java     | 1141 +++++++++
 .../optimized/OptimizedFieldType.java           |   50 +
 .../optimized/OptimizedMarshaller.java          |  313 +++
 .../optimized/OptimizedMarshallerIdMapper.java  |   33 +
 .../optimized/OptimizedMarshallerUtils.java     |  551 +++++
 .../optimized/OptimizedObjectInputStream.java   | 1231 ++++++++++
 .../optimized/OptimizedObjectOutputStream.java  |  875 +++++++
 .../OptimizedObjectStreamRegistry.java          |  244 ++
 .../processors/cache/CacheEntryImplEx.java      |    8 +-
 .../processors/cache/GridCacheAdapter.java      |   20 -
 .../cache/GridCacheAtomicVersionComparator.java |   24 +-
 .../processors/cache/GridCacheAttributes.java   |   16 -
 .../cache/GridCacheConcurrentMap.java           |    5 -
 .../cache/GridCacheConcurrentMapImpl.java       |   10 -
 .../processors/cache/GridCacheMapEntry.java     |   21 +-
 .../processors/cache/GridCacheMvcc.java         |   23 +-
 .../processors/cache/GridCacheProcessor.java    |  152 +-
 .../cache/GridCacheSwapEntryImpl.java           |    4 +-
 .../processors/cache/GridCacheUtils.java        |    7 +-
 .../processors/cache/GridNoStorageCacheMap.java |    5 -
 .../processors/cache/IgniteCacheProxy.java      |   25 +-
 .../IgniteCacheDatabaseSharedManager.java       |   14 +-
 .../cache/database/tree/io/CacheVersionIO.java  |   12 +-
 .../dht/GridCachePartitionedConcurrentMap.java  |    5 -
 .../dht/atomic/GridDhtAtomicCache.java          |   19 +-
 ...idNearAtomicAbstractSingleUpdateRequest.java |    1 -
 .../atomic/GridNearAtomicFullUpdateRequest.java |    3 +-
 ...GridNearAtomicSingleUpdateFilterRequest.java |    3 +-
 ...GridNearAtomicSingleUpdateInvokeRequest.java |    3 +-
 .../distributed/near/GridNearCacheAdapter.java  |    6 -
 .../cache/query/GridCacheSqlIndexMetadata.java  |    3 +-
 .../cache/query/GridCacheSqlMetadata.java       |    3 +-
 .../cache/query/GridCacheSqlQuery.java          |  114 +-
 .../cache/transactions/IgniteTxEntry.java       |    8 +-
 .../cache/transactions/IgniteTxManager.java     |    2 +-
 .../version/GridCachePlainVersionedEntry.java   |    5 -
 .../version/GridCacheRawVersionedEntry.java     |    5 -
 .../cache/version/GridCacheVersion.java         |   47 +-
 .../cache/version/GridCacheVersionEx.java       |   19 +-
 .../cache/version/GridCacheVersionManager.java  |    9 +-
 .../cache/version/GridCacheVersionedEntry.java  |    7 -
 .../clock/GridClockDeltaSnapshot.java           |  235 --
 .../clock/GridClockDeltaSnapshotMessage.java    |  154 --
 .../processors/clock/GridClockDeltaVersion.java |  194 --
 .../processors/clock/GridClockMessage.java      |  171 --
 .../processors/clock/GridClockServer.java       |  222 --
 .../processors/clock/GridClockSource.java       |   30 -
 .../clock/GridClockSyncProcessor.java           |  481 ----
 .../processors/clock/GridJvmClockSource.java    |   28 -
 .../datastructures/DataStructuresProcessor.java |    2 -
 .../internal/processors/igfs/IgfsUtils.java     |    2 -
 .../callback/PlatformCallbackGateway.java       |   68 -
 .../cache/PlatformCachePluginProvider.java      |  121 -
 .../utils/PlatformConfigurationUtils.java       |    3 -
 .../rest/client/message/GridClientNodeBean.java |    2 +-
 .../top/GridTopologyCommandHandler.java         |    4 +
 .../internal/util/IgniteExceptionRegistry.java  |    3 +-
 .../ignite/internal/util/IgniteUtils.java       |   26 +-
 .../ignite/internal/util/lang/GridTupleV.java   |  194 --
 .../internal/visor/VisorDataTransferObject.java |   87 +
 .../visor/VisorDataTransferObjectInput.java     |  156 ++
 .../visor/VisorDataTransferObjectOutput.java    |  141 ++
 .../ignite/internal/visor/VisorEither.java      |  103 +
 .../internal/visor/VisorMultiNodeTask.java      |    6 +-
 .../ignite/internal/visor/VisorOneNodeTask.java |    5 +-
 .../internal/visor/VisorTaskArgument.java       |   51 +-
 .../visor/binary/VisorBinaryMetadata.java       |  139 ++
 .../VisorBinaryMetadataCollectorTask.java       |   70 +
 .../VisorBinaryMetadataCollectorTaskResult.java |   87 +
 .../visor/binary/VisorBinaryMetadataField.java  |  101 +
 .../ignite/internal/visor/cache/VisorCache.java |  124 +-
 .../cache/VisorCacheAffinityConfiguration.java  |   91 +-
 .../visor/cache/VisorCacheAffinityNodeTask.java |   13 +-
 .../cache/VisorCacheAffinityNodeTaskArg.java    |   86 +
 .../cache/VisorCacheAggregatedMetrics.java      |  205 +-
 .../visor/cache/VisorCacheClearTask.java        |  100 +-
 .../visor/cache/VisorCacheClearTaskResult.java  |   85 +
 .../visor/cache/VisorCacheConfiguration.java    |  284 ++-
 .../VisorCacheConfigurationCollectorJob.java    |    4 +-
 .../cache/VisorCacheDefaultConfiguration.java   |   58 -
 .../cache/VisorCacheEvictionConfiguration.java  |   52 +-
 .../visor/cache/VisorCacheJdbcType.java         |  189 ++
 .../visor/cache/VisorCacheJdbcTypeField.java    |  117 +
 .../visor/cache/VisorCacheLoadTask.java         |   20 +-
 .../visor/cache/VisorCacheLoadTaskArg.java      |  101 +
 .../visor/cache/VisorCacheMetadataTask.java     |   18 +-
 .../internal/visor/cache/VisorCacheMetrics.java |  208 +-
 .../cache/VisorCacheMetricsCollectorTask.java   |   29 +-
 .../VisorCacheMetricsCollectorTaskArg.java      |   87 +
 .../cache/VisorCacheNearConfiguration.java      |   59 +-
 .../visor/cache/VisorCachePartition.java        |   57 +-
 .../visor/cache/VisorCachePartitions.java       |   43 +-
 .../visor/cache/VisorCachePartitionsTask.java   |    7 +-
 .../cache/VisorCacheQueryConfiguration.java     |  122 -
 .../cache/VisorCacheQueryDetailMetrics.java     |  167 --
 ...sorCacheQueryDetailMetricsCollectorTask.java |  146 --
 .../visor/cache/VisorCacheQueryMetrics.java     |  102 -
 .../cache/VisorCacheRebalanceConfiguration.java |   71 +-
 .../VisorCacheResetQueryDetailMetricsTask.java  |   71 -
 .../cache/VisorCacheResetQueryMetricsTask.java  |   69 -
 .../visor/cache/VisorCacheSqlIndexMetadata.java |  115 +
 .../visor/cache/VisorCacheSqlMetadata.java      |  162 ++
 .../visor/cache/VisorCacheStartArg.java         |  100 +
 .../visor/cache/VisorCacheStartTask.java        |   60 +-
 .../cache/VisorCacheStoreConfiguration.java     |   77 +-
 .../cache/VisorCacheTypeFieldMetadata.java      |   92 -
 .../visor/cache/VisorCacheTypeMetadata.java     |  294 ---
 .../internal/visor/cache/VisorPartitionMap.java |   90 +
 .../compute/VisorComputeMonitoringHolder.java   |    8 +-
 .../VisorComputeToggleMonitoringTask.java       |   52 +-
 .../VisorComputeToggleMonitoringTaskArg.java    |   86 +
 .../visor/compute/VisorGatewayTask.java         |    4 +-
 .../visor/debug/VisorThreadDumpTask.java        |   13 +-
 .../visor/debug/VisorThreadDumpTaskResult.java  |   88 +
 .../internal/visor/debug/VisorThreadInfo.java   |  234 +-
 .../visor/debug/VisorThreadLockInfo.java        |   51 +-
 .../visor/debug/VisorThreadMonitorInfo.java     |   76 +-
 .../visor/event/VisorGridDeploymentEvent.java   |   43 +-
 .../visor/event/VisorGridDiscoveryEvent.java    |   59 +-
 .../internal/visor/event/VisorGridEvent.java    |   66 +-
 .../visor/event/VisorGridEventsLost.java        |   15 +-
 .../internal/visor/event/VisorGridJobEvent.java |   61 +-
 .../visor/event/VisorGridTaskEvent.java         |   61 +-
 .../internal/visor/file/VisorFileBlock.java     |   60 +-
 .../internal/visor/file/VisorFileBlockArg.java  |  114 +
 .../internal/visor/file/VisorFileBlockTask.java |   64 +-
 .../visor/file/VisorLatestTextFilesTask.java    |   17 +-
 .../visor/file/VisorLatestTextFilesTaskArg.java |   86 +
 .../ignite/internal/visor/igfs/VisorIgfs.java   |   76 +-
 .../internal/visor/igfs/VisorIgfsEndpoint.java  |   72 +-
 .../internal/visor/igfs/VisorIgfsMetrics.java   |  118 +-
 .../internal/visor/igfs/VisorIgfsProfiler.java  |   24 +-
 .../visor/igfs/VisorIgfsProfilerClearTask.java  |   11 +-
 .../igfs/VisorIgfsProfilerClearTaskResult.java  |   85 +
 .../visor/igfs/VisorIgfsProfilerEntry.java      |  106 +-
 .../visor/igfs/VisorIgfsProfilerTask.java       |   41 +-
 .../VisorIgfsProfilerUniformityCounters.java    |   38 +-
 .../visor/igfs/VisorIgfsSamplingStateTask.java  |   17 +-
 .../igfs/VisorIgfsSamplingStateTaskArg.java     |   86 +
 .../ignite/internal/visor/log/VisorLogFile.java |   43 +-
 .../internal/visor/log/VisorLogSearchArg.java   |  114 +
 .../visor/log/VisorLogSearchResult.java         |   80 +-
 .../internal/visor/log/VisorLogSearchTask.java  |   74 +-
 .../visor/log/VisorLogSearchTaskResult.java     |   92 +
 .../visor/node/VisorAtomicConfiguration.java    |   49 +-
 .../visor/node/VisorBasicConfiguration.java     |  163 +-
 .../node/VisorExecutorServiceConfiguration.java |   81 +-
 .../visor/node/VisorGridConfiguration.java      |  126 +-
 .../visor/node/VisorIgfsConfiguration.java      |  203 +-
 .../visor/node/VisorLifecycleConfiguration.java |   39 +-
 .../visor/node/VisorMemoryConfiguration.java    |   60 +-
 .../node/VisorMemoryPolicyConfiguration.java    |   37 +-
 .../visor/node/VisorMetricsConfiguration.java   |   50 +-
 .../VisorNodeConfigurationCollectorJob.java     |    4 +-
 .../visor/node/VisorNodeDataCollectorJob.java   |   63 +-
 .../node/VisorNodeDataCollectorJobResult.java   |  109 +-
 .../visor/node/VisorNodeDataCollectorTask.java  |   40 +-
 .../node/VisorNodeDataCollectorTaskArg.java     |   54 +-
 .../node/VisorNodeDataCollectorTaskResult.java  |  110 +-
 .../node/VisorNodeEventsCollectorTask.java      |  133 +-
 .../node/VisorNodeEventsCollectorTaskArg.java   |  163 ++
 .../internal/visor/node/VisorNodeGcTask.java    |   18 +-
 .../visor/node/VisorNodeGcTaskResult.java       |   85 +
 .../internal/visor/node/VisorNodePingTask.java  |   15 +-
 .../visor/node/VisorNodePingTaskResult.java     |   99 +
 .../visor/node/VisorNodeSuppressedErrors.java   |   89 +
 .../node/VisorNodeSuppressedErrorsTask.java     |   23 +-
 .../node/VisorPeerToPeerConfiguration.java      |   57 +-
 .../visor/node/VisorRestConfiguration.java      |   93 +-
 .../node/VisorSegmentationConfiguration.java    |   67 +-
 .../visor/node/VisorSpiDescription.java         |   89 +
 .../visor/node/VisorSpisConfiguration.java      |  128 +-
 .../visor/node/VisorSuppressedError.java        |  147 ++
 .../node/VisorTransactionConfiguration.java     |  104 +-
 .../visor/query/VisorCancelQueriesTask.java     |   72 -
 .../query/VisorCollectRunningQueriesTask.java   |   96 -
 .../internal/visor/query/VisorQueryArg.java     |   65 +-
 .../visor/query/VisorQueryCancelTask.java       |   72 +
 .../visor/query/VisorQueryCleanupTask.java      |    6 +-
 .../visor/query/VisorQueryConfiguration.java    |  142 ++
 .../visor/query/VisorQueryDetailMetrics.java    |  205 ++
 .../VisorQueryDetailMetricsCollectorTask.java   |  146 ++
 .../internal/visor/query/VisorQueryEntity.java  |  188 ++
 .../internal/visor/query/VisorQueryField.java   |   42 +-
 .../internal/visor/query/VisorQueryIndex.java   |  105 +
 .../visor/query/VisorQueryIndexField.java       |  106 +
 .../internal/visor/query/VisorQueryJob.java     |  275 ---
 .../internal/visor/query/VisorQueryMetrics.java |  125 +
 .../visor/query/VisorQueryNextPageTask.java     |   33 +-
 .../visor/query/VisorQueryNextPageTaskArg.java  |   86 +
 .../query/VisorQueryResetDetailMetricsTask.java |   71 +
 .../visor/query/VisorQueryResetMetricsTask.java |   69 +
 .../internal/visor/query/VisorQueryResult.java  |   97 +-
 .../visor/query/VisorQueryResultEx.java         |   89 -
 .../visor/query/VisorQueryScanRegexFilter.java  |   59 +
 .../query/VisorQueryScanSubstringFilter.java    |   64 -
 .../internal/visor/query/VisorQueryTask.java    |  120 +-
 .../internal/visor/query/VisorQueryUtils.java   |   43 +-
 .../query/VisorRunningQueriesCollectorTask.java |   96 +
 .../internal/visor/query/VisorRunningQuery.java |   47 +-
 .../internal/visor/query/VisorScanQueryArg.java |  157 ++
 .../visor/query/VisorScanQueryTask.java         |  185 ++
 .../visor/service/VisorServiceDescriptor.java   |   40 +-
 .../internal/visor/util/VisorTaskUtils.java     |   38 +-
 .../apache/ignite/marshaller/Marshaller.java    |    3 +-
 .../ignite/marshaller/jdk/JdkMarshaller.java    |    3 +-
 .../optimized/OptimizedClassDescriptor.java     | 1141 ---------
 .../optimized/OptimizedFieldType.java           |   50 -
 .../optimized/OptimizedMarshaller.java          |  313 ---
 .../optimized/OptimizedMarshallerIdMapper.java  |   33 -
 .../optimized/OptimizedMarshallerUtils.java     |  551 -----
 .../optimized/OptimizedObjectInputStream.java   | 1231 ----------
 .../optimized/OptimizedObjectOutputStream.java  |  875 -------
 .../OptimizedObjectStreamRegistry.java          |  244 --
 .../marshaller/optimized/package-info.java      |   22 -
 .../ignite/plugin/platform/package-info.java    |   22 +
 .../plugin/security/SecurityPermissionSet.java  |    3 +-
 .../ignite/plugin/security/SecuritySubject.java |    3 +-
 .../plugin/segmentation/SegmentationPolicy.java |   18 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  109 -
 .../tcp/TcpCommunicationSpiMBean.java           |   54 -
 .../ignite/startup/BasicWarmupClosure.java      |    3 +-
 .../resources/META-INF/classnames.properties    |  248 +-
 modules/core/src/test/config/example-cache.xml  |    2 +-
 modules/core/src/test/config/igfs-loopback.xml  |    2 +-
 modules/core/src/test/config/igfs-shmem.xml     |    2 +-
 .../src/test/config/spring-start-nodes-attr.xml |    2 +-
 .../core/src/test/config/spring-start-nodes.xml |    2 +-
 .../config/websession/example-cache-base.xml    |    3 +-
 .../test/config/websession/spring-cache-1.xml   |    6 -
 .../test/config/websession/spring-cache-2.xml   |    6 -
 .../test/config/websession/spring-cache-3.xml   |    6 -
 .../IgniteExternalizableAbstractTest.java       |    2 +-
 ...ndezvousAffinityFunctionSimpleBenchmark.java |   48 +-
 ...dbcPojoStoreOptimizedMarshallerSelfTest.java |    2 +-
 .../apache/ignite/igfs/IgfsPathSelfTest.java    |    2 +-
 .../internal/GridLifecycleAwareSelfTest.java    |    2 +-
 .../IgniteClientReconnectCacheTest.java         |   87 +-
 ...ryConfigurationCustomSerializerSelfTest.java |  147 ++
 .../managers/GridManagerStopSelfTest.java       |    2 +-
 .../GridCommunicationSendMessageSelfTest.java   |    2 -
 .../GridDiscoveryManagerAttributesSelfTest.java |    2 +-
 .../OptimizedMarshallerEnumSelfTest.java        |   87 +
 .../OptimizedMarshallerNodeFailoverTest.java    |  358 +++
 .../OptimizedMarshallerPooledSelfTest.java      |   46 +
 .../optimized/OptimizedMarshallerSelfTest.java  |  284 +++
 ...arshallerSerialPersistentFieldsSelfTest.java |  116 +
 .../optimized/OptimizedMarshallerTest.java      |  790 +++++++
 .../OptimizedObjectStreamSelfTest.java          | 2162 ++++++++++++++++++
 .../TestTcpDiscoveryIpFinderAdapter.java        |   43 +
 .../CacheAtomicSingleMessageCountSelfTest.java  |    2 -
 .../cache/CacheEnumOperationsAbstractTest.java  |    2 -
 ...torPartitionCounterRandomOperationsTest.java |    2 -
 .../CacheStartupInDeploymentModesTest.java      |    2 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   |    2 -
 .../EntryVersionConsistencyReadThroughTest.java |    2 -
 ...idAbstractCacheInterceptorRebalanceTest.java |    2 -
 .../cache/GridCacheAbstractFullApiSelfTest.java |   15 +-
 .../GridCacheAbstractLocalStoreSelfTest.java    |   16 +-
 .../GridCacheAbstractRemoveFailureTest.java     |    9 -
 .../GridCacheAtomicMessageCountSelfTest.java    |   54 +-
 .../cache/GridCacheConcurrentMapTest.java       |  138 --
 ...idCacheConfigurationConsistencySelfTest.java |   14 -
 .../cache/GridCacheDeploymentSelfTest.java      |    2 +-
 .../cache/GridCacheEntryMemorySizeSelfTest.java |    2 +-
 .../cache/GridCacheEntryVersionSelfTest.java    |    2 -
 .../cache/GridCacheIncrementTransformTest.java  |    2 -
 .../GridCacheInterceptorAbstractSelfTest.java   |   24 +-
 ...erceptorAtomicPrimaryWriteOrderSelfTest.java |   47 -
 ...omicReplicatedPrimaryWriteOrderSelfTest.java |   48 -
 ...acheInterceptorAtomicReplicatedSelfTest.java |    8 -
 .../GridCacheInterceptorAtomicSelfTest.java     |    8 -
 ...GridCacheInterceptorLocalAtomicSelfTest.java |    8 -
 .../cache/GridCacheMvccFlagsTest.java           |    4 +-
 .../cache/GridCacheMvccPartitionedSelfTest.java |   24 +-
 .../processors/cache/GridCacheMvccSelfTest.java |    8 +-
 ...HeapMultiThreadedUpdateAbstractSelfTest.java |    2 -
 .../GridCachePreloadingEvictionsSelfTest.java   |    3 +-
 .../GridCacheReturnValueTransferSelfTest.java   |   15 +-
 ...ridCacheStoreManagerDeserializationTest.java |   12 +-
 .../processors/cache/GridCacheTestEntryEx.java  |    2 +-
 ...idCacheValueConsistencyAbstractSelfTest.java |   10 -
 .../cache/GridCacheVersionMultinodeTest.java    |   40 -
 .../cache/GridCacheVersionSelfTest.java         |    6 +-
 .../GridCacheVersionTopologyChangeTest.java     |    2 -
 .../cache/IgniteCacheAbstractTest.java          |   14 -
 .../cache/IgniteCacheAtomicInvokeTest.java      |    7 -
 .../cache/IgniteCacheAtomicPeekModesTest.java   |    7 -
 ...eCacheAtomicPrimaryWriteOrderInvokeTest.java |   57 -
 ...maryWriteOrderNearEnabledStoreValueTest.java |   31 -
 ...heAtomicPrimaryWriteOrderStoreValueTest.java |   32 -
 ...micPrimaryWriteOrderWithStoreInvokeTest.java |   32 -
 .../cache/IgniteCacheAtomicStoreValueTest.java  |    7 -
 .../IgniteCacheAtomicWithStoreInvokeTest.java   |   32 +
 .../IgniteCacheConfigVariationsFullApiTest.java |    6 -
 .../IgniteCacheEntryListenerAtomicTest.java     |    7 -
 ...niteCacheEntryListenerExpiredEventsTest.java |    2 -
 .../IgniteCacheEntryProcessorCallTest.java      |    3 -
 .../IgniteCacheInterceptorSelfTestSuite.java    |    2 -
 ...gniteCacheInvokeReadThroughAbstractTest.java |    2 -
 .../IgniteCacheP2pUnmarshallingErrorTest.java   |    6 -
 .../IgniteCacheReadThroughStoreCallTest.java    |    2 -
 .../IgniteCacheStoreValueAbstractTest.java      |    4 -
 .../cache/IgniteCacheTxPeekModesTest.java       |    7 -
 .../cache/IgniteExchangeFutureHistoryTest.java  |    6 -
 ...logyValidatorPartitionedAtomicCacheTest.java |    7 -
 ...ologyValidatorReplicatedAtomicCacheTest.java |    7 -
 ...sExchangeOnDiscoveryHistoryOverflowTest.java |    7 -
 .../IgniteCacheAtomicExecutionContextTest.java  |    7 -
 ...iteCachePartitionedExecutionContextTest.java |    7 -
 ...niteCacheReplicatedExecutionContextTest.java |    7 -
 .../IgniteCacheTxExecutionContextTest.java      |    7 -
 ...eAbstractDataStructuresFailoverSelfTest.java |    2 +-
 .../distributed/CacheAffinityEarlyTest.java     |    2 +-
 ...CacheAtomicNearUpdateTopologyChangeTest.java |    7 -
 .../CacheGetFutureHangsSelfTest.java            |    2 +-
 .../CacheLateAffinityAssignmentTest.java        |    2 -
 ...NearDisabledAtomicInvokeRestartSelfTest.java |    6 -
 ...acheEntrySetIterationPreloadingSelfTest.java |    6 +-
 ...dCacheMultithreadedFailoverAbstractTest.java |   18 +-
 ...chePartitionedReloadAllAbstractSelfTest.java |   11 -
 .../GridCacheTransformEventSelfTest.java        |    2 -
 .../IgniteCacheAtomicNodeJoinTest.java          |    6 -
 ...niteCacheClientNodeChangingTopologyTest.java |   92 +-
 .../IgniteCacheCreatePutMultiNodeSelfTest.java  |    2 +-
 .../distributed/IgniteCacheCreatePutTest.java   |    2 +-
 .../IgniteCacheMessageRecoveryAbstractTest.java |    2 -
 ...tPartitionedOnlyByteArrayValuesSelfTest.java |    2 -
 .../dht/GridCacheAtomicFullApiSelfTest.java     |   19 -
 .../dht/GridCacheAtomicNearCacheSelfTest.java   |   52 +-
 ...EnabledPrimaryWriteOrderFullApiSelfTest.java |   31 -
 ...eAtomicPrimaryWriteOrderFullApiSelfTest.java |   32 -
 ...tomicPrimaryWriteOrderReloadAllSelfTest.java |   32 -
 .../GridCacheDhtAtomicRemoveFailureTest.java    |    7 -
 .../dht/IgniteCacheConcurrentPutGetRemove.java  |    2 -
 ...artitionedBackupNodeFailureRecoveryTest.java |    7 -
 .../IgniteCachePutRetryAbstractSelfTest.java    |   16 -
 .../atomic/GridCacheAtomicFailoverSelfTest.java |    3 -
 ...eAtomicInvalidPartitionHandlingSelfTest.java |   39 +-
 ...AtomicPrimaryWriteOrderFailoverSelfTest.java |   36 -
 ...tomicPrimaryWriteOrderRemoveFailureTest.java |   53 -
 .../GridCacheAtomicRemoveFailureTest.java       |    7 -
 ...micPrimaryWriteOrderNearEnabledSelfTest.java |   39 -
 ...sistencyAtomicPrimaryWriteOrderSelfTest.java |   32 -
 ...PutRetryAtomicPrimaryWriteOrderSelfTest.java |   32 -
 ...LateAffDisabledMultiNodeFullApiSelfTest.java |   35 +
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |   35 -
 ...GridCacheAtomicMultiNodeFullApiSelfTest.java |   10 -
 ...omicMultiNodeP2PDisabledFullApiSelfTest.java |   19 -
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |   31 -
 .../GridCacheAtomicNearRemoveFailureTest.java   |    7 -
 ...idCacheAtomicPartitionedMetricsSelfTest.java |    2 -
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |   32 -
 ...rderMultiNodeP2PDisabledFullApiSelfTest.java |   33 -
 ...cPrimaryWriteOrderNearRemoveFailureTest.java |   52 -
 ...cPrimaryWriteOrderOnheapFullApiSelfTest.java |   28 -
 ...riteOrderOnheapMultiNodeFullApiSelfTest.java |   29 -
 .../near/GridCacheNearEvictionSelfTest.java     |    2 -
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |    2 -
 .../near/GridCacheNearTxForceKeyTest.java       |    1 -
 ...rtitionedAffinityHashIdResolverSelfTest.java |  102 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |    4 -
 .../near/NearCacheSyncUpdateTest.java           |   27 +-
 .../GridCacheRebalancingOrderingTest.java       |    2 -
 ...cheRebalancingPartitionDistributionTest.java |    2 -
 ...ridCacheAtomicReplicatedMetricsSelfTest.java |    2 -
 ...eplicatedAtomicMultiNodeFullApiSelfTest.java |   19 -
 ...imaryWriteOrderMultiNodeFullApiSelfTest.java |   33 -
 .../IgniteCacheAtomicExpiryPolicyTest.java      |    7 -
 ...iteCacheAtomicExpiryPolicyWithStoreTest.java |    7 -
 ...AtomicPrimaryWriteOrderExpiryPolicyTest.java |   32 -
 ...maryWriteOrderWithStoreExpiryPolicyTest.java |   32 -
 .../IgniteCacheExpiryPolicyAbstractTest.java    |   13 +-
 .../IgniteCacheExpiryPolicyTestSuite.java       |    2 -
 .../IgniteCacheAtomicLoadAllTest.java           |    7 -
 .../IgniteCacheAtomicLoaderWriterTest.java      |    7 -
 ...gniteCacheAtomicNoLoadPreviousValueTest.java |    7 -
 .../IgniteCacheAtomicNoReadThroughTest.java     |    7 -
 .../IgniteCacheAtomicNoWriteThroughTest.java    |    7 -
 .../IgniteCacheAtomicStoreSessionTest.java      |    7 -
 ...eCacheAtomicStoreSessionWriteBehindTest.java |    7 -
 ...IgniteCacheJdbcBlobStoreNodeRestartTest.java |    8 -
 .../GridCacheAtomicLocalMetricsSelfTest.java    |    2 -
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |   31 -
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |   31 -
 ...OrderMultiJvmP2PDisabledFullApiSelfTest.java |   31 -
 ...WriteOrderOnheapMultiJvmFullApiSelfTest.java |   29 -
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |   31 -
 ...FailoverAtomicPrimaryWriteOrderSelfTest.java |   50 -
 ...tinuousQueryAsyncFailoverAtomicSelfTest.java |   43 +
 ...eContinuousQueryAsyncFilterListenerTest.java |    2 -
 ...acheContinuousQueryExecuteInPrimaryTest.java |    2 -
 ...ContinuousQueryFailoverAbstractSelfTest.java |   10 -
 ...ryFailoverAtomicNearEnabledSelfSelfTest.java |    9 +-
 ...FailoverAtomicPrimaryWriteOrderSelfTest.java |   44 -
 ...usQueryFailoverAtomicReplicatedSelfTest.java |    9 +-
 ...heContinuousQueryFailoverAtomicSelfTest.java |   36 +
 ...ontinuousQueryOperationFromCallbackTest.java |    2 -
 .../CacheContinuousQueryOperationP2PTest.java   |    2 -
 .../CacheContinuousQueryOrderingEventTest.java  |    2 -
 ...acheContinuousQueryRandomOperationsTest.java |    2 -
 .../CacheEntryProcessorNonSerializableTest.java |    2 +-
 .../CacheKeepBinaryIterationTest.java           |    2 -
 ...teCacheClientWriteBehindStoreAtomicTest.java |    7 -
 .../transactions/DepthFirstSearchTest.java      |   18 +-
 .../CacheVersionedEntryAbstractTest.java        |   13 -
 .../clock/GridTimeSyncProcessorSelfTest.java    |  224 --
 .../database/FreeListImplSelfTest.java          |    2 +-
 .../DataStreamerUpdateAfterLoadTest.java        |   18 +-
 .../igfs/IgfsAbstractBaseSelfTest.java          |    2 +-
 .../processors/igfs/IgfsFileInfoSelfTest.java   |    2 +-
 .../service/ClosureServiceClientsNodesTest.java |    2 +-
 ...ent2ClassLoadersOptimizedMarshallerTest.java |    2 +-
 ...mentClassLoadingOptimizedMarshallerTest.java |    2 +-
 .../ServicePredicateAccessCacheTest.java        |    4 +-
 .../apache/ignite/lang/GridTupleSelfTest.java   |   35 -
 .../communication/GridIoManagerBenchmark0.java  |    1 -
 ...namicProxySerializationMultiJvmSelfTest.java |    2 +-
 .../GridMarshallerPerformanceTest.java          |    2 +-
 .../OptimizedMarshallerEnumSelfTest.java        |   87 -
 .../OptimizedMarshallerNodeFailoverTest.java    |  357 ---
 .../OptimizedMarshallerPooledSelfTest.java      |   44 -
 .../optimized/OptimizedMarshallerSelfTest.java  |  283 ---
 ...arshallerSerialPersistentFieldsSelfTest.java |  114 -
 .../optimized/OptimizedMarshallerTest.java      |  790 -------
 .../OptimizedObjectStreamSelfTest.java          | 2157 -----------------
 .../TestTcpDiscoveryIpFinderAdapter.java        |   43 -
 .../marshaller/optimized/package-info.java      |   22 -
 .../IgniteMessagingWithClientTest.java          |    2 +-
 .../tcp/TcpCommunicationSpiDropNodesTest.java   |    1 -
 .../TcpCommunicationSpiFaultyClientTest.java    |    1 -
 ...pClientDiscoveryMarshallerCheckSelfTest.java |    2 +-
 .../TcpDiscoveryMarshallerCheckSelfTest.java    |    2 +-
 .../configvariations/ConfigVariations.java      |    5 +-
 .../testframework/junits/GridAbstractTest.java  |    2 -
 .../junits/IgniteTestResources.java             |    2 +-
 .../junits/common/GridCommonAbstractTest.java   |   18 -
 .../multijvm/IgniteCacheProcessProxy.java       |    5 -
 .../multijvm/IgniteClusterProcessProxy.java     |   11 -
 .../testsuites/IgniteBinaryBasicTestSuite.java  |   14 +-
 .../IgniteBinaryObjectsTestSuite.java           |    2 +
 .../IgniteCacheFailoverTestSuite.java           |    4 -
 .../IgniteCacheFailoverTestSuite2.java          |    2 -
 .../IgniteCacheFailoverTestSuite3.java          |    2 -
 ...IgniteCacheFullApiMultiJvmSelfTestSuite.java |   10 -
 .../IgniteCacheFullApiSelfTestSuite.java        |   24 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |    6 +-
 .../testsuites/IgniteCacheTestSuite2.java       |    2 -
 .../testsuites/IgniteCacheTestSuite3.java       |    4 -
 .../IgniteMarshallerSelfTestSuite.java          |   14 +-
 .../webapp/META-INF/ignite-webapp-config.xml    |    2 +-
 .../ignite/hadoop/planner/package-info.java     |   22 +
 .../resources/META-INF/classnames.properties    |    8 -
 .../test/config/hadoop-fs-open-test/grid-0.xml  |    2 +-
 .../test/config/hadoop-fs-open-test/grid-1.xml  |    2 +-
 .../test/config/hadoop-fs-open-test/grid-2.xml  |    2 +-
 .../test/config/igfs-cli-config-dual-async.xml  |    2 +-
 .../test/config/igfs-cli-config-dual-sync.xml   |    2 +-
 .../src/test/config/igfs-cli-config-primary.xml |    2 +-
 .../src/test/config/igfs-cli-config-proxy.xml   |    2 +-
 .../IgniteHadoopFileSystemAbstractSelfTest.java |    2 +-
 .../CacheHibernateBlobStoreNodeRestartTest.java |    8 -
 .../CacheHibernateBlobStoreNodeRestartTest.java |    8 -
 .../cache/query/GridCacheTwoStepQuery.java      |   26 +-
 .../processors/query/h2/IgniteH2Indexing.java   |   34 +-
 .../query/h2/opt/GridH2TreeIndex.java           |    2 +-
 .../query/h2/sql/GridSqlQuerySplitter.java      |   85 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   68 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |  154 +-
 .../h2/twostep/msg/GridH2QueryRequest.java      |  109 +-
 .../CacheOperationsWithExpirationTest.java      |    2 -
 .../CacheRandomOperationsMultithreadedTest.java |    2 -
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |   51 +-
 .../IgniteCacheCrossCacheJoinRandomTest.java    |    2 -
 ...acheDistributedJoinCollocatedAndNotTest.java |    2 -
 ...acheDistributedJoinCustomAffinityMapper.java |    2 -
 .../IgniteCacheDistributedJoinNoIndexTest.java  |    2 -
 ...ributedJoinPartitionedAndReplicatedTest.java |    2 -
 ...CacheDistributedJoinQueryConditionsTest.java |    2 -
 ...PartitionedAndReplicatedCollocationTest.java |    2 -
 ...teCacheJoinPartitionedAndReplicatedTest.java |   12 +-
 .../cache/IgniteCacheNoClassQuerySelfTest.java  |    2 +-
 ...iteCacheReplicatedFieldsQueryROSelfTest.java |   27 +
 ...gniteSqlSegmentedIndexMultiNodeSelfTest.java |   28 +
 .../query/IgniteSqlSegmentedIndexSelfTest.java  |  154 +-
 .../query/IgniteSqlSplitterSelfTest.java        |  125 +-
 .../h2/sql/AbstractH2CompareQueryTest.java      |    2 +-
 .../FetchingQueryCursorStressTest.java          |    2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |    6 +-
 .../IgniteCacheQuerySelfTestSuite4.java         |    8 +-
 modules/math/README.txt                         |   15 +
 modules/math/licenses/apache-2.0.txt            |  202 ++
 modules/math/licenses/mit.txt                   |    7 +
 modules/math/pom.xml                            |  109 +
 .../java/org/apache/ignite/math/Algebra.java    |  571 +++++
 .../java/org/apache/ignite/math/Constants.java  |   42 +
 .../org/apache/ignite/math/Destroyable.java     |   30 +
 .../apache/ignite/math/IdentityValueMapper.java |   53 +
 .../java/org/apache/ignite/math/KeyMapper.java  |   33 +
 .../java/org/apache/ignite/math/Matrix.java     |  518 +++++
 .../org/apache/ignite/math/MatrixKeyMapper.java |   30 +
 .../org/apache/ignite/math/MatrixStorage.java   |   58 +
 .../org/apache/ignite/math/MetaAttributes.java  |   76 +
 .../java/org/apache/ignite/math/MurmurHash.java |  246 ++
 .../apache/ignite/math/StorageConstants.java    |   49 +
 .../apache/ignite/math/StorageOpsMetrics.java   |   49 +
 .../java/org/apache/ignite/math/Tracer.java     |  456 ++++
 .../org/apache/ignite/math/ValueMapper.java     |   27 +
 .../java/org/apache/ignite/math/Vector.java     |  498 ++++
 .../org/apache/ignite/math/VectorKeyMapper.java |   29 +
 .../org/apache/ignite/math/VectorStorage.java   |   53 +
 .../decompositions/CholeskyDecomposition.java   |  306 +++
 .../decompositions/DecompositionSupport.java    |  105 +
 .../math/decompositions/EigenDecomposition.java |  923 ++++++++
 .../math/decompositions/LUDecomposition.java    |  366 +++
 .../math/decompositions/QRDecomposition.java    |  186 ++
 .../SingularValueDecomposition.java             |  620 +++++
 .../math/decompositions/package-info.java       |   22 +
 .../math/exceptions/CardinalityException.java   |   38 +
 .../math/exceptions/ColumnIndexException.java   |   35 +
 .../ignite/math/exceptions/IndexException.java  |   35 +
 .../NonPositiveDefiniteMatrixException.java     |   20 +
 .../exceptions/NonSymmetricMatrixException.java |   18 +
 .../math/exceptions/RowIndexException.java      |   35 +
 .../exceptions/SingularMatrixException.java     |   30 +
 .../exceptions/UnknownProviderException.java    |   35 +
 .../UnsupportedOperationException.java          |   44 +
 .../ignite/math/exceptions/package-info.java    |   22 +
 .../apache/ignite/math/functions/Functions.java |  136 ++
 .../ignite/math/functions/IgniteBiConsumer.java |   12 +
 .../ignite/math/functions/IgniteBiFunction.java |   29 +
 .../ignite/math/functions/IgniteConsumer.java   |   29 +
 .../math/functions/IgniteDoubleFunction.java    |   29 +
 .../ignite/math/functions/IgniteFunction.java   |   30 +
 .../math/functions/IntDoubleToVoidFunction.java |   25 +
 .../functions/IntIntDoubleToVoidFunction.java   |   28 +
 .../math/functions/IntIntToDoubleFunction.java  |   24 +
 .../ignite/math/functions/package-info.java     |   22 +
 .../apache/ignite/math/impls/CacheUtils.java    |  356 +++
 .../math/impls/matrix/AbstractMatrix.java       |  880 +++++++
 .../ignite/math/impls/matrix/CacheMatrix.java   |  158 ++
 .../impls/matrix/DenseLocalOffHeapMatrix.java   |   90 +
 .../impls/matrix/DenseLocalOnHeapMatrix.java    |   86 +
 .../math/impls/matrix/DiagonalMatrix.java       |  101 +
 .../math/impls/matrix/FunctionMatrix.java       |   95 +
 .../ignite/math/impls/matrix/MatrixView.java    |   84 +
 .../math/impls/matrix/PivotedMatrixView.java    |  243 ++
 .../ignite/math/impls/matrix/RandomMatrix.java  |   97 +
 .../impls/matrix/SparseDistributedMatrix.java   |  155 ++
 .../impls/matrix/SparseLocalOnHeapMatrix.java   |   72 +
 .../math/impls/matrix/TransposedMatrixView.java |   84 +
 .../ignite/math/impls/matrix/package-info.java  |   22 +
 .../apache/ignite/math/impls/package-info.java  |   22 +
 .../storage/matrix/ArrayMatrixStorage.java      |  161 ++
 .../storage/matrix/CacheMatrixStorage.java      |  180 ++
 .../matrix/DenseOffHeapMatrixStorage.java       |  197 ++
 .../storage/matrix/DiagonalMatrixStorage.java   |  136 ++
 .../storage/matrix/FunctionMatrixStorage.java   |  175 ++
 .../storage/matrix/MatrixDelegateStorage.java   |  205 ++
 .../storage/matrix/PivotedMatrixStorage.java    |  256 +++
 .../storage/matrix/RandomMatrixStorage.java     |  176 ++
 .../matrix/SparseDistributedMatrixStorage.java  |  281 +++
 .../matrix/SparseLocalOnHeapMatrixStorage.java  |  226 ++
 .../math/impls/storage/matrix/package-info.java |   22 +
 .../storage/vector/ArrayVectorStorage.java      |  135 ++
 .../storage/vector/CacheVectorStorage.java      |  175 ++
 .../storage/vector/ConstantVectorStorage.java   |  133 ++
 .../storage/vector/DelegateVectorStorage.java   |  157 ++
 .../vector/DenseLocalOffHeapVectorStorage.java  |  172 ++
 .../storage/vector/FunctionVectorStorage.java   |  141 ++
 .../storage/vector/MatrixVectorStorage.java     |  185 ++
 .../storage/vector/PivotedVectorStorage.java    |  175 ++
 .../storage/vector/RandomVectorStorage.java     |  152 ++
 .../SingleElementVectorDelegateStorage.java     |  145 ++
 .../vector/SingleElementVectorStorage.java      |  143 ++
 .../vector/SparseLocalOffHeapVectorStorage.java |  148 ++
 .../vector/SparseLocalOnHeapVectorStorage.java  |  152 ++
 .../math/impls/storage/vector/package-info.java |   22 +
 .../impls/vector/AbstractReadOnlyVector.java    |  108 +
 .../math/impls/vector/AbstractVector.java       |  903 ++++++++
 .../ignite/math/impls/vector/CacheVector.java   |  140 ++
 .../math/impls/vector/ConstantVector.java       |   84 +
 .../math/impls/vector/DelegatingVector.java     |  391 ++++
 .../impls/vector/DenseLocalOffHeapVector.java   |   89 +
 .../impls/vector/DenseLocalOnHeapVector.java    |  104 +
 .../math/impls/vector/FunctionVector.java       |  112 +
 .../math/impls/vector/MatrixVectorView.java     |  139 ++
 .../math/impls/vector/PivotedVectorView.java    |  163 ++
 .../ignite/math/impls/vector/RandomVector.java  |  128 ++
 .../math/impls/vector/SingleElementVector.java  |  102 +
 .../impls/vector/SingleElementVectorView.java   |   97 +
 .../impls/vector/SparseLocalOffHeapVector.java  |   47 +
 .../math/impls/vector/SparseLocalVector.java    |   71 +
 .../ignite/math/impls/vector/VectorView.java    |   85 +
 .../ignite/math/impls/vector/package-info.java  |   22 +
 .../org/apache/ignite/math/package-info.java    |   22 +
 .../apache/ignite/math/d3-matrix-template.html  |  128 ++
 .../apache/ignite/math/d3-vector-template.html  |  111 +
 .../org/apache/ignite/math/ExternalizeTest.java |   66 +
 .../math/MathImplDistributedTestSuite.java      |   39 +
 .../ignite/math/MathImplLocalTestSuite.java     |  123 +
 .../ignite/math/MathImplMainTestSuite.java      |   33 +
 .../java/org/apache/ignite/math/TracerTest.java |  195 ++
 .../ignite/math/benchmark/MathBenchmark.java    |  205 ++
 .../math/benchmark/MathBenchmarkSelfTest.java   |  100 +
 .../ignite/math/benchmark/ResultsWriter.java    |  127 +
 .../math/benchmark/VectorBenchmarkTest.java     |  138 ++
 .../ignite/math/benchmark/package-info.java     |   18 +
 .../CholeskyDecompositionTest.java              |  158 ++
 .../decompositions/EigenDecompositionTest.java  |  193 ++
 .../decompositions/LUDecompositionTest.java     |  250 ++
 .../decompositions/QRDecompositionTest.java     |  139 ++
 .../SingularValueDecompositionTest.java         |  120 +
 .../ignite/math/impls/MathTestConstants.java    |   88 +
 .../math/impls/matrix/CacheMatrixTest.java      |  369 +++
 .../DenseLocalOffHeapMatrixConstructorTest.java |   65 +
 .../DenseLocalOnHeapMatrixConstructorTest.java  |   71 +
 .../math/impls/matrix/DiagonalMatrixTest.java   |  209 ++
 .../matrix/FunctionMatrixConstructorTest.java   |  113 +
 .../math/impls/matrix/MatrixAttributeTest.java  |  156 ++
 .../matrix/MatrixImplementationFixtures.java    |  381 +++
 .../impls/matrix/MatrixImplementationsTest.java | 1113 +++++++++
 .../impls/matrix/MatrixKeyMapperForTests.java   |   69 +
 .../impls/matrix/MatrixViewConstructorTest.java |  114 +
 .../PivotedMatrixViewConstructorTest.java       |  128 ++
 .../matrix/RandomMatrixConstructorTest.java     |   71 +
 .../matrix/SparseDistributedMatrixTest.java     |  265 +++
 .../SparseLocalOnHeapMatrixConstructorTest.java |   53 +
 .../impls/matrix/TransposedMatrixViewTest.java  |   87 +
 .../storage/matrix/MatrixArrayStorageTest.java  |   63 +
 .../storage/matrix/MatrixBaseStorageTest.java   |   89 +
 .../matrix/MatrixOffHeapStorageTest.java        |   39 +
 .../storage/matrix/MatrixStorageFixtures.java   |  141 ++
 .../matrix/MatrixStorageImplementationTest.java |   73 +
 .../SparseDistributedMatrixStorageTest.java     |  126 +
 .../RandomAccessSparseVectorStorageTest.java    |   60 +
 .../SparseLocalOffHeapVectorStorageTest.java    |   78 +
 .../storage/vector/VectorArrayStorageTest.java  |   58 +
 .../storage/vector/VectorBaseStorageTest.java   |   69 +
 .../vector/VectorOffheapStorageTest.java        |   73 +
 .../math/impls/vector/AbstractVectorTest.java   |  543 +++++
 .../math/impls/vector/CacheVectorTest.java      |  417 ++++
 .../vector/ConstantVectorConstructorTest.java   |   52 +
 .../vector/DelegatingVectorConstructorTest.java |   62 +
 .../DenseLocalOffHeapVectorConstructorTest.java |   59 +
 .../DenseLocalOnHeapVectorConstructorTest.java  |  163 ++
 .../vector/FunctionVectorConstructorTest.java   |  121 +
 .../math/impls/vector/MatrixVectorViewTest.java |  209 ++
 .../PivotedVectorViewConstructorTest.java       |  211 ++
 .../vector/RandomVectorConstructorTest.java     |  145 ++
 .../SingleElementVectorConstructorTest.java     |  159 ++
 .../SingleElementVectorViewConstructorTest.java |  137 ++
 .../SparseLocalVectorConstructorTest.java       |   54 +
 .../math/impls/vector/VectorAttributesTest.java |  217 ++
 .../math/impls/vector/VectorFoldMapTest.java    |  122 +
 .../vector/VectorImplementationsFixtures.java   |  655 ++++++
 .../impls/vector/VectorImplementationsTest.java |  860 +++++++
 .../math/impls/vector/VectorIterableTest.java   |  376 +++
 .../math/impls/vector/VectorNormTest.java       |  247 ++
 .../math/impls/vector/VectorToMatrixTest.java   |  291 +++
 .../math/impls/vector/VectorViewTest.java       |  162 ++
 .../platforms/cpp/core-test/src/cache_test.cpp  |   38 +-
 .../Apache.Ignite.Core.Tests.csproj             |    3 -
 .../Cache/CacheConfigurationTest.cs             |   16 +-
 .../Config/marshaller-invalid.xml               |    2 +-
 .../Config/native-client-test-cache.xml         |    3 -
 .../IgniteConfigurationSerializerTest.cs        |   35 +-
 .../Apache.Ignite.Core.Tests/LifecycleTest.cs   |    8 +-
 .../Log/CustomLoggerTest.cs                     |    4 +-
 .../Plugin/Cache/CachePlugin.cs                 |  127 -
 .../Plugin/Cache/CachePluginConfiguration.cs    |   64 -
 .../Plugin/Cache/CachePluginTest.cs             |  218 --
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |    2 +-
 .../Apache.Ignite.Core.csproj                   |   12 +-
 .../Configuration/CacheAtomicWriteOrderMode.cs  |   43 -
 .../Cache/Configuration/CacheConfiguration.cs   |   13 -
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |    6 +-
 .../IgniteConfigurationSection.xsd              |   18 +-
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |   32 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |   16 +-
 .../Impl/LifecycleBeanHolder.cs                 |   66 -
 .../Impl/LifecycleHandlerHolder.cs              |   66 +
 .../Impl/Plugin/Cache/CachePluginContext.cs     |   82 -
 .../Impl/Plugin/Cache/CachePluginProcessor.cs   |   77 -
 .../Plugin/Cache/CachePluginProviderProxy.cs    |   75 -
 .../Plugin/Cache/ICachePluginProviderProxy.cs   |   52 -
 .../Impl/Unmanaged/UnmanagedCallbackOp.cs       |    4 -
 .../Impl/Unmanaged/UnmanagedCallbacks.cs        |   58 +-
 .../Lifecycle/ILifecycleBean.cs                 |   64 -
 .../Lifecycle/ILifecycleHandler.cs              |   64 +
 .../Lifecycle/LifecycleEventType.cs             |    2 +-
 .../Cache/CachePluginProviderTypeAttribute.cs   |   52 -
 .../Plugin/Cache/ICachePluginConfiguration.cs   |   21 -
 .../Plugin/Cache/ICachePluginContext.cs         |   47 -
 .../Plugin/Cache/ICachePluginProvider.cs        |   52 -
 .../Apache.Ignite/Service/IgniteService.cs      |    6 +-
 .../Misc/LifecycleExample.cs                    |   12 +-
 .../http/jetty/GridJettyObjectMapper.java       |  119 +-
 .../GridSpringBeanSerializationSelfTest.java    |    2 +-
 .../commands/cache/VisorCacheClearCommand.scala |    2 +-
 .../commands/cache/VisorCacheCommand.scala      |  290 ++-
 .../commands/cache/VisorCacheScanCommand.scala  |   16 +-
 .../config/VisorConfigurationCommand.scala      |  183 +-
 .../commands/disco/VisorDiscoveryCommand.scala  |   22 +-
 .../commands/events/VisorEventsCommand.scala    |   30 +-
 .../visor/commands/gc/VisorGcCommand.scala      |    4 +-
 .../commands/tasks/VisorTasksCommand.scala      |   61 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   34 +-
 modules/web-console/backend/app/agent.js        |   98 +-
 modules/web-console/backend/app/browser.js      |   76 +-
 modules/web-console/backend/app/mongo.js        |   32 +-
 .../frontend/app/data/pom-dependencies.json     |    1 +
 .../app/helpers/jade/form/form-field-text.pug   |   40 +-
 .../frontend/app/helpers/jade/mixins.pug        |   20 +-
 .../frontend/app/modules/agent/agent.module.js  |   41 +-
 .../generator/AbstractTransformer.js            |    5 -
 .../generator/ConfigurationGenerator.js         |   63 +-
 .../generator/JavaTransformer.service.js        |    3 +
 .../generator/PlatformGenerator.js              |   11 +-
 .../defaults/Cache.platform.service.js          |    9 -
 .../generator/defaults/Cache.service.js         |   13 +-
 .../generator/defaults/Cluster.service.js       |    9 +-
 .../generator/defaults/IGFS.service.js          |    2 +-
 .../frontend/app/modules/sql/sql.controller.js  |   62 +-
 .../states/configuration/caches/affinity.pug    |    2 +-
 .../states/configuration/caches/concurrency.pug |   11 -
 .../states/configuration/caches/general.pug     |   25 +
 .../states/configuration/caches/memory.pug      |   64 +-
 .../states/configuration/caches/query.pug       |    3 +
 .../states/configuration/clusters/events.pug    |    6 +-
 .../states/configuration/clusters/general.pug   |    3 +
 .../clusters/general/discovery/kubernetes.pug   |   37 +
 .../configuration/clusters/marshaller.pug       |    6 -
 .../states/configuration/clusters/swap.pug      |   72 -
 .../states/configuration/clusters/time.pug      |   10 +-
 .../modules/states/configuration/igfs/misc.pug  |    2 +-
 .../configuration/summary/summary.controller.js |    3 +
 .../configuration/summary/summary.worker.js     |   22 +
 .../frontend/app/primitives/btn-group/index.pug |   35 +
 .../frontend/controllers/caches-controller.js   |   29 -
 .../frontend/controllers/clusters-controller.js |   41 +-
 .../views/configuration/clusters.tpl.pug        |    1 -
 .../views/configuration/domains-import.tpl.pug  |    2 +-
 .../views/configuration/domains.tpl.pug         |    1 -
 .../web-console/frontend/views/sql/sql.tpl.pug  |   12 +-
 .../ignite/console/demo/AgentClusterDemo.java   |    2 +
 .../src/main/resources/log4j.properties         |    1 -
 .../webapp2/META-INF/ignite-webapp-config.xml   |    2 +-
 modules/yardstick/README.txt                    |    1 -
 modules/yardstick/config/ignite-base-config.xml |   25 +-
 .../ignite-int-max-values-onheap-config.xml     |    2 +-
 modules/yardstick/config/ignite-jdbc-config.xml |    2 +-
 .../yardstick/IgniteBenchmarkArguments.java     |   15 +-
 .../org/apache/ignite/yardstick/IgniteNode.java |    3 -
 pom.xml                                         |    7 +
 831 files changed, 49419 insertions(+), 21258 deletions(-)
----------------------------------------------------------------------



[45/50] [abbrv] ignite git commit: Empty java files removed

Posted by sb...@apache.org.
Empty java files removed


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

Branch: refs/heads/ignite-1561-1
Commit: 8fa438c65d395cc78628abfede2a8bca045a846d
Parents: 0db4ceb
Author: agura <ag...@gridgain.com>
Authored: Sat Apr 15 19:03:08 2017 +0300
Committer: agura <ag...@gridgain.com>
Committed: Sat Apr 15 19:03:08 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/clock/GridClockDeltaSnapshot.java     | 0
 .../internal/processors/clock/GridClockDeltaSnapshotMessage.java     | 0
 .../ignite/internal/processors/clock/GridClockDeltaVersion.java      | 0
 .../org/apache/ignite/internal/processors/clock/GridClockServer.java | 0
 .../ignite/internal/processors/clock/GridClockSyncProcessor.java     | 0
 .../processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java     | 0
 .../cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java        | 0
 .../dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java | 0
 .../near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java   | 0
 .../distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java      | 0
 .../near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java         | 0
 ...eAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java | 0
 .../near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java  | 0
 ...idCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java | 0
 .../IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java | 0
 .../cache/query/GridCacheSwapScanQueryAbstractSelfTest.java          | 0
 .../CacheContinuousQueryFailoverAtomicOffheapTieredTest.java         | 0
 .../internal/processors/clock/GridTimeSyncProcessorSelfTest.java     | 0
 18 files changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicOffheapTieredTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicOffheapTieredTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAtomicOffheapTieredTest.java
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa438c6/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java
deleted file mode 100644
index e69de29..0000000


[14/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 79f54d6..11b1fde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -17,25 +17,29 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheMetrics;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.internal.visor.query.VisorQueryMetrics;
 
 /**
  * Data transfer object for {@link CacheMetrics}.
  */
-public class VisorCacheMetrics implements Serializable, LessNamingBean {
+public class VisorCacheMetrics extends VisorDataTransferObject {
     /** */
-    private static final float MICROSECONDS_IN_SECOND = 1_000_000;
+    private static final long serialVersionUID = 0L;
 
     /** */
-    private static final long serialVersionUID = 0L;
+    private static final float MICROSECONDS_IN_SECOND = 1_000_000;
 
     /** Cache name. */
     private String name;
@@ -110,7 +114,7 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
     private int rollbacksPerSec;
 
     /** Gets query metrics for cache. */
-    private VisorCacheQueryMetrics qryMetrics;
+    private VisorQueryMetrics qryMetrics;
 
     /** Current size of evict queue used to batch up evictions. */
     private int dhtEvictQueueCurrSize;
@@ -174,11 +178,19 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
     }
 
     /**
+     * Default constructor.
+     */
+    public VisorCacheMetrics() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache metrics.
+     *
      * @param ignite Ignite.
      * @param cacheName Cache name.
-     * @return Data transfer object for given cache metrics.
      */
-    public VisorCacheMetrics from(IgniteEx ignite, String cacheName) {
+    public VisorCacheMetrics(IgniteEx ignite, String cacheName) {
         GridCacheProcessor cacheProcessor = ignite.context().cache();
 
         IgniteCache<Object, Object> c = cacheProcessor.jcache(cacheName);
@@ -217,7 +229,7 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
         commitsPerSec = perSecond(m.getAverageTxCommitTime());
         rollbacksPerSec = perSecond(m.getAverageTxRollbackTime());
 
-        qryMetrics = VisorCacheQueryMetrics.from(c.queryMetrics());
+        qryMetrics = new VisorQueryMetrics(c.queryMetrics());
 
         dhtEvictQueueCurrSize = m.getDhtEvictQueueCurrentSize();
         txThreadMapSize = m.getTxThreadMapSize();
@@ -239,14 +251,12 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
 
         offHeapAllocatedSize = ca.offHeapAllocatedSize();
         offHeapEntriesCnt = ca.offHeapEntriesCount();
-
-        return this;
     }
 
     /**
      * @return Cache name.
      */
-    public String name() {
+    public String getName() {
         return name;
     }
 
@@ -255,287 +265,287 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
      *
      * @param name New value for cache name.
      */
-    public void name(String name) {
+    public void setName(String name) {
         this.name = name;
     }
 
     /**
      * @return Cache mode.
      */
-    public CacheMode mode() {
+    public CacheMode getMode() {
         return mode;
     }
 
     /**
      * @return Cache system state.
      */
-    public boolean system() {
+    public boolean isSystem() {
         return sys;
     }
 
     /**
      * @return Total number of reads of the owning entity (either cache or entry).
      */
-    public long reads() {
+    public long getReads() {
         return reads;
     }
 
     /**
      * @return The mean time to execute gets
      */
-    public float avgReadTime() {
+    public float getAvgReadTime() {
         return avgReadTime;
     }
 
     /**
      * @return Total number of writes of the owning entity (either cache or entry).
      */
-    public long writes() {
+    public long getWrites() {
         return writes;
     }
 
     /**
      * @return Total number of hits for the owning entity (either cache or entry).
      */
-    public long hits() {
+    public long getHits() {
         return hits;
     }
 
     /**
      * @return Total number of misses for the owning entity (either cache or entry).
      */
-    public long misses() {
+    public long getMisses() {
         return misses;
     }
 
     /**
      * @return Total number of transaction commits.
      */
-    public long txCommits() {
+    public long getTxCommits() {
         return txCommits;
     }
 
     /**
      * @return avgTxCommitTime
      */
-    public float avgTxCommitTime() {
+    public float getAvgTxCommitTime() {
         return avgTxCommitTime;
     }
 
     /**
      * @return The mean time to execute tx rollbacks.
      */
-    public float avgTxRollbackTime() {
+    public float getAvgTxRollbackTime() {
         return avgTxRollbackTime;
     }
 
     /**
      * @return The total number of puts to the cache.
      */
-    public long puts() {
+    public long getPuts() {
         return puts;
     }
 
     /**
      * @return The mean time to execute puts.
      */
-    public float avgPutTime() {
+    public float getAvgPutTime() {
         return avgPutTime;
     }
 
     /**
      * @return The total number of removals from the cache.
      */
-    public long removals() {
+    public long getRemovals() {
         return removals;
     }
 
     /**
      * @return The mean time to execute removes.
      */
-    public float avgRemovalTime() {
+    public float getAvgRemovalTime() {
         return avgRemovalTime;
     }
 
     /**
      * @return The total number of evictions from the cache.
      */
-    public long evictions() {
+    public long getEvictions() {
         return evictions;
     }
 
     /**
      * @return Total number of transaction rollbacks.
      */
-    public long txRollbacks() {
+    public long getTxRollbacks() {
         return txRollbacks;
     }
 
     /**
      * @return Reads per second.
      */
-    public int readsPerSecond() {
+    public int getReadsPerSecond() {
         return readsPerSec;
     }
 
     /**
      * @return Puts per second.
      */
-    public int putsPerSecond() {
+    public int getPutsPerSecond() {
         return putsPerSec;
     }
 
     /**
      * @return Removes per second.
      */
-    public int removalsPerSecond() {
+    public int getRemovalsPerSecond() {
         return removalsPerSec;
     }
 
     /**
      * @return Commits per second.
      */
-    public int commitsPerSecond() {
+    public int getCommitsPerSecond() {
         return commitsPerSec;
     }
 
     /**
      * @return Rollbacks per second.
      */
-    public int rollbacksPerSecond() {
+    public int getRollbacksPerSecond() {
         return rollbacksPerSec;
     }
 
     /**
      * @return Number of non-{@code null} values in the cache.
      */
-    public int size() {
+    public int getSize() {
         return size;
     }
 
     /**
      * @return Gets number of keys in the cache, possibly with {@code null} values.
      */
-    public int keySize() {
+    public int getKeySize() {
         return keySize;
     }
 
     /**
      * @return Gets query metrics for cache.
      */
-    public VisorCacheQueryMetrics queryMetrics() {
+    public VisorQueryMetrics getQueryMetrics() {
         return qryMetrics;
     }
 
     /**
      * @return Current size of evict queue used to batch up evictions.
      */
-    public int dhtEvictQueueCurrentSize() {
+    public int getDhtEvictQueueCurrentSize() {
         return dhtEvictQueueCurrSize;
     }
 
     /**
      * @return Gets transaction per-thread map size.
      */
-    public int txThreadMapSize() {
+    public int getTxThreadMapSize() {
         return txThreadMapSize;
     }
 
     /**
      * @return Transaction per-Xid map size.
      */
-    public int txXidMapSize() {
+    public int getTxXidMapSize() {
         return txXidMapSize;
     }
 
     /**
      * @return Committed transaction queue size.
      */
-    public int txCommitQueueSize() {
+    public int getTxCommitQueueSize() {
         return txCommitQueueSize;
     }
 
     /**
      * @return Prepared transaction queue size.
      */
-    public int txPrepareQueueSize() {
+    public int getTxPrepareQueueSize() {
         return txPrepareQueueSize;
     }
 
     /**
      * @return Start version counts map size.
      */
-    public int txStartVersionCountsSize() {
+    public int getTxStartVersionCountsSize() {
         return txStartVerCountsSize;
     }
 
     /**
      * @return Number of cached committed transaction IDs.
      */
-    public int txCommittedVersionsSize() {
+    public int getTxCommittedVersionsSize() {
         return txCommittedVersionsSize;
     }
 
     /**
      * @return Number of cached rolled back transaction IDs.
      */
-    public int txRolledbackVersionsSize() {
+    public int getTxRolledbackVersionsSize() {
         return txRolledbackVersionsSize;
     }
 
     /**
      * @return DHT thread map size
      */
-    public int txDhtThreadMapSize() {
+    public int getTxDhtThreadMapSize() {
         return txDhtThreadMapSize;
     }
 
     /**
      * @return Transaction DHT per-Xid map size.
      */
-    public int txDhtXidMapSize() {
+    public int getTxDhtXidMapSize() {
         return txDhtXidMapSize;
     }
 
     /**
      * @return Committed DHT transaction queue size.
      */
-    public int txDhtCommitQueueSize() {
+    public int getTxDhtCommitQueueSize() {
         return txDhtCommitQueueSize;
     }
 
     /**
      * @return Prepared DHT transaction queue size.
      */
-    public int txDhtPrepareQueueSize() {
+    public int getTxDhtPrepareQueueSize() {
         return txDhtPrepareQueueSize;
     }
 
     /**
      * @return DHT start version counts map size.
      */
-    public int txDhtStartVersionCountsSize() {
+    public int getTxDhtStartVersionCountsSize() {
         return txDhtStartVerCountsSize;
     }
 
     /**
      * @return Number of cached committed DHT transaction IDs.
      */
-    public int txDhtCommittedVersionsSize() {
+    public int getTxDhtCommittedVersionsSize() {
         return txDhtCommittedVersionsSize;
     }
 
     /**
      * @return Number of cached rolled back DHT transaction IDs.
      */
-    public int txDhtRolledbackVersionsSize() {
+    public int getTxDhtRolledbackVersionsSize() {
         return txDhtRolledbackVersionsSize;
     }
 
     /**
      * @return Memory size allocated in off-heap.
      */
-    public long offHeapAllocatedSize() {
+    public long getOffHeapAllocatedSize() {
         return offHeapAllocatedSize;
     }
 
@@ -547,6 +557,98 @@ public class VisorCacheMetrics implements Serializable, LessNamingBean {
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeEnum(out, mode);
+        out.writeBoolean(sys);
+        out.writeInt(size);
+        out.writeInt(keySize);
+        out.writeLong(reads);
+        out.writeFloat(avgReadTime);
+        out.writeLong(writes);
+        out.writeLong(hits);
+        out.writeLong(misses);
+        out.writeLong(txCommits);
+        out.writeFloat(avgTxCommitTime);
+        out.writeLong(txRollbacks);
+        out.writeFloat(avgTxRollbackTime);
+        out.writeLong(puts);
+        out.writeFloat(avgPutTime);
+        out.writeLong(removals);
+        out.writeFloat(avgRemovalTime);
+        out.writeLong(evictions);
+        out.writeInt(readsPerSec);
+        out.writeInt(putsPerSec);
+        out.writeInt(removalsPerSec);
+        out.writeInt(commitsPerSec);
+        out.writeInt(rollbacksPerSec);
+        out.writeInt(dhtEvictQueueCurrSize);
+        out.writeInt(txThreadMapSize);
+        out.writeInt(txXidMapSize);
+        out.writeInt(txCommitQueueSize);
+        out.writeInt(txPrepareQueueSize);
+        out.writeInt(txStartVerCountsSize);
+        out.writeInt(txCommittedVersionsSize);
+        out.writeInt(txRolledbackVersionsSize);
+        out.writeInt(txDhtThreadMapSize);
+        out.writeInt(txDhtXidMapSize);
+        out.writeInt(txDhtCommitQueueSize);
+        out.writeInt(txDhtPrepareQueueSize);
+        out.writeInt(txDhtStartVerCountsSize);
+        out.writeInt(txDhtCommittedVersionsSize);
+        out.writeInt(txDhtRolledbackVersionsSize);
+        out.writeLong(offHeapAllocatedSize);
+        out.writeLong(offHeapEntriesCnt);
+        out.writeObject(qryMetrics);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        mode = CacheMode.fromOrdinal(in.readByte());
+        sys = in.readBoolean();
+        size = in.readInt();
+        keySize = in.readInt();
+        reads = in.readLong();
+        avgReadTime = in.readFloat();
+        writes = in.readLong();
+        hits = in.readLong();
+        misses = in.readLong();
+        txCommits = in.readLong();
+        avgTxCommitTime = in.readFloat();
+        txRollbacks = in.readLong();
+        avgTxRollbackTime = in.readFloat();
+        puts = in.readLong();
+        avgPutTime = in.readFloat();
+        removals = in.readLong();
+        avgRemovalTime = in.readFloat();
+        evictions = in.readLong();
+        readsPerSec = in.readInt();
+        putsPerSec = in.readInt();
+        removalsPerSec = in.readInt();
+        commitsPerSec = in.readInt();
+        rollbacksPerSec = in.readInt();
+        dhtEvictQueueCurrSize = in.readInt();
+        txThreadMapSize = in.readInt();
+        txXidMapSize = in.readInt();
+        txCommitQueueSize = in.readInt();
+        txPrepareQueueSize = in.readInt();
+        txStartVerCountsSize = in.readInt();
+        txCommittedVersionsSize = in.readInt();
+        txRolledbackVersionsSize = in.readInt();
+        txDhtThreadMapSize = in.readInt();
+        txDhtXidMapSize = in.readInt();
+        txDhtCommitQueueSize = in.readInt();
+        txDhtPrepareQueueSize = in.readInt();
+        txDhtStartVerCountsSize = in.readInt();
+        txDhtCommittedVersionsSize = in.readInt();
+        txDhtRolledbackVersionsSize = in.readInt();
+        offHeapAllocatedSize = in.readLong();
+        offHeapEntriesCnt = in.readLong();
+        qryMetrics = (VisorQueryMetrics)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheMetrics.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index 4fd85de..5cc8154 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -29,20 +29,19 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Task that collect cache metrics from all nodes.
  */
 @GridInternal
-public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiTuple<Boolean, Collection<String>>,
+public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<VisorCacheMetricsCollectorTaskArg,
     Iterable<VisorCacheAggregatedMetrics>, Collection<VisorCacheMetrics>> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Override protected VisorCacheMetricsCollectorJob job(IgniteBiTuple<Boolean, Collection<String>> arg) {
+    @Override protected VisorCacheMetricsCollectorJob job(VisorCacheMetricsCollectorTaskArg arg) {
         return new VisorCacheMetricsCollectorJob(arg, debug);
     }
 
@@ -55,15 +54,15 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
                 Collection<VisorCacheMetrics> cms = res.getData();
 
                 for (VisorCacheMetrics cm : cms) {
-                    VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.name());
+                    VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.getName());
 
                     if (am == null) {
-                        am = VisorCacheAggregatedMetrics.from(cm);
+                        am = new VisorCacheAggregatedMetrics(cm);
 
-                        grpAggrMetrics.put(cm.name(), am);
+                        grpAggrMetrics.put(cm.getName(), am);
                     }
 
-                    am.metrics().put(res.getNode().id(), cm);
+                    am.getMetrics().put(res.getNode().id(), cm);
                 }
             }
         }
@@ -76,7 +75,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
      * Job that collect cache metrics from node.
      */
     private static class VisorCacheMetricsCollectorJob
-        extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Collection<VisorCacheMetrics>> {
+        extends VisorJob<VisorCacheMetricsCollectorTaskArg, Collection<VisorCacheMetrics>> {
 
         /** */
         private static final long serialVersionUID = 0L;
@@ -87,19 +86,17 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
          * @param arg Whether to collect metrics for all caches or for specified cache name only.
          * @param debug Debug flag.
          */
-        private VisorCacheMetricsCollectorJob(IgniteBiTuple<Boolean, Collection<String>> arg, boolean debug) {
+        private VisorCacheMetricsCollectorJob(VisorCacheMetricsCollectorTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected Collection<VisorCacheMetrics> run(final IgniteBiTuple<Boolean, Collection<String>> arg) {
+        @Override protected Collection<VisorCacheMetrics> run(final VisorCacheMetricsCollectorTaskArg arg) {
             assert arg != null;
 
-            Boolean showSysCaches = arg.get1();
+            Boolean showSysCaches = arg.isShowSystemCaches();
 
-            assert showSysCaches != null;
-
-            Collection<String> cacheNames = arg.get2();
+            Collection<String> cacheNames = arg.getCacheNames();
 
             assert cacheNames != null;
 
@@ -115,9 +112,9 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
                 if (ca.context().started()) {
                     String cacheName = ca.getName();
 
-                    VisorCacheMetrics cm = new VisorCacheMetrics().from(ignite, cacheName);
+                    VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName);
 
-                    if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.system()))
+                    if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem()))
                         res.add(cm);
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
new file mode 100644
index 0000000..9529ab4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTaskArg.java
@@ -0,0 +1,87 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Cache start arguments.
+ */
+public class VisorCacheMetricsCollectorTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Collect metrics for system caches. */
+    private boolean showSysCaches;
+
+    /** Cache names to collect metrics. */
+    private List<String> cacheNames;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheMetricsCollectorTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param showSysCaches Collect metrics for system caches.
+     * @param cacheNames Cache names to collect metrics.
+     */
+    public VisorCacheMetricsCollectorTaskArg(boolean showSysCaches, List<String> cacheNames) {
+        this.showSysCaches = showSysCaches;
+        this.cacheNames = cacheNames;
+    }
+
+    /**
+     * @return Collect metrics for system caches
+     */
+    public boolean isShowSystemCaches() {
+        return showSysCaches;
+    }
+
+    /**
+     * @return Cache names to collect metrics
+     */
+    public List<String> getCacheNames() {
+        return cacheNames;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(showSysCaches);
+        U.writeCollection(out, cacheNames);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        showSysCaches = in.readBoolean();
+        cacheNames = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheMetricsCollectorTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
index 8771da4..ae55f83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheNearConfiguration.java
@@ -17,12 +17,15 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.processors.cache.GridCacheUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
@@ -31,7 +34,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.evictionPolic
 /**
  * Data transfer object for near cache configuration properties.
  */
-public class VisorCacheNearConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheNearConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -48,54 +51,74 @@ public class VisorCacheNearConfiguration implements Serializable, LessNamingBean
     private Integer nearEvictMaxSize;
 
     /**
-     * @param ccfg Cache configuration.
-     * @return Data transfer object for near cache configuration properties.
+     * Default constructor.
      */
-    public static VisorCacheNearConfiguration from(CacheConfiguration ccfg) {
-        VisorCacheNearConfiguration cfg = new VisorCacheNearConfiguration();
+    public VisorCacheNearConfiguration() {
+        // No-op.
+    }
 
-        cfg.nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
+    /**
+     * Create data transfer object for near cache configuration properties.
+     *
+     * @param ccfg Cache configuration.
+     */
+    public VisorCacheNearConfiguration(CacheConfiguration ccfg) {
+        nearEnabled = GridCacheUtils.isNearEnabled(ccfg);
 
-        if (cfg.nearEnabled) {
+        if (nearEnabled) {
             NearCacheConfiguration nccfg = ccfg.getNearConfiguration();
 
-            cfg.nearStartSize = nccfg.getNearStartSize();
-            cfg.nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
-            cfg.nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
+            nearStartSize = nccfg.getNearStartSize();
+            nearEvictPlc = compactClass(nccfg.getNearEvictionPolicy());
+            nearEvictMaxSize = evictionPolicyMaxSize(nccfg.getNearEvictionPolicy());
         }
-
-        return cfg;
     }
 
     /**
      * @return {@code true} if near cache enabled.
      */
-    public boolean nearEnabled() {
+    public boolean isNearEnabled() {
         return nearEnabled;
     }
 
     /**
      * @return Near cache start size.
      */
-    public int nearStartSize() {
+    public int getNearStartSize() {
         return nearStartSize;
     }
 
     /**
      * @return Near cache eviction policy.
      */
-    @Nullable public String nearEvictPolicy() {
+    @Nullable public String getNearEvictPolicy() {
         return nearEvictPlc;
     }
 
     /**
      * @return Near cache eviction policy max size.
      */
-    @Nullable public Integer nearEvictMaxSize() {
+    @Nullable public Integer getNearEvictMaxSize() {
         return nearEvictMaxSize;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(nearEnabled);
+        out.writeInt(nearStartSize);
+        U.writeString(out, nearEvictPlc);
+        out.writeObject(nearEvictMaxSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        nearEnabled = in.readBoolean();
+        nearStartSize = in.readInt();
+        nearEvictPlc = U.readString(in);
+        nearEvictMaxSize = (Integer)in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheNearConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
index e73d1f6..b57bc53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartition.java
@@ -17,58 +17,67 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for information about keys in cache partition.
  */
-public class VisorCachePartition implements Serializable, LessNamingBean {
+public class VisorCachePartition extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** */
-    private int part;
+    private int partId;
 
     /** */
-    private int heap;
+    private long cnt;
 
-    /** */
-    private long offheap;
+    /**
+     * Default constructor.
+     */
+    public VisorCachePartition() {
+        // No-op.
+    }
 
     /**
      * Full constructor.
      *
-     * @param part Partition id.
-     * @param heap Number of keys in heap.
-     * @param offheap Number of keys in offheap.
+     * @param partId Partition id.
+     * @param cnt Number of keys in partition.
      */
-    public VisorCachePartition(int part, int heap, long offheap) {
-        this.part = part;
-        this.heap = heap;
-        this.offheap = offheap;
+    public VisorCachePartition(int partId, long cnt) {
+        this.partId = partId;
+        this.cnt = cnt;
     }
 
     /**
      * @return Partition id.
      */
-    public int partition() {
-        return part;
+    public int getPartitionId() {
+        return partId;
     }
 
     /**
-     * @return Number of keys in heap.
+     * @return Number of keys in partition.
      */
-    public int heap() {
-        return heap;
+    public long getCount() {
+        return cnt;
     }
 
-    /**
-     * @return Number of keys in offheap.
-     */
-    public long offheap() {
-        return offheap;
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeInt(partId);
+        out.writeLong(cnt);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        partId = in.readInt();
+        cnt = in.readLong();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
index f8e54a9..2713179 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitions.java
@@ -17,16 +17,19 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for information about cache partitions.
  */
-public class VisorCachePartitions implements Serializable, LessNamingBean {
+public class VisorCachePartitions extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -47,40 +50,50 @@ public class VisorCachePartitions implements Serializable, LessNamingBean {
     /**
      * Add primary partition descriptor.
      *
-     * @param part Partition id.
-     * @param heap Number of primary keys in heap.
-     * @param offheap Number of primary keys in offheap.
+     * @param partId Partition id.
+     * @param cnt Number of primary keys in partition.
      */
-    public void addPrimary(int part, int heap, long offheap) {
-       primary.add(new VisorCachePartition(part, heap, offheap));
+    public void addPrimary(int partId, long cnt) {
+       primary.add(new VisorCachePartition(partId, cnt));
     }
 
     /**
      * Add backup partition descriptor.
      *
-     * @param part Partition id.
-     * @param heap Number of backup keys in heap.
-     * @param offheap Number of backup keys in offheap.
+     * @param partId Partition id.
+     * @param cnt Number of backup keys in partition.
      */
-    public void addBackup(int part, int heap, long offheap) {
-       backup.add(new VisorCachePartition(part, heap, offheap));
+    public void addBackup(int partId, long cnt) {
+       backup.add(new VisorCachePartition(partId, cnt));
     }
 
     /**
      * @return Get list of primary partitions.
      */
-    public List<VisorCachePartition> primary() {
+    public List<VisorCachePartition> getPrimary() {
         return primary;
     }
 
     /**
      * @return Get list of backup partitions.
      */
-    public List<VisorCachePartition> backup() {
+    public List<VisorCachePartition> getBackup() {
         return backup;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeCollection(out, primary);
+        U.writeCollection(out, backup);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        primary = U.readList(in);
+        backup = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCachePartitions.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
index 6d3a9d8..b7ca975 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java
@@ -45,7 +45,8 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName;
  * Task that collect keys distribution in partitions.
  */
 @GridInternal
-public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUID, VisorCachePartitions>, VisorCachePartitions> {
+public class VisorCachePartitionsTask extends VisorMultiNodeTask<String,
+    Map<UUID, VisorCachePartitions>, VisorCachePartitions> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -125,9 +126,9 @@ public class VisorCachePartitionsTask extends VisorMultiNodeTask<String, Map<UUI
 
                         // Pass -1 as topology version in order not to wait for topology version.
                         if (part.primary(AffinityTopologyVersion.NONE))
-                            parts.addPrimary(p, sz, 0);
+                            parts.addPrimary(p, sz);
                         else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE))
-                            parts.addBackup(p, sz, 0);
+                            parts.addBackup(p, sz);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
deleted file mode 100644
index a21cf43..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java
+++ /dev/null
@@ -1,122 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-/**
- * Data transfer object for cache query configuration data.
- */
-public class VisorCacheQueryConfiguration implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private String[] sqlFuncClss;
-
-    /** */
-    private long longQryWarnTimeout;
-
-    /** */
-    private boolean sqlEscapeAll;
-
-    /** */
-    private String[] indexedTypes;
-
-    /** */
-    private int sqlOnheapRowCacheSize;
-
-    /** */
-    private String sqlSchema;
-
-    /**
-     * @param clss Classes to compact.
-     */
-    private static String[] compactClasses(Class<?>[] clss) {
-        if (clss == null)
-            return null;
-
-        int len = clss.length;
-
-        String[] res = new String[len];
-
-        for (int i = 0; i < len; i++)
-            res[i] = U.compact(clss[i].getName());
-
-        return res;
-    }
-
-    /**
-     * @param ccfg Cache configuration.
-     * @return Fill data transfer object with cache query configuration data.
-     */
-    public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) {
-        sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses());
-        longQryWarnTimeout = ccfg.getLongQueryWarningTimeout();
-        sqlEscapeAll = ccfg.isSqlEscapeAll();
-        indexedTypes = compactClasses(ccfg.getIndexedTypes());
-        sqlSchema = ccfg.getSqlSchema();
-
-        return this;
-    }
-
-    /**
-     * @return Classes names with SQL functions.
-     */
-    public String[] sqlFunctionClasses() {
-        return sqlFuncClss;
-    }
-
-    /**
-     * @return Timeout in milliseconds after which long query warning will be printed.
-     */
-    public long longQueryWarningTimeout() {
-        return longQryWarnTimeout;
-    }
-
-    /**
-     * @return {@code true} if SQL engine generate SQL statements with escaped names.
-     */
-    public boolean sqlEscapeAll() {
-        return sqlEscapeAll;
-    }
-
-    /**
-     * @return Array of key and value classes names to be indexed.
-     */
-    public String[] indexedTypes() {
-        return indexedTypes;
-    }
-
-    /**
-     * @return Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
-     */
-    public int sqlOnheapRowCacheSize() {
-        return sqlOnheapRowCacheSize;
-    }
-
-    /**
-     * @return Schema name, which is used by SQL engine for SQL statements generation.
-     */
-    public String sqlSchema() {
-        return sqlSchema;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
deleted file mode 100644
index dc46906..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
+++ /dev/null
@@ -1,167 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.cache.query.QueryDetailMetrics;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for cache query detail metrics.
- */
-public class VisorCacheQueryDetailMetrics implements Serializable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Query type. */
-    private String qryType;
-
-    /** Textual query representation. */
-    private String qry;
-
-    /** Cache name. */
-    private String cache;
-
-    /** Number of executions. */
-    private int execs;
-
-    /** Number of completions executions. */
-    private int completions;
-
-    /** Number of failures. */
-    private int failures;
-
-    /** Minimum time of execution. */
-    private long minTime;
-
-    /** Maximum time of execution. */
-    private long maxTime;
-
-    /** Average time of execution. */
-    private double avgTime;
-
-    /** Sum of execution time of completions time. */
-    private long totalTime;
-
-    /** Sum of execution time of completions time. */
-    private long lastStartTime;
-
-    /**
-     * @param m Cache query metrics.
-     * @return Data transfer object for given cache metrics.
-     */
-    public VisorCacheQueryDetailMetrics from(QueryDetailMetrics m) {
-        qryType = m.queryType();
-        qry = m.query();
-        cache = m.cache();
-
-        execs = m.executions();
-        completions = m.completions();
-        failures = m.failures();
-
-        minTime = m.minimumTime();
-        maxTime = m.maximumTime();
-        avgTime = m.averageTime();
-        totalTime = m.totalTime();
-        lastStartTime = m.lastStartTime();
-
-        return this;
-    }
-
-    /**
-     * @return Query type
-     */
-    public String getQueryType() {
-        return qryType;
-    }
-
-    /**
-     * @return Query type
-     */
-    public String getQuery() {
-        return qry;
-    }
-
-    /**
-     * @return Cache name where query was executed.
-     */
-    public String getCache() {
-        return cache;
-    }
-
-    /**
-     * @return Number of executions.
-     */
-    public int getExecutions() {
-        return execs;
-    }
-
-    /**
-     * @return Number of completed executions.
-     */
-    public int getCompletions() {
-        return completions;
-    }
-
-    /**
-     * @return Total number of times a query execution failed.
-     */
-    public int getFailures() {
-        return failures;
-    }
-
-    /**
-     * @return Minimum execution time of query.
-     */
-    public long getMinimumTime() {
-        return minTime;
-    }
-
-    /**
-     * @return Maximum execution time of query.
-     */
-    public long getMaximumTime() {
-        return maxTime;
-    }
-
-    /**
-     * @return Average execution time of query.
-     */
-    public double getAverageTime() {
-        return avgTime;
-    }
-
-    /**
-     * @return Total time of all query executions.
-     */
-    public long getTotalTime() {
-        return totalTime;
-    }
-
-    /**
-     * @return Latest time query was stared.
-     */
-    public long getLastStartTime() {
-        return lastStartTime;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorCacheQueryDetailMetrics.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
deleted file mode 100644
index aee5063..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
+++ /dev/null
@@ -1,146 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.query.QueryDetailMetrics;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
-
-/**
- * Task to collect cache query metrics.
- */
-@GridInternal
-public class VisorCacheQueryDetailMetricsCollectorTask extends VisorMultiNodeTask<Long, Collection<VisorCacheQueryDetailMetrics>,
-    Collection<? extends QueryDetailMetrics>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCacheQueryDetailMetricsCollectorJob job(Long arg) {
-        return new VisorCacheQueryDetailMetricsCollectorJob(arg, debug);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Collection<VisorCacheQueryDetailMetrics> reduce0(List<ComputeJobResult> results)
-        throws IgniteException {
-        Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> taskRes = new HashMap<>();
-
-        for (ComputeJobResult res : results) {
-            if (res.getException() != null)
-                throw res.getException();
-
-            Collection<GridCacheQueryDetailMetricsAdapter> metrics = res.getData();
-
-            VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics);
-        }
-
-        Collection<GridCacheQueryDetailMetricsAdapter> aggMetrics = taskRes.values();
-
-        Collection<VisorCacheQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
-
-        for (GridCacheQueryDetailMetricsAdapter m : aggMetrics)
-            res.add(new VisorCacheQueryDetailMetrics().from(m));
-
-        return res;
-    }
-
-    /**
-     * Job that will actually collect query metrics.
-     */
-    private static class VisorCacheQueryDetailMetricsCollectorJob extends VisorJob<Long, Collection<? extends QueryDetailMetrics>> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * Create job with specified argument.
-         *
-         * @param arg Last time when metrics were collected.
-         * @param debug Debug flag.
-         */
-        protected VisorCacheQueryDetailMetricsCollectorJob(@Nullable Long arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /**
-         * @param since Time when metrics were collected last time.
-         * @param res Response.
-         * @param metrics Metrics.
-         */
-        private static void aggregateMetrics(long since, Map<GridCacheQueryDetailMetricsKey,
-            GridCacheQueryDetailMetricsAdapter> res, Collection<GridCacheQueryDetailMetricsAdapter> metrics) {
-            for (GridCacheQueryDetailMetricsAdapter m : metrics) {
-                if (m.lastStartTime() > since) {
-                    GridCacheQueryDetailMetricsKey key = m.key();
-
-                    GridCacheQueryDetailMetricsAdapter aggMetrics = res.get(key);
-
-                    res.put(key, aggMetrics == null ? m : aggMetrics.aggregate(m));
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends QueryDetailMetrics> run(@Nullable Long arg) throws IgniteException {
-            assert arg != null;
-
-            IgniteConfiguration cfg = ignite.configuration();
-
-            GridCacheProcessor cacheProc = ignite.context().cache();
-
-            Collection<String> cacheNames = cacheProc.cacheNames();
-
-            Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> aggMetrics = new HashMap<>();
-
-            for (String cacheName : cacheNames) {
-                if (!isSystemCache(cacheName) && !isIgfsCache(cfg, cacheName)) {
-                    IgniteInternalCache<Object, Object> cache = cacheProc.cache(cacheName);
-
-                    if (cache == null || !cache.context().started())
-                        continue;
-
-                    aggregateMetrics(arg, aggMetrics, cache.context().queries().detailMetrics());
-                }
-            }
-
-            return new ArrayList<>(aggMetrics.values());
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheQueryDetailMetricsCollectorJob.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
deleted file mode 100644
index a3d77e5..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
+++ /dev/null
@@ -1,102 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import java.io.Serializable;
-import org.apache.ignite.cache.query.QueryMetrics;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Data transfer object for cache query metrics.
- */
-public class VisorCacheQueryMetrics implements Serializable, LessNamingBean {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Minimum execution time of query. */
-    private long minTime;
-
-    /** Maximum execution time of query. */
-    private long maxTime;
-
-    /** Average execution time of query. */
-    private double avgTime;
-
-    /** Number of executions. */
-    private int execs;
-
-    /** Total number of times a query execution failed. */
-    private int fails;
-
-    /**
-     * @param m Cache query metrics.
-     * @return Data transfer object for given cache metrics.
-     */
-    public static VisorCacheQueryMetrics from(QueryMetrics m) {
-        VisorCacheQueryMetrics qm = new VisorCacheQueryMetrics();
-
-        qm.minTime = m.minimumTime();
-        qm.maxTime = m.maximumTime();
-        qm.avgTime = m.averageTime();
-        qm.execs = m.executions();
-        qm.fails = m.fails();
-
-        return qm;
-    }
-
-    /**
-     * @return Minimum execution time of query.
-     */
-    public long minimumTime() {
-        return minTime;
-    }
-
-    /**
-     * @return Maximum execution time of query.
-     */
-    public long maximumTime() {
-        return maxTime;
-    }
-
-    /**
-     * @return Average execution time of query.
-     */
-    public double averageTime() {
-        return avgTime;
-    }
-
-    /**
-     * @return Number of executions.
-     */
-    public int executions() {
-        return execs;
-    }
-
-    /**
-     * @return Total number of times a query execution failed.
-     */
-    public int fails() {
-        return fails;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorCacheQueryMetrics.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
index 4c28d00..618fa97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheRebalanceConfiguration.java
@@ -17,25 +17,25 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.cache.CacheRebalanceMode;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for cache rebalance configuration properties.
  */
-public class VisorCacheRebalanceConfiguration implements Serializable, LessNamingBean {
+public class VisorCacheRebalanceConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Cache rebalance mode. */
     private CacheRebalanceMode mode;
 
-    /** Rebalance thread pool size. */
-    private int threadPoolSize;
-
     /** Cache rebalance batch size. */
     private int batchSize;
 
@@ -49,65 +49,78 @@ public class VisorCacheRebalanceConfiguration implements Serializable, LessNamin
     private long timeout;
 
     /**
-     * @param ccfg Cache configuration.
-     * @return Data transfer object for rebalance configuration properties.
+     * Default constructor.
      */
-    public static VisorCacheRebalanceConfiguration from(CacheConfiguration ccfg) {
-        VisorCacheRebalanceConfiguration cfg = new VisorCacheRebalanceConfiguration();
-
-        cfg.mode = ccfg.getRebalanceMode();
-        cfg.batchSize = ccfg.getRebalanceBatchSize();
-        cfg.threadPoolSize = ccfg.getRebalanceThreadPoolSize();
-        cfg.partitionedDelay = ccfg.getRebalanceDelay();
-        cfg.throttle = ccfg.getRebalanceThrottle();
-        cfg.timeout = ccfg.getRebalanceTimeout();
-
-        return cfg;
+    public VisorCacheRebalanceConfiguration() {
+        // No-op.
     }
 
     /**
-     * @return Cache rebalance mode.
+     * Create data transfer object for rebalance configuration properties.
+     * @param ccfg Cache configuration.
      */
-    public CacheRebalanceMode mode() {
-        return mode;
+    public VisorCacheRebalanceConfiguration(CacheConfiguration ccfg) {
+        mode = ccfg.getRebalanceMode();
+        batchSize = ccfg.getRebalanceBatchSize();
+        partitionedDelay = ccfg.getRebalanceDelay();
+        throttle = ccfg.getRebalanceThrottle();
+        timeout = ccfg.getRebalanceTimeout();
     }
 
     /**
-     * @return Rebalance thread pool size.
+     * @return Cache rebalance mode.
      */
-    public int threadPoolSize() {
-        return threadPoolSize;
+    public CacheRebalanceMode getMode() {
+        return mode;
     }
 
     /**
      * @return Cache rebalance batch size.
      */
-    public int batchSize() {
+    public int getBatchSize() {
         return batchSize;
     }
 
     /**
      * @return Rebalance partitioned delay.
      */
-    public long partitionedDelay() {
+    public long getPartitionedDelay() {
         return partitionedDelay;
     }
 
     /**
      * @return Time in milliseconds to wait between rebalance messages.
      */
-    public long throttle() {
+    public long getThrottle() {
         return throttle;
     }
 
     /**
      * @return Rebalance timeout.
      */
-    public long timeout() {
+    public long getTimeout() {
         return timeout;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeEnum(out, mode);
+        out.writeInt(batchSize);
+        out.writeLong(partitionedDelay);
+        out.writeLong(throttle);
+        out.writeLong(timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        mode = CacheRebalanceMode.fromOrdinal(in.readByte());
+        batchSize = in.readInt();
+        partitionedDelay = in.readLong();
+        throttle = in.readLong();
+        timeout = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCacheRebalanceConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
deleted file mode 100644
index 84aae9d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
+++ /dev/null
@@ -1,71 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorOneNodeTask;
-
-/**
- * Reset query detail metrics.
- */
-@GridInternal
-public class VisorCacheResetQueryDetailMetricsTask extends VisorOneNodeTask<Void, Void> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCacheResetQueryDetailMetricsJob job(Void arg) {
-        return new VisorCacheResetQueryDetailMetricsJob(arg, debug);
-    }
-
-    /**
-     * Job that reset query detail metrics.
-     */
-    private static class VisorCacheResetQueryDetailMetricsJob extends VisorJob<Void, Void> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * @param arg Task argument.
-         * @param debug Debug flag.
-         */
-        private VisorCacheResetQueryDetailMetricsJob(Void arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Void run(Void arg) {
-            for (String cacheName : ignite.cacheNames()) {
-                IgniteCache cache = ignite.cache(cacheName);
-
-                if (cache != null)
-                    cache.resetQueryDetailMetrics();
-            }
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheResetQueryDetailMetricsJob.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
deleted file mode 100644
index 5ba6156..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
+++ /dev/null
@@ -1,69 +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.
- */
-
-package org.apache.ignite.internal.visor.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorOneNodeTask;
-
-/**
- * Reset compute grid query metrics.
- */
-@GridInternal
-public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Void> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCacheResetQueryMetricsJob job(String arg) {
-        return new VisorCacheResetQueryMetricsJob(arg, debug);
-    }
-
-    /**
-     * Job that reset cache query metrics.
-     */
-    private static class VisorCacheResetQueryMetricsJob extends VisorJob<String, Void> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * @param arg Cache name to reset query metrics for.
-         * @param debug Debug flag.
-         */
-        private VisorCacheResetQueryMetricsJob(String arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Void run(String cacheName) {
-            IgniteCache cache = ignite.cache(cacheName);
-
-            if (cache != null)
-                cache.resetQueryMetrics();
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheResetQueryMetricsJob.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
new file mode 100644
index 0000000..cd4c95c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlIndexMetadata.java
@@ -0,0 +1,115 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for cache SQL index metadata.
+ */
+public class VisorCacheSqlIndexMetadata extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private String name;
+
+    /** */
+    private List<String> fields;
+
+    /** */
+    private List<String> descendings;
+
+    /** */
+    private boolean unique;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheSqlIndexMetadata() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object.
+     * 
+     * @param meta SQL index metadata.
+     */
+    public VisorCacheSqlIndexMetadata(GridCacheSqlIndexMetadata meta) {
+        name = meta.name();
+        fields = toList(meta.fields());
+        descendings = toList(meta.descendings());
+        unique = meta.unique();
+    }
+
+    /**
+     * @return Index name.
+     */
+    public String getName() {
+        return name; 
+    }
+    
+    /**
+     * @return Indexed fields names.
+     */
+    public List<String> getFields() {
+        return fields;
+    }
+
+    /**
+     * @return Descendings.
+     */
+    public List<String> getDescendings() {
+        return descendings;
+    }
+
+    /**
+     * @return {@code True} if index is unique, {@code false} otherwise.
+     */
+    public boolean isUnique() {
+        return unique;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeCollection(out, fields);
+        U.writeCollection(out, descendings);
+        out.writeBoolean(unique);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        fields = U.readList(in);
+        descendings = U.readList(in);
+        unique = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheSqlIndexMetadata.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
new file mode 100644
index 0000000..c7ff3a7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheSqlMetadata.java
@@ -0,0 +1,162 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for cache SQL metadata.
+ */
+public class VisorCacheSqlMetadata extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private String cacheName;
+
+    /** */
+    private List<String> types;
+
+    /** */
+    private Map<String, String> keyClasses;
+
+    /** */
+    private Map<String, String> valClasses;
+
+    /** */
+    private Map<String, Map<String, String>> fields;
+
+    /** */
+    private Map<String, List<VisorCacheSqlIndexMetadata>> indexes;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheSqlMetadata() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object.
+     *
+     * @param meta Cache SQL metadata.
+     */
+    public VisorCacheSqlMetadata(GridCacheSqlMetadata meta) {
+        cacheName = meta.cacheName();
+        types = toList(meta.types());
+        keyClasses = meta.keyClasses();
+        valClasses = meta.valClasses();
+        fields = meta.fields();
+        indexes = new HashMap<>();
+
+        Map<String, Collection<GridCacheSqlIndexMetadata>> src = meta.indexes();
+
+        if (src != null) {
+            for (Map.Entry<String, Collection<GridCacheSqlIndexMetadata>> entry: src.entrySet()) {
+                Collection<GridCacheSqlIndexMetadata> idxs = entry.getValue();
+
+                List<VisorCacheSqlIndexMetadata> res = new ArrayList<>(idxs.size());
+
+                for (GridCacheSqlIndexMetadata idx : idxs)
+                    res.add(new VisorCacheSqlIndexMetadata(idx));
+
+                indexes.put(entry.getKey(), res);
+            }
+        }
+    }
+
+    /**
+     * @return Cache name.
+     */
+    public String getCacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @return Collection of available types.
+     */
+    public List<String> getTypes() {
+        return types;
+    }
+
+    /**
+     * @return Key classes.
+     */
+    public Map<String, String> getKeyClasses() {
+        return keyClasses;
+    }
+
+    /**
+     * @return Value classes.
+     */
+    public Map<String, String> getValueClasses() {
+        return valClasses;
+    }
+
+    /**
+     * @return Fields.
+     */
+    public Map<String, Map<String, String>> getFields() {
+        return fields;
+    }
+
+    /**
+     * @return Indexes.
+     */
+    public Map<String, List<VisorCacheSqlIndexMetadata>> getIndexes() {
+        return indexes;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, cacheName);
+        U.writeCollection(out, types);
+        IgfsUtils.writeStringMap(out, keyClasses);
+        IgfsUtils.writeStringMap(out, valClasses);
+        U.writeMap(out, fields);
+        U.writeMap(out, indexes);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        cacheName = U.readString(in);
+        types = U.readList(in);
+        keyClasses = IgfsUtils.readStringMap(in);
+        valClasses = IgfsUtils.readStringMap(in);
+        fields = U.readMap(in);
+        indexes = U.readMap(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheSqlMetadata.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
new file mode 100644
index 0000000..a2fd518
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartArg.java
@@ -0,0 +1,100 @@
+/*
+ * 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.internal.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Cache start arguments.
+ */
+public class VisorCacheStartArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private boolean near;
+
+    /** */
+    private String name;
+
+    /** */
+    private String cfg;
+
+    /**
+     * Default constructor.
+     */
+    public VisorCacheStartArg() {
+        // No-op.
+    }
+
+    /**
+     * @param near {@code true} if near cache should be started.
+     * @param name Name for near cache.
+     * @param cfg Cache XML configuration.
+     */
+    public VisorCacheStartArg(boolean near, String name, String cfg) {
+        this.near = near;
+        this.name = name;
+        this.cfg = cfg;
+    }
+
+    /**
+     * @return {@code true} if near cache should be started.
+     */
+    public boolean isNear() {
+        return near;
+    }
+
+    /**
+     * @return Name for near cache.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @return Cache XML configuration.
+     */
+    public String getConfiguration() {
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(near);
+        U.writeString(out, name);
+        U.writeString(out, cfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        near = in.readBoolean();
+        name = U.readString(in);
+        cfg = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheStartArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
index 758f39a..af51a38 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStartTask.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.visor.cache;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.Serializable;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,8 +40,7 @@ import org.jetbrains.annotations.Nullable;
  * Task that start cache or near cache with specified configuration.
  */
 @GridInternal
-public class VisorCacheStartTask extends
-    VisorMultiNodeTask<VisorCacheStartTask.VisorCacheStartArg, Map<UUID, IgniteException>, Void> {
+public class VisorCacheStartTask extends VisorMultiNodeTask<VisorCacheStartArg, Map<UUID, IgniteException>, Void> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -63,56 +61,6 @@ public class VisorCacheStartTask extends
     }
 
     /**
-     * Cache start arguments.
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class VisorCacheStartArg implements Serializable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private final boolean near;
-
-        /** */
-        private final String name;
-
-        /** */
-        private final String cfg;
-
-        /**
-         * @param near {@code true} if near cache should be started.
-         * @param name Name for near cache.
-         * @param cfg Cache XML configuration.
-         */
-        public VisorCacheStartArg(boolean near, String name, String cfg) {
-            this.near = near;
-            this.name = name;
-            this.cfg = cfg;
-        }
-
-        /**
-         * @return {@code true} if near cache should be started.
-         */
-        public boolean near() {
-            return near;
-        }
-
-        /**
-         * @return Name for near cache.
-         */
-        public String name() {
-            return name;
-        }
-
-        /**
-         * @return Cache XML configuration.
-         */
-        public String configuration() {
-            return cfg;
-        }
-    }
-
-    /**
      * Job that start cache or near cache with specified configuration.
      */
     private static class VisorCacheStartJob extends VisorJob<VisorCacheStartArg, Void> {
@@ -131,15 +79,15 @@ public class VisorCacheStartTask extends
 
         /** {@inheritDoc} */
         @Override protected Void run(VisorCacheStartArg arg) throws IgniteException {
-            String cfg = arg.configuration();
+            String cfg = arg.getConfiguration();
 
             assert !F.isEmpty(cfg);
 
             try (ByteArrayInputStream bais = new ByteArrayInputStream(cfg.getBytes())) {
-                if (arg.near) {
+                if (arg.isNear()) {
                     NearCacheConfiguration nearCfg = Ignition.loadSpringBean(bais, "nearCacheConfiguration");
 
-                    ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.name()), nearCfg);
+                    ignite.getOrCreateNearCache(VisorTaskUtils.unescapeName(arg.getName()), nearCfg);
                 }
                 else {
                     CacheConfiguration cacheCfg = Ignition.loadSpringBean(bais, "cacheConfiguration");


[37/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
index 396f258..8550e2c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
@@ -45,7 +45,6 @@ import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -224,7 +223,6 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
index 3a55f47..a1a2f89 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
@@ -176,8 +176,6 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
 
             cache.remove(key);
 
-            atomicClockModeDelay(cache);
-
             try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(null)) {
                 streamer.allowOverwrite(true);
 
@@ -345,8 +343,6 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
 
             cache.remove(key);
 
-            atomicClockModeDelay(cache);
-
             try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(null)) {
                 streamer.allowOverwrite(true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
index 61839b5..ea22f53 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java
@@ -17,11 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -45,11 +43,6 @@ public class IgniteCacheTxPeekModesTest extends IgniteCachePeekModesAbstractTest
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override public void testLocalPeek() throws Exception {
         // TODO: uncomment and re-open ticket if fails.
 //        fail("https://issues.apache.org/jira/browse/IGNITE-1824");

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
index aac7019..6e4bdf9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
@@ -47,11 +46,6 @@ public class IgniteExchangeFutureHistoryTest extends IgniteCacheAbstractTest {
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CacheAtomicWriteOrderMode.PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheTest.java
index 1298607..84beadb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -40,11 +38,6 @@ public class IgniteTopologyValidatorPartitionedAtomicCacheTest extends IgniteTop
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheTest.java
index 460de7f..f48097e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -40,11 +38,6 @@ public class IgniteTopologyValidatorReplicatedAtomicCacheTest extends IgniteTopo
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeOnDiscoveryHistoryOverflowTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeOnDiscoveryHistoryOverflowTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeOnDiscoveryHistoryOverflowTest.java
index b1b5395..b9eab78 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeOnDiscoveryHistoryOverflowTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionsExchangeOnDiscoveryHistoryOverflowTest.java
@@ -21,7 +21,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -35,7 +34,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCOVERY_HISTORY_SIZE;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
@@ -91,11 +89,6 @@ public class PartitionsExchangeOnDiscoveryHistoryOverflowTest extends IgniteCach
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAtomicExecutionContextTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAtomicExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAtomicExecutionContextTest.java
index ef91468..025d345 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAtomicExecutionContextTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAtomicExecutionContextTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.context;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -40,11 +38,6 @@ public class IgniteCacheAtomicExecutionContextTest extends IgniteCacheAbstractEx
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCachePartitionedExecutionContextTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCachePartitionedExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCachePartitionedExecutionContextTest.java
index e4d5989..36d2c2b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCachePartitionedExecutionContextTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCachePartitionedExecutionContextTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.context;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -40,11 +38,6 @@ public class IgniteCachePartitionedExecutionContextTest extends IgniteCacheAbstr
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheReplicatedExecutionContextTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheReplicatedExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheReplicatedExecutionContextTest.java
index 9a644b7..c6e57f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheReplicatedExecutionContextTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheReplicatedExecutionContextTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.context;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -40,11 +38,6 @@ public class IgniteCacheReplicatedExecutionContextTest extends IgniteCacheAbstra
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java
index 1cde3f8..680b134 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheTxExecutionContextTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.context;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 
 /**
@@ -40,11 +38,6 @@ public class IgniteCacheTxExecutionContextTest extends IgniteCacheAbstractExecut
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAtomicNearUpdateTopologyChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAtomicNearUpdateTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAtomicNearUpdateTopologyChangeTest.java
index d19a1a4..931a22e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAtomicNearUpdateTopologyChangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAtomicNearUpdateTopologyChangeTest.java
@@ -17,11 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache.distributed;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.internal.processors.cache.CacheNearUpdateTopologyChangeAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -32,9 +30,4 @@ public class CacheAtomicNearUpdateTopologyChangeTest extends CacheNearUpdateTopo
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index 40d8335..5ecc5aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -92,7 +92,6 @@ import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheRebalanceMode.ASYNC;
@@ -194,7 +193,6 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
         ccfg.setNodeFilter(cacheNodeFilter);
         ccfg.setAffinity(affinityFunction(null));
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setBackups(0);
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
index 90427f5..28f2fe0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheNearDisabledAtomicInvokeRestartSelfTest.java
@@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicLong;
 import javax.cache.processor.EntryProcessorException;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheEntryProcessor;
 import org.apache.ignite.cache.CacheMode;
@@ -69,11 +68,6 @@ public class CacheNearDisabledAtomicInvokeRestartSelfTest extends CacheAbstractR
         return ATOMIC;
     }
 
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CacheAtomicWriteOrderMode.PRIMARY;
-    }
-
     /** */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
index 77619f2..d3a2ca7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
@@ -41,7 +41,6 @@ import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -140,13 +139,6 @@ public class GridCacheMultithreadedFailoverAbstractTest extends GridCommonAbstra
     }
 
     /**
-     * @return Atomic write order mode.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return null;
-    }
-
-    /**
      * @return Number of data nodes.
      */
     protected int dataNodes() {
@@ -225,14 +217,8 @@ public class GridCacheMultithreadedFailoverAbstractTest extends GridCommonAbstra
         if (cacheMode() == PARTITIONED)
             ccfg.setBackups(backups());
 
-        if (atomicityMode() == ATOMIC) {
-            assert atomicWriteOrderMode() != null;
-
-            ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
-        }
-        else {
-            if (cacheMode() == PARTITIONED)
-                ccfg.setNearConfiguration(new NearCacheConfiguration());
+        if (atomicityMode() != ATOMIC && cacheMode() == PARTITIONED) {
+            ccfg.setNearConfiguration(new NearCacheConfiguration());
         }
 
         IgniteConfiguration cfg = getConfiguration(nodeName(idx));

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
index af98e36..51e9564 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
@@ -23,7 +23,6 @@ import java.util.Map;
 import javax.cache.integration.CompletionListenerFuture;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.affinity.Affinity;
@@ -42,7 +41,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jsr166.ConcurrentHashMap8;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -100,8 +98,6 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid
         else
             cc.setCacheStoreFactory(null);
 
-        cc.setAtomicWriteOrderMode(atomicWriteOrderMode());
-
         c.setCacheConfiguration(cc);
 
         return c;
@@ -122,13 +118,6 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid
     }
 
     /**
-     * @return Write order mode for atomic cache.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /**
      * @return {@code True} if near cache is enabled.
      */
     protected abstract boolean nearEnabled();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index b36d01b..a48e1b6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -47,7 +47,6 @@ import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.eclipse.jetty.util.ConcurrentHashSet;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -131,7 +130,6 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(BACKUP_CNT);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeJoinTest.java
index 96dd50c..eeb96c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheAtomicNodeJoinTest.java
@@ -17,21 +17,15 @@
 
 package org.apache.ignite.internal.processors.cache.distributed;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
  *
  */
 public class IgniteCacheAtomicNodeJoinTest extends IgniteCacheNodeJoinAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 
     /** {@inheritDoc} */
     @Override protected CacheAtomicityMode atomicityMode() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 0ef86d8..8fd8b81 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -42,7 +42,7 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteTransactions;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cache.affinity.AffinityFunction;
 import org.apache.ignite.cluster.ClusterNode;
@@ -91,8 +91,6 @@ import org.apache.ignite.transactions.TransactionIsolation;
 import org.eclipse.jetty.util.ConcurrentHashSet;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -150,53 +148,30 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
     /**
      * @throws Exception If failed.
      */
-    public void testAtomicPutAllClockMode() throws Exception {
-        atomicPut(CLOCK, true, null);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testAtomicPutAllPrimaryMode() throws Exception {
-        atomicPut(PRIMARY, true, null);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAtomicPutAllNearEnabledClockMode() throws Exception {
-        atomicPut(CLOCK, true, new NearCacheConfiguration());
+        atomicPut(true, null);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testAtomicPutAllNearEnabledPrimaryMode() throws Exception {
-        atomicPut(PRIMARY, true, new NearCacheConfiguration());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAtomicPutClockMode() throws Exception {
-        atomicPut(CLOCK, false, null);
+        atomicPut(true, new NearCacheConfiguration());
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testAtomicPutPrimaryMode() throws Exception {
-        atomicPut(PRIMARY, false, null);
+        atomicPut(false, null);
     }
 
     /**
-     * @param writeOrder Write order.
      * @param putAll If {@code true} executes putAll.
      * @param nearCfg Near cache configuration.
      * @throws Exception If failed.
      */
-    private void atomicPut(CacheAtomicWriteOrderMode writeOrder,
-        final boolean putAll,
+    private void atomicPut(final boolean putAll,
         @Nullable NearCacheConfiguration nearCfg) throws Exception {
         ccfg = new CacheConfiguration();
 
@@ -204,7 +179,6 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         ccfg.setBackups(1);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(writeOrder);
         ccfg.setRebalanceMode(SYNC);
 
         IgniteEx ignite0 = startGrid(0);
@@ -235,8 +209,6 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
 
-        assertEquals(writeOrder, cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
-
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
                 Thread.currentThread().setName("put-thread");
@@ -315,29 +287,20 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
     /**
      * @throws Exception If failed.
      */
-    public void testAtomicNoRemapClockMode() throws Exception {
-        atomicNoRemap(CLOCK);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testAtomicNoRemapPrimaryMode() throws Exception {
-        atomicNoRemap(PRIMARY);
+        atomicNoRemap();
     }
 
     /**
-     * @param writeOrder Write order.
      * @throws Exception If failed.
      */
-    private void atomicNoRemap(CacheAtomicWriteOrderMode writeOrder) throws Exception {
+    private void atomicNoRemap() throws Exception {
         ccfg = new CacheConfiguration();
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(writeOrder);
         ccfg.setRebalanceMode(SYNC);
 
         IgniteEx ignite0 = startGrid(0);
@@ -369,8 +332,6 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
 
-        assertEquals(writeOrder, cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
-
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
                 Thread.currentThread().setName("put-thread");
@@ -413,29 +374,20 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
     /**
      * @throws Exception If failed.
      */
-    public void testAtomicGetAndPutClockMode() throws Exception {
-        atomicGetAndPut(CLOCK);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testAtomicGetAndPutPrimaryMode() throws Exception {
-        atomicGetAndPut(PRIMARY);
+        atomicGetAndPut();
     }
 
     /**
-     * @param writeOrder Write order.
      * @throws Exception If failed.
      */
-    private void atomicGetAndPut(CacheAtomicWriteOrderMode writeOrder) throws Exception {
+    private void atomicGetAndPut() throws Exception {
         ccfg = new CacheConfiguration();
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(writeOrder);
         ccfg.setRebalanceMode(SYNC);
 
         IgniteEx ignite0 = startGrid(0);
@@ -461,8 +413,6 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
 
-        assertEquals(writeOrder, cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
-
         IgniteInternalFuture<Integer> putFut = GridTestUtils.runAsync(new Callable<Integer>() {
             @Override public Integer call() throws Exception {
                 Thread.currentThread().setName("put-thread");
@@ -1698,57 +1648,49 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testAtomicPrimaryPutAllMultinode() throws Exception {
-        multinode(PRIMARY, TestType.PUT_ALL);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAtomicClockPutAllMultinode() throws Exception {
-        multinode(CLOCK, TestType.PUT_ALL);
+        multinode(ATOMIC, TestType.PUT_ALL);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testOptimisticTxPutAllMultinode() throws Exception {
-        multinode(null, TestType.OPTIMISTIC_TX);
+        multinode(TRANSACTIONAL, TestType.OPTIMISTIC_TX);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testOptimisticSerializableTxPutAllMultinode() throws Exception {
-        multinode(null, TestType.OPTIMISTIC_SERIALIZABLE_TX);
+        multinode(TRANSACTIONAL, TestType.OPTIMISTIC_SERIALIZABLE_TX);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPessimisticTxPutAllMultinode() throws Exception {
-        multinode(null, TestType.PESSIMISTIC_TX);
+        multinode(TRANSACTIONAL, TestType.PESSIMISTIC_TX);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testLockAllMultinode() throws Exception {
-        multinode(null, TestType.LOCK);
+        multinode(TRANSACTIONAL, TestType.LOCK);
     }
 
     /**
-     * @param atomicWriteOrder Write order if test atomic cache.
+     * @param atomicityMode Atomicity mode cache.
      * @param testType Test type.
      * @throws Exception If failed.
      */
-    private void multinode(final CacheAtomicWriteOrderMode atomicWriteOrder, final TestType testType)
+    private void multinode(CacheAtomicityMode atomicityMode, final TestType testType)
         throws Exception {
         ccfg = new CacheConfiguration();
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
-        ccfg.setAtomicityMode(atomicWriteOrder != null ? ATOMIC : TRANSACTIONAL);
-        ccfg.setAtomicWriteOrderMode(atomicWriteOrder);
+        ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setRebalanceMode(SYNC);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
index 1d2cd2d..d25b798 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
@@ -39,7 +39,6 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -67,7 +66,6 @@ public abstract class IgniteCacheMessageRecoveryAbstractTest extends GridCommonA
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode());
         ccfg.setBackups(1);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setNearConfiguration(null);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java
index affac28..86738f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest.java
@@ -23,7 +23,6 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.GridCacheAbstractPartitionedByteArrayValuesSelfTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.junit.Assert.assertArrayEquals;
 
@@ -49,7 +48,6 @@ public abstract class GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest ex
 
         atomicCacheCfg.setName(CACHE_ATOMIC);
         atomicCacheCfg.setAtomicityMode(ATOMIC);
-        atomicCacheCfg.setAtomicWriteOrderMode(PRIMARY);
 
         c.setCacheConfiguration(cacheConfiguration(), atomicCacheCfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
index a49f2c6..b027aea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java
@@ -23,27 +23,17 @@ import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 import javax.cache.CacheException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFullApiSelfTest;
 import org.apache.ignite.testframework.GridTestUtils;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
  * Multi node test for disabled near cache.
  */
 public class GridCacheAtomicFullApiSelfTest extends GridCachePartitionedFullApiSelfTest {
-    /**
-     * @return Write order mode for atomic cache.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
     /** {@inheritDoc} */
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
@@ -64,15 +54,6 @@ public class GridCacheAtomicFullApiSelfTest extends GridCachePartitionedFullApiS
         return false;
     }
 
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
-        CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
-
-        ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
-
-        return ccfg;
-    }
-
     /**
      * @throws Exception If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
index c55cf52..0c7bf3c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
@@ -29,7 +29,6 @@ import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -47,7 +46,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -74,9 +72,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
     private int backups;
 
     /** */
-    private CacheAtomicWriteOrderMode writeOrderMode;
-
-    /** */
     private int lastKey;
 
     /** {@inheritDoc} */
@@ -90,10 +85,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         ccfg.setNearConfiguration(new NearCacheConfiguration());
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setRebalanceMode(SYNC);
-
-        assert writeOrderMode != null;
-
-        ccfg.setAtomicWriteOrderMode(writeOrderMode);
         ccfg.setBackups(backups);
 
         cfg.setCacheConfiguration(ccfg);
@@ -109,8 +100,8 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void testNoBackupsPrimaryWriteOrder() throws Exception {
-        startGrids(0, CacheAtomicWriteOrderMode.PRIMARY);
+    public void testNoBackups() throws Exception {
+        doStartGrids(0);
 
         checkNearCache();
     }
@@ -118,26 +109,8 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void testNoBackupsClockWriteOrder() throws Exception {
-        startGrids(0, CLOCK);
-
-        checkNearCache();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testWithBackupsPrimaryWriteOrder() throws Exception {
-        startGrids(2, CacheAtomicWriteOrderMode.PRIMARY);
-
-        checkNearCache();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testWithBackupsClockWriteOrder() throws Exception {
-        startGrids(2, CLOCK);
+    public void testWithBackups() throws Exception {
+        doStartGrids(2);
 
         checkNearCache();
     }
@@ -236,8 +209,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT; i++) {
             IgniteCache<Integer, Integer> cache = grid(i).cache(null);
 
-            atomicClockModeDelay(cache);
-
             for (Integer key : nearKeys.keySet())
                 nearKeys.put(key, val);
 
@@ -322,8 +293,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT; i++) {
             IgniteCache<Integer, Integer> cache = grid(i).cache(null);
 
-            atomicClockModeDelay(cache);
-
             log.info("Transform [igniteInstanceName=" + grid(i).name() + ", val=" + val + ']');
 
             cache.invoke(nearKey, new Processor(val));
@@ -415,8 +384,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT; i++) {
             IgniteCache<Integer, Integer> cache = grid(i).cache(null);
 
-            atomicClockModeDelay(cache);
-
             for (Integer key : nearKeys)
                 nearKeys.add(key);
 
@@ -536,8 +503,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT; i++) {
             IgniteCache<Integer, Integer> cache = grid(i).cache(null);
 
-            atomicClockModeDelay(cache);
-
             log.info("Put [igniteInstanceName=" + grid(i).name() + ", val=" + val + ']');
 
             cache.put(nearKey, val);
@@ -639,8 +604,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         IgniteCache<Integer, Integer> primaryCache = G.ignite(
             (String)aff.mapKeyToNode(nearKey).attribute(ATTR_IGNITE_INSTANCE_NAME)).cache(null);
 
-        atomicClockModeDelay(cache0);
-
         primaryCache.put(nearKey, 2); // This put should see that near entry evicted on grid0 and remove reader.
 
         for (int i = 0; i < GRID_CNT; i++)
@@ -687,8 +650,6 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         IgniteCache<Integer, Integer> primaryCache = primaryNode.cache(null);
 
-        atomicClockModeDelay(primaryCache);
-
         primaryCache.put(nearKey, 2); // Put from primary, check there are no readers.
 
         checkEntry(primaryNode, nearKey, 2, false);
@@ -825,14 +786,11 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
     /**
      * @param backups Backups number.
-     * @param writeOrderMode Write order mode.
      * @throws Exception If failed.
      */
-    private void startGrids(int backups, CacheAtomicWriteOrderMode writeOrderMode) throws Exception {
+    private void doStartGrids(int backups) throws Exception {
         this.backups = backups;
 
-        this.writeOrderMode = writeOrderMode;
-
         startGrids(GRID_CNT);
 
         awaitPartitionMapExchange();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java
deleted file mode 100644
index b039f40..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht;
-
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
-/**
- * Tests atomic cache with near cache enabled.
- */
-public class GridCacheAtomicNearEnabledPrimaryWriteOrderFullApiSelfTest
-    extends GridCacheAtomicPrimaryWriteOrderFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return new NearCacheConfiguration();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java
deleted file mode 100644
index 0895c42..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderFullApiSelfTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- * Test for atomic cache with primary write order mode.
- */
-public class GridCacheAtomicPrimaryWriteOrderFullApiSelfTest extends GridCacheAtomicFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java
deleted file mode 100644
index 1f216a7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- * Tests reloadAll for colocated cache with primary write order.
- */
-public class GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest extends GridCacheAtomicReloadAllSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
index bee94a2..b4e6a08 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtAtomicRemoveFailureTest.java
@@ -17,13 +17,11 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -42,11 +40,6 @@ public class GridCacheDhtAtomicRemoveFailureTest extends GridCacheAbstractRemove
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearCache() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
index ca7b3ed..3b64487 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
@@ -34,7 +34,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -173,7 +172,6 @@ public class IgniteCacheConcurrentPutGetRemove extends GridCommonAbstractTest {
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setBackups(backups);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         return ccfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
index 53d32b3..9f948f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
@@ -24,7 +24,6 @@ import java.util.concurrent.locks.ReentrantLock;
 import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.affinity.Affinity;
@@ -35,7 +34,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest;
 import org.apache.ignite.internal.util.typedef.PA;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -62,11 +60,6 @@ public class IgniteCachePartitionedBackupNodeFailureRecoveryTest extends IgniteC
     }
 
     /** {@inheritDoc}*/
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc}*/
     @Override protected NearCacheConfiguration nearConfiguration() {
         return new NearCacheConfiguration();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index ee83990..ca55a47 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -33,7 +33,6 @@ import javax.cache.processor.EntryProcessorResult;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheEntryProcessor;
 import org.apache.ignite.cache.CachePartialUpdateException;
@@ -57,8 +56,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager.DEFERRED_ONE_PHASE_COMMIT_ACK_REQUEST_TIMEOUT;
@@ -96,7 +93,6 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
 
         cfg.setAtomicityMode(atomicityMode());
         cfg.setWriteSynchronizationMode(FULL_SYNC);
-        cfg.setAtomicWriteOrderMode(writeOrderMode());
         cfg.setBackups(1);
         cfg.setRebalanceMode(SYNC);
 
@@ -171,13 +167,6 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
     protected abstract CacheAtomicityMode atomicityMode();
 
     /**
-     * @return Write order mode.
-     */
-    protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return CLOCK;
-    }
-
-    /**
      * @throws Exception If failed.
      */
     public void testPut() throws Exception {
@@ -277,11 +266,6 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
         int iter = 0;
 
         try {
-            if (atomicityMode() == ATOMIC) {
-                assertEquals(writeOrderMode(),
-                    cache.getConfiguration(CacheConfiguration.class).getAtomicWriteOrderMode());
-            }
-
             long stopTime = System.currentTimeMillis() + DURATION;
 
             switch (test) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicFailoverSelfTest.java
index e7b9fce..741dba3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicFailoverSelfTest.java
@@ -23,7 +23,6 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractFailoverSelfTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -35,8 +34,6 @@ public class GridCacheAtomicFailoverSelfTest extends GridCacheAbstractFailoverSe
     @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
         CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
 
-        ccfg.setAtomicWriteOrderMode(CLOCK);
-
         assertEquals(CacheWriteSynchronizationMode.FULL_SYNC, ccfg.getWriteSynchronizationMode());
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 4d345c8..a35a561 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -30,7 +30,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteDataStreamer;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CachePartialUpdateException;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.affinity.Affinity;
@@ -59,8 +58,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jsr166.ThreadLocalRandom8;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
@@ -78,9 +75,6 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
     /** Delay flag. */
     private static volatile boolean delay;
 
-    /** Write order. */
-    private CacheAtomicWriteOrderMode writeOrder;
-
     /** Write sync. */
     private CacheWriteSynchronizationMode writeSync;
 
@@ -113,7 +107,6 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
         ccfg.setCacheMode(PARTITIONED);
 
         ccfg.setBackups(1);
-        ccfg.setAtomicWriteOrderMode(writeOrder);
         ccfg.setWriteSynchronizationMode(writeSync);
 
         ccfg.setRebalanceMode(SYNC);
@@ -143,54 +136,30 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
     /**
      * @throws Exception If failed.
      */
-    public void testClockFullSync() throws Exception {
-        checkRestarts(CLOCK, FULL_SYNC);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClockPrimarySync() throws Exception {
-        checkRestarts(CLOCK, PRIMARY_SYNC);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClockFullAsync() throws Exception {
-        checkRestarts(CLOCK, FULL_ASYNC);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testPrimaryFullSync() throws Exception {
-        checkRestarts(PRIMARY, FULL_SYNC);
+        checkRestarts(FULL_SYNC);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPrimaryPrimarySync() throws Exception {
-        checkRestarts(PRIMARY, PRIMARY_SYNC);
+        checkRestarts(PRIMARY_SYNC);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPrimaryFullAsync() throws Exception {
-        checkRestarts(PRIMARY, FULL_ASYNC);
+        checkRestarts(FULL_ASYNC);
     }
 
     /**
-     * @param writeOrder Write order to check.
      * @param writeSync Write synchronization mode to check.
      * @throws Exception If failed.
      */
-    private void checkRestarts(CacheAtomicWriteOrderMode writeOrder,
-        CacheWriteSynchronizationMode writeSync)
+    private void checkRestarts(CacheWriteSynchronizationMode writeSync)
         throws Exception {
-        this.writeOrder = writeOrder;
         this.writeSync = writeSync;
 
         final int gridCnt = 6;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java
index 82b6247..e69de29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.java
@@ -1,36 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.configuration.CacheConfiguration;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class GridCacheAtomicPrimaryWriteOrderFailoverSelfTest extends GridCacheAtomicFailoverSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
-        CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
-
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
-
-        return ccfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
deleted file mode 100644
index 2fd8a82..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPrimaryWriteOrderRemoveFailureTest.java
+++ /dev/null
@@ -1,53 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Tests that removes are not lost when topology changes.
- */
-public class GridCacheAtomicPrimaryWriteOrderRemoveFailureTest extends GridCacheAbstractRemoveFailureTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearCache() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
index a21cd35..8b992ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicRemoveFailureTest.java
@@ -17,13 +17,11 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -42,11 +40,6 @@ public class GridCacheAtomicRemoveFailureTest extends GridCacheAbstractRemoveFai
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearCache() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest.java
deleted file mode 100644
index ac56011..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest.java
+++ /dev/null
@@ -1,39 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- * Tests cache value consistency for ATOMIC mode with near cache enabled.
- */
-public class GridCacheValueConsistencyAtomicPrimaryWriteOrderNearEnabledSelfTest
-    extends GridCacheValueConsistencyAtomicSelfTest {
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return new NearCacheConfiguration();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest.java
deleted file mode 100644
index f270949..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class GridCacheValueConsistencyAtomicPrimaryWriteOrderSelfTest extends GridCacheValueConsistencyAtomicSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
deleted file mode 100644
index 3ed1323..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryAtomicSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest extends IgniteCachePutRetryAtomicSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file


[21/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsTest.java
new file mode 100644
index 0000000..0e61513
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorImplementationsTest.java
@@ -0,0 +1,860 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/** See also: {@link AbstractVectorTest} and {@link VectorToMatrixTest}. */
+public class VectorImplementationsTest { // todo split this to smaller cohesive test classes
+    /** */
+    @Test
+    public void vectorImplementationsFixturesTest() {
+        new VectorImplementationsFixtures().selfTest();
+    }
+
+    /** */
+    @Test
+    public void setGetTest() {
+        consumeSampleVectors((v, desc) -> mutateAtIdxTest(v, desc, (vec, idx, val) -> {
+            vec.set(idx, val);
+
+            return val;
+        }));
+    }
+
+    /** */
+    @Test
+    public void setXTest() {
+        consumeSampleVectors((v, desc) -> mutateAtIdxTest(v, desc, (vec, idx, val) -> {
+            vec.setX(idx, val);
+
+            return val;
+        }));
+    }
+
+    /** */
+    @Test
+    public void incrementTest() {
+        consumeSampleVectors((v, desc) -> mutateAtIdxTest(v, desc, (vec, idx, val) -> {
+            double old = vec.get(idx);
+
+            vec.increment(idx, val);
+
+            return old + val;
+        }));
+    }
+
+    /** */
+    @Test
+    public void incrementXTest() {
+        consumeSampleVectors((v, desc) -> mutateAtIdxTest(v, desc, (vec, idx, val) -> {
+            double old = vec.getX(idx);
+
+            vec.incrementX(idx, val);
+
+            return old + val;
+        }));
+    }
+
+    /** */
+    @Test
+    public void operateXOutOfBoundsTest() {
+        consumeSampleVectors((v, desc) -> {
+            if (v instanceof DenseLocalOffHeapVector || v instanceof SparseLocalVector || v instanceof SparseLocalOffHeapVector)
+                return; // todo find out if it's OK to skip by instances here
+
+            boolean expECaught = false;
+
+            try {
+                v.getX(-1);
+            }
+            catch (ArrayIndexOutOfBoundsException | IgniteException e) {
+                expECaught = true;
+            }
+
+            if (!getXOutOfBoundsOK(v))
+                assertTrue("Expect exception at negative index getX in " + desc, expECaught);
+
+            expECaught = false;
+
+            try {
+                v.setX(-1, 0);
+            }
+            catch (ArrayIndexOutOfBoundsException | IgniteException e) {
+                expECaught = true;
+            }
+
+            assertTrue("Expect exception at negative index setX in " + desc, expECaught);
+
+            expECaught = false;
+
+            try {
+                v.incrementX(-1, 1);
+            }
+            catch (ArrayIndexOutOfBoundsException | IgniteException e) {
+                expECaught = true;
+            }
+
+            assertTrue("Expect exception at negative index incrementX in " + desc, expECaught);
+
+            expECaught = false;
+
+            try {
+                v.getX(v.size());
+            }
+            catch (ArrayIndexOutOfBoundsException | IgniteException e) {
+                expECaught = true;
+            }
+
+            if (!getXOutOfBoundsOK(v))
+                assertTrue("Expect exception at too large index getX in " + desc, expECaught);
+
+            expECaught = false;
+
+            try {
+                v.setX(v.size(), 1);
+            }
+            catch (ArrayIndexOutOfBoundsException | IgniteException e) {
+                expECaught = true;
+            }
+
+            assertTrue("Expect exception at too large index setX in " + desc, expECaught);
+
+            expECaught = false;
+
+            try {
+                v.incrementX(v.size(), 1);
+            }
+            catch (ArrayIndexOutOfBoundsException | IgniteException e) {
+                expECaught = true;
+            }
+
+            assertTrue("Expect exception at too large index incrementX in " + desc, expECaught);
+        });
+    }
+
+    /** */
+    @Test
+    public void sizeTest() {
+        final AtomicReference<Integer> expSize = new AtomicReference<>(0);
+
+        consumeSampleVectors(
+            expSize::set,
+            (v, desc) -> assertEquals("Expected size for " + desc,
+                (int)expSize.get(), v.size())
+        );
+    }
+
+    /** */
+    @Test
+    public void getElementTest() {
+        consumeSampleVectors((v, desc) -> new ElementsChecker(v, desc).assertCloseEnough(v));
+    }
+
+    /** */
+    @Test
+    public void copyTest() {
+        consumeSampleVectors((v, desc) -> new ElementsChecker(v, desc).assertCloseEnough(v.copy()));
+    }
+
+    /** */
+    @Test
+    public void divideTest() {
+        operationTest((val, operand) -> val / operand, Vector::divide);
+    }
+
+    /** */
+    @Test
+    public void likeTest() {
+        for (int card : new int[] {1, 2, 4, 8, 16, 32, 64, 128})
+            consumeSampleVectors((v, desc) -> {
+                Class<? extends Vector> expType = expLikeType(v);
+
+                if (expType == null) {
+                    try {
+                        v.like(card);
+                    }
+                    catch (UnsupportedOperationException uoe) {
+                        return;
+                    }
+
+                    fail("Expected exception wasn't caught for " + desc);
+
+                    return;
+                }
+
+                Vector vLike = v.like(card);
+
+                assertNotNull("Expect non-null like vector for " + expType.getSimpleName() + " in " + desc, vLike);
+                assertEquals("Expect size equal to cardinality at " + desc, card, vLike.size());
+
+                Class<? extends Vector> actualType = vLike.getClass();
+
+                assertTrue("Actual vector type " + actualType.getSimpleName()
+                        + " should be assignable from expected type " + expType.getSimpleName() + " in " + desc,
+                    actualType.isAssignableFrom(expType));
+            });
+    }
+
+    /** */
+    @Test
+    public void minusTest() {
+        operationVectorTest((operand1, operand2) -> operand1 - operand2, Vector::minus);
+    }
+
+    /** */
+    @Test
+    public void plusVectorTest() {
+        operationVectorTest((operand1, operand2) -> operand1 + operand2, Vector::plus);
+    }
+
+    /** */
+    @Test
+    public void plusDoubleTest() {
+        operationTest((val, operand) -> val + operand, Vector::plus);
+    }
+
+    /** */
+    @Test
+    public void timesVectorTest() {
+        operationVectorTest((operand1, operand2) -> operand1 * operand2, Vector::times);
+    }
+
+    /** */
+    @Test
+    public void timesDoubleTest() {
+        operationTest((val, operand) -> val * operand, Vector::times);
+    }
+
+    /** */
+    @Test
+    public void viewPartTest() {
+        consumeSampleVectors((v, desc) -> {
+            final int size = v.size();
+            final double[] ref = new double[size];
+            final int delta = size > 32 ? 3 : 1; // IMPL NOTE this is for faster test execution
+
+            final ElementsChecker checker = new ElementsChecker(v, ref, desc);
+
+            for (int off = 0; off < size; off += delta)
+                for (int len = 1; len < size - off; len += delta)
+                    checker.assertCloseEnough(v.viewPart(off, len), Arrays.copyOfRange(ref, off, off + len));
+        });
+    }
+
+    /** */
+    @Test
+    public void sumTest() {
+        toDoubleTest(
+            ref -> Arrays.stream(ref).sum(),
+            Vector::sum);
+    }
+
+    /** */
+    @Test
+    public void minValueTest() {
+        toDoubleTest(
+            ref -> Arrays.stream(ref).min().getAsDouble(),
+            Vector::minValue);
+    }
+
+    /** */
+    @Test
+    public void maxValueTest() {
+        toDoubleTest(
+            ref -> Arrays.stream(ref).max().getAsDouble(),
+            Vector::maxValue);
+    }
+
+    /** */
+    @Test
+    public void sortTest() {
+        consumeSampleVectors((v, desc) -> {
+            if (readOnly(v) || !v.isArrayBased()) {
+                boolean expECaught = false;
+
+                try {
+                    v.sort();
+                }
+                catch (UnsupportedOperationException uoe) {
+                    expECaught = true;
+                }
+
+                assertTrue("Expected exception was not caught for sort in " + desc, expECaught);
+
+                return;
+            }
+
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            new ElementsChecker(v, ref, desc).assertCloseEnough(v.sort(), Arrays.stream(ref).sorted().toArray());
+        });
+    }
+
+    /** */
+    @Test
+    public void metaAttributesTest() {
+        consumeSampleVectors((v, desc) -> {
+            assertNotNull("Null meta storage in " + desc, v.getMetaStorage());
+
+            final String key = "test key";
+            final String val = "test value";
+            final String details = "key [" + key + "] for " + desc;
+
+            v.setAttribute(key, val);
+            assertTrue("Expect to have meta attribute for " + details, v.hasAttribute(key));
+            assertEquals("Unexpected meta attribute value for " + details, val, v.getAttribute(key));
+
+            v.removeAttribute(key);
+            assertFalse("Expect not to have meta attribute for " + details, v.hasAttribute(key));
+            assertNull("Unexpected meta attribute value for " + details, v.getAttribute(key));
+        });
+    }
+
+    /** */
+    @Test
+    public void assignDoubleTest() {
+        consumeSampleVectors((v, desc) -> {
+            if (readOnly(v))
+                return;
+
+            for (double val : new double[] {0, -1, 0, 1}) {
+                v.assign(val);
+
+                for (int idx = 0; idx < v.size(); idx++) {
+                    final Metric metric = new Metric(val, v.get(idx));
+
+                    assertTrue("Not close enough at index " + idx + ", val " + val + ", " + metric
+                        + ", " + desc, metric.closeEnough());
+                }
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void assignDoubleArrTest() {
+        consumeSampleVectors((v, desc) -> {
+            if (readOnly(v))
+                return;
+
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            final ElementsChecker checker = new ElementsChecker(v, ref, desc);
+
+            for (int idx = 0; idx < size; idx++)
+                ref[idx] = -ref[idx];
+
+            v.assign(ref);
+
+            checker.assertCloseEnough(v, ref);
+
+            assignDoubleArrWrongCardinality(v, desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void assignVectorTest() {
+        consumeSampleVectors((v, desc) -> {
+            if (readOnly(v))
+                return;
+
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            final ElementsChecker checker = new ElementsChecker(v, ref, desc);
+
+            for (int idx = 0; idx < size; idx++)
+                ref[idx] = -ref[idx];
+
+            v.assign(new DenseLocalOnHeapVector(ref));
+
+            checker.assertCloseEnough(v, ref);
+
+            assignVectorWrongCardinality(v, desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void assignFunctionTest() {
+        consumeSampleVectors((v, desc) -> {
+            if (readOnly(v))
+                return;
+
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            final ElementsChecker checker = new ElementsChecker(v, ref, desc);
+
+            for (int idx = 0; idx < size; idx++)
+                ref[idx] = -ref[idx];
+
+            v.assign((idx) -> ref[idx]);
+
+            checker.assertCloseEnough(v, ref);
+        });
+    }
+
+    /** */
+    @Test
+    public void minElementTest() {
+        consumeSampleVectors((v, desc) -> {
+            final ElementsChecker checker = new ElementsChecker(v, desc);
+
+            final Vector.Element minE = v.minElement();
+
+            final int minEIdx = minE.index();
+
+            assertTrue("Unexpected index from minElement " + minEIdx + ", " + desc,
+                minEIdx >= 0 && minEIdx < v.size());
+
+            final Metric metric = new Metric(minE.get(), v.minValue());
+
+            assertTrue("Not close enough minElement at index " + minEIdx + ", " + metric
+                + ", " + desc, metric.closeEnough());
+
+            checker.assertNewMinElement(v);
+        });
+    }
+
+    /** */
+    @Test
+    public void maxElementTest() {
+        consumeSampleVectors((v, desc) -> {
+            final ElementsChecker checker = new ElementsChecker(v, desc);
+
+            final Vector.Element maxE = v.maxElement();
+
+            final int minEIdx = maxE.index();
+
+            assertTrue("Unexpected index from minElement " + minEIdx + ", " + desc,
+                minEIdx >= 0 && minEIdx < v.size());
+
+            final Metric metric = new Metric(maxE.get(), v.maxValue());
+
+            assertTrue("Not close enough maxElement at index " + minEIdx + ", " + metric
+                + ", " + desc, metric.closeEnough());
+
+            checker.assertNewMaxElement(v);
+        });
+    }
+
+    /** */
+    @Test
+    public void externalizeTest() {
+        (new ExternalizeTest<Vector>() {
+            /** {@inheritDoc} */
+            @Override public void externalizeTest() {
+                consumeSampleVectors((v, desc) -> {
+                    if (v instanceof SparseLocalOffHeapVector)
+                        return; //TODO: wait till SparseLocalOffHeapVector externalization support.
+
+                    externalizeTest(v);
+                });
+            }
+        }).externalizeTest();
+    }
+
+    /** */
+    @Test
+    public void hashCodeTest() {
+        consumeSampleVectors((v, desc) -> assertTrue("Zero hash code for " + desc, v.hashCode() != 0));
+    }
+
+    /** */
+    private boolean getXOutOfBoundsOK(Vector v) {
+        // todo find out if this is indeed OK
+        return v instanceof RandomVector || v instanceof ConstantVector
+            || v instanceof SingleElementVector || v instanceof SingleElementVectorView;
+    }
+
+    /** */
+    private void mutateAtIdxTest(Vector v, String desc, MutateAtIdx operation) {
+        if (readOnly(v)) {
+            if (v.size() < 1)
+                return;
+
+            boolean expECaught = false;
+
+            try {
+                operation.apply(v, 0, 1);
+            }
+            catch (UnsupportedOperationException uoe) {
+                expECaught = true;
+            }
+
+            assertTrue("Expect exception at attempt to mutate element in " + desc, expECaught);
+
+            return;
+        }
+
+        for (double val : new double[] {0, -1, 0, 1})
+            for (int idx = 0; idx < v.size(); idx++) {
+                double exp = operation.apply(v, idx, val);
+
+                final Metric metric = new Metric(exp, v.get(idx));
+
+                assertTrue("Not close enough at index " + idx + ", val " + val + ", " + metric
+                    + ", " + desc, metric.closeEnough());
+            }
+    }
+
+    /** */
+    private Class<? extends Vector> expLikeType(Vector v) {
+        Class<? extends Vector> clazz = v.getClass();
+
+        if (clazz.isAssignableFrom(PivotedVectorView.class) || clazz.isAssignableFrom(SingleElementVectorView.class))
+            return null;
+
+        if (clazz.isAssignableFrom(MatrixVectorView.class) || clazz.isAssignableFrom(DelegatingVector.class))
+            return DenseLocalOnHeapVector.class; // IMPL NOTE per fixture
+
+        return clazz;
+    }
+
+    /** */
+    private void toDoubleTest(Function<double[], Double> calcRef, Function<Vector, Double> calcVec) {
+        consumeSampleVectors((v, desc) -> {
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            new ElementsChecker(v, ref, desc); // IMPL NOTE this initialises vector and reference array
+
+            final Metric metric = new Metric(calcRef.apply(ref), calcVec.apply(v));
+
+            assertTrue("Not close enough at " + desc
+                + ", " + metric, metric.closeEnough());
+        });
+    }
+
+    /** */
+    private void operationVectorTest(BiFunction<Double, Double, Double> operation,
+        BiFunction<Vector, Vector, Vector> vecOperation) {
+        consumeSampleVectors((v, desc) -> {
+            // TODO find out if more elaborate testing scenario is needed or it's okay as is.
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            final ElementsChecker checker = new ElementsChecker(v, ref, desc);
+            final Vector operand = v.copy();
+
+            for (int idx = 0; idx < size; idx++)
+                ref[idx] = operation.apply(ref[idx], ref[idx]);
+
+            checker.assertCloseEnough(vecOperation.apply(v, operand), ref);
+
+            assertWrongCardinality(v, desc, vecOperation);
+        });
+    }
+
+    /** */
+    private void assignDoubleArrWrongCardinality(Vector v, String desc) {
+        boolean expECaught = false;
+
+        try {
+            v.assign(new double[v.size() + 1]);
+        }
+        catch (CardinalityException ce) {
+            expECaught = true;
+        }
+
+        assertTrue("Expect exception at too large size in " + desc, expECaught);
+
+        if (v.size() < 2)
+            return;
+
+        expECaught = false;
+
+        try {
+            v.assign(new double[v.size() - 1]);
+        }
+        catch (CardinalityException ce) {
+            expECaught = true;
+        }
+
+        assertTrue("Expect exception at too small size in " + desc, expECaught);
+    }
+
+    /** */
+    private void assignVectorWrongCardinality(Vector v, String desc) {
+        boolean expECaught = false;
+
+        try {
+            v.assign(new DenseLocalOnHeapVector(v.size() + 1));
+        }
+        catch (CardinalityException ce) {
+            expECaught = true;
+        }
+
+        assertTrue("Expect exception at too large size in " + desc, expECaught);
+
+        if (v.size() < 2)
+            return;
+
+        expECaught = false;
+
+        try {
+            v.assign(new DenseLocalOnHeapVector(v.size() - 1));
+        }
+        catch (CardinalityException ce) {
+            expECaught = true;
+        }
+
+        assertTrue("Expect exception at too small size in " + desc, expECaught);
+    }
+
+    /** */
+    private void assertWrongCardinality(
+        Vector v, String desc, BiFunction<Vector, Vector, Vector> vecOperation) {
+        boolean expECaught = false;
+
+        try {
+            vecOperation.apply(v, new DenseLocalOnHeapVector(v.size() + 1));
+        }
+        catch (CardinalityException ce) {
+            expECaught = true;
+        }
+
+        assertTrue("Expect exception at too large size in " + desc, expECaught);
+
+        if (v.size() < 2)
+            return;
+
+        expECaught = false;
+
+        try {
+            vecOperation.apply(v, new DenseLocalOnHeapVector(v.size() - 1));
+        }
+        catch (CardinalityException ce) {
+            expECaught = true;
+        }
+
+        assertTrue("Expect exception at too small size in " + desc, expECaught);
+    }
+
+    /** */
+    private void operationTest(BiFunction<Double, Double, Double> operation,
+        BiFunction<Vector, Double, Vector> vecOperation) {
+        for (double val : new double[] {0, 0.1, 1, 2, 10})
+            consumeSampleVectors((v, desc) -> {
+                final int size = v.size();
+                final double[] ref = new double[size];
+
+                final ElementsChecker checker = new ElementsChecker(v, ref, "val " + val + ", " + desc);
+
+                for (int idx = 0; idx < size; idx++)
+                    ref[idx] = operation.apply(ref[idx], val);
+
+                checker.assertCloseEnough(vecOperation.apply(v, val), ref);
+            });
+    }
+
+    /** */
+    private void consumeSampleVectors(BiConsumer<Vector, String> consumer) {
+        consumeSampleVectors(null, consumer);
+    }
+
+    /** */
+    private void consumeSampleVectors(Consumer<Integer> paramsConsumer, BiConsumer<Vector, String> consumer) {
+        new VectorImplementationsFixtures().consumeSampleVectors(paramsConsumer, consumer);
+    }
+
+    /** */
+    private static boolean readOnly(Vector v) {
+        return v instanceof RandomVector || v instanceof ConstantVector;
+    }
+
+    /** */
+    private interface MutateAtIdx {
+        /** */
+        double apply(Vector v, int idx, double val);
+    }
+
+    /** */
+    static class ElementsChecker {
+        /** */
+        private final String fixtureDesc;
+
+        /** */
+        private final double[] refReadOnly;
+
+        /** */
+        private final boolean nonNegative;
+
+        /** */
+        ElementsChecker(Vector v, double[] ref, String fixtureDesc, boolean nonNegative) {
+            this.fixtureDesc = fixtureDesc;
+
+            this.nonNegative = nonNegative;
+
+            refReadOnly = readOnly(v) && ref == null ? new double[v.size()] : null;
+
+            init(v, ref);
+        }
+
+        /** */
+        ElementsChecker(Vector v, double[] ref, String fixtureDesc) {
+            this(v, ref, fixtureDesc, false);
+        }
+
+        /** */
+        ElementsChecker(Vector v, String fixtureDesc) {
+            this(v, null, fixtureDesc);
+        }
+
+        /** */
+        void assertCloseEnough(Vector obtained, double[] exp) {
+            final int size = obtained.size();
+
+            for (int i = 0; i < size; i++) {
+                final Vector.Element e = obtained.getElement(i);
+
+                if (refReadOnly != null && exp == null)
+                    exp = refReadOnly;
+
+                final Metric metric = new Metric(exp == null ? generated(i) : exp[i], e.get());
+
+                assertEquals("Unexpected vector index at " + fixtureDesc, i, e.index());
+                assertTrue("Not close enough at index " + i + ", size " + size + ", " + metric
+                    + ", " + fixtureDesc, metric.closeEnough());
+            }
+        }
+
+        /** */
+        void assertCloseEnough(Vector obtained) {
+            assertCloseEnough(obtained, null);
+        }
+
+        /** */
+        void assertNewMinElement(Vector v) {
+            if (readOnly(v))
+                return;
+
+            int exp = v.size() / 2;
+
+            v.set(exp, -(v.size() * 2 + 1));
+
+            assertEquals("Unexpected minElement index at " + fixtureDesc, exp, v.minElement().index());
+        }
+
+        /** */
+        void assertNewMaxElement(Vector v) {
+            if (readOnly(v))
+                return;
+
+            int exp = v.size() / 2;
+
+            v.set(exp, v.size() * 2 + 1);
+
+            assertEquals("Unexpected minElement index at " + fixtureDesc, exp, v.maxElement().index());
+        }
+
+        /** */
+        private void init(Vector v, double[] ref) {
+            if (readOnly(v)) {
+                initReadonly(v, ref);
+
+                return;
+            }
+
+            for (Vector.Element e : v.all()) {
+                int idx = e.index();
+
+                // IMPL NOTE introduce negative values because their absence
+                //    blocked catching an ugly bug in AbstractVector#kNorm
+                int val = generated(idx);
+
+                e.set(val);
+
+                if (ref != null)
+                    ref[idx] = val;
+            }
+        }
+
+        /** */
+        private void initReadonly(Vector v, double[] ref) {
+            if (refReadOnly != null)
+                for (Vector.Element e : v.all())
+                    refReadOnly[e.index()] = e.get();
+
+            if (ref != null)
+                for (Vector.Element e : v.all())
+                    ref[e.index()] = e.get();
+        }
+
+        /** */
+        private int generated(int idx) {
+            return nonNegative || (idx & 1) == 0 ? idx : -idx;
+        }
+    }
+
+    /** */
+    static class Metric { // todo consider if softer tolerance (like say 0.1 or 0.01) would make sense here
+        /** */
+        private final double exp;
+
+        /** */
+        private final double obtained;
+
+        /** **/
+        Metric(double exp, double obtained) {
+            this.exp = exp;
+            this.obtained = obtained;
+        }
+
+        /** */
+        boolean closeEnough() {
+            return new Double(exp).equals(obtained) || closeEnoughToZero();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "Metric{" + "expected=" + exp +
+                ", obtained=" + obtained +
+                '}';
+        }
+
+        /** */
+        private boolean closeEnoughToZero() {
+            return (new Double(exp).equals(0.0) && new Double(obtained).equals(-0.0))
+                || (new Double(exp).equals(-0.0) && new Double(obtained).equals(0.0));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorIterableTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorIterableTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorIterableTest.java
new file mode 100644
index 0000000..7a64c85
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorIterableTest.java
@@ -0,0 +1,376 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Spliterator;
+import java.util.function.BiConsumer;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Test;
+
+import static java.util.Spliterator.ORDERED;
+import static java.util.Spliterator.SIZED;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/** */
+public class VectorIterableTest {
+    /** */
+    @Test
+    public void allTest() {
+        consumeSampleVectors(
+            (v, desc) -> {
+                int expIdx = 0;
+
+                for (Vector.Element e : v.all()) {
+                    int actualIdx = e.index();
+
+                    assertEquals("Unexpected index for " + desc,
+                        expIdx, actualIdx);
+
+                    expIdx++;
+                }
+
+                assertEquals("Unexpected amount of elements for " + desc,
+                    expIdx, v.size());
+            }
+        );
+    }
+
+    /** */
+    @Test
+    public void allTestBound() {
+        consumeSampleVectors(
+            (v, desc) -> iteratorTestBound(v.all().iterator(), desc)
+        );
+    }
+
+    /** */
+    @Test
+    public void nonZeroesTestBasic() {
+        final int size = 5;
+
+        final double[] nonZeroesOddData = new double[size], nonZeroesEvenData = new double[size];
+
+        for (int idx = 0; idx < size; idx++) {
+            final boolean odd = (idx & 1) == 1;
+
+            nonZeroesOddData[idx] = odd ? 1 : 0;
+
+            nonZeroesEvenData[idx] = odd ? 0 : 1;
+        }
+
+        assertTrue("Arrays failed to initialize.",
+            !isZero(nonZeroesEvenData[0])
+                && isZero(nonZeroesEvenData[1])
+                && isZero(nonZeroesOddData[0])
+                && !isZero(nonZeroesOddData[1]));
+
+        final Vector nonZeroesEvenVec = new DenseLocalOnHeapVector(nonZeroesEvenData),
+            nonZeroesOddVec = new DenseLocalOnHeapVector(nonZeroesOddData);
+
+        assertTrue("Vectors failed to initialize.",
+            !isZero(nonZeroesEvenVec.getElement(0).get())
+                && isZero(nonZeroesEvenVec.getElement(1).get())
+                && isZero(nonZeroesOddVec.getElement(0).get())
+                && !isZero(nonZeroesOddVec.getElement(1).get()));
+
+        assertTrue("Iterator(s) failed to start.",
+            nonZeroesEvenVec.nonZeroes().iterator().next() != null
+                && nonZeroesOddVec.nonZeroes().iterator().next() != null);
+
+        int nonZeroesActual = 0;
+
+        for (Vector.Element e : nonZeroesEvenVec.nonZeroes()) {
+            final int idx = e.index();
+
+            final boolean odd = (idx & 1) == 1;
+
+            final double val = e.get();
+
+            assertTrue("Not an even index " + idx + ", for value " + val, !odd);
+
+            assertTrue("Zero value " + val + " at even index " + idx, !isZero(val));
+
+            nonZeroesActual++;
+        }
+
+        final int nonZeroesOddExp = (size + 1) / 2;
+
+        assertEquals("Unexpected num of iterated odd non-zeroes.", nonZeroesOddExp, nonZeroesActual);
+
+        assertEquals("Unexpected nonZeroElements of odd.", nonZeroesOddExp, nonZeroesEvenVec.nonZeroElements());
+
+        nonZeroesActual = 0;
+
+        for (Vector.Element e : nonZeroesOddVec.nonZeroes()) {
+            final int idx = e.index();
+
+            final boolean odd = (idx & 1) == 1;
+
+            final double val = e.get();
+
+            assertTrue("Not an odd index " + idx + ", for value " + val, odd);
+
+            assertTrue("Zero value " + val + " at even index " + idx, !isZero(val));
+
+            nonZeroesActual++;
+        }
+
+        final int nonZeroesEvenExp = size / 2;
+
+        assertEquals("Unexpected num of iterated even non-zeroes", nonZeroesEvenExp, nonZeroesActual);
+
+        assertEquals("Unexpected nonZeroElements of even", nonZeroesEvenExp, nonZeroesOddVec.nonZeroElements());
+    }
+
+    /** */
+    @Test
+    public void nonZeroesTest() {
+        // todo make RandomVector constructor that accepts a function and use it here
+        //  in order to *reliably* test non-zeroes in there
+        consumeSampleVectors(
+            (v, desc) -> consumeSampleVectorsWithZeroes(v, (vec, numZeroes)
+                -> {
+                int numZeroesActual = vec.size();
+
+                for (Vector.Element e : vec.nonZeroes()) {
+                    numZeroesActual--;
+
+                    assertTrue("Unexpected zero at " + desc + ", index " + e.index(), !isZero(e.get()));
+                }
+
+                assertEquals("Unexpected num zeroes at " + desc, (int)numZeroes, numZeroesActual);
+            }));
+    }
+
+    /** */
+    @Test
+    public void nonZeroesTestBound() {
+        consumeSampleVectors(
+            (v, desc) -> consumeSampleVectorsWithZeroes(v, (vec, numZeroes)
+                -> iteratorTestBound(vec.nonZeroes().iterator(), desc)));
+    }
+
+    /** */
+    @Test
+    public void nonZeroElementsTest() {
+        consumeSampleVectors(
+            (v, desc) -> consumeSampleVectorsWithZeroes(v, (vec, numZeroes)
+                -> assertEquals("Unexpected num zeroes at " + desc,
+                (int)numZeroes, vec.size() - vec.nonZeroElements())));
+    }
+
+    /** */
+    @Test
+    public void allSpliteratorTest() {
+        consumeSampleVectors(
+            (v, desc) -> {
+                final String desc1 = " " + desc;
+
+                Spliterator<Double> spliterator = v.allSpliterator();
+
+                assertNotNull(MathTestConstants.NULL_VAL + desc1, spliterator);
+
+                assertNull(MathTestConstants.NOT_NULL_VAL + desc1, spliterator.trySplit());
+
+                assertTrue(MathTestConstants.UNEXPECTED_VAL + desc1, spliterator.hasCharacteristics(ORDERED | SIZED));
+
+                if (!readOnly(v))
+                    fillWithNonZeroes(v);
+
+                spliterator = v.allSpliterator();
+
+                assertNotNull(MathTestConstants.NULL_VAL + desc1, spliterator);
+
+                assertEquals(MathTestConstants.VAL_NOT_EQUALS + desc1, spliterator.estimateSize(), v.size());
+
+                assertEquals(MathTestConstants.VAL_NOT_EQUALS + desc1, spliterator.getExactSizeIfKnown(), v.size());
+
+                assertTrue(MathTestConstants.UNEXPECTED_VAL + desc1, spliterator.hasCharacteristics(ORDERED | SIZED));
+
+                Spliterator<Double> secondHalf = spliterator.trySplit();
+
+                assertNull(MathTestConstants.NOT_NULL_VAL + desc1, secondHalf);
+
+                spliterator.tryAdvance(x -> {
+                });
+            }
+        );
+    }
+
+    /** */
+    @Test
+    public void nonZeroSpliteratorTest() {
+        consumeSampleVectors(
+            (v, desc) -> consumeSampleVectorsWithZeroes(v, (vec, numZeroes)
+                -> {
+                final String desc1 = " Num zeroes " + numZeroes + " " + desc;
+
+                Spliterator<Double> spliterator = vec.nonZeroSpliterator();
+
+                assertNotNull(MathTestConstants.NULL_VAL + desc1, spliterator);
+
+                assertNull(MathTestConstants.NOT_NULL_VAL + desc1, spliterator.trySplit());
+
+                assertTrue(MathTestConstants.UNEXPECTED_VAL + desc1, spliterator.hasCharacteristics(ORDERED | SIZED));
+
+                spliterator = vec.nonZeroSpliterator();
+
+                assertNotNull(MathTestConstants.NULL_VAL + desc1, spliterator);
+
+                assertEquals(MathTestConstants.VAL_NOT_EQUALS + desc1, spliterator.estimateSize(), vec.size() - numZeroes);
+
+                assertEquals(MathTestConstants.VAL_NOT_EQUALS + desc1, spliterator.getExactSizeIfKnown(), vec.size() - numZeroes);
+
+                assertTrue(MathTestConstants.UNEXPECTED_VAL + desc1, spliterator.hasCharacteristics(ORDERED | SIZED));
+
+                Spliterator<Double> secondHalf = spliterator.trySplit();
+
+                assertNull(MathTestConstants.NOT_NULL_VAL + desc1, secondHalf);
+
+                double[] data = new double[vec.size()];
+
+                for (Vector.Element e : vec.all())
+                    data[e.index()] = e.get();
+
+                spliterator = vec.nonZeroSpliterator();
+
+                assertNotNull(MathTestConstants.NULL_VAL + desc1, spliterator);
+
+                assertEquals(MathTestConstants.VAL_NOT_EQUALS + desc1, spliterator.estimateSize(),
+                    Arrays.stream(data).filter(x -> x != 0d).count());
+
+                assertEquals(MathTestConstants.VAL_NOT_EQUALS + desc1, spliterator.getExactSizeIfKnown(),
+                    Arrays.stream(data).filter(x -> x != 0d).count());
+
+                assertTrue(MathTestConstants.UNEXPECTED_VAL + desc1, spliterator.hasCharacteristics(ORDERED | SIZED));
+
+                secondHalf = spliterator.trySplit();
+
+                assertNull(MathTestConstants.NOT_NULL_VAL + desc1, secondHalf);
+
+                if (!spliterator.tryAdvance(x -> {
+                }))
+                    fail(MathTestConstants.NO_NEXT_ELEMENT + desc1);
+            }));
+    }
+
+    /** */
+    private void iteratorTestBound(Iterator<Vector.Element> it, String desc) {
+        while (it.hasNext())
+            assertNotNull(it.next());
+
+        boolean expECaught = false;
+
+        try {
+            it.next();
+        }
+        catch (NoSuchElementException e) {
+            expECaught = true;
+        }
+
+        assertTrue("Expected exception missed for " + desc,
+            expECaught);
+    }
+
+    /** */
+    private void consumeSampleVectorsWithZeroes(Vector sample,
+        BiConsumer<Vector, Integer> consumer) {
+        if (readOnly(sample)) {
+            int numZeroes = 0;
+
+            for (Vector.Element e : sample.all())
+                if (isZero(e.get()))
+                    numZeroes++;
+
+            consumer.accept(sample, numZeroes);
+
+            return;
+        }
+
+        fillWithNonZeroes(sample);
+
+        consumer.accept(sample, 0);
+
+        final int sampleSize = sample.size();
+
+        if (sampleSize == 0)
+            return;
+
+        for (Vector.Element e : sample.all())
+            e.set(0);
+
+        consumer.accept(sample, sampleSize);
+
+        fillWithNonZeroes(sample);
+
+        for (int testIdx : new int[] {0, sampleSize / 2, sampleSize - 1}) {
+            final Vector.Element e = sample.getElement(testIdx);
+
+            final double backup = e.get();
+
+            e.set(0);
+
+            consumer.accept(sample, 1);
+
+            e.set(backup);
+        }
+
+        if (sampleSize < 3)
+            return;
+
+        sample.getElement(sampleSize / 3).set(0);
+
+        sample.getElement((2 * sampleSize) / 3).set(0);
+
+        consumer.accept(sample, 2);
+    }
+
+    /** */
+    private void fillWithNonZeroes(Vector sample) {
+        int idx = 0;
+
+        for (Vector.Element e : sample.all())
+            e.set(1 + idx++);
+
+        assertEquals("Not all filled with non-zeroes", idx, sample.size());
+    }
+
+    /** */
+    private void consumeSampleVectors(BiConsumer<Vector, String> consumer) {
+        new VectorImplementationsFixtures().consumeSampleVectors(null, consumer);
+    }
+
+    /** */
+    private boolean isZero(double val) {
+        return val == 0.0;
+    }
+
+    /** */
+    private boolean readOnly(Vector v) {
+        return v instanceof RandomVector || v instanceof ConstantVector;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorNormTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorNormTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorNormTest.java
new file mode 100644
index 0000000..f1c2928
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorNormTest.java
@@ -0,0 +1,247 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import org.apache.ignite.math.Vector;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class VectorNormTest {
+    /** */
+    @Test
+    public void normalizeTest() {
+        normalizeTest(2, (val, len) -> val / len, Vector::normalize);
+    }
+
+    /** */
+    @Test
+    public void normalizePowerTest() {
+        for (double pow : new double[] {0, 0.5, 1, 2, 2.5, Double.POSITIVE_INFINITY})
+            normalizeTest(pow, (val, norm) -> val / norm, (v) -> v.normalize(pow));
+    }
+
+    /** */
+    @Test
+    public void logNormalizeTest() {
+        normalizeTest(2, (val, len) -> Math.log1p(val) / (len * Math.log(2)), Vector::logNormalize);
+    }
+
+    /** */
+    @Test
+    public void logNormalizePowerTest() {
+        for (double pow : new double[] {1.1, 2, 2.5})
+            normalizeTest(pow, (val, norm) -> Math.log1p(val) / (norm * Math.log(pow)), (v) -> v.logNormalize(pow));
+    }
+
+    /** */
+    @Test
+    public void kNormTest() {
+        for (double pow : new double[] {0, 0.5, 1, 2, 2.5, Double.POSITIVE_INFINITY})
+            toDoubleTest(pow, ref -> new Norm(ref, pow).calculate(), v -> v.kNorm(pow));
+    }
+
+    /** */
+    @Test
+    public void getLengthSquaredTest() {
+        toDoubleTest(2.0, ref -> new Norm(ref, 2).sumPowers(), Vector::getLengthSquared);
+    }
+
+    /** */
+    @Test
+    public void getDistanceSquaredTest() {
+        consumeSampleVectors((v, desc) -> {
+            new VectorImplementationsTest.ElementsChecker(v, desc); // IMPL NOTE this initialises vector
+
+            final int size = v.size();
+            final Vector vOnHeap = new DenseLocalOnHeapVector(size);
+            final Vector vOffHeap = new DenseLocalOffHeapVector(size);
+
+            invertValues(v, vOnHeap);
+            invertValues(v, vOffHeap);
+
+            for (int idx = 0; idx < size; idx++) {
+                final double exp = v.get(idx);
+                final int idxMirror = size - 1 - idx;
+
+                assertTrue("On heap vector difference at " + desc + ", idx " + idx,
+                    exp - vOnHeap.get(idxMirror) == 0);
+                assertTrue("Off heap vector difference at " + desc + ", idx " + idx,
+                    exp - vOffHeap.get(idxMirror) == 0);
+            }
+
+            final double exp = vOnHeap.minus(v).getLengthSquared(); // IMPL NOTE this won't mutate vOnHeap
+            final VectorImplementationsTest.Metric metric = new VectorImplementationsTest.Metric(exp, v.getDistanceSquared(vOnHeap));
+
+            assertTrue("On heap vector not close enough at " + desc + ", " + metric,
+                metric.closeEnough());
+
+            final VectorImplementationsTest.Metric metric1 = new VectorImplementationsTest.Metric(exp, v.getDistanceSquared(vOffHeap));
+
+            assertTrue("Off heap vector not close enough at " + desc + ", " + metric1,
+                metric1.closeEnough());
+        });
+    }
+
+    /** */
+    @Test
+    public void dotTest() {
+        consumeSampleVectors((v, desc) -> {
+            new VectorImplementationsTest.ElementsChecker(v, desc); // IMPL NOTE this initialises vector
+
+            final int size = v.size();
+            final Vector v1 = new DenseLocalOnHeapVector(size);
+
+            invertValues(v, v1);
+
+            final double actual = v.dot(v1);
+
+            double exp = 0;
+
+            for (Vector.Element e : v.all())
+                exp += e.get() * v1.get(e.index());
+
+            final VectorImplementationsTest.Metric metric = new VectorImplementationsTest.Metric(exp, actual);
+
+            assertTrue("Dot product not close enough at " + desc + ", " + metric,
+                metric.closeEnough());
+        });
+    }
+
+    /** */
+    private void invertValues(Vector src, Vector dst) {
+        final int size = src.size();
+
+        for (Vector.Element e : src.all()) {
+            final int idx = size - 1 - e.index();
+            final double val = e.get();
+
+            dst.set(idx, val);
+        }
+    }
+
+    /** */
+    private void toDoubleTest(Double val, Function<double[], Double> calcRef, Function<Vector, Double> calcVec) {
+        consumeSampleVectors((v, desc) -> {
+            final int size = v.size();
+            final double[] ref = new double[size];
+
+            new VectorImplementationsTest.ElementsChecker(v, ref, desc); // IMPL NOTE this initialises vector and reference array
+
+            final double exp = calcRef.apply(ref);
+            final double obtained = calcVec.apply(v);
+            final VectorImplementationsTest.Metric metric = new VectorImplementationsTest.Metric(exp, obtained);
+
+            assertTrue("Not close enough at " + desc
+                + (val == null ? "" : ", value " + val) + ", " + metric, metric.closeEnough());
+        });
+    }
+
+    /** */
+    private void normalizeTest(double pow, BiFunction<Double, Double, Double> operation,
+        Function<Vector, Vector> vecOperation) {
+        consumeSampleVectors((v, desc) -> {
+            final int size = v.size();
+            final double[] ref = new double[size];
+            final boolean nonNegative = pow != (int)pow;
+
+            final VectorImplementationsTest.ElementsChecker checker = new VectorImplementationsTest.ElementsChecker(v, ref, desc + ", pow = " + pow, nonNegative);
+            final double norm = new Norm(ref, pow).calculate();
+
+            for (int idx = 0; idx < size; idx++)
+                ref[idx] = operation.apply(ref[idx], norm);
+
+            checker.assertCloseEnough(vecOperation.apply(v), ref);
+        });
+    }
+
+    /** */
+    private void consumeSampleVectors(BiConsumer<Vector, String> consumer) {
+        new VectorImplementationsFixtures().consumeSampleVectors(null, consumer);
+    }
+
+    /** */
+    private static class Norm {
+        /** */
+        private final double[] arr;
+
+        /** */
+        private final Double pow;
+
+        /** */
+        Norm(double[] arr, double pow) {
+            this.arr = arr;
+            this.pow = pow;
+        }
+
+        /** */
+        double calculate() {
+            if (pow.equals(0.0))
+                return countNonZeroes(); // IMPL NOTE this is beautiful if you think of it
+
+            if (pow.equals(Double.POSITIVE_INFINITY))
+                return maxAbs();
+
+            return Math.pow(sumPowers(), 1 / pow);
+        }
+
+        /** */
+        double sumPowers() {
+            if (pow.equals(0.0))
+                return countNonZeroes();
+
+            double norm = 0;
+
+            for (double val : arr)
+                norm += pow == 1 ? Math.abs(val) : Math.pow(val, pow);
+
+            return norm;
+        }
+
+        /** */
+        private int countNonZeroes() {
+            int cnt = 0;
+
+            final Double zero = 0.0;
+
+            for (double val : arr)
+                if (!zero.equals(val))
+                    cnt++;
+
+            return cnt;
+        }
+
+        /** */
+        private double maxAbs() {
+            double res = 0;
+
+            for (double val : arr) {
+                final double abs = Math.abs(val);
+
+                if (abs > res)
+                    res = abs;
+            }
+
+            return res;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorToMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorToMatrixTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorToMatrixTest.java
new file mode 100644
index 0000000..adcb2cc
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorToMatrixTest.java
@@ -0,0 +1,291 @@
+package org.apache.ignite.math.impls.vector;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiConsumer;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.matrix.DenseLocalOffHeapMatrix;
+import org.apache.ignite.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.math.impls.matrix.RandomMatrix;
+import org.apache.ignite.math.impls.matrix.SparseLocalOnHeapMatrix;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+/** Tests for methods of Vector that involve Matrix. */
+public class VectorToMatrixTest {
+    /** */
+    private static final Map<Class<? extends Vector>, Class<? extends Matrix>> typesMap = typesMap();
+
+    /** */
+    private static final List<Class<? extends Vector>> likeMatrixUnsupported = Arrays.asList(FunctionVector.class,
+        SingleElementVector.class, SingleElementVectorView.class, ConstantVector.class);
+
+    /** */
+    @Test
+    public void testHaveLikeMatrix() throws InstantiationException, IllegalAccessException {
+        for (Class<? extends Vector> key : typesMap.keySet()) {
+            Class<? extends Matrix> val = typesMap.get(key);
+
+            if (val == null && likeMatrixSupported(key))
+                System.out.println("Missing test for implementation of likeMatrix for " + key.getSimpleName());
+        }
+    }
+
+    /** */
+    @Test
+    public void testLikeMatrixUnsupported() throws Exception {
+        consumeSampleVectors((v, desc) -> {
+            if (likeMatrixSupported(v.getClass()))
+                return;
+
+            boolean expECaught = false;
+
+            try {
+                assertNull("Null view instead of exception in " + desc, v.likeMatrix(1, 1));
+            }
+            catch (UnsupportedOperationException uoe) {
+                expECaught = true;
+            }
+
+            assertTrue("Expected exception was not caught in " + desc, expECaught);
+        });
+    }
+
+    /** */
+    @Test
+    public void testLikeMatrix() {
+        consumeSampleVectors((v, desc) -> {
+            if (!availableForTesting(v))
+                return;
+
+            final Matrix matrix = v.likeMatrix(1, 1);
+
+            Class<? extends Vector> key = v.getClass();
+
+            Class<? extends Matrix> expMatrixType = typesMap.get(key);
+
+            assertNotNull("Expect non-null matrix for " + key.getSimpleName() + " in " + desc, matrix);
+
+            Class<? extends Matrix> actualMatrixType = matrix.getClass();
+
+            assertTrue("Expected matrix type " + expMatrixType.getSimpleName()
+                    + " should be assignable from actual type " + actualMatrixType.getSimpleName() + " in " + desc,
+                expMatrixType.isAssignableFrom(actualMatrixType));
+
+            for (int rows : new int[] {1, 2})
+                for (int cols : new int[] {1, 2}) {
+                    final Matrix actualMatrix = v.likeMatrix(rows, cols);
+
+                    String details = "rows " + rows + " cols " + cols;
+
+                    assertNotNull("Expect non-null matrix for " + details + " in " + desc,
+                        actualMatrix);
+
+                    assertEquals("Unexpected number of rows in " + desc, rows, actualMatrix.rowSize());
+
+                    assertEquals("Unexpected number of cols in " + desc, cols, actualMatrix.columnSize());
+                }
+        });
+    }
+
+    /** */
+    @Test
+    public void testToMatrix() {
+        consumeSampleVectors((v, desc) -> {
+            if (!availableForTesting(v))
+                return;
+
+            fillWithNonZeroes(v);
+
+            final Matrix matrixRow = v.toMatrix(true);
+
+            final Matrix matrixCol = v.toMatrix(false);
+
+            for (Vector.Element e : v.all())
+                assertToMatrixValue(desc, matrixRow, matrixCol, e.get(), e.index());
+        });
+    }
+
+    /** */
+    @Test
+    public void testToMatrixPlusOne() {
+        consumeSampleVectors((v, desc) -> {
+            if (!availableForTesting(v))
+                return;
+
+            fillWithNonZeroes(v);
+
+            for (double zeroVal : new double[] {-1, 0, 1, 2}) {
+                final Matrix matrixRow = v.toMatrixPlusOne(true, zeroVal);
+
+                final Matrix matrixCol = v.toMatrixPlusOne(false, zeroVal);
+
+                final Metric metricRow0 = new Metric(zeroVal, matrixRow.get(0, 0));
+
+                assertTrue("Not close enough row like " + metricRow0 + " at index 0 in " + desc,
+                    metricRow0.closeEnough());
+
+                final Metric metricCol0 = new Metric(zeroVal, matrixCol.get(0, 0));
+
+                assertTrue("Not close enough cols like " + metricCol0 + " at index 0 in " + desc,
+                    metricCol0.closeEnough());
+
+                for (Vector.Element e : v.all())
+                    assertToMatrixValue(desc, matrixRow, matrixCol, e.get(), e.index() + 1);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testCross() {
+        consumeSampleVectors((v, desc) -> {
+            if (!availableForTesting(v))
+                return;
+
+            fillWithNonZeroes(v);
+
+            for (int delta : new int[] {-1, 0, 1}) {
+                final int size2 = v.size() + delta;
+
+                if (size2 < 1)
+                    return;
+
+                final Vector v2 = new DenseLocalOnHeapVector(size2);
+
+                for (Vector.Element e : v2.all())
+                    e.set(size2 - e.index());
+
+                assertCross(v, v2, desc);
+            }
+        });
+    }
+
+    /** */
+    private void assertCross(Vector v1, Vector v2, String desc) {
+        assertNotNull(v1);
+        assertNotNull(v2);
+
+        final Matrix res = v1.cross(v2);
+
+        assertNotNull("Cross matrix is expected to be not null in " + desc, res);
+
+        assertEquals("Unexpected number of rows in cross Matrix in " + desc, v1.size(), res.rowSize());
+
+        assertEquals("Unexpected number of cols in cross Matrix in " + desc, v2.size(), res.columnSize());
+
+        for (int row = 0; row < v1.size(); row++)
+            for (int col = 0; col < v2.size(); col++) {
+                final Metric metric = new Metric(v1.get(row) * v2.get(col), res.get(row, col));
+
+                assertTrue("Not close enough cross " + metric + " at row " + row + " at col " + col
+                    + " in " + desc, metric.closeEnough());
+            }
+    }
+
+    /** */
+    private void assertToMatrixValue(String desc, Matrix matrixRow, Matrix matrixCol, double exp, int idx) {
+        final Metric metricRow = new Metric(exp, matrixRow.get(0, idx));
+
+        assertTrue("Not close enough row like " + metricRow + " at index " + idx + " in " + desc,
+            metricRow.closeEnough());
+
+        final Metric metricCol = new Metric(exp, matrixCol.get(idx, 0));
+
+        assertTrue("Not close enough cols like " + matrixCol + " at index " + idx + " in " + desc,
+            metricCol.closeEnough());
+    }
+
+    /** */
+    private void fillWithNonZeroes(Vector sample) {
+        if (sample instanceof RandomVector)
+            return;
+
+        for (Vector.Element e : sample.all())
+            e.set(1 + e.index());
+    }
+
+    /** */
+    private boolean availableForTesting(Vector v) {
+        assertNotNull("Error in test: vector is null", v);
+
+        if (!likeMatrixSupported(v.getClass()))
+            return false;
+
+        final boolean availableForTesting = typesMap.get(v.getClass()) != null;
+
+        final Matrix actualLikeMatrix = v.likeMatrix(1, 1);
+
+        assertTrue("Need to enable matrix testing for vector type " + v.getClass().getSimpleName(),
+            availableForTesting || actualLikeMatrix == null);
+
+        return availableForTesting;
+    }
+
+    /** Ignore test for given vector type. */
+    private boolean likeMatrixSupported(Class<? extends Vector> clazz) {
+        for (Class<? extends Vector> ignoredClass : likeMatrixUnsupported)
+            if (ignoredClass.isAssignableFrom(clazz))
+                return false;
+
+        return true;
+    }
+
+    /** */
+    private void consumeSampleVectors(BiConsumer<Vector, String> consumer) {
+        new VectorImplementationsFixtures().consumeSampleVectors(null, consumer);
+    }
+
+    /** */
+    private static Map<Class<? extends Vector>, Class<? extends Matrix>> typesMap() {
+        return new LinkedHashMap<Class<? extends Vector>, Class<? extends Matrix>>() {{
+            put(DenseLocalOnHeapVector.class, DenseLocalOnHeapMatrix.class);
+            put(DenseLocalOffHeapVector.class, DenseLocalOffHeapMatrix.class);
+            put(RandomVector.class, RandomMatrix.class);
+            put(SparseLocalVector.class, SparseLocalOnHeapMatrix.class);
+            put(SingleElementVector.class, null); // todo find out if we need SingleElementMatrix to match, or skip it
+            put(ConstantVector.class, null);
+            put(FunctionVector.class, null);
+            put(PivotedVectorView.class, DenseLocalOnHeapMatrix.class); // IMPL NOTE per fixture
+            put(SingleElementVectorView.class, null);
+            put(MatrixVectorView.class, DenseLocalOnHeapMatrix.class); // IMPL NOTE per fixture
+            put(DelegatingVector.class, DenseLocalOnHeapMatrix.class); // IMPL NOTE per fixture
+            // IMPL NOTE check for presence of all implementations here will be done in testHaveLikeMatrix via Fixture
+        }};
+    }
+
+    /** */
+    private static class Metric { // todo consider if softer tolerance (like say 0.1 or 0.01) would make sense here
+        /** */
+        private final double exp;
+
+        /** */
+        private final double obtained;
+
+        /** **/
+        Metric(double exp, double obtained) {
+            this.exp = exp;
+            this.obtained = obtained;
+        }
+
+        /** */
+        boolean closeEnough() {
+            return new Double(exp).equals(obtained);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "Metric{" + "expected=" + exp +
+                ", obtained=" + obtained +
+                '}';
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorViewTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorViewTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorViewTest.java
new file mode 100644
index 0000000..55893d0
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/VectorViewTest.java
@@ -0,0 +1,162 @@
+/*
+ * 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.math.impls.vector;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.function.BiConsumer;
+import java.util.stream.IntStream;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Unit tests for {@link VectorView}.
+ */
+public class VectorViewTest {
+    /** */
+    private static final int OFFSET = 10;
+
+    /** */
+    private static final int VIEW_LENGTH = 80;
+
+    /** */
+    private static final String EXTERNALIZE_TEST_FILE_NAME = "externalizeTest";
+
+    /** */
+    private VectorView testVector;
+
+    /** */
+    private DenseLocalOnHeapVector parentVector;
+
+    /** */
+    private double[] parentData;
+
+    /** */
+    @Before
+    public void setup() {
+        parentVector = new DenseLocalOnHeapVector(MathTestConstants.STORAGE_SIZE);
+
+        IntStream.range(0, MathTestConstants.STORAGE_SIZE).forEach(idx -> parentVector.set(idx, Math.random()));
+
+        parentData = parentVector.getStorage().data().clone();
+
+        testVector = new VectorView(parentVector, OFFSET, VIEW_LENGTH);
+    }
+
+    /** */
+    @AfterClass
+    public static void cleanup() throws IOException {
+        Files.deleteIfExists(Paths.get(EXTERNALIZE_TEST_FILE_NAME));
+    }
+
+    /** */
+    @Test
+    public void testCopy() throws Exception {
+        Vector cp = testVector.copy();
+
+        assertTrue(MathTestConstants.VAL_NOT_EQUALS, cp.equals(testVector));
+    }
+
+    /** */
+    @Test(expected = org.apache.ignite.math.exceptions.UnsupportedOperationException.class)
+    public void testLike() throws Exception {
+        for (int card : new int[] {1, 2, 4, 8, 16, 32, 64, 128})
+            consumeSampleVectors((v, desc) -> {
+                Vector vLike = new VectorView(v, 0, 1).like(card);
+
+                Class<? extends Vector> expType = v.getClass();
+
+                assertNotNull("Expect non-null like vector for " + expType.getSimpleName() + " in " + desc, vLike);
+
+                assertEquals("Expect size equal to cardinality at " + desc, card, vLike.size());
+
+                Class<? extends Vector> actualType = vLike.getClass();
+
+                assertTrue("Expected matrix type " + expType.getSimpleName()
+                        + " should be assignable from actual type " + actualType.getSimpleName() + " in " + desc,
+                    expType.isAssignableFrom(actualType));
+
+            });
+    }
+
+    /** See also {@link VectorToMatrixTest#testLikeMatrix()}. */
+    @Test
+    public void testLikeMatrix() {
+        consumeSampleVectors((v, desc) -> {
+            boolean expECaught = false;
+
+            try {
+                assertNull("Null view instead of exception in " + desc, new VectorView(v, 0, 1).likeMatrix(1, 1));
+            }
+            catch (UnsupportedOperationException uoe) {
+                expECaught = true;
+            }
+
+            assertTrue("Expected exception was not caught in " + desc, expECaught);
+        });
+    }
+
+    /** */
+    @Test
+    public void testWriteReadExternal() throws Exception {
+        assertNotNull("Unexpected null parent data", parentData);
+
+        File f = new File(EXTERNALIZE_TEST_FILE_NAME);
+
+        try {
+            ObjectOutputStream objOutputStream = new ObjectOutputStream(new FileOutputStream(f));
+
+            objOutputStream.writeObject(testVector);
+
+            objOutputStream.close();
+
+            ObjectInputStream objInputStream = new ObjectInputStream(new FileInputStream(f));
+
+            VectorView readVector = (VectorView)objInputStream.readObject();
+
+            objInputStream.close();
+
+            assertTrue(MathTestConstants.VAL_NOT_EQUALS, testVector.equals(readVector));
+        }
+        catch (ClassNotFoundException | IOException e) {
+            fail(e.getMessage());
+        }
+    }
+
+    /** */
+    private void consumeSampleVectors(BiConsumer<Vector, String> consumer) {
+        new VectorImplementationsFixtures().consumeSampleVectors(null, consumer);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5f2cb7c..9e9d877 100644
--- a/pom.xml
+++ b/pom.xml
@@ -933,6 +933,13 @@
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>math</id>
+            <modules>
+                <module>modules/math</module>
+            </modules>
+        </profile>
     </profiles>
 
     <build>


[10/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 81c09b9..5018f43 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -17,14 +17,18 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-import org.apache.ignite.internal.LessNamingBean;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.internal.visor.cache.VisorCache;
 import org.apache.ignite.internal.visor.event.VisorGridEvent;
 import org.apache.ignite.internal.visor.igfs.VisorIgfs;
@@ -34,7 +38,7 @@ import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
 /**
  * Data collector task result.
  */
-public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamingBean {
+public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -42,47 +46,54 @@ public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamin
     private boolean active;
 
     /** Unhandled exceptions from nodes. */
-    private final Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
+    private Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
 
     /** Nodes grid names. */
-    private final Map<UUID, String> igniteInstanceNames = new HashMap<>();
+    private Map<UUID, String> gridNames = new HashMap<>();
 
     /** Nodes topology versions. */
-    private final Map<UUID, Long> topVersions = new HashMap<>();
+    private Map<UUID, Long> topVersions = new HashMap<>();
 
     /** All task monitoring state collected from nodes. */
-    private final Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>();
+    private Map<UUID, Boolean> taskMonitoringEnabled = new HashMap<>();
 
     /** Nodes error counts. */
-    private final Map<UUID, Long> errCnts = new HashMap<>();
+    private Map<UUID, Long> errCnts = new HashMap<>();
 
     /** All events collected from nodes. */
-    private final List<VisorGridEvent> evts = new ArrayList<>();
+    private List<VisorGridEvent> evts = new ArrayList<>();
 
     /** Exceptions caught during collecting events from nodes. */
-    private final Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
+    private Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
 
     /** All caches collected from nodes. */
-    private final Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
+    private Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
 
     /** Exceptions caught during collecting caches from nodes. */
-    private final Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
+    private Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
 
     /** All IGFS collected from nodes. */
-    private final Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
+    private Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
 
     /** All IGFS endpoints collected from nodes. */
-    private final Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
+    private Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
 
     /** Exceptions caught during collecting IGFS from nodes. */
-    private final Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
+    private Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
+
+    /**
+     * Default constructor.
+     */
+    public VisorNodeDataCollectorTaskResult() {
+        // No-op.
+    }
 
     /**
      * @return {@code true} If no data was collected.
      */
     public boolean isEmpty() {
         return
-            igniteInstanceNames.isEmpty() &&
+            gridNames.isEmpty() &&
             topVersions.isEmpty() &&
             unhandledEx.isEmpty() &&
             taskMonitoringEnabled.isEmpty() &&
@@ -112,84 +123,123 @@ public class VisorNodeDataCollectorTaskResult implements Serializable, LessNamin
     /**
      * @return Unhandled exceptions from nodes.
      */
-    public Map<UUID, VisorExceptionWrapper> unhandledEx() {
+    public Map<UUID, VisorExceptionWrapper> getUnhandledEx() {
         return unhandledEx;
     }
 
     /**
-     * @return Nodes Ignite instance names.
+     * @return Nodes grid names.
      */
-    public Map<UUID, String> igniteInstanceNames() {
-        return igniteInstanceNames;
+    public Map<UUID, String> getGridNames() {
+        return gridNames;
     }
 
     /**
      * @return Nodes topology versions.
      */
-    public Map<UUID, Long> topologyVersions() {
+    public Map<UUID, Long> getTopologyVersions() {
         return topVersions;
     }
 
     /**
      * @return All task monitoring state collected from nodes.
      */
-    public Map<UUID, Boolean> taskMonitoringEnabled() {
+    public Map<UUID, Boolean> isTaskMonitoringEnabled() {
         return taskMonitoringEnabled;
     }
 
     /**
      * @return All events collected from nodes.
      */
-    public List<VisorGridEvent> events() {
+    public List<VisorGridEvent> getEvents() {
         return evts;
     }
 
     /**
      * @return Exceptions caught during collecting events from nodes.
      */
-    public Map<UUID, VisorExceptionWrapper> eventsEx() {
+    public Map<UUID, VisorExceptionWrapper> getEventsEx() {
         return evtsEx;
     }
 
     /**
      * @return All caches collected from nodes.
      */
-    public Map<UUID, Collection<VisorCache>> caches() {
+    public Map<UUID, Collection<VisorCache>> getCaches() {
         return caches;
     }
 
     /**
      * @return Exceptions caught during collecting caches from nodes.
      */
-    public Map<UUID, VisorExceptionWrapper> cachesEx() {
+    public Map<UUID, VisorExceptionWrapper> getCachesEx() {
         return cachesEx;
     }
 
     /**
      * @return All IGFS collected from nodes.
      */
-    public Map<UUID, Collection<VisorIgfs>> igfss() {
+    public Map<UUID, Collection<VisorIgfs>> getIgfss() {
         return igfss;
     }
 
     /**
      * @return All IGFS endpoints collected from nodes.
      */
-    public Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints() {
+    public Map<UUID, Collection<VisorIgfsEndpoint>> getIgfsEndpoints() {
         return igfsEndpoints;
     }
 
     /**
      * @return Exceptions caught during collecting IGFS from nodes.
      */
-    public Map<UUID, VisorExceptionWrapper> igfssEx() {
+    public Map<UUID, VisorExceptionWrapper> getIgfssEx() {
         return igfssEx;
     }
 
     /**
      * @return Nodes error counts.
      */
-    public Map<UUID, Long> errorCounts() {
+    public Map<UUID, Long> getErrorCounts() {
         return errCnts;
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(active);
+        U.writeMap(out, unhandledEx);
+        U.writeMap(out, gridNames);
+        U.writeMap(out, topVersions);
+        U.writeMap(out, taskMonitoringEnabled);
+        U.writeMap(out, errCnts);
+        U.writeCollection(out, evts);
+        U.writeMap(out, evtsEx);
+        U.writeMap(out, caches);
+        U.writeMap(out, cachesEx);
+        U.writeMap(out, igfss);
+        U.writeMap(out, igfsEndpoints);
+        U.writeMap(out, igfssEx);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        active = in.readBoolean();
+        unhandledEx = U.readMap(in);
+        gridNames = U.readMap(in);
+        topVersions = U.readMap(in);
+        taskMonitoringEnabled = U.readMap(in);
+        errCnts = U.readMap(in);
+        evts = U.readList(in);
+        evtsEx = U.readMap(in);
+        caches = U.readMap(in);
+        cachesEx = U.readMap(in);
+        igfss = U.readMap(in);
+        igfsEndpoints = U.readMap(in);
+        igfssEx = U.readMap(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodeDataCollectorTaskResult.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java
index f219908..bb6c83e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTask.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -38,18 +37,14 @@ import org.apache.ignite.internal.visor.util.VisorEventMapper;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.events.EventType.EVTS_JOB_EXECUTION;
-import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION;
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.EVT_MAPPER;
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.concat;
 
 /**
  * Task that runs on specified node and returns events data.
  */
 @GridInternal
-public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg,
+public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEventsCollectorTaskArg,
     Iterable<? extends VisorGridEvent>, Collection<? extends VisorGridEvent>> {
     /** */
     private static final long serialVersionUID = 0L;
@@ -72,114 +67,6 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
     }
 
     /**
-     * Argument for task returns events data.
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class VisorNodeEventsCollectorTaskArg implements Serializable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Node local storage key. */
-        private final String keyOrder;
-
-        /** Arguments for type filter. */
-        private final int[] typeArg;
-
-        /** Arguments for time filter. */
-        private final Long timeArg;
-
-        /** Task or job events with task name contains. */
-        private final String taskName;
-
-        /** Task or job events with session. */
-        private final IgniteUuid taskSesId;
-
-        /**
-         * @param keyOrder Arguments for node local storage key.
-         * @param typeArg Arguments for type filter.
-         * @param timeArg Arguments for time filter.
-         * @param taskName Arguments for task name filter.
-         * @param taskSesId Arguments for task session filter.
-         */
-        public VisorNodeEventsCollectorTaskArg(@Nullable String keyOrder, @Nullable int[] typeArg,
-            @Nullable Long timeArg,
-            @Nullable String taskName, @Nullable IgniteUuid taskSesId) {
-            this.keyOrder = keyOrder;
-            this.typeArg = typeArg;
-            this.timeArg = timeArg;
-            this.taskName = taskName;
-            this.taskSesId = taskSesId;
-        }
-
-        /**
-         * @param typeArg Arguments for type filter.
-         * @param timeArg Arguments for time filter.
-         */
-        public static VisorNodeEventsCollectorTaskArg createEventsArg(@Nullable int[] typeArg, @Nullable Long timeArg) {
-            return new VisorNodeEventsCollectorTaskArg(null, typeArg, timeArg, null, null);
-        }
-
-        /**
-         * @param timeArg Arguments for time filter.
-         * @param taskName Arguments for task name filter.
-         * @param taskSesId Arguments for task session filter.
-         */
-        public static VisorNodeEventsCollectorTaskArg createTasksArg(@Nullable Long timeArg, @Nullable String taskName,
-            @Nullable IgniteUuid taskSesId) {
-            return new VisorNodeEventsCollectorTaskArg(null, concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION),
-                timeArg, taskName, taskSesId);
-        }
-
-        /**
-         * @param keyOrder Arguments for node local storage key.
-         * @param typeArg Arguments for type filter.
-         */
-        public static VisorNodeEventsCollectorTaskArg createLogArg(@Nullable String keyOrder, @Nullable int[] typeArg) {
-            return new VisorNodeEventsCollectorTaskArg(keyOrder, typeArg, null, null, null);
-        }
-
-        /**
-         * @return Node local storage key.
-         */
-        @Nullable public String keyOrder() {
-            return keyOrder;
-        }
-
-        /**
-         * @return Arguments for type filter.
-         */
-        public int[] typeArgument() {
-            return typeArg;
-        }
-
-        /**
-         * @return Arguments for time filter.
-         */
-        public Long timeArgument() {
-            return timeArg;
-        }
-
-        /**
-         * @return Task or job events with task name contains.
-         */
-        public String taskName() {
-            return taskName;
-        }
-
-        /**
-         * @return Task or job events with session.
-         */
-        public IgniteUuid taskSessionId() {
-            return taskSesId;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorNodeEventsCollectorTaskArg.class, this);
-        }
-    }
-
-    /**
      * Job for task returns events data.
      */
     protected static class VisorNodeEventsCollectorJob extends VisorJob<VisorNodeEventsCollectorTaskArg,
@@ -279,12 +166,12 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
 
         /** {@inheritDoc} */
         @Override protected Collection<? extends VisorGridEvent> run(final VisorNodeEventsCollectorTaskArg arg) {
-            final long startEvtTime = arg.timeArgument() == null ? 0L : System.currentTimeMillis() - arg.timeArgument();
+            final long startEvtTime = arg.getTimeArgument() == null ? 0L : System.currentTimeMillis() - arg.getTimeArgument();
 
             final ConcurrentMap<String, Long> nl = ignite.cluster().nodeLocalMap();
 
-            final Long startEvtOrder = arg.keyOrder() != null && nl.containsKey(arg.keyOrder()) ?
-                nl.get(arg.keyOrder()) : -1L;
+            final Long startEvtOrder = arg.getKeyOrder() != null && nl.containsKey(arg.getKeyOrder()) ?
+                nl.get(arg.getKeyOrder()) : -1L;
 
             Collection<Event> evts = ignite.events().localQuery(new IgnitePredicate<Event>() {
                 /** */
@@ -292,10 +179,10 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
 
                 @Override public boolean apply(Event evt) {
                     return evt.localOrder() > startEvtOrder &&
-                        (arg.typeArgument() == null || F.contains(arg.typeArgument(), evt.type())) &&
+                        (arg.getTypeArgument() == null || F.contains(arg.getTypeArgument(), evt.type())) &&
                         (evt.timestamp() >= startEvtTime) &&
-                        (arg.taskName() == null || filterByTaskName(evt, arg.taskName())) &&
-                        (arg.taskSessionId() == null || filterByTaskSessionId(evt, arg.taskSessionId()));
+                        (arg.getTaskName() == null || filterByTaskName(evt, arg.getTaskName())) &&
+                        (arg.getTaskSessionId() == null || filterByTaskSessionId(evt, arg.getTaskSessionId()));
                 }
             });
 
@@ -319,8 +206,8 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
             }
 
             // Update latest order in node local, if not empty.
-            if (arg.keyOrder() != null && !res.isEmpty())
-                nl.put(arg.keyOrder(), maxOrder);
+            if (arg.getKeyOrder() != null && !res.isEmpty())
+                nl.put(arg.getKeyOrder(), maxOrder);
 
             return res;
         }
@@ -330,4 +217,4 @@ public class VisorNodeEventsCollectorTask extends VisorMultiNodeTask<VisorNodeEv
             return S.toString(VisorNodeEventsCollectorJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
new file mode 100644
index 0000000..c2e6b4a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeEventsCollectorTaskArg.java
@@ -0,0 +1,163 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.events.EventType.EVTS_JOB_EXECUTION;
+import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.concat;
+
+/**
+ * Argument for task returns events data.
+ */
+public class VisorNodeEventsCollectorTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Node local storage key. */
+    private String keyOrder;
+
+    /** Arguments for type filter. */
+    private int[] typeArg;
+
+    /** Arguments for time filter. */
+    private Long timeArg;
+
+    /** Task or job events with task name contains. */
+    private String taskName;
+
+    /** Task or job events with session. */
+    private IgniteUuid taskSesId;
+
+    /**
+     * Default constructor.
+     */
+    public VisorNodeEventsCollectorTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param keyOrder Arguments for node local storage key.
+     * @param typeArg Arguments for type filter.
+     * @param timeArg Arguments for time filter.
+     * @param taskName Arguments for task name filter.
+     * @param taskSesId Arguments for task session filter.
+     */
+    public VisorNodeEventsCollectorTaskArg(@Nullable String keyOrder, @Nullable int[] typeArg,
+        @Nullable Long timeArg,
+        @Nullable String taskName, @Nullable IgniteUuid taskSesId) {
+        this.keyOrder = keyOrder;
+        this.typeArg = typeArg;
+        this.timeArg = timeArg;
+        this.taskName = taskName;
+        this.taskSesId = taskSesId;
+    }
+
+    /**
+     * @param typeArg Arguments for type filter.
+     * @param timeArg Arguments for time filter.
+     */
+    public static VisorNodeEventsCollectorTaskArg createEventsArg(@Nullable int[] typeArg, @Nullable Long timeArg) {
+        return new VisorNodeEventsCollectorTaskArg(null, typeArg, timeArg, null, null);
+    }
+
+    /**
+     * @param timeArg Arguments for time filter.
+     * @param taskName Arguments for task name filter.
+     * @param taskSesId Arguments for task session filter.
+     */
+    public static VisorNodeEventsCollectorTaskArg createTasksArg(@Nullable Long timeArg, @Nullable String taskName,
+        @Nullable IgniteUuid taskSesId) {
+        return new VisorNodeEventsCollectorTaskArg(null, concat(EVTS_JOB_EXECUTION, EVTS_TASK_EXECUTION),
+            timeArg, taskName, taskSesId);
+    }
+
+    /**
+     * @param keyOrder Arguments for node local storage key.
+     * @param typeArg Arguments for type filter.
+     */
+    public static VisorNodeEventsCollectorTaskArg createLogArg(@Nullable String keyOrder, @Nullable int[] typeArg) {
+        return new VisorNodeEventsCollectorTaskArg(keyOrder, typeArg, null, null, null);
+    }
+
+    /**
+     * @return Node local storage key.
+     */
+    @Nullable public String getKeyOrder() {
+        return keyOrder;
+    }
+
+    /**
+     * @return Arguments for type filter.
+     */
+    public int[] getTypeArgument() {
+        return typeArg;
+    }
+
+    /**
+     * @return Arguments for time filter.
+     */
+    public Long getTimeArgument() {
+        return timeArg;
+    }
+
+    /**
+     * @return Task or job events with task name contains.
+     */
+    public String getTaskName() {
+        return taskName;
+    }
+
+    /**
+     * @return Task or job events with session.
+     */
+    public IgniteUuid getTaskSessionId() {
+        return taskSesId;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, keyOrder);
+        out.writeObject(typeArg);
+        out.writeObject(timeArg);
+        U.writeString(out, taskName);
+        U.writeGridUuid(out, taskSesId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        keyOrder = U.readString(in);
+        typeArg = (int[])in.readObject();
+        timeArg = (Long)in.readObject();
+        taskName = U.readString(in);
+        taskSesId = U.readGridUuid(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodeEventsCollectorTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
index 42afc73..bdc1104 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTask.java
@@ -28,15 +28,13 @@ import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Task to run gc on nodes.
  */
 @GridInternal
-public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBiTuple<Long, Long>>,
-    IgniteBiTuple<Long, Long>> {
+public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, VisorNodeGcTaskResult>, VisorNodeGcTaskResult> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -46,11 +44,11 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override protected Map<UUID, IgniteBiTuple<Long, Long>> reduce0(List<ComputeJobResult> results) {
-        Map<UUID, IgniteBiTuple<Long, Long>> total = new HashMap<>();
+    @Nullable @Override protected Map<UUID, VisorNodeGcTaskResult> reduce0(List<ComputeJobResult> results) {
+        Map<UUID, VisorNodeGcTaskResult> total = new HashMap<>();
 
         for (ComputeJobResult res : results) {
-            IgniteBiTuple<Long, Long> jobRes = res.getData();
+            VisorNodeGcTaskResult jobRes = res.getData();
 
             total.put(res.getNode().id(), jobRes);
         }
@@ -59,7 +57,7 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
     }
 
     /** Job that perform GC on node. */
-    private static class VisorNodeGcJob extends VisorJob<Void, IgniteBiTuple<Long, Long>> {
+    private static class VisorNodeGcJob extends VisorJob<Void, VisorNodeGcTaskResult> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -74,14 +72,14 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
         }
 
         /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<Long, Long> run(Void arg) {
+        @Override protected VisorNodeGcTaskResult run(Void arg) {
             ClusterNode locNode = ignite.localNode();
 
             long before = freeHeap(locNode);
 
             System.gc();
 
-            return new IgniteBiTuple<>(before, freeHeap(locNode));
+            return new VisorNodeGcTaskResult(before, freeHeap(locNode));
         }
 
         /**
@@ -99,4 +97,4 @@ public class VisorNodeGcTask extends VisorMultiNodeTask<Void, Map<UUID, IgniteBi
             return S.toString(VisorNodeGcJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
new file mode 100644
index 0000000..eb12ef7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeGcTaskResult.java
@@ -0,0 +1,85 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for task returns GC execution results.
+ */
+public class VisorNodeGcTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Size before GC execution. */
+    private long sizeBefore;
+
+    /** Size after GC execution. */
+    private long sizeAfter;
+
+    /**
+     * Default constructor.
+     */
+    public VisorNodeGcTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * @param sizeBefore Size before GC execution.
+     * @param sizeAfter Size after GC execution.
+     */
+    public VisorNodeGcTaskResult(long sizeBefore, long sizeAfter) {
+        this.sizeBefore = sizeBefore;
+        this.sizeAfter = sizeAfter;
+    }
+
+    /**
+     * @return Size before GC execution.
+     */
+    public Long getSizeBefore() {
+        return sizeBefore;
+    }
+
+    /**
+     * @return Size after GC execution.
+     */
+    public Long getSizeAfter() {
+        return sizeAfter;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(sizeBefore);
+        out.writeLong(sizeAfter);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        sizeBefore = in.readLong();
+        sizeAfter = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodeGcTaskResult.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
index f59ea01..6169dcb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTask.java
@@ -22,7 +22,6 @@ import java.util.UUID;
 import org.apache.ignite.cluster.ClusterTopologyException;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.lang.GridTuple3;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
@@ -32,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
  * Ping other node.
  */
 @GridInternal
-public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean, Long, Long>> {
+public class VisorNodePingTask extends VisorOneNodeTask<UUID, VisorNodePingTaskResult> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -42,19 +41,19 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override protected GridTuple3<Boolean, Long, Long> reduce0(List<ComputeJobResult> results) {
+    @Nullable @Override protected VisorNodePingTaskResult reduce0(List<ComputeJobResult> results) {
         try {
             return super.reduce0(results);
         }
         catch (ClusterTopologyException ignored) {
-            return new GridTuple3<>(false, -1L, -1L);
+            return new VisorNodePingTaskResult(false, -1L, -1L);
         }
     }
 
     /**
      * Job that ping node.
      */
-    private static class VisorNodePingJob extends VisorJob<UUID, GridTuple3<Boolean, Long, Long>> {
+    private static class VisorNodePingJob extends VisorJob<UUID, VisorNodePingTaskResult> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -67,10 +66,10 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
         }
 
         /** {@inheritDoc} */
-        @Override protected GridTuple3<Boolean, Long, Long> run(UUID nodeToPing) {
+        @Override protected VisorNodePingTaskResult run(UUID nodeToPing) {
             long start = System.currentTimeMillis();
 
-            return new GridTuple3<>(ignite.cluster().pingNode(nodeToPing), start, System.currentTimeMillis());
+            return new VisorNodePingTaskResult(ignite.cluster().pingNode(nodeToPing), start, System.currentTimeMillis());
         }
 
         /** {@inheritDoc} */
@@ -78,4 +77,4 @@ public class VisorNodePingTask extends VisorOneNodeTask<UUID, GridTuple3<Boolean
             return S.toString(VisorNodePingJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
new file mode 100644
index 0000000..5328f65
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodePingTaskResult.java
@@ -0,0 +1,99 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Result for {@link VisorNodePingTask}.
+ */
+public class VisorNodePingTaskResult extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Node alive. */
+    private boolean alive;
+
+    /** Ping start time. */
+    private long startTime;
+
+    /** Ping finish time. */
+    private long finishTime;
+
+    /**
+     * Default constructor.
+     */
+    public VisorNodePingTaskResult() {
+        // No-op.
+    }
+
+    /**
+     * @param alive Node alive.
+     * @param startTime Ping start time.
+     * @param finishTime Ping finish time.
+     */
+    public VisorNodePingTaskResult(boolean alive, long startTime, long finishTime) {
+        this.alive = alive;
+        this.startTime = startTime;
+        this.finishTime = finishTime;
+    }
+
+    /**
+     * @return Node alive.
+     */
+    public boolean isAlive() {
+        return alive;
+    }
+
+    /**
+     * @return Ping start time.
+     */
+    public long getStartTime() {
+        return startTime;
+    }
+
+    /**
+     * @return Ping finish time.
+     */
+    public long getFinishTime() {
+        return finishTime;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(alive);
+        out.writeLong(startTime);
+        out.writeLong(finishTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        alive = in.readBoolean();
+        startTime = in.readLong();
+        finishTime = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodePingTaskResult.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
new file mode 100644
index 0000000..482adce
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrors.java
@@ -0,0 +1,89 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Create data transfer object for node's suppressed errors.
+ */
+public class VisorNodeSuppressedErrors extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Order number of last suppressed error. */
+    private Long order;
+
+    /** List of suppressed errors. */
+    private List<VisorSuppressedError> errors;
+
+    /**
+     * Default constructor.
+     */
+    public VisorNodeSuppressedErrors() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for node's suppressed errors.
+     *
+     * @param order Order number of last suppressed error.
+     * @param errors List of suppressed errors.
+     */
+    public VisorNodeSuppressedErrors(Long order, List<VisorSuppressedError> errors) {
+        this.order = order;
+        this.errors = errors;
+    }
+
+    /**
+     * @return Order number of last suppressed error.
+     */
+    public Long getOrder() {
+        return order;
+    }
+
+    /**
+     * @return List of suppressed errors.
+     */
+    public List<VisorSuppressedError> getErrors() {
+        return errors;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(order);
+        U.writeCollection(out, errors);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        order = in.readLong();
+        errors = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorNodeSuppressedErrors.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
index 1f673ca..c7b9cf7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
 import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -37,8 +36,7 @@ import org.jetbrains.annotations.Nullable;
  */
 @GridInternal
 public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID, Long>,
-    Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>>,
-    IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> {
+    Map<UUID, VisorNodeSuppressedErrors>, VisorNodeSuppressedErrors> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -48,13 +46,13 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override protected Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>>
+    @Nullable @Override protected Map<UUID, VisorNodeSuppressedErrors>
         reduce0(List<ComputeJobResult> results) {
-        Map<UUID, IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> taskRes =
+        Map<UUID, VisorNodeSuppressedErrors> taskRes =
             new HashMap<>(results.size());
 
         for (ComputeJobResult res : results) {
-            IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> jobRes = res.getData();
+            VisorNodeSuppressedErrors jobRes = res.getData();
 
             taskRes.put(res.getNode().id(), jobRes);
         }
@@ -65,8 +63,7 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
     /**
      * Job to collect last errors on nodes.
      */
-    private static class VisorNodeSuppressedErrorsJob extends VisorJob<Map<UUID, Long>,
-        IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>>> {
+    private static class VisorNodeSuppressedErrorsJob extends VisorJob<Map<UUID, Long>, VisorNodeSuppressedErrors> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -81,20 +78,20 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
         }
 
         /** {@inheritDoc} */
-        @Override protected IgniteBiTuple<Long, List<IgniteExceptionRegistry.ExceptionInfo>> run(Map<UUID, Long> arg) {
+        @Override protected VisorNodeSuppressedErrors run(Map<UUID, Long> arg) {
             Long lastOrder = arg.get(ignite.localNode().id());
 
             long order = lastOrder != null ? lastOrder : 0;
 
             List<IgniteExceptionRegistry.ExceptionInfo> errors = ignite.context().exceptionRegistry().getErrors(order);
 
-            List<IgniteExceptionRegistry.ExceptionInfo> wrapped = new ArrayList<>(errors.size());
+            List<VisorSuppressedError> wrapped = new ArrayList<>(errors.size());
 
             for (IgniteExceptionRegistry.ExceptionInfo error : errors) {
                 if (error.order() > order)
                     order = error.order();
 
-                wrapped.add(new IgniteExceptionRegistry.ExceptionInfo(error.order(),
+                wrapped.add(new VisorSuppressedError(error.order(),
                     new VisorExceptionWrapper(error.error()),
                     error.message(),
                     error.threadId(),
@@ -102,7 +99,7 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
                     error.time()));
             }
 
-            return new IgniteBiTuple<>(order, wrapped);
+            return new VisorNodeSuppressedErrors(order, wrapped);
         }
 
         /** {@inheritDoc} */
@@ -110,4 +107,4 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
             return S.toString(VisorNodeSuppressedErrorsJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
index 93177fd..ab9e140 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorPeerToPeerConfiguration.java
@@ -17,18 +17,21 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.List;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
-
 /**
  * Data transfer object for node P2P configuration properties.
  */
-public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBean {
+public class VisorPeerToPeerConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -39,44 +42,62 @@ public class VisorPeerToPeerConfiguration implements Serializable, LessNamingBea
     private int p2pMissedResCacheSize;
 
     /** List of packages from the system classpath that need to be loaded from task originating node. */
-    private String p2pLocClsPathExcl;
+    private List<String> p2pLocClsPathExcl;
 
     /**
-     * @param c Grid configuration.
-     * @return Data transfer object for node P2P configuration properties.
+     * Default constructor.
      */
-    public static VisorPeerToPeerConfiguration from(IgniteConfiguration c) {
-        VisorPeerToPeerConfiguration cfg = new VisorPeerToPeerConfiguration();
-
-        cfg.p2pEnabled = c.isPeerClassLoadingEnabled();
-        cfg.p2pMissedResCacheSize = c.getPeerClassLoadingMissedResourcesCacheSize();
-        cfg.p2pLocClsPathExcl = compactArray(c.getPeerClassLoadingLocalClassPathExclude());
+    public VisorPeerToPeerConfiguration() {
+        // No-op.
+    }
 
-        return cfg;
+    /**
+     * Create data transfer object for node P2P configuration properties.
+     *
+     * @param c Grid configuration.
+     */
+    public VisorPeerToPeerConfiguration(IgniteConfiguration c) {
+        p2pEnabled = c.isPeerClassLoadingEnabled();
+        p2pMissedResCacheSize = c.getPeerClassLoadingMissedResourcesCacheSize();
+        p2pLocClsPathExcl = Arrays.asList(c.getPeerClassLoadingLocalClassPathExclude());
     }
 
     /**
      * @return Whether peer-to-peer class loading is enabled.
      */
-    public boolean p2pEnabled() {
+    public boolean isPeerClassLoadingEnabled() {
         return p2pEnabled;
     }
 
     /**
      * @return Missed resource cache size.
      */
-    public int p2pMissedResponseCacheSize() {
+    public int getPeerClassLoadingMissedResourcesCacheSize() {
         return p2pMissedResCacheSize;
     }
 
     /**
      * @return List of packages from the system classpath that need to be loaded from task originating node.
      */
-    @Nullable public String p2pLocalClassPathExclude() {
+    @Nullable public List<String> getPeerClassLoadingLocalClassPathExclude() {
         return p2pLocClsPathExcl;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(p2pEnabled);
+        out.writeInt(p2pMissedResCacheSize);
+        U.writeCollection(out, p2pLocClsPathExcl);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        p2pEnabled = in.readBoolean();
+        p2pMissedResCacheSize = in.readInt();
+        p2pLocClsPathExcl = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorPeerToPeerConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
index 78a54b3..1f1e2b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
@@ -17,11 +17,14 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.ConnectorConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.jetbrains.annotations.Nullable;
 
 import static java.lang.System.getProperty;
@@ -33,7 +36,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.intValue;
 /**
  * Create data transfer object for node REST configuration properties.
  */
-public class VisorRestConfiguration implements Serializable, LessNamingBean {
+public class VisorRestConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -43,9 +46,6 @@ public class VisorRestConfiguration implements Serializable, LessNamingBean {
     /** Whether or not SSL is enabled for TCP binary protocol. */
     private boolean tcpSslEnabled;
 
-    /** Rest accessible folders (log command can get files from). */
-    private String[] accessibleFolders;
-
     /** Jetty config path. */
     private String jettyPath;
 
@@ -65,95 +65,116 @@ public class VisorRestConfiguration implements Serializable, LessNamingBean {
     private String tcpSslCtxFactory;
 
     /**
+     * Default constructor.
+     */
+    public VisorRestConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for node REST configuration properties.
+     *
      * @param c Grid configuration.
-     * @return Create data transfer object for node REST configuration properties.
      */
-    public static VisorRestConfiguration from(IgniteConfiguration c) {
-        VisorRestConfiguration cfg = new VisorRestConfiguration();
+    public VisorRestConfiguration(IgniteConfiguration c) {
+        assert c != null;
 
         ConnectorConfiguration clnCfg = c.getConnectorConfiguration();
 
-        boolean restEnabled = clnCfg != null;
-
-        cfg.restEnabled = restEnabled;
+        restEnabled = clnCfg != null;
 
         if (restEnabled) {
-            cfg.tcpSslEnabled = clnCfg.isSslEnabled();
-            cfg.jettyPath = clnCfg.getJettyPath();
-            cfg.jettyHost = getProperty(IGNITE_JETTY_HOST);
-            cfg.jettyPort = intValue(IGNITE_JETTY_PORT, null);
-            cfg.tcpHost = clnCfg.getHost();
-            cfg.tcpPort = clnCfg.getPort();
-            cfg.tcpSslCtxFactory = compactClass(clnCfg.getSslContextFactory());
+            tcpSslEnabled = clnCfg.isSslEnabled();
+            jettyPath = clnCfg.getJettyPath();
+            jettyHost = getProperty(IGNITE_JETTY_HOST);
+            jettyPort = intValue(IGNITE_JETTY_PORT, null);
+            tcpHost = clnCfg.getHost();
+            tcpPort = clnCfg.getPort();
+            tcpSslCtxFactory = compactClass(clnCfg.getSslContextFactory());
         }
-
-        return cfg;
     }
 
     /**
      * @return Whether REST enabled or not.
      */
-    public boolean restEnabled() {
+    public boolean isRestEnabled() {
         return restEnabled;
     }
 
     /**
      * @return Whether or not SSL is enabled for TCP binary protocol.
      */
-    public boolean tcpSslEnabled() {
+    public boolean isTcpSslEnabled() {
         return tcpSslEnabled;
     }
 
     /**
-     * @return Rest accessible folders (log command can get files from).
-     */
-    @Nullable public String[] accessibleFolders() {
-        return accessibleFolders;
-    }
-
-    /**
      * @return Jetty config path.
      */
-    @Nullable public String jettyPath() {
+    @Nullable public String getJettyPath() {
         return jettyPath;
     }
 
     /**
      * @return Jetty host.
      */
-    @Nullable public String jettyHost() {
+    @Nullable public String getJettyHost() {
         return jettyHost;
     }
 
     /**
      * @return Jetty port.
      */
-    @Nullable public Integer jettyPort() {
+    @Nullable public Integer getJettyPort() {
         return jettyPort;
     }
 
     /**
      * @return REST TCP binary host.
      */
-    @Nullable public String tcpHost() {
+    @Nullable public String getTcpHost() {
         return tcpHost;
     }
 
     /**
      * @return REST TCP binary port.
      */
-    @Nullable public Integer tcpPort() {
+    @Nullable public Integer getTcpPort() {
         return tcpPort;
     }
 
     /**
      * @return Context factory for SSL.
      */
-    @Nullable public String tcpSslContextFactory() {
+    @Nullable public String getTcpSslContextFactory() {
         return tcpSslCtxFactory;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeBoolean(restEnabled);
+        out.writeBoolean(tcpSslEnabled);
+        U.writeString(out, jettyPath);
+        U.writeString(out, jettyHost);
+        out.writeObject(jettyPort);
+        U.writeString(out, tcpHost);
+        out.writeObject(tcpPort);
+        U.writeString(out, tcpSslCtxFactory);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        restEnabled = in.readBoolean();
+        tcpSslEnabled = in.readBoolean();
+        jettyPath = U.readString(in);
+        jettyHost = U.readString(in);
+        jettyPort = (Integer)in.readObject();
+        tcpHost = U.readString(in);
+        tcpPort = (Integer)in.readObject();
+        tcpSslCtxFactory = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorRestConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
index 44909fc..6516141 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSegmentationConfiguration.java
@@ -17,10 +17,13 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
 import org.jetbrains.annotations.Nullable;
 
@@ -29,7 +32,7 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactArray;
 /**
  * Data transfer object for node segmentation configuration properties.
  */
-public class VisorSegmentationConfiguration implements Serializable, LessNamingBean {
+public class VisorSegmentationConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -46,57 +49,79 @@ public class VisorSegmentationConfiguration implements Serializable, LessNamingB
     private boolean waitOnStart;
 
     /** Whether or not all resolvers should succeed for node to be in correct segment. */
-    private boolean passRequired;
+    private boolean allResolversPassReq;
 
     /**
-     * @param c Grid configuration.
-     * @return Data transfer object for node segmentation configuration properties.
+     * Default constructor.
      */
-    public static VisorSegmentationConfiguration from(IgniteConfiguration c) {
-        VisorSegmentationConfiguration cfg = new VisorSegmentationConfiguration();
-
-        cfg.plc = c.getSegmentationPolicy();
-        cfg.resolvers = compactArray(c.getSegmentationResolvers());
-        cfg.checkFreq = c.getSegmentCheckFrequency();
-        cfg.waitOnStart = c.isWaitForSegmentOnStart();
-        cfg.passRequired = c.isAllSegmentationResolversPassRequired();
+    public VisorSegmentationConfiguration() {
+        // No-op.
+    }
 
-        return cfg;
+    /**
+     * Create data transfer object for node segmentation configuration properties.
+     *
+     * @param c Grid configuration.
+     */
+    public VisorSegmentationConfiguration(IgniteConfiguration c) {
+        plc = c.getSegmentationPolicy();
+        resolvers = compactArray(c.getSegmentationResolvers());
+        checkFreq = c.getSegmentCheckFrequency();
+        waitOnStart = c.isWaitForSegmentOnStart();
+        allResolversPassReq = c.isAllSegmentationResolversPassRequired();
     }
 
     /**
      * @return Segmentation policy.
      */
-    public SegmentationPolicy policy() {
+    public SegmentationPolicy getPolicy() {
         return plc;
     }
 
     /**
      * @return Segmentation resolvers.
      */
-    @Nullable public String resolvers() {
+    @Nullable public String getResolvers() {
         return resolvers;
     }
 
     /**
      * @return Frequency of network segment check by discovery manager.
      */
-    public long checkFrequency() {
+    public long getCheckFrequency() {
         return checkFreq;
     }
 
     /**
      * @return Whether or not node should wait for correct segment on start.
      */
-    public boolean waitOnStart() {
+    public boolean isWaitOnStart() {
         return waitOnStart;
     }
 
     /**
      * @return Whether or not all resolvers should succeed for node to be in correct segment.
      */
-    public boolean passRequired() {
-        return passRequired;
+    public boolean isAllSegmentationResolversPassRequired() {
+        return allResolversPassReq;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeEnum(out, plc);
+        U.writeString(out, resolvers);
+        out.writeLong(checkFreq);
+        out.writeBoolean(waitOnStart);
+        out.writeBoolean(allResolversPassReq);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        plc = SegmentationPolicy.fromOrdinal(in.readByte());
+        resolvers = U.readString(in);
+        checkFreq = in.readLong();
+        waitOnStart = in.readBoolean();
+        allResolversPassReq = in.readBoolean();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
new file mode 100644
index 0000000..2d1eb48
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpiDescription.java
@@ -0,0 +1,89 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Transfer object for single spi description.
+ */
+public class VisorSpiDescription extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** SPI class name. */
+    private String clsName;
+
+    /** SPI fields description. */
+    private Map<String, Object> fldDesc;
+
+    /**
+     * Default constructor.
+     */
+    public VisorSpiDescription() {
+        // No-op.
+    }
+
+    /**
+     * Construct Visor spi description object.
+     *
+     * @param clsName SPI class name.
+     * @param fldDesc SPI fields description.
+     */
+    public VisorSpiDescription(String clsName, Map<String, Object> fldDesc) {
+        this.clsName = clsName;
+        this.fldDesc = fldDesc;
+    }
+
+    /**
+     * @return SPI class name.
+     */
+    public String getClassName() {
+        return clsName;
+    }
+
+    /**
+     * @return SPI fields description.
+     */
+    public Map<String, Object> getFieldDescriptions() {
+        return fldDesc;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, clsName);
+        U.writeMap(out, fldDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        clsName = U.readString(in);
+        fldDesc = U.readMap(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorSpiDescription.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
index 55653a3..83cc7c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSpisConfiguration.java
@@ -17,16 +17,16 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
-import java.util.Map;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.spi.IgniteSpi;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 
@@ -36,36 +36,43 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactObject
 /**
  * Data transfer object for node SPIs configuration properties.
  */
-public class VisorSpisConfiguration implements Serializable, LessNamingBean {
+public class VisorSpisConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Discovery SPI. */
-    private IgniteBiTuple<String, Map<String, Object>> discoSpi;
+    private VisorSpiDescription discoSpi;
 
     /** Communication SPI. */
-    private IgniteBiTuple<String, Map<String, Object>> commSpi;
+    private VisorSpiDescription commSpi;
 
     /** Event storage SPI. */
-    private IgniteBiTuple<String, Map<String, Object>> evtSpi;
+    private VisorSpiDescription evtSpi;
 
     /** Collision SPI. */
-    private IgniteBiTuple<String, Map<String, Object>> colSpi;
+    private VisorSpiDescription colSpi;
 
     /** Deployment SPI. */
-    private IgniteBiTuple<String, Map<String, Object>> deploySpi;
+    private VisorSpiDescription deploySpi;
 
     /** Checkpoint SPIs. */
-    private IgniteBiTuple<String, Map<String, Object>>[] cpSpis;
+    private VisorSpiDescription[] cpSpis;
 
     /** Failover SPIs. */
-    private IgniteBiTuple<String, Map<String, Object>>[] failSpis;
+    private VisorSpiDescription[] failSpis;
 
     /** Load balancing SPIs. */
-    private IgniteBiTuple<String, Map<String, Object>>[] loadBalancingSpis;
+    private VisorSpiDescription[] loadBalancingSpis;
 
     /** Indexing SPIs. */
-    private IgniteBiTuple<String, Map<String, Object>>[] indexingSpis;
+    private VisorSpiDescription[] indexingSpis;
+
+    /**
+     * Default constructor.
+     */
+    public VisorSpisConfiguration() {
+        // No-op.
+    }
 
     /**
      * Collects SPI information based on GridSpiConfiguration-annotated methods.
@@ -74,7 +81,7 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
      * @param spi SPI to collect information on.
      * @return Tuple where first component is SPI name and map with properties as second.
      */
-    private static IgniteBiTuple<String, Map<String, Object>> collectSpiInfo(IgniteSpi spi) {
+    private static VisorSpiDescription collectSpiInfo(IgniteSpi spi) {
         Class<? extends IgniteSpi> spiCls = spi.getClass();
 
         HashMap<String, Object> res = new HashMap<>();
@@ -88,13 +95,13 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
                 if (mtdName.startsWith("set")) {
                     String propName = Character.toLowerCase(mtdName.charAt(3)) + mtdName.substring(4);
 
-                    String[] getterNames = new String[] {
-                        "get" + mtdName.substring(3),
-                        "is" + mtdName.substring(3),
-                        "get" + mtdName.substring(3) + "Formatted"
-                    };
-
                     try {
+                        String[] getterNames = new String[] {
+                            "get" + mtdName.substring(3),
+                            "is" + mtdName.substring(3),
+                            "get" + mtdName.substring(3) + "Formatted"
+                        };
+
                         for (String getterName : getterNames) {
                             try {
                                 Method getter = spiCls.getDeclaredMethod(getterName);
@@ -120,106 +127,129 @@ public class VisorSpisConfiguration implements Serializable, LessNamingBean {
             }
         }
 
-        return new IgniteBiTuple<String, Map<String, Object>>(spi.getName(), res);
+        return new VisorSpiDescription(spi.getName(), res);
     }
 
     /**
      * @param spis Array of spi to process.
      * @return Tuple where first component is SPI name and map with properties as second.
      */
-    private static IgniteBiTuple<String, Map<String, Object>>[] collectSpiInfo(IgniteSpi[] spis) {
-        IgniteBiTuple[] res = new IgniteBiTuple[spis.length];
+    private static VisorSpiDescription[] collectSpiInfo(IgniteSpi[] spis) {
+        VisorSpiDescription[] res = new VisorSpiDescription[spis.length];
 
         for (int i = 0; i < spis.length; i++)
             res[i] = collectSpiInfo(spis[i]);
 
-        return (IgniteBiTuple<String, Map<String, Object>>[])res;
+        return res;
     }
 
     /**
+     * Create data transfer object for node SPIs configuration properties.
+     *
      * @param c Grid configuration.
-     * @return Data transfer object for node SPIs configuration properties.
      */
-    public static VisorSpisConfiguration from(IgniteConfiguration c) {
-        VisorSpisConfiguration cfg = new VisorSpisConfiguration();
-
-        cfg.discoSpi = collectSpiInfo(c.getDiscoverySpi());
-        cfg.commSpi = collectSpiInfo(c.getCommunicationSpi());
-        cfg.evtSpi = collectSpiInfo(c.getEventStorageSpi());
-        cfg.colSpi = collectSpiInfo(c.getCollisionSpi());
-        cfg.deploySpi = collectSpiInfo(c.getDeploymentSpi());
-        cfg.cpSpis = collectSpiInfo(c.getCheckpointSpi());
-        cfg.failSpis = collectSpiInfo(c.getFailoverSpi());
-        cfg.loadBalancingSpis = collectSpiInfo(c.getLoadBalancingSpi());
-        cfg.indexingSpis = F.asArray(collectSpiInfo(c.getIndexingSpi()));
-
-        return cfg;
+    public VisorSpisConfiguration(IgniteConfiguration c) {
+        discoSpi = collectSpiInfo(c.getDiscoverySpi());
+        commSpi = collectSpiInfo(c.getCommunicationSpi());
+        evtSpi = collectSpiInfo(c.getEventStorageSpi());
+        colSpi = collectSpiInfo(c.getCollisionSpi());
+        deploySpi = collectSpiInfo(c.getDeploymentSpi());
+        cpSpis = collectSpiInfo(c.getCheckpointSpi());
+        failSpis = collectSpiInfo(c.getFailoverSpi());
+        loadBalancingSpis = collectSpiInfo(c.getLoadBalancingSpi());
+        indexingSpis = F.asArray(collectSpiInfo(c.getIndexingSpi()));
     }
 
     /**
      * @return Discovery SPI.
      */
-    public IgniteBiTuple<String, Map<String, Object>> discoverySpi() {
+    public VisorSpiDescription getDiscoverySpi() {
         return discoSpi;
     }
 
     /**
      * @return Communication SPI.
      */
-    public IgniteBiTuple<String, Map<String, Object>> communicationSpi() {
+    public VisorSpiDescription getCommunicationSpi() {
         return commSpi;
     }
 
     /**
      * @return Event storage SPI.
      */
-    public IgniteBiTuple<String, Map<String, Object>> eventStorageSpi() {
+    public VisorSpiDescription getEventStorageSpi() {
         return evtSpi;
     }
 
     /**
      * @return Collision SPI.
      */
-    public IgniteBiTuple<String, Map<String, Object>> collisionSpi() {
+    public VisorSpiDescription getCollisionSpi() {
         return colSpi;
     }
 
     /**
      * @return Deployment SPI.
      */
-    public IgniteBiTuple<String, Map<String, Object>> deploymentSpi() {
+    public VisorSpiDescription getDeploymentSpi() {
         return deploySpi;
     }
 
     /**
      * @return Checkpoint SPIs.
      */
-    public IgniteBiTuple<String, Map<String, Object>>[] checkpointSpis() {
+    public VisorSpiDescription[] getCheckpointSpis() {
         return cpSpis;
     }
 
     /**
      * @return Failover SPIs.
      */
-    public IgniteBiTuple<String, Map<String, Object>>[] failoverSpis() {
+    public VisorSpiDescription[] getFailoverSpis() {
         return failSpis;
     }
 
     /**
      * @return Load balancing SPIs.
      */
-    public IgniteBiTuple<String, Map<String, Object>>[] loadBalancingSpis() {
+    public VisorSpiDescription[] getLoadBalancingSpis() {
         return loadBalancingSpis;
     }
 
     /**
      * @return Indexing SPIs.
      */
-    public IgniteBiTuple<String, Map<String, Object>>[] indexingSpis() {
+    public VisorSpiDescription[] getIndexingSpis() {
         return indexingSpis;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeObject(discoSpi);
+        out.writeObject(commSpi);
+        out.writeObject(evtSpi);
+        out.writeObject(colSpi);
+        out.writeObject(deploySpi);
+        out.writeObject(cpSpis);
+        out.writeObject(failSpis);
+        out.writeObject(loadBalancingSpis);
+        out.writeObject(indexingSpis);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        discoSpi = (VisorSpiDescription)in.readObject();
+        commSpi = (VisorSpiDescription)in.readObject();
+        evtSpi = (VisorSpiDescription)in.readObject();
+        colSpi = (VisorSpiDescription)in.readObject();
+        deploySpi = (VisorSpiDescription)in.readObject();
+        cpSpis = (VisorSpiDescription[])in.readObject();
+        failSpis = (VisorSpiDescription[])in.readObject();
+        loadBalancingSpis = (VisorSpiDescription[])in.readObject();
+        indexingSpis = (VisorSpiDescription[])in.readObject();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorSpisConfiguration.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
new file mode 100644
index 0000000..2ffaabd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorSuppressedError.java
@@ -0,0 +1,147 @@
+/*
+ * 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.internal.visor.node;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+
+/**
+ * Data transfer object for suppressed errors.
+ */
+public class VisorSuppressedError extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private long order;
+
+    /** */
+    @GridToStringExclude
+    private VisorExceptionWrapper error;
+
+    /** */
+    private long threadId;
+
+    /** */
+    private String threadName;
+
+    /** */
+    private long time;
+
+    /** */
+    private String msg;
+
+    /**
+     * Default constructor.
+     */
+    public VisorSuppressedError() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param order Locally unique ID that is atomically incremented for each new error.
+     * @param error Suppressed error.
+     * @param msg Message that describe reason why error was suppressed.
+     * @param threadId Thread ID.
+     * @param threadName Thread name.
+     * @param time Occurrence time.
+     */
+    public VisorSuppressedError(long order, VisorExceptionWrapper error, String msg, long threadId, String threadName, long time) {
+        this.order = order;
+        this.error = error;
+        this.threadId = threadId;
+        this.threadName = threadName;
+        this.time = time;
+        this.msg = msg;
+    }
+
+    /**
+     * @return Locally unique ID that is atomically incremented for each new error.
+     */
+    public long getOrder() {
+        return order;
+    }
+
+    /**
+     * @return Gets message that describe reason why error was suppressed.
+     */
+    public String getMessage() {
+        return msg;
+    }
+
+    /**
+     * @return Suppressed error.
+     */
+    public VisorExceptionWrapper getError() {
+        return error;
+    }
+
+    /**
+     * @return Gets thread ID.
+     */
+    public long getThreadId() {
+        return threadId;
+    }
+
+    /**
+     * @return Gets thread name.
+     */
+    public String getThreadName() {
+        return threadName;
+    }
+
+    /**
+     * @return Gets time.
+     */
+    public long getTime() {
+        return time;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(order);
+        out.writeObject(error);
+        out.writeLong(threadId);
+        U.writeString(out, threadName);
+        out.writeLong(time);
+        U.writeString(out, msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        order = in.readLong();
+        error = (VisorExceptionWrapper)in.readObject();
+        threadId = in.readLong();
+        threadName= U.readString(in);
+        time = in.readLong();
+        msg = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    public String toString() {
+        return S.toString(VisorSuppressedError.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
index 6855c43..1ac827a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorTransactionConfiguration.java
@@ -17,28 +17,33 @@
 
 package org.apache.ignite.internal.visor.node;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.configuration.TransactionConfiguration;
-import org.apache.ignite.internal.LessNamingBean;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
+
 /**
  * Data transfer object for transaction configuration.
  */
-public class VisorTransactionConfiguration implements Serializable, LessNamingBean {
+public class VisorTransactionConfiguration extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Default cache concurrency. */
-    private TransactionConcurrency dfltTxConcurrency;
+    private TransactionConcurrency dfltConcurrency;
 
     /** Default transaction isolation. */
-    private TransactionIsolation dfltTxIsolation;
+    private TransactionIsolation dfltIsolation;
 
     /** Default transaction timeout. */
-    private long dfltTxTimeout;
+    private long dfltTimeout;
 
     /** Pessimistic tx log linger. */
     private int pessimisticTxLogLinger;
@@ -46,53 +51,62 @@ public class VisorTransactionConfiguration implements Serializable, LessNamingBe
     /** Pessimistic tx log size. */
     private int pessimisticTxLogSize;
 
-    /** Default transaction serializable flag. */
-    private boolean txSerEnabled;
+    /** Transaction manager factory. */
+    private String txMgrFactory;
 
     /**
-     * Create data transfer object for transaction configuration.
-     *
-     * @param src Transaction configuration.
-     * @return Data transfer object.
+     * Default constructor.
      */
-    public static VisorTransactionConfiguration from(TransactionConfiguration src) {
-        VisorTransactionConfiguration cfg = new VisorTransactionConfiguration();
+    public VisorTransactionConfiguration() {
+        // No-op.
+    }
 
-        cfg.dfltTxConcurrency = src.getDefaultTxConcurrency();
-        cfg.dfltTxIsolation = src.getDefaultTxIsolation();
-        cfg.dfltTxTimeout = src.getDefaultTxTimeout();
-        cfg.pessimisticTxLogLinger = src.getPessimisticTxLogLinger();
-        cfg.pessimisticTxLogSize = src.getPessimisticTxLogSize();
-        cfg.txSerEnabled = src.isTxSerializableEnabled();
+    /**
+     * Whether to use JTA {@code javax.transaction.Synchronization}
+     * instead of {@code javax.transaction.xa.XAResource}.
+     */
+    private boolean useJtaSync;
 
-        return cfg;
+    /**
+     * Create data transfer object for transaction configuration.
+     *
+     * @param cfg Transaction configuration.
+     */
+    public VisorTransactionConfiguration(TransactionConfiguration cfg) {
+        dfltConcurrency = cfg.getDefaultTxConcurrency();
+        dfltIsolation = cfg.getDefaultTxIsolation();
+        dfltTimeout = cfg.getDefaultTxTimeout();
+        pessimisticTxLogLinger = cfg.getPessimisticTxLogLinger();
+        pessimisticTxLogSize = cfg.getPessimisticTxLogSize();
+        txMgrFactory = compactClass(cfg.getTxManagerFactory());
+        useJtaSync = cfg.isUseJtaSynchronization();
     }
 
     /**
      * @return Default cache transaction concurrency.
      */
-    public TransactionConcurrency defaultTxConcurrency() {
-        return dfltTxConcurrency;
+    public TransactionConcurrency getDefaultTxConcurrency() {
+        return dfltConcurrency;
     }
 
     /**
      * @return Default cache transaction isolation.
      */
-    public TransactionIsolation defaultTxIsolation() {
-        return dfltTxIsolation;
+    public TransactionIsolation getDefaultTxIsolation() {
+        return dfltIsolation;
     }
 
     /**
      * @return Default transaction timeout.
      */
-    public long defaultTxTimeout() {
-        return dfltTxTimeout;
+    public long getDefaultTxTimeout() {
+        return dfltTimeout;
     }
 
     /**
      * @return Pessimistic log cleanup delay in milliseconds.
      */
-    public int pessimisticTxLogLinger() {
+    public int getPessimisticTxLogLinger() {
         return pessimisticTxLogLinger;
     }
 
@@ -104,10 +118,38 @@ public class VisorTransactionConfiguration implements Serializable, LessNamingBe
     }
 
     /**
-     * @return {@code True} if serializable transactions are enabled, {@code false} otherwise.
+     * @return Transaction manager factory.
      */
-    public boolean txSerializableEnabled() {
-        return txSerEnabled;
+    public String getTxManagerFactory() {
+        return txMgrFactory;
+    }
+
+    /**
+     * @return Whether to use JTA {@code javax.transaction.Synchronization}
+     *     instead of {@code javax.transaction.xa.XAResource}.
+     */
+    public boolean isUseJtaSync() {
+        return useJtaSync;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeEnum(out, dfltConcurrency);
+        U.writeEnum(out, dfltIsolation);
+        out.writeLong(dfltTimeout);
+        out.writeInt(pessimisticTxLogLinger);
+        out.writeInt(pessimisticTxLogSize);
+        U.writeString(out, txMgrFactory);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        dfltConcurrency = TransactionConcurrency.fromOrdinal(in.readByte());
+        dfltIsolation = TransactionIsolation.fromOrdinal(in.readByte());
+        dfltTimeout = in.readLong();
+        pessimisticTxLogLinger = in.readInt();
+        pessimisticTxLogSize = in.readInt();
+        txMgrFactory = U.readString(in);
     }
 
     /** {@inheritDoc} */


[24/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationFixtures.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationFixtures.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationFixtures.java
new file mode 100644
index 0000000..88aa4fe
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationFixtures.java
@@ -0,0 +1,381 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.storage.matrix.FunctionMatrixStorage;
+import org.jetbrains.annotations.NotNull;
+
+/** */
+class MatrixImplementationFixtures {
+    /** */
+    private static final List<Supplier<Iterable<Matrix>>> suppliers = Arrays.asList(
+        (Supplier<Iterable<Matrix>>)DenseLocalOnHeapMatrixFixture::new,
+        (Supplier<Iterable<Matrix>>)DenseLocalOffHeapMatrixFixture::new,
+        (Supplier<Iterable<Matrix>>)RandomMatrixFixture::new,
+        (Supplier<Iterable<Matrix>>)SparseLocalOnHeapMatrixFixture::new,
+        (Supplier<Iterable<Matrix>>)PivotedMatrixViewFixture::new,
+        (Supplier<Iterable<Matrix>>)MatrixViewFixture::new,
+        (Supplier<Iterable<Matrix>>)FunctionMatrixFixture::new,
+        (Supplier<Iterable<Matrix>>)DiagonalMatrixFixture::new,
+        (Supplier<Iterable<Matrix>>)TransposedMatrixViewFixture::new
+    );
+
+    /** */
+    void consumeSampleMatrix(BiConsumer<Matrix, String> consumer) {
+        for (Supplier<Iterable<Matrix>> fixtureSupplier : suppliers) {
+            final Iterable<Matrix> fixture = fixtureSupplier.get();
+
+            for (Matrix matrix : fixture) {
+                consumer.accept(matrix, fixture.toString());
+
+                matrix.destroy();
+            }
+        }
+    }
+
+    /** */
+    private static class DenseLocalOnHeapMatrixFixture extends MatrixSizeIterator {
+        /** */
+        DenseLocalOnHeapMatrixFixture() {
+            super(DenseLocalOnHeapMatrix::new, "DenseLocalOnHeapMatrix");
+        }
+    }
+
+    /** */
+    private static class DenseLocalOffHeapMatrixFixture extends MatrixSizeIterator {
+        /** */
+        DenseLocalOffHeapMatrixFixture() {
+            super(DenseLocalOffHeapMatrix::new, "DenseLocalOffHeapMatrix");
+        }
+    }
+
+    /** */
+    private static class RandomMatrixFixture extends MatrixSizeIterator {
+        /** */
+        RandomMatrixFixture() {
+            super(RandomMatrix::new, "RandomMatrix");
+        }
+    }
+
+    /** */
+    private static class SparseLocalOnHeapMatrixFixture extends MatrixSizeIterator {
+        /** */
+        SparseLocalOnHeapMatrixFixture() {
+            super(SparseLocalOnHeapMatrix::new, "SparseLocalOnHeapMatrix");
+        }
+    }
+
+    /** */
+    private static class PivotedMatrixViewFixture extends WrapperMatrixIterator {
+        /** */
+        PivotedMatrixViewFixture() {
+            super(PivotedMatrixView::new, "PivotedMatrixView over DenseLocalOnHeapMatrix");
+        }
+    }
+
+    /** */
+    private static class MatrixViewFixture extends WrapperMatrixIterator {
+        /** */
+        MatrixViewFixture() {
+            super((matrix) -> new MatrixView(matrix, 0, 0, matrix.rowSize(), matrix.columnSize()),
+                "MatrixView over DenseLocalOnHeapMatrix");
+        }
+    }
+
+    /** */
+    private static class FunctionMatrixFixture extends WrapperMatrixIterator {
+        /** */
+        FunctionMatrixFixture() {
+            super(FunctionMatrixForTest::new, "FunctionMatrix wrapping DenseLocalOnHeapMatrix");
+        }
+    }
+
+    /** */
+    private static class DiagonalMatrixFixture extends DiagonalIterator {
+        /** */
+        DiagonalMatrixFixture() {
+            super(DenseLocalOnHeapMatrix::new, "DiagonalMatrix over DenseLocalOnHeapMatrix");
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Matrix> iterator() {
+            return new Iterator<Matrix>() {
+                /** {@inheritDoc} */
+                @Override public boolean hasNext() {
+                    return hasNextSize(getSizeIdx());
+                }
+
+                /** {@inheritDoc} */
+                @Override public Matrix next() {
+                    assert getSize(getSizeIdx()) == 1 : "Only size 1 allowed for diagonal matrix fixture.";
+
+                    Matrix matrix = getConstructor().apply(getSize(getSizeIdx()), getSize(getSizeIdx()));
+
+                    nextIdx();
+
+                    return new DiagonalMatrix(matrix);
+                }
+            };
+        }
+    }
+
+    /** */
+    private static class TransposedMatrixViewFixture extends WrapperMatrixIterator {
+        /** */
+        TransposedMatrixViewFixture() {
+            super(TransposedMatrixView::new, "TransposedMatrixView over DenseLocalOnHeapMatrix");
+        }
+    }
+
+    /** */
+    private static abstract class DiagonalIterator implements Iterable<Matrix> {
+        /** */
+        private final Integer[] sizes = new Integer[] {1, null};
+        /** */
+        private int sizeIdx = 0;
+
+        /** */
+        private BiFunction<Integer, Integer, ? extends Matrix> constructor;
+        /** */
+        private String desc;
+
+        /** */
+        DiagonalIterator(BiFunction<Integer, Integer, ? extends Matrix> constructor, String desc) {
+            this.constructor = constructor;
+            this.desc = desc;
+        }
+
+        /** */
+        public BiFunction<Integer, Integer, ? extends Matrix> getConstructor() {
+            return constructor;
+        }
+
+        /** */
+        int getSizeIdx() {
+            return sizeIdx;
+        }
+
+        /** */
+        @Override public String toString() {
+            return desc + "{rows=" + sizes[sizeIdx] + ", cols=" + sizes[sizeIdx] + "}";
+        }
+
+        /** */
+        boolean hasNextSize(int idx) {
+            return sizes[idx] != null;
+        }
+
+        /** */
+        Integer getSize(int idx) {
+            return sizes[idx];
+        }
+
+        /** */
+        void nextIdx() {
+            sizeIdx++;
+        }
+    }
+
+    /** */
+    private static class WrapperMatrixIterator extends MatrixSizeIterator {
+        /** */
+        private final Function<Matrix, Matrix> wrapperCtor;
+
+        /** */
+        WrapperMatrixIterator(Function<Matrix, Matrix> wrapperCtor, String desc) {
+            super(DenseLocalOnHeapMatrix::new, desc);
+
+            this.wrapperCtor = wrapperCtor;
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Matrix> iterator() {
+            return new Iterator<Matrix>() {
+                /** {@inheritDoc} */
+                @Override public boolean hasNext() {
+                    return hasNextCol(getSizeIdx()) && hasNextRow(getSizeIdx());
+                }
+
+                /** {@inheritDoc} */
+                @Override public Matrix next() {
+                    Matrix matrix = getConstructor().apply(getRow(getSizeIdx()), getCol(getSizeIdx()));
+
+                    nextIdx();
+
+                    return wrapperCtor.apply(matrix);
+                }
+            };
+        }
+    }
+
+    /** */
+    private static class MatrixSizeIterator implements Iterable<Matrix> {
+        /** */
+        private final Integer[] rows = new Integer[] {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 512, 1024, null};
+        /** */
+        private final Integer[] cols = new Integer[] {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 1024, 512, null};
+        /** */
+        private int sizeIdx = 0;
+
+        /** */
+        private BiFunction<Integer, Integer, ? extends Matrix> constructor;
+        /** */
+        private String desc;
+
+        /** */
+        MatrixSizeIterator(BiFunction<Integer, Integer, ? extends Matrix> constructor, String desc) {
+            this.constructor = constructor;
+            this.desc = desc;
+        }
+
+        /** */
+        public BiFunction<Integer, Integer, ? extends Matrix> getConstructor() {
+            return constructor;
+        }
+
+        /** */
+        int getSizeIdx() {
+            return sizeIdx;
+        }
+
+        /** */
+        @Override public String toString() {
+            return desc + "{rows=" + rows[sizeIdx] + ", cols=" + cols[sizeIdx] + "}";
+        }
+
+        /** */
+        boolean hasNextRow(int idx) {
+            return rows[idx] != null;
+        }
+
+        /** */
+        boolean hasNextCol(int idx) {
+            return cols[idx] != null;
+        }
+
+        /** */
+        Integer getRow(int idx) {
+            return rows[idx];
+        }
+
+        /** */
+        int getCol(int idx) {
+            return cols[idx];
+        }
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<Matrix> iterator() {
+            return new Iterator<Matrix>() {
+                /** {@inheritDoc} */
+                @Override public boolean hasNext() {
+                    return hasNextCol(sizeIdx) && hasNextRow(sizeIdx);
+                }
+
+                /** {@inheritDoc} */
+                @Override public Matrix next() {
+                    Matrix matrix = constructor.apply(rows[sizeIdx], cols[sizeIdx]);
+
+                    nextIdx();
+
+                    return matrix;
+                }
+            };
+        }
+
+        /** */
+        void nextIdx() {
+            sizeIdx++;
+        }
+    }
+
+    /** Subclass tweaked for serialization */
+    private static class FunctionMatrixForTest extends FunctionMatrix {
+        /** */
+        Matrix underlying;
+
+        /** */
+        public FunctionMatrixForTest() {
+            // No-op.
+        }
+
+        /** */
+        FunctionMatrixForTest(Matrix underlying) {
+            super(underlying.rowSize(), underlying.columnSize(), underlying::get, underlying::set);
+
+            this.underlying = underlying;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Matrix copy() {
+            return new FunctionMatrixForTest(underlying);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            super.writeExternal(out);
+
+            out.writeObject(underlying);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            super.readExternal(in);
+
+            underlying = (Matrix)in.readObject();
+
+            setStorage(new FunctionMatrixStorage(underlying.rowSize(), underlying.columnSize(),
+                underlying::get, underlying::set));
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = 1;
+
+            res = res * 37 + underlying.hashCode();
+
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            FunctionMatrixForTest that = (FunctionMatrixForTest)o;
+
+            return underlying != null ? underlying.equals(that.underlying) : that.underlying == null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationsTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationsTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationsTest.java
new file mode 100644
index 0000000..28abab7
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixImplementationsTest.java
@@ -0,0 +1,1113 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiConsumer;
+import java.util.function.Supplier;
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.ColumnIndexException;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.exceptions.RowIndexException;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.vector.DenseLocalOffHeapVector;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.math.impls.vector.RandomVector;
+import org.apache.ignite.math.impls.vector.SparseLocalVector;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link Matrix} implementations.
+ */
+public class MatrixImplementationsTest extends ExternalizeTest<Matrix> {
+    /** */
+    private static final double DEFAULT_DELTA = 0.000000001d;
+
+    /** */
+    private void consumeSampleMatrix(BiConsumer<Matrix, String> consumer) {
+        new MatrixImplementationFixtures().consumeSampleMatrix(consumer);
+    }
+
+    /** */
+    @Test
+    public void externalizeTest() {
+        consumeSampleMatrix((m, desc) -> externalizeTest(m));
+    }
+
+    /** */
+    @Test
+    public void testLike() {
+        consumeSampleMatrix((m, desc) -> {
+            Class<? extends Matrix> cls = likeMatrixType(m);
+
+            if (cls != null) {
+                Matrix like = m.like(m.rowSize(), m.columnSize());
+
+                assertEquals("Wrong \"like\" matrix for " + desc + "; Unexpected rows.", like.rowSize(), m.rowSize());
+                assertEquals("Wrong \"like\" matrix for " + desc + "; Unexpected columns.", like.columnSize(), m.columnSize());
+
+                assertEquals("Wrong \"like\" matrix for " + desc
+                        + "; Unexpected class: " + like.getClass().toString(),
+                    cls,
+                    like.getClass());
+
+                return;
+            }
+
+            boolean expECaught = false;
+
+            try {
+                m.like(1, 1);
+            }
+            catch (UnsupportedOperationException uoe) {
+                expECaught = true;
+            }
+
+            assertTrue("Expected exception was not caught for " + desc, expECaught);
+        });
+    }
+
+    /** */
+    @Test
+    public void testCopy() {
+        consumeSampleMatrix((m, desc) -> {
+            Matrix cp = m.copy();
+            assertTrue("Incorrect copy for empty matrix " + desc, cp.equals(m));
+
+            if (!readOnly(m))
+                fillMatrix(m);
+
+            cp = m.copy();
+
+            assertTrue("Incorrect copy for matrix " + desc, cp.equals(m));
+        });
+    }
+
+    /** */
+    @Test
+    public void testHaveLikeVector() throws InstantiationException, IllegalAccessException {
+        for (Class<? extends Matrix> key : likeVectorTypesMap().keySet()) {
+            Class<? extends Vector> val = likeVectorTypesMap().get(key);
+
+            if (val == null && !ignore(key))
+                System.out.println("Missing test for implementation of likeMatrix for " + key.getSimpleName());
+        }
+    }
+
+    /** */
+    @Test
+    public void testLikeVector() {
+        consumeSampleMatrix((m, desc) -> {
+            if (likeVectorTypesMap().containsKey(m.getClass())) {
+                Vector likeVector = m.likeVector(m.columnSize());
+
+                assertNotNull(likeVector);
+                assertEquals("Unexpected value for " + desc, likeVector.size(), m.columnSize());
+
+                return;
+            }
+
+            boolean expECaught = false;
+
+            try {
+                m.likeVector(1);
+            }
+            catch (UnsupportedOperationException uoe) {
+                expECaught = true;
+            }
+
+            assertTrue("Expected exception was not caught for " + desc, expECaught);
+        });
+    }
+
+    /** */
+    @Test
+    public void testAssignSingleElement() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            final double assignVal = Math.random();
+
+            m.assign(assignVal);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        assignVal, m.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testAssignArray() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] data = new double[m.rowSize()][m.columnSize()];
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    data[i][j] = Math.random();
+
+            m.assign(data);
+
+            for (int i = 0; i < m.rowSize(); i++) {
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        data[i][j], m.get(i, j), 0d);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testAssignFunction() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            m.assign((i, j) -> (double)(i * m.columnSize() + j));
+
+            for (int i = 0; i < m.rowSize(); i++) {
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        (double)(i * m.columnSize() + j), m.get(i, j), 0d);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testPlus() {
+        consumeSampleMatrix((m, desc) -> {
+            if (readOnly(m))
+                return;
+
+            double[][] data = fillAndReturn(m);
+
+            double plusVal = Math.random();
+
+            Matrix plus = m.plus(plusVal);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        data[i][j] + plusVal, plus.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testPlusMatrix() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] data = fillAndReturn(m);
+
+            Matrix plus = m.plus(m);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        data[i][j] * 2.0, plus.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testMinusMatrix() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            Matrix minus = m.minus(m);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        0.0, minus.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testTimes() {
+        consumeSampleMatrix((m, desc) -> {
+            if (readOnly(m))
+                return;
+
+            double[][] data = fillAndReturn(m);
+
+            double timeVal = Math.random();
+            Matrix times = m.times(timeVal);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        data[i][j] * timeVal, times.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testTimesVector() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] data = fillAndReturn(m);
+
+            double[] arr = fillArray(m.columnSize());
+
+            Vector times = m.times(new DenseLocalOnHeapVector(arr));
+
+            assertEquals("Unexpected vector size for " + desc, times.size(), m.rowSize());
+
+            for (int i = 0; i < m.rowSize(); i++) {
+                double exp = 0.0;
+
+                for (int j = 0; j < m.columnSize(); j++)
+                    exp += arr[j] * data[i][j];
+
+                assertEquals("Unexpected value for " + desc + " at " + i,
+                    times.get(i), exp, 0d);
+            }
+
+            testInvalidCardinality(() -> m.times(new DenseLocalOnHeapVector(m.columnSize() + 1)), desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void testTimesMatrix() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] data = fillAndReturn(m);
+
+            double[] arr = fillArray(m.columnSize());
+
+            Matrix mult = new DenseLocalOnHeapMatrix(m.columnSize(), 1);
+
+            mult.setColumn(0, arr);
+
+            Matrix times = m.times(mult);
+
+            assertEquals("Unexpected rows for " + desc, times.rowSize(), m.rowSize());
+
+            assertEquals("Unexpected cols for " + desc, times.columnSize(), 1);
+
+            for (int i = 0; i < m.rowSize(); i++) {
+                double exp = 0.0;
+
+                for (int j = 0; j < m.columnSize(); j++)
+                    exp += arr[j] * data[i][j];
+
+                assertEquals("Unexpected value for " + desc + " at " + i,
+                    exp, times.get(i, 0), 0d);
+            }
+
+            testInvalidCardinality(() -> m.times(new DenseLocalOnHeapMatrix(m.columnSize() + 1, 1)), desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void testDivide() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] data = fillAndReturn(m);
+
+            double divVal = Math.random();
+
+            Matrix divide = m.divide(divVal);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        data[i][j] / divVal, divide.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testTranspose() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            Matrix transpose = m.transpose();
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        m.get(i, j), transpose.get(j, i), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testDeterminant() {
+        consumeSampleMatrix((m, desc) -> {
+            if (m.rowSize() != m.columnSize())
+                return;
+
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] doubles = fillIntAndReturn(m);
+
+            if (m.rowSize() == 1) {
+                assertEquals("Unexpected value " + desc, m.determinant(), doubles[0][0], 0d);
+
+                return;
+            }
+
+            if (m.rowSize() == 2) {
+                double det = doubles[0][0] * doubles[1][1] - doubles[0][1] * doubles[1][0];
+                assertEquals("Unexpected value " + desc, m.determinant(), det, 0d);
+
+                return;
+            }
+
+            if (m.rowSize() > 512)
+                return; // IMPL NOTE if row size >= 30000 it takes unacceptably long for normal test run.
+
+            Matrix diagMtx = m.like(m.rowSize(), m.columnSize());
+
+            diagMtx.assign(0);
+            for (int i = 0; i < m.rowSize(); i++)
+                diagMtx.set(i, i, m.get(i, i));
+
+            double det = 1;
+
+            for (int i = 0; i < diagMtx.rowSize(); i++)
+                det *= diagMtx.get(i, i);
+
+            try {
+                assertEquals("Unexpected value " + desc, det, diagMtx.determinant(), DEFAULT_DELTA);
+            }
+            catch (Exception e) {
+                System.out.println(desc);
+                throw e;
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testInverse() {
+        consumeSampleMatrix((m, desc) -> {
+            if (m.rowSize() != m.columnSize())
+                return;
+
+            if (ignore(m.getClass()))
+                return;
+
+            if (m.rowSize() > 256)
+                return; // IMPL NOTE this is for quicker test run.
+
+            fillNonSingularMatrix(m);
+
+            assertTrue("Unexpected zero determinant " + desc, Math.abs(m.determinant()) > 0d);
+
+            Matrix inverse = m.inverse();
+
+            Matrix mult = m.times(inverse);
+
+            final double delta = 0.001d;
+
+            assertEquals("Unexpected determinant " + desc, 1d, mult.determinant(), delta);
+
+            assertEquals("Unexpected top left value " + desc, 1d, mult.get(0, 0), delta);
+
+            if (m.rowSize() == 1)
+                return;
+
+            assertEquals("Unexpected center value " + desc,
+                1d, mult.get(m.rowSize() / 2, m.rowSize() / 2), delta);
+
+            assertEquals("Unexpected bottom right value " + desc,
+                1d, mult.get(m.rowSize() - 1, m.rowSize() - 1), delta);
+
+            assertEquals("Unexpected top right value " + desc,
+                0d, mult.get(0, m.rowSize() - 1), delta);
+
+            assertEquals("Unexpected bottom left value " + desc,
+                0d, mult.get(m.rowSize() - 1, 0), delta);
+        });
+    }
+
+    /** */
+    @Test
+    public void testMap() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            m.map(x -> 10d);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        10d, m.get(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testMapMatrix() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            double[][] doubles = fillAndReturn(m);
+
+            testMapMatrixWrongCardinality(m, desc);
+
+            Matrix cp = m.copy();
+
+            m.map(cp, (m1, m2) -> m1 + m2);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        m.get(i, j), doubles[i][j] * 2, 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testViewRow() {
+        consumeSampleMatrix((m, desc) -> {
+            if (!readOnly(m))
+                fillMatrix(m);
+
+            for (int i = 0; i < m.rowSize(); i++) {
+                Vector vector = m.viewRow(i);
+                assert vector != null;
+
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        m.get(i, j), vector.get(j), 0d);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testViewCol() {
+        consumeSampleMatrix((m, desc) -> {
+            if (!readOnly(m))
+                fillMatrix(m);
+
+            for (int i = 0; i < m.columnSize(); i++) {
+                Vector vector = m.viewColumn(i);
+                assert vector != null;
+
+                for (int j = 0; j < m.rowSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at (" + i + "," + j + ")",
+                        m.get(j, i), vector.get(j), 0d);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testFoldRow() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            Vector foldRows = m.foldRows(Vector::sum);
+
+            for (int i = 0; i < m.rowSize(); i++) {
+                Double locSum = 0d;
+
+                for (int j = 0; j < m.columnSize(); j++)
+                    locSum += m.get(i, j);
+
+                assertEquals("Unexpected value for " + desc + " at " + i,
+                    foldRows.get(i), locSum, 0d);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testFoldCol() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            Vector foldCols = m.foldColumns(Vector::sum);
+
+            for (int j = 0; j < m.columnSize(); j++) {
+                Double locSum = 0d;
+
+                for (int i = 0; i < m.rowSize(); i++)
+                    locSum += m.get(i, j);
+
+                assertEquals("Unexpected value for " + desc + " at " + j,
+                    foldCols.get(j), locSum, 0d);
+            }
+        });
+    }
+
+    /** */
+    @Test
+    public void testSum() {
+        consumeSampleMatrix((m, desc) -> {
+            double[][] data = fillAndReturn(m);
+
+            double sum = m.sum();
+
+            double rawSum = 0;
+            for (double[] anArr : data)
+                for (int j = 0; j < data[0].length; j++)
+                    rawSum += anArr[j];
+
+            assertEquals("Unexpected value for " + desc,
+                rawSum, sum, 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testMax() {
+        consumeSampleMatrix((m, desc) -> {
+            double[][] doubles = fillAndReturn(m);
+            double max = Double.NEGATIVE_INFINITY;
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    max = max < doubles[i][j] ? doubles[i][j] : max;
+
+            assertEquals("Unexpected value for " + desc, m.maxValue(), max, 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testMin() {
+        consumeSampleMatrix((m, desc) -> {
+            double[][] doubles = fillAndReturn(m);
+            double min = Double.MAX_VALUE;
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    min = min > doubles[i][j] ? doubles[i][j] : min;
+
+            assertEquals("Unexpected value for " + desc, m.minValue(), min, 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testGetElement() {
+        consumeSampleMatrix((m, desc) -> {
+            if (!(readOnly(m)))
+                fillMatrix(m);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++) {
+                    final Matrix.Element e = m.getElement(i, j);
+
+                    final String details = desc + " at [" + i + "," + j + "]";
+
+                    assertEquals("Unexpected element row " + details, i, e.row());
+                    assertEquals("Unexpected element col " + details, j, e.column());
+
+                    final double val = m.get(i, j);
+
+                    assertEquals("Unexpected value for " + details, val, e.get(), 0d);
+
+                    boolean expECaught = false;
+
+                    final double newVal = val * 2.0;
+
+                    try {
+                        e.set(newVal);
+                    }
+                    catch (UnsupportedOperationException uoe) {
+                        if (!(readOnly(m)))
+                            throw uoe;
+
+                        expECaught = true;
+                    }
+
+                    if (readOnly(m)) {
+                        if (!expECaught)
+                            fail("Expected exception was not caught for " + details);
+
+                        continue;
+                    }
+
+                    assertEquals("Unexpected value set for " + details, newVal, m.get(i, j), 0d);
+                }
+        });
+    }
+
+    /** */
+    @Test
+    public void testGetX() {
+        consumeSampleMatrix((m, desc) -> {
+            if (!(readOnly(m)))
+                fillMatrix(m);
+
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    assertEquals("Unexpected value for " + desc + " at [" + i + "," + j + "]",
+                        m.get(i, j), m.getX(i, j), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testGetMetaStorage() {
+        consumeSampleMatrix((m, desc) -> assertNotNull("Null meta storage in " + desc, m.getMetaStorage()));
+    }
+
+    /** */
+    @Test
+    public void testGuid() {
+        consumeSampleMatrix((m, desc) -> assertNotNull("Null guid in " + desc, m.guid()));
+    }
+
+    /** */
+    @Test
+    public void testSwapRows() {
+        consumeSampleMatrix((m, desc) -> {
+            if (readOnly(m))
+                return;
+
+            double[][] doubles = fillAndReturn(m);
+
+            final int swap_i = m.rowSize() == 1 ? 0 : 1;
+            final int swap_j = 0;
+
+            Matrix swap = m.swapRows(swap_i, swap_j);
+
+            for (int col = 0; col < m.columnSize(); col++) {
+                assertEquals("Unexpected value for " + desc + " at col " + col + ", swap_i " + swap_i,
+                    swap.get(swap_i, col), doubles[swap_j][col], 0d);
+
+                assertEquals("Unexpected value for " + desc + " at col " + col + ", swap_j " + swap_j,
+                    swap.get(swap_j, col), doubles[swap_i][col], 0d);
+            }
+
+            testInvalidRowIndex(() -> m.swapRows(-1, 0), desc + " negative first swap index");
+            testInvalidRowIndex(() -> m.swapRows(0, -1), desc + " negative second swap index");
+            testInvalidRowIndex(() -> m.swapRows(m.rowSize(), 0), desc + " too large first swap index");
+            testInvalidRowIndex(() -> m.swapRows(0, m.rowSize()), desc + " too large second swap index");
+        });
+    }
+
+    /** */
+    @Test
+    public void testSwapColumns() {
+        consumeSampleMatrix((m, desc) -> {
+            if (readOnly(m))
+                return;
+
+            double[][] doubles = fillAndReturn(m);
+
+            final int swap_i = m.columnSize() == 1 ? 0 : 1;
+            final int swap_j = 0;
+
+            Matrix swap = m.swapColumns(swap_i, swap_j);
+
+            for (int row = 0; row < m.rowSize(); row++) {
+                assertEquals("Unexpected value for " + desc + " at row " + row + ", swap_i " + swap_i,
+                    swap.get(row, swap_i), doubles[row][swap_j], 0d);
+
+                assertEquals("Unexpected value for " + desc + " at row " + row + ", swap_j " + swap_j,
+                    swap.get(row, swap_j), doubles[row][swap_i], 0d);
+            }
+
+            testInvalidColIndex(() -> m.swapColumns(-1, 0), desc + " negative first swap index");
+            testInvalidColIndex(() -> m.swapColumns(0, -1), desc + " negative second swap index");
+            testInvalidColIndex(() -> m.swapColumns(m.columnSize(), 0), desc + " too large first swap index");
+            testInvalidColIndex(() -> m.swapColumns(0, m.columnSize()), desc + " too large second swap index");
+        });
+    }
+
+    /** */
+    @Test
+    public void testSetRow() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            int rowIdx = m.rowSize() / 2;
+
+            double[] newValues = fillArray(m.columnSize());
+
+            m.setRow(rowIdx, newValues);
+
+            for (int col = 0; col < m.columnSize(); col++)
+                assertEquals("Unexpected value for " + desc + " at " + col,
+                    newValues[col], m.get(rowIdx, col), 0d);
+
+            testInvalidCardinality(() -> m.setRow(rowIdx, new double[m.columnSize() + 1]), desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void testSetColumn() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            int colIdx = m.columnSize() / 2;
+
+            double[] newValues = fillArray(m.rowSize());
+
+            m.setColumn(colIdx, newValues);
+
+            for (int row = 0; row < m.rowSize(); row++)
+                assertEquals("Unexpected value for " + desc + " at " + row,
+                    newValues[row], m.get(row, colIdx), 0d);
+
+            testInvalidCardinality(() -> m.setColumn(colIdx, new double[m.rowSize() + 1]), desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void testViewPart() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            int rowOff = m.rowSize() < 3 ? 0 : 1;
+            int rows = m.rowSize() < 3 ? 1 : m.rowSize() - 2;
+            int colOff = m.columnSize() < 3 ? 0 : 1;
+            int cols = m.columnSize() < 3 ? 1 : m.columnSize() - 2;
+
+            Matrix view1 = m.viewPart(rowOff, rows, colOff, cols);
+            Matrix view2 = m.viewPart(new int[] {rowOff, colOff}, new int[] {rows, cols});
+
+            String details = desc + " view [" + rowOff + ", " + rows + ", " + colOff + ", " + cols + "]";
+
+            for (int i = 0; i < rows; i++)
+                for (int j = 0; j < cols; j++) {
+                    assertEquals("Unexpected view1 value for " + details + " at (" + i + "," + j + ")",
+                        m.get(i + rowOff, j + colOff), view1.get(i, j), 0d);
+
+                    assertEquals("Unexpected view2 value for " + details + " at (" + i + "," + j + ")",
+                        m.get(i + rowOff, j + colOff), view2.get(i, j), 0d);
+                }
+        });
+    }
+
+    /** */
+    @Test
+    public void testDensity() {
+        consumeSampleMatrix((m, desc) -> {
+            if (!readOnly(m))
+                fillMatrix(m);
+
+            assertTrue("Unexpected density with threshold 0 for " + desc, m.density(0.0));
+
+            assertFalse("Unexpected density with threshold 1 for " + desc, m.density(1.0));
+        });
+    }
+
+    /** */
+    @Test
+    public void testMaxAbsRowSumNorm() {
+        consumeSampleMatrix((m, desc) -> {
+            if (!readOnly(m))
+                fillMatrix(m);
+
+            assertEquals("Unexpected value for " + desc,
+                maxAbsRowSumNorm(m), m.maxAbsRowSumNorm(), 0d);
+        });
+    }
+
+    /** */
+    @Test
+    public void testAssignRow() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            int rowIdx = m.rowSize() / 2;
+
+            double[] newValues = fillArray(m.columnSize());
+
+            m.assignRow(rowIdx, new DenseLocalOnHeapVector(newValues));
+
+            for (int col = 0; col < m.columnSize(); col++)
+                assertEquals("Unexpected value for " + desc + " at " + col,
+                    newValues[col], m.get(rowIdx, col), 0d);
+
+            testInvalidCardinality(() -> m.assignRow(rowIdx, new DenseLocalOnHeapVector(m.columnSize() + 1)), desc);
+        });
+    }
+
+    /** */
+    @Test
+    public void testAssignColumn() {
+        consumeSampleMatrix((m, desc) -> {
+            if (ignore(m.getClass()))
+                return;
+
+            fillMatrix(m);
+
+            int colIdx = m.columnSize() / 2;
+
+            double[] newValues = fillArray(m.rowSize());
+
+            m.assignColumn(colIdx, new DenseLocalOnHeapVector(newValues));
+
+            for (int row = 0; row < m.rowSize(); row++)
+                assertEquals("Unexpected value for " + desc + " at " + row,
+                    newValues[row], m.get(row, colIdx), 0d);
+        });
+    }
+
+    /** */
+    private double[] fillArray(int len) {
+        double[] newValues = new double[len];
+
+        for (int i = 0; i < newValues.length; i++)
+            newValues[i] = newValues.length - i;
+        return newValues;
+    }
+
+    /** */
+    private double maxAbsRowSumNorm(Matrix m) {
+        double max = 0.0;
+
+        for (int x = 0; x < m.rowSize(); x++) {
+            double sum = 0;
+
+            for (int y = 0; y < m.columnSize(); y++)
+                sum += Math.abs(m.getX(x, y));
+
+            if (sum > max)
+                max = sum;
+        }
+
+        return max;
+    }
+
+    /** */
+    private void testInvalidRowIndex(Supplier<Matrix> supplier, String desc) {
+        try {
+            supplier.get();
+        }
+        catch (RowIndexException | IndexException ie) {
+            return;
+        }
+
+        fail("Expected exception was not caught for " + desc);
+    }
+
+    /** */
+    private void testInvalidColIndex(Supplier<Matrix> supplier, String desc) {
+        try {
+            supplier.get();
+        }
+        catch (ColumnIndexException | IndexException ie) {
+            return;
+        }
+
+        fail("Expected exception was not caught for " + desc);
+    }
+
+    /** */
+    private void testMapMatrixWrongCardinality(Matrix m, String desc) {
+        for (int rowDelta : new int[] {-1, 0, 1})
+            for (int colDelta : new int[] {-1, 0, 1}) {
+                if (rowDelta == 0 && colDelta == 0)
+                    continue;
+
+                int rowNew = m.rowSize() + rowDelta;
+                int colNew = m.columnSize() + colDelta;
+
+                if (rowNew < 1 || colNew < 1)
+                    continue;
+
+                testInvalidCardinality(() -> m.map(new DenseLocalOnHeapMatrix(rowNew, colNew), (m1, m2) -> m1 + m2),
+                    desc + " wrong cardinality when mapping to size " + rowNew + "x" + colNew);
+            }
+    }
+
+    /** */
+    private void testInvalidCardinality(Supplier<Object> supplier, String desc) {
+        try {
+            supplier.get();
+        }
+        catch (CardinalityException ce) {
+            return;
+        }
+
+        fail("Expected exception was not caught for " + desc);
+    }
+
+    /** */
+    private boolean readOnly(Matrix m) {
+        return m instanceof RandomMatrix;
+    }
+
+    /** */
+    private double[][] fillIntAndReturn(Matrix m) {
+        double[][] data = new double[m.rowSize()][m.columnSize()];
+
+        if (readOnly(m)) {
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    data[i][j] = m.get(i, j);
+
+        }
+        else {
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    data[i][j] = i * m.rowSize() + j + 1;
+
+            m.assign(data);
+        }
+        return data;
+    }
+
+    /** */
+    private double[][] fillAndReturn(Matrix m) {
+        double[][] data = new double[m.rowSize()][m.columnSize()];
+
+        if (readOnly(m)) {
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    data[i][j] = m.get(i, j);
+
+        }
+        else {
+            for (int i = 0; i < m.rowSize(); i++)
+                for (int j = 0; j < m.columnSize(); j++)
+                    data[i][j] = -0.5d + Math.random();
+
+            m.assign(data);
+        }
+        return data;
+    }
+
+    /** */
+    private void fillNonSingularMatrix(Matrix m) {
+        for (int i = 0; i < m.rowSize(); i++) {
+            m.set(i, i, 10);
+
+            for (int j = 0; j < m.columnSize(); j++)
+                if (j != i)
+                    m.set(i, j, 0.01d);
+        }
+    }
+
+    /** */
+    private void fillMatrix(Matrix m) {
+        for (int i = 0; i < m.rowSize(); i++)
+            for (int j = 0; j < m.columnSize(); j++)
+                m.set(i, j, Math.random());
+    }
+
+    /** Ignore test for given matrix type. */
+    private boolean ignore(Class<? extends Matrix> clazz) {
+        List<Class<? extends Matrix>> ignoredClasses = Arrays.asList(RandomMatrix.class, PivotedMatrixView.class,
+            MatrixView.class, FunctionMatrix.class, TransposedMatrixView.class);
+
+        for (Class<? extends Matrix> ignoredClass : ignoredClasses)
+            if (ignoredClass.isAssignableFrom(clazz))
+                return true;
+
+        return false;
+    }
+
+    /** */
+    private Class<? extends Matrix> likeMatrixType(Matrix m) {
+        for (Class<? extends Matrix> clazz : likeTypesMap().keySet())
+            if (clazz.isAssignableFrom(m.getClass()))
+                return likeTypesMap().get(clazz);
+
+        return null;
+    }
+
+    /** */
+    private static Map<Class<? extends Matrix>, Class<? extends Vector>> likeVectorTypesMap() {
+        return new LinkedHashMap<Class<? extends Matrix>, Class<? extends Vector>>() {{
+            put(DenseLocalOnHeapMatrix.class, DenseLocalOnHeapVector.class);
+            put(DenseLocalOffHeapMatrix.class, DenseLocalOffHeapVector.class);
+            put(RandomMatrix.class, RandomVector.class);
+            put(SparseLocalOnHeapMatrix.class, SparseLocalVector.class);
+            put(DenseLocalOnHeapMatrix.class, DenseLocalOnHeapVector.class);
+            put(DiagonalMatrix.class, DenseLocalOnHeapVector.class); // IMPL NOTE per fixture
+            // IMPL NOTE check for presence of all implementations here will be done in testHaveLikeMatrix via Fixture
+        }};
+    }
+
+    /** */
+    private static Map<Class<? extends Matrix>, Class<? extends Matrix>> likeTypesMap() {
+        return new LinkedHashMap<Class<? extends Matrix>, Class<? extends Matrix>>() {{
+            put(DenseLocalOnHeapMatrix.class, DenseLocalOnHeapMatrix.class);
+            put(DenseLocalOffHeapMatrix.class, DenseLocalOffHeapMatrix.class);
+            put(RandomMatrix.class, RandomMatrix.class);
+            put(SparseLocalOnHeapMatrix.class, SparseLocalOnHeapMatrix.class);
+            put(DenseLocalOnHeapMatrix.class, DenseLocalOnHeapMatrix.class);
+            put(DiagonalMatrix.class, DenseLocalOnHeapMatrix.class); // IMPL NOTE per fixture
+            put(FunctionMatrix.class, FunctionMatrix.class);
+            // IMPL NOTE check for presence of all implementations here will be done in testHaveLikeMatrix via Fixture
+        }};
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixKeyMapperForTests.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixKeyMapperForTests.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixKeyMapperForTests.java
new file mode 100644
index 0000000..90fbec4
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixKeyMapperForTests.java
@@ -0,0 +1,69 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.MatrixKeyMapper;
+
+/** */
+public class MatrixKeyMapperForTests implements MatrixKeyMapper<Integer> {
+    /** */ private int rows;
+    /** */ private int cols;
+
+    /** */
+    public MatrixKeyMapperForTests() {
+        // No-op.
+    }
+
+    /** */
+    public MatrixKeyMapperForTests(int rows, int cols) {
+        this.rows = rows;
+        this.cols = cols;
+    }
+
+    /** */
+    @Override public Integer apply(int x, int y) {
+        return x * cols + y;
+    }
+
+    /** */
+    @Override public boolean isValid(Integer integer) {
+        return (rows * cols) > integer;
+    }
+
+    /** */
+    @Override public int hashCode() {
+        int hash = 1;
+
+        hash += hash * 31 + rows;
+        hash += hash * 31 + cols;
+
+        return hash;
+    }
+
+    /** */
+    @Override public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        MatrixKeyMapperForTests that = (MatrixKeyMapperForTests)obj;
+
+        return rows == that.rows && cols == that.cols;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixViewConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixViewConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixViewConstructorTest.java
new file mode 100644
index 0000000..01278da
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/MatrixViewConstructorTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.impls.storage.matrix.MatrixDelegateStorage;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class MatrixViewConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        Matrix m = new DenseLocalOnHeapMatrix(1, 1);
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new MatrixView((Matrix)null, 0, 0, 1, 1),
+            "Null parent matrix.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new MatrixView(m, -1, 0, 1, 1),
+            "Invalid row offset.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new MatrixView(m, 0, -1, 1, 1),
+            "Invalid col offset.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new MatrixView(m, 0, 0, 0, 1),
+            "Invalid rows.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new MatrixView(m, 0, 0, 1, 0),
+            "Invalid cols.");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        for (Matrix m : new Matrix[] {
+            new DenseLocalOnHeapMatrix(3, 3),
+            new DenseLocalOnHeapMatrix(3, 4), new DenseLocalOnHeapMatrix(4, 3)})
+            for (int rowOff : new int[] {0, 1})
+                for (int colOff : new int[] {0, 1})
+                    for (int rows : new int[] {1, 2})
+                        for (int cols : new int[] {1, 2})
+                            basicTest(m, rowOff, colOff, rows, cols);
+    }
+
+    /** */
+    private void basicTest(Matrix parent, int rowOff, int colOff, int rows, int cols) {
+        for (int row = 0; row < parent.rowSize(); row++)
+            for (int col = 0; col < parent.columnSize(); col++)
+                parent.set(row, col, row * parent.columnSize() + col + 1);
+
+        Matrix view = new MatrixView(parent, rowOff, colOff, rows, cols);
+
+        assertEquals("Rows in view.", rows, view.rowSize());
+        assertEquals("Cols in view.", cols, view.columnSize());
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++)
+                assertEquals("Unexpected value at " + row + "x" + col,
+                    parent.get(row + rowOff, col + colOff), view.get(row, col), 0d);
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++)
+                view.set(row, col, 0d);
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++)
+                assertEquals("Unexpected value set at " + row + "x" + col,
+                    0d, parent.get(row + rowOff, col + colOff), 0d);
+    }
+
+    /** */
+    @Test
+    public void attributeTest() {
+        for (Matrix m : new Matrix[] {
+            new DenseLocalOnHeapMatrix(3, 3),
+            new DenseLocalOnHeapMatrix(3, 4), new DenseLocalOnHeapMatrix(4, 3)}) {
+            MatrixView matrixView = new MatrixView(m, 0, 0, m.rowSize(), m.columnSize());
+
+            MatrixDelegateStorage delegateStorage = (MatrixDelegateStorage)matrixView.getStorage();
+
+            assertEquals(m.rowSize(), matrixView.rowSize());
+            assertEquals(m.columnSize(), matrixView.columnSize());
+
+            assertEquals(m.rowSize(), (delegateStorage).rowsLength());
+            assertEquals(m.columnSize(), (delegateStorage).columnsLength());
+
+            assertEquals(m.isSequentialAccess(), delegateStorage.isSequentialAccess());
+            assertEquals(m.isRandomAccess(), delegateStorage.isRandomAccess());
+            assertEquals(m.isDistributed(), delegateStorage.isDistributed());
+            assertEquals(m.isDense(), delegateStorage.isDense());
+            assertEquals(m.isArrayBased(), delegateStorage.isArrayBased());
+
+            assertArrayEquals(m.getStorage().data(), delegateStorage.data());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/PivotedMatrixViewConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/PivotedMatrixViewConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/PivotedMatrixViewConstructorTest.java
new file mode 100644
index 0000000..a495745
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/PivotedMatrixViewConstructorTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.util.Arrays;
+import org.apache.ignite.math.Matrix;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class PivotedMatrixViewConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        Matrix m = new DenseLocalOnHeapMatrix(1, 1);
+
+        int[] pivot = new int[] {0};
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new PivotedMatrixView(null),
+            "Null parent matrix.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new PivotedMatrixView(null, pivot),
+            "Null parent matrix, with pivot.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new PivotedMatrixView(m, null),
+            "Null pivot.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new PivotedMatrixView(m, null, pivot),
+            "Null row pivot.");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new PivotedMatrixView(m, pivot, null),
+            "Null col pivot.");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        Matrix m = new DenseLocalOnHeapMatrix(2, 2);
+
+        int[] pivot = new int[] {0, 1};
+
+        PivotedMatrixView view = new PivotedMatrixView(m, pivot);
+
+        assertEquals("Rows in view.", m.rowSize(), view.rowSize());
+        assertEquals("Cols in view.", m.columnSize(), view.columnSize());
+
+        assertTrue("Row pivot array in view.", Arrays.equals(pivot, view.rowPivot()));
+        assertTrue("Col pivot array in view.", Arrays.equals(pivot, view.columnPivot()));
+
+        assertEquals("Base matrix in view.", m, view.getBaseMatrix());
+
+        assertEquals("Row pivot value in view.", 0, view.rowPivot(0));
+        assertEquals("Col pivot value in view.", 0, view.columnPivot(0));
+
+        assertEquals("Row unpivot value in view.", 0, view.rowUnpivot(0));
+        assertEquals("Col unpivot value in view.", 0, view.columnUnpivot(0));
+
+        Matrix swap = view.swap(1, 1);
+
+        for (int row = 0; row < view.rowSize(); row++)
+            for (int col = 0; col < view.columnSize(); col++)
+                assertEquals("Unexpected swap value set at (" + row + "," + col + ").",
+                    view.get(row, col), swap.get(row, col), 0d);
+
+        //noinspection EqualsWithItself
+        assertTrue("View is expected to be equal to self.", view.equals(view));
+        //noinspection ObjectEqualsNull
+        assertFalse("View is expected to be not equal to null.", view.equals(null));
+    }
+
+    /** */
+    @Test
+    public void pivotTest() {
+        int[] pivot = new int[] {2, 1, 0, 3};
+
+        for (Matrix m : new Matrix[] {
+            new DenseLocalOnHeapMatrix(3, 3),
+            new DenseLocalOnHeapMatrix(3, 4), new DenseLocalOnHeapMatrix(4, 3)})
+            pivotTest(m, pivot);
+    }
+
+    /** */
+    private void pivotTest(Matrix parent, int[] pivot) {
+        for (int row = 0; row < parent.rowSize(); row++)
+            for (int col = 0; col < parent.columnSize(); col++)
+                parent.set(row, col, row * parent.columnSize() + col + 1);
+
+        Matrix view = new PivotedMatrixView(parent, pivot);
+
+        int rows = parent.rowSize();
+        int cols = parent.columnSize();
+
+        assertEquals("Rows in view.", rows, view.rowSize());
+        assertEquals("Cols in view.", cols, view.columnSize());
+
+        for (int row = 0; row < rows; row++)
+            for (int col = 0; col < cols; col++)
+                assertEquals("Unexpected value at " + row + "x" + col,
+                    parent.get(pivot[row], pivot[col]), view.get(row, col), 0d);
+
+        int min = rows < cols ? rows : cols;
+
+        for (int idx = 0; idx < min; idx++)
+            view.set(idx, idx, 0d);
+
+        for (int idx = 0; idx < min; idx++)
+            assertEquals("Unexpected value set at " + idx,
+                0d, parent.get(pivot[idx], pivot[idx]), 0d);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/RandomMatrixConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/RandomMatrixConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/RandomMatrixConstructorTest.java
new file mode 100644
index 0000000..e19cfa3
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/RandomMatrixConstructorTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class RandomMatrixConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new RandomMatrix(0, 1), "invalid row parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new RandomMatrix(1, 0), "invalid col parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new RandomMatrix(0, 1, true), "invalid row parameter, fastHash true");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new RandomMatrix(1, 0, true), "invalid col parameter, fastHash true");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new RandomMatrix(0, 1, false), "invalid row parameter, fastHash false");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new RandomMatrix(1, 0, false), "invalid col parameter, fastHash false");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        assertEquals("Expected number of rows, int parameters.", 1,
+            new RandomMatrix(1, 2).rowSize());
+
+        assertEquals("Expected number of cols, int parameters.", 1,
+            new RandomMatrix(2, 1).columnSize());
+
+        assertEquals("Expected number of rows, int parameters, fastHash true.", 1,
+            new RandomMatrix(1, 2, true).rowSize());
+
+        assertEquals("Expected number of cols, int parameters, fastHash true.", 1,
+            new RandomMatrix(2, 1, true).columnSize());
+
+        assertEquals("Expected number of rows, int parameters, fastHash false.", 1,
+            new RandomMatrix(1, 2, false).rowSize());
+
+        assertEquals("Expected number of cols, int parameters, fastHash false.", 1,
+            new RandomMatrix(2, 1, false).columnSize());
+
+        RandomMatrix m = new RandomMatrix(1, 1);
+        //noinspection EqualsWithItself
+        assertTrue("Matrix is expected to be equal to self.", m.equals(m));
+        //noinspection ObjectEqualsNull
+        assertFalse("Matrix is expected to be not equal to null.", m.equals(null));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrixTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrixTest.java
new file mode 100644
index 0000000..8218a12
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrixTest.java
@@ -0,0 +1,265 @@
+// @java.file.header
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+/*
+ * 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.math.impls.matrix;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+import static org.apache.ignite.math.impls.MathTestConstants.UNEXPECTED_VAL;
+
+/**
+ * Tests for {@link SparseDistributedMatrix}.
+ */
+@GridCommonTest(group = "Distributed Models")
+public class SparseDistributedMatrixTest extends GridCommonAbstractTest {
+    /** Number of nodes in grid */
+    private static final int NODE_COUNT = 3;
+    /** Cache name. */
+    private static final String CACHE_NAME = "test-cache";
+    /** Precision. */
+    private static final double PRECISION = 0.0;
+    /** Grid instance. */
+    private Ignite ignite;
+    /** Matrix rows */
+    private final int rows = MathTestConstants.STORAGE_SIZE;
+    /** Matrix cols */
+    private final int cols = MathTestConstants.STORAGE_SIZE;
+    /** Matrix for tests */
+    private SparseDistributedMatrix cacheMatrix;
+
+    /**
+     * Default constructor.
+     */
+    public SparseDistributedMatrixTest() {
+        super(false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        for (int i = 1; i <= NODE_COUNT; i++)
+            startGrid(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        ignite = grid(NODE_COUNT);
+
+        ignite.configuration().setPeerClassLoadingEnabled(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        ignite.destroyCache(CACHE_NAME);
+
+        if (cacheMatrix != null) {
+            cacheMatrix.destroy();
+            cacheMatrix = null;
+        }
+    }
+
+    /** */
+    public void testGetSet() throws Exception {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        for (int i = 0; i < rows; i++) {
+            for (int j = 0; j < cols; j++) {
+                double v = Math.random();
+                cacheMatrix.set(i, j, v);
+
+                assert Double.compare(v, cacheMatrix.get(i, j)) == 0;
+            }
+        }
+    }
+
+    /** */
+    public void testExternalize() throws IOException, ClassNotFoundException {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        cacheMatrix.set(1, 1, 1.0);
+
+        ByteArrayOutputStream byteArrOutputStream = new ByteArrayOutputStream();
+        ObjectOutputStream objOutputStream = new ObjectOutputStream(byteArrOutputStream);
+
+        objOutputStream.writeObject(cacheMatrix);
+
+        ByteArrayInputStream byteArrInputStream = new ByteArrayInputStream(byteArrOutputStream.toByteArray());
+        ObjectInputStream objInputStream = new ObjectInputStream(byteArrInputStream);
+
+        SparseDistributedMatrix objRestored = (SparseDistributedMatrix)objInputStream.readObject();
+
+        assertTrue(MathTestConstants.VAL_NOT_EQUALS, cacheMatrix.equals(objRestored));
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, objRestored.get(1, 1), 1.0, 0.0);
+    }
+
+    /** Test simple math. */
+    public void testMath() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+        initMtx(cacheMatrix);
+
+        cacheMatrix.assign(2.0);
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                assertEquals(UNEXPECTED_VAL, 2.0, cacheMatrix.get(i, j), PRECISION);
+
+        cacheMatrix.plus(3.0);
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                assertEquals(UNEXPECTED_VAL, 5.0, cacheMatrix.get(i, j), PRECISION);
+
+        cacheMatrix.times(2.0);
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                assertEquals(UNEXPECTED_VAL, 10.0, cacheMatrix.get(i, j), PRECISION);
+
+        cacheMatrix.divide(10.0);
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                assertEquals(UNEXPECTED_VAL, 1.0, cacheMatrix.get(i, j), PRECISION);
+
+        assertEquals(UNEXPECTED_VAL, cacheMatrix.rowSize() * cacheMatrix.columnSize(), cacheMatrix.sum(), PRECISION);
+    }
+
+    /** */
+    public void testMinMax() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                cacheMatrix.set(i, j, i * cols + j + 1);
+
+        assertEquals(UNEXPECTED_VAL, 1.0, cacheMatrix.minValue(), PRECISION);
+        assertEquals(UNEXPECTED_VAL, rows * cols, cacheMatrix.maxValue(), PRECISION);
+
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                cacheMatrix.set(i, j, -1.0 * (i * cols + j + 1));
+
+        assertEquals(UNEXPECTED_VAL, -rows * cols, cacheMatrix.minValue(), PRECISION);
+        assertEquals(UNEXPECTED_VAL, -1.0, cacheMatrix.maxValue(), PRECISION);
+
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                cacheMatrix.set(i, j, i * cols + j);
+
+        assertEquals(UNEXPECTED_VAL, 1.0, cacheMatrix.minValue(), PRECISION);
+        assertEquals(UNEXPECTED_VAL, rows * cols - 1.0, cacheMatrix.maxValue(), PRECISION);
+    }
+
+    /** */
+    public void testMap() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+        initMtx(cacheMatrix);
+
+        cacheMatrix.map(i -> 100.0);
+        for (int i = 0; i < cacheMatrix.rowSize(); i++)
+            for (int j = 0; j < cacheMatrix.columnSize(); j++)
+                assertEquals(UNEXPECTED_VAL, 100.0, cacheMatrix.get(i, j), PRECISION);
+    }
+
+    /** */
+    public void testCopy() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        try {
+            cacheMatrix.copy();
+            fail("UnsupportedOperationException expected.");
+        }
+        catch (UnsupportedOperationException e) {
+            return;
+        }
+        fail("UnsupportedOperationException expected.");
+    }
+
+    /** */
+    public void testLike() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        try {
+            cacheMatrix.like(1, 1);
+            fail("UnsupportedOperationException expected.");
+        }
+        catch (UnsupportedOperationException e) {
+            return;
+        }
+        fail("UnsupportedOperationException expected.");
+    }
+
+    /** */
+    public void testLikeVector() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        cacheMatrix = new SparseDistributedMatrix(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        try {
+            cacheMatrix.likeVector(1);
+            fail("UnsupportedOperationException expected.");
+        }
+        catch (UnsupportedOperationException e) {
+            return;
+        }
+        fail("UnsupportedOperationException expected.");
+    }
+
+    /** */
+    private void initMtx(Matrix m) {
+        for (int i = 0; i < m.rowSize(); i++)
+            for (int j = 0; j < m.columnSize(); j++)
+                m.set(i, j, 1.0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrixConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrixConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrixConstructorTest.java
new file mode 100644
index 0000000..fc675c1
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrixConstructorTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/** */
+public class SparseLocalOnHeapMatrixConstructorTest {
+    /** */
+    @Test
+    public void invalidArgsTest() {
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new SparseLocalOnHeapMatrix(0, 1),
+            "invalid row parameter");
+
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new SparseLocalOnHeapMatrix(1, 0),
+            "invalid col parameter");
+    }
+
+    /** */
+    @Test
+    public void basicTest() {
+        assertEquals("Expected number of rows.", 1,
+            new SparseLocalOnHeapMatrix(1, 2).rowSize());
+
+        assertEquals("Expected number of cols, int parameters.", 1,
+            new SparseLocalOnHeapMatrix(2, 1).columnSize());
+
+        SparseLocalOnHeapMatrix m = new SparseLocalOnHeapMatrix(1, 1);
+        //noinspection EqualsWithItself
+        assertTrue("Matrix is expected to be equal to self.", m.equals(m));
+        //noinspection ObjectEqualsNull
+        assertFalse("Matrix is expected to be not equal to null.", m.equals(null));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/TransposedMatrixViewTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/TransposedMatrixViewTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/TransposedMatrixViewTest.java
new file mode 100644
index 0000000..5eacfea
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/matrix/TransposedMatrixViewTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link TransposedMatrixView}.
+ */
+public class TransposedMatrixViewTest extends ExternalizeTest<TransposedMatrixView> {
+    /** */
+    private static final String UNEXPECTED_VALUE = "Unexpected value";
+    /** */
+    private TransposedMatrixView testMatrix;
+    /** */
+    private DenseLocalOnHeapMatrix parent;
+
+    /** */
+    @Before
+    public void setup() {
+        parent = new DenseLocalOnHeapMatrix(MathTestConstants.STORAGE_SIZE, MathTestConstants.STORAGE_SIZE);
+        fillMatrix(parent);
+        testMatrix = new TransposedMatrixView(parent);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void externalizeTest() {
+        externalizeTest(testMatrix);
+    }
+
+    /** */
+    @Test
+    public void testView() {
+        assertEquals(UNEXPECTED_VALUE, parent.rowSize(), testMatrix.columnSize());
+        assertEquals(UNEXPECTED_VALUE, parent.columnSize(), testMatrix.rowSize());
+
+        for (int i = 0; i < parent.rowSize(); i++)
+            for (int j = 0; j < parent.columnSize(); j++)
+                assertEquals(UNEXPECTED_VALUE, parent.get(i, j), testMatrix.get(j, i), 0d);
+    }
+
+    /** */
+    @Test
+    public void testNullParams() {
+        DenseLocalOnHeapMatrixConstructorTest.verifyAssertionError(() -> new TransposedMatrixView(null), "Null Matrix parameter");
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void testLike() {
+        testMatrix.like(0, 0);
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void testLikeVector() {
+        testMatrix.likeVector(0);
+    }
+
+    /** */
+    private void fillMatrix(DenseLocalOnHeapMatrix mtx) {
+        for (int i = 0; i < mtx.rowSize(); i++)
+            for (int j = 0; j < mtx.columnSize(); j++)
+                mtx.setX(i, j, i * mtx.rowSize() + j);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixArrayStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixArrayStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixArrayStorageTest.java
new file mode 100644
index 0000000..817dd49
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixArrayStorageTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit tests for {@link ArrayMatrixStorage}.
+ */
+public class MatrixArrayStorageTest extends MatrixBaseStorageTest<ArrayMatrixStorage> {
+    /** {@inheritDoc} */
+    @Override public void setUp() {
+        storage = new ArrayMatrixStorage(MathTestConstants.STORAGE_SIZE, MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void isSequentialAccess() throws Exception {
+        assertFalse(MathTestConstants.UNEXPECTED_VAL, storage.isSequentialAccess());
+    }
+
+    /** */
+    @Test
+    public void isDense() throws Exception {
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, storage.isDense());
+    }
+
+    /** */
+    @Test
+    public void isArrayBased() throws Exception {
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, storage.isArrayBased());
+    }
+
+    /** */
+    @Test
+    public void data() throws Exception {
+        double[][] data = storage.data();
+        assertNotNull(MathTestConstants.NULL_VAL, data);
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, data.length == MathTestConstants.STORAGE_SIZE);
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, data[0].length == MathTestConstants.STORAGE_SIZE);
+    }
+
+}


[29/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/AbstractMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/AbstractMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/AbstractMatrix.java
new file mode 100644
index 0000000..ca11e81
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/AbstractMatrix.java
@@ -0,0 +1,880 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.decompositions.LUDecomposition;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.ColumnIndexException;
+import org.apache.ignite.math.exceptions.RowIndexException;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.functions.IntIntToDoubleFunction;
+import org.apache.ignite.math.impls.vector.MatrixVectorView;
+
+/**
+ * This class provides a helper implementation of the {@link Matrix}
+ * interface to minimize the effort required to implement it.
+ * Subclasses may override some of the implemented methods if a more
+ * specific or optimized implementation is desirable.
+ *
+ * TODO: add row/column optimization.
+ */
+public abstract class AbstractMatrix implements Matrix {
+    // Stochastic sparsity analysis.
+    /** */
+    private static final double Z95 = 1.959964;
+    /** */
+    private static final double Z80 = 1.281552;
+    /** */
+    private static final int MAX_SAMPLES = 500;
+    /** */
+    private static final int MIN_SAMPLES = 15;
+
+    /** Cached minimum element. */
+    private Element minElm;
+    /** Cached maximum element. */
+    private Element maxElm = null;
+
+    /** Matrix storage implementation. */
+    private MatrixStorage sto;
+
+    /** Meta attributes storage. */
+    private Map<String, Object> meta = new HashMap<>();
+
+    /** Matrix's GUID. */
+    private IgniteUuid guid = IgniteUuid.randomUuid();
+
+    /**
+     * @param sto Backing {@link MatrixStorage}.
+     */
+    public AbstractMatrix(MatrixStorage sto) {
+        this.sto = sto;
+    }
+
+    /**
+     *
+     */
+    public AbstractMatrix() {
+        // No-op.
+    }
+
+    /**
+     * @param sto Backing {@link MatrixStorage}.
+     */
+    protected void setStorage(MatrixStorage sto) {
+        assert sto != null;
+
+        this.sto = sto;
+    }
+
+    /**
+     * @param row Row index in the matrix.
+     * @param col Column index in the matrix.
+     * @param v Value to set.
+     */
+    protected void storageSet(int row, int col, double v) {
+        sto.set(row, col, v);
+
+        // Reset cached values.
+        minElm = maxElm = null;
+    }
+
+    /**
+     * @param row Row index in the matrix.
+     * @param col Column index in the matrix.
+     */
+    protected double storageGet(int row, int col) {
+        return sto.get(row, col);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element maxElement() {
+        if (maxElm == null) {
+            double max = Double.NEGATIVE_INFINITY;
+            int row = 0, col = 0;
+
+            int rows = rowSize();
+            int cols = columnSize();
+
+            for (int x = 0; x < rows; x++)
+                for (int y = 0; y < cols; y++) {
+                    double d = storageGet(x, y);
+
+                    if (d > max) {
+                        max = d;
+                        row = x;
+                        col = y;
+                    }
+                }
+
+            maxElm = mkElement(row, col);
+        }
+
+        return maxElm;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element minElement() {
+        if (minElm == null) {
+            double min = Double.MAX_VALUE;
+            int row = 0, col = 0;
+
+            int rows = rowSize();
+            int cols = columnSize();
+
+            for (int x = 0; x < rows; x++)
+                for (int y = 0; y < cols; y++) {
+                    double d = storageGet(x, y);
+
+                    if (d < min) {
+                        min = d;
+                        row = x;
+                        col = y;
+                    }
+                }
+
+            minElm = mkElement(row, col);
+        }
+
+        return minElm;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxValue() {
+        return maxElement().get();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double minValue() {
+        return minElement().get();
+    }
+
+    /**
+     * @param row Row index in the matrix.
+     * @param col Column index in the matrix.
+     */
+    private Element mkElement(int row, int col) {
+        return new Element() {
+            /** {@inheritDoc} */
+            @Override public double get() {
+                return storageGet(row, col);
+            }
+
+            /** {@inheritDoc} */
+            @Override public int row() {
+                return row;
+            }
+
+            /** {@inheritDoc} */
+            @Override public int column() {
+                return col;
+            }
+
+            /** {@inheritDoc} */
+            @Override public void set(double d) {
+                storageSet(row, col, d);
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override public Element getElement(int row, int col) {
+        return mkElement(row, col);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix swapRows(int row1, int row2) {
+        checkRowIndex(row1);
+        checkRowIndex(row2);
+
+        int cols = columnSize();
+
+        for (int y = 0; y < cols; y++) {
+            double v = getX(row1, y);
+
+            setX(row1, y, getX(row2, y));
+            setX(row2, y, v);
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix swapColumns(int col1, int col2) {
+        checkColumnIndex(col1);
+        checkColumnIndex(col2);
+
+        int rows = rowSize();
+
+        for (int x = 0; x < rows; x++) {
+            double v = getX(x, col1);
+
+            setX(x, col1, getX(x, col2));
+            setX(x, col2, v);
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public MatrixStorage getStorage() {
+        return sto;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return sto.isSequentialAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return sto.isDense();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return sto.isRandomAccess();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return sto.isDistributed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return sto.isArrayBased();
+    }
+
+    /**
+     * Check row index bounds.
+     *
+     * @param row Row index.
+     */
+    private void checkRowIndex(int row) {
+        if (row < 0 || row >= rowSize())
+            throw new RowIndexException(row);
+    }
+
+    /**
+     * Check column index bounds.
+     *
+     * @param col Column index.
+     */
+    private void checkColumnIndex(int col) {
+        if (col < 0 || col >= columnSize())
+            throw new ColumnIndexException(col);
+    }
+
+    /**
+     * Check column and row index bounds.
+     *
+     * @param row Row index.
+     * @param col Column index.
+     */
+    protected void checkIndex(int row, int col) {
+        checkRowIndex(row);
+        checkColumnIndex(col);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(sto);
+        out.writeObject(meta);
+        out.writeObject(guid);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<String, Object> getMetaStorage() {
+        return meta;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        sto = (MatrixStorage)in.readObject();
+        meta = (Map<String, Object>)in.readObject();
+        guid = (IgniteUuid)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assign(double val) {
+        if (sto.isArrayBased())
+            for (double[] column : sto.data())
+                Arrays.fill(column, val);
+        else {
+            int rows = rowSize();
+            int cols = columnSize();
+
+            for (int x = 0; x < rows; x++)
+                for (int y = 0; y < cols; y++)
+                    storageSet(x, y, val);
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assign(IntIntToDoubleFunction fun) {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                storageSet(x, y, fun.apply(x, y));
+
+        return this;
+    }
+
+    /** */
+    private void checkCardinality(Matrix mtx) {
+        checkCardinality(mtx.rowSize(), mtx.columnSize());
+    }
+
+    /** */
+    private void checkCardinality(int rows, int cols) {
+        if (rows != rowSize())
+            throw new CardinalityException(rowSize(), rows);
+
+        if (cols != columnSize())
+            throw new CardinalityException(columnSize(), cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assign(double[][] vals) {
+        checkCardinality(vals.length, vals[0].length);
+
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                storageSet(x, y, vals[x][y]);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assign(Matrix mtx) {
+        checkCardinality(mtx);
+
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                storageSet(x, y, mtx.getX(x, y));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix map(IgniteDoubleFunction<Double> fun) {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                storageSet(x, y, fun.apply(storageGet(x, y)));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix map(Matrix mtx, IgniteBiFunction<Double, Double, Double> fun) {
+        checkCardinality(mtx);
+
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                storageSet(x, y, fun.apply(storageGet(x, y), mtx.getX(x, y)));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assignColumn(int col, org.apache.ignite.math.Vector vec) {
+        checkColumnIndex(col);
+
+        int rows = rowSize();
+
+        for (int x = 0; x < rows; x++)
+            storageSet(x, col, vec.getX(x));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assignRow(int row, Vector vec) {
+        checkRowIndex(row);
+
+        int cols = columnSize();
+
+        if (cols != vec.size())
+            throw new CardinalityException(cols, vec.size());
+
+        if (sto.isArrayBased() && vec.getStorage().isArrayBased())
+            System.arraycopy(vec.getStorage().data(), 0, sto.data()[row], 0, cols);
+        else
+            for (int y = 0; y < cols; y++)
+                storageSet(row, y, vec.getX(y));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector foldRows(IgniteFunction<Vector, Double> fun) {
+        int rows = rowSize();
+
+        Vector vec = likeVector(rows);
+
+        for (int i = 0; i < rows; i++)
+            vec.setX(i, fun.apply(viewRow(i)));
+
+        return vec;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector foldColumns(IgniteFunction<Vector, Double> fun) {
+        int cols = columnSize();
+
+        Vector vec = likeVector(cols);
+
+        for (int i = 0; i < cols; i++)
+            vec.setX(i, fun.apply(viewColumn(i)));
+
+        return vec;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T foldMap(IgniteBiFunction<T, Double, T> foldFun, IgniteDoubleFunction<Double> mapFun,
+        T zeroVal) {
+        T res = zeroVal;
+
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                res = foldFun.apply(res, mapFun.apply(storageGet(x, y)));
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return sto.columnSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return sto.rowSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double determinant() {
+        //TODO: This decomposition should be cached
+        LUDecomposition dec = new LUDecomposition(this);
+        double res = dec.determinant();
+        dec.destroy();
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix inverse() {
+        if (rowSize() != columnSize())
+            throw new CardinalityException(rowSize(), columnSize());
+
+        //TODO: This decomposition should be cached
+        LUDecomposition dec = new LUDecomposition(this);
+
+        Matrix res = dec.solve(likeIdentity());
+        dec.destroy();
+
+        return res;
+    }
+
+    /** */
+    protected Matrix likeIdentity() {
+        int n = rowSize();
+        Matrix res = like(n, n);
+
+        for (int i = 0; i < n; i++)
+            res.setX(i, i, 1.0);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix divide(double d) {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                setX(x, y, getX(x, y) / d);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int row, int col) {
+        checkIndex(row, col);
+
+        return storageGet(row, col);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getX(int row, int col) {
+        return storageGet(row, col);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix minus(Matrix mtx) {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        checkCardinality(rows, cols);
+
+        Matrix res = like(rows, cols);
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                res.setX(x, y, getX(x, y) - mtx.getX(x, y));
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix plus(double x) {
+        Matrix cp = copy();
+
+        cp.map(Functions.plus(x));
+
+        return cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix plus(Matrix mtx) {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        checkCardinality(rows, cols);
+
+        Matrix res = like(rows, cols);
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                res.setX(x, y, getX(x, y) + mtx.getX(x, y));
+
+        return res;
+
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteUuid guid() {
+        return guid;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix set(int row, int col, double val) {
+        checkIndex(row, col);
+
+        storageSet(row, col, val);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix setRow(int row, double[] data) {
+        checkRowIndex(row);
+
+        int cols = columnSize();
+
+        if (cols != data.length)
+            throw new CardinalityException(cols, data.length);
+
+        if (sto.isArrayBased())
+            System.arraycopy(data, 0, sto.data()[row], 0, cols);
+        else
+            for (int y = 0; y < cols; y++)
+                setX(row, y, data[y]);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix setColumn(int col, double[] data) {
+        checkColumnIndex(col);
+
+        int rows = rowSize();
+
+        if (rows != data.length)
+            throw new CardinalityException(rows, data.length);
+
+        for (int x = 0; x < rows; x++)
+            setX(x, col, data[x]);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix setX(int row, int col, double val) {
+        storageSet(row, col, val);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix times(double x) {
+        Matrix cp = copy();
+
+        cp.map(Functions.mult(x));
+
+        return cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxAbsRowSumNorm() {
+        double max = 0.0;
+
+        int rows = rowSize();
+        int cols = columnSize();
+
+        for (int x = 0; x < rows; x++) {
+            double sum = 0;
+
+            for (int y = 0; y < cols; y++)
+                sum += Math.abs(getX(x, y));
+
+            if (sum > max)
+                max = sum;
+        }
+
+        return max;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector times(Vector vec) {
+        int cols = columnSize();
+
+        if (cols != vec.size())
+            throw new CardinalityException(cols, vec.size());
+
+        int rows = rowSize();
+
+        Vector res = likeVector(rows);
+
+        for (int x = 0; x < rows; x++)
+            res.setX(x, vec.dot(viewRow(x)));
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix times(Matrix mtx) {
+        int cols = columnSize();
+
+        if (cols != mtx.rowSize())
+            throw new CardinalityException(cols, mtx.rowSize());
+
+        int rows = rowSize();
+
+        int mtxCols = mtx.columnSize();
+
+        Matrix res = like(rows, mtxCols);
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < mtxCols; y++) {
+                double sum = 0.0;
+
+                for (int k = 0; k < cols; k++)
+                    sum += getX(x, k) * mtx.getX(k, y);
+
+                res.setX(x, y, sum);
+            }
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        double sum = 0.0;
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                sum += getX(x, y);
+
+        return sum;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix transpose() {
+        int rows = rowSize();
+        int cols = columnSize();
+
+        Matrix mtx = like(cols, rows);
+
+        for (int x = 0; x < rows; x++)
+            for (int y = 0; y < cols; y++)
+                mtx.setX(y, x, getX(x, y));
+
+        return mtx;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean density(double threshold) {
+        assert threshold >= 0.0 && threshold <= 1.0;
+
+        int n = MIN_SAMPLES;
+        int rows = rowSize();
+        int cols = columnSize();
+
+        double mean = 0.0;
+        double pq = threshold * (1 - threshold);
+
+        Random rnd = new Random();
+
+        for (int i = 0; i < MIN_SAMPLES; i++)
+            if (getX(rnd.nextInt(rows), rnd.nextInt(cols)) != 0.0)
+                mean++;
+
+        mean /= MIN_SAMPLES;
+
+        double iv = Z80 * Math.sqrt(pq / n);
+
+        if (mean < threshold - iv)
+            return false; // Sparse.
+        else if (mean > threshold + iv)
+            return true; // Dense.
+
+        while (n < MAX_SAMPLES) {
+            // Determine upper bound we may need for 'n' to likely relinquish the uncertainty.
+            // Here, we use confidence interval formula but solved for 'n'.
+            double ivX = Math.max(Math.abs(threshold - mean), 1e-11);
+
+            double stdErr = ivX / Z80;
+            double nX = Math.min(Math.max((int)Math.ceil(pq / (stdErr * stdErr)), n), MAX_SAMPLES) - n;
+
+            if (nX < 1.0) // IMPL NOTE this can happen with threshold 1.0
+                nX = 1.0;
+
+            double meanNext = 0.0;
+
+            for (int i = 0; i < nX; i++)
+                if (getX(rnd.nextInt(rows), rnd.nextInt(cols)) != 0.0)
+                    meanNext++;
+
+            mean = (n * mean + meanNext) / (n + nX);
+
+            n += nX;
+
+            // Are we good now?
+            iv = Z80 * Math.sqrt(pq / n);
+
+            if (mean < threshold - iv)
+                return false; // Sparse.
+            else if (mean > threshold + iv)
+                return true; // Dense.
+        }
+
+        return mean > threshold; // Dense if mean > threshold.
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix viewPart(int[] off, int[] size) {
+        return new MatrixView(this, off[0], off[1], size[0], size[1]);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix viewPart(int rowOff, int rows, int colOff, int cols) {
+        return viewPart(new int[] {rowOff, colOff}, new int[] {rows, cols});
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewRow(int row) {
+        return new MatrixVectorView(this, row, 0, 0, 1);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewColumn(int col) {
+        return new MatrixVectorView(this, 0, col, 1, 0);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewDiagonal() {
+        return new MatrixVectorView(this, 0, 0, 1, 1);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        Matrix cp = like(rowSize(), columnSize());
+
+        cp.assign(this);
+
+        return cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + guid.hashCode();
+        res = res * 37 + sto.hashCode();
+        res = res * 37 + meta.hashCode();
+
+        return res;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * We ignore guid's for comparisons.
+     */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        AbstractMatrix that = (AbstractMatrix)o;
+
+        MatrixStorage sto = getStorage();
+
+        return (sto != null ? sto.equals(that.getStorage()) : that.getStorage() == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/CacheMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/CacheMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/CacheMatrix.java
new file mode 100644
index 0000000..8ce1192
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/CacheMatrix.java
@@ -0,0 +1,158 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixKeyMapper;
+import org.apache.ignite.math.ValueMapper;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.impls.CacheUtils;
+import org.apache.ignite.math.impls.storage.matrix.CacheMatrixStorage;
+
+/**
+ * Matrix based on existing cache and key and value mapping functions.
+ */
+public class CacheMatrix<K, V> extends AbstractMatrix {
+    /**
+     *
+     */
+    public CacheMatrix() {
+        // No-op.
+    }
+
+    /**
+     * Creates new matrix over existing cache.
+     *
+     * @param rows
+     * @param cols
+     * @param cache
+     * @param keyMapper
+     * @param valMapper
+     */
+    public CacheMatrix(
+        int rows,
+        int cols,
+        IgniteCache<K, V> cache,
+        MatrixKeyMapper<K> keyMapper,
+        ValueMapper<V> valMapper) {
+        assert rows > 0;
+        assert cols > 0;
+        assert cache != null;
+        assert keyMapper != null;
+        assert valMapper != null;
+
+        setStorage(new CacheMatrixStorage<>(rows, cols, cache, keyMapper, valMapper));
+    }
+
+    /**
+     *
+     *
+     */
+    @SuppressWarnings({"unchecked"})
+    private CacheMatrixStorage<K, V> storage() {
+        return (CacheMatrixStorage<K, V>)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Return the same matrix with updates values (broken contract).
+     *
+     * @param d
+     */
+    @Override public Matrix divide(double d) {
+        return mapOverValues((Double v) -> v / d);
+    }
+
+    /**
+     * Return the same matrix with updates values (broken contract).
+     *
+     * @param x
+     */
+    @Override public Matrix plus(double x) {
+        return mapOverValues((Double v) -> v + x);
+    }
+
+    /**
+     * Return the same matrix with updates values (broken contract).
+     *
+     * @param x
+     */
+    @Override public Matrix times(double x) {
+        return mapOverValues((Double v) -> v * x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assign(double val) {
+        return mapOverValues((Double v) -> val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix map(IgniteDoubleFunction<Double> fun) {
+        return mapOverValues(fun::apply);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        CacheMatrixStorage<K, V> sto = storage();
+
+        return CacheUtils.sum(sto.cache().getName(), sto.keyMapper(), sto.valueMapper());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxValue() {
+        CacheMatrixStorage<K, V> sto = storage();
+
+        return CacheUtils.max(sto.cache().getName(), sto.keyMapper(), sto.valueMapper());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double minValue() {
+        CacheMatrixStorage<K, V> sto = storage();
+
+        return CacheUtils.min(sto.cache().getName(), sto.keyMapper(), sto.valueMapper());
+    }
+
+    /**
+     * @param mapper
+     */
+    private Matrix mapOverValues(IgniteFunction<Double, Double> mapper) {
+        CacheMatrixStorage<K, V> sto = storage();
+
+        CacheUtils.map(sto.cache().getName(), sto.keyMapper(), sto.valueMapper(), mapper);
+
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrix.java
new file mode 100644
index 0000000..d5f8eca
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOffHeapMatrix.java
@@ -0,0 +1,90 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.storage.matrix.DenseOffHeapMatrixStorage;
+import org.apache.ignite.math.impls.vector.DenseLocalOffHeapVector;
+
+/**
+ * Dense local off-heap implementation of the {@link Matrix} interface.
+ */
+public class DenseLocalOffHeapMatrix extends AbstractMatrix {
+    /** */
+    public DenseLocalOffHeapMatrix() {
+        // No-op.
+    }
+
+    /**
+     * @param data Backing data array.
+     */
+    public DenseLocalOffHeapMatrix(double[][] data) {
+        assert data != null;
+
+        setStorage(new DenseOffHeapMatrixStorage(data));
+    }
+
+    /**
+     * @param rows Amount of rows in matrix.
+     * @param cols Amount of columns in matrix.
+     */
+    public DenseLocalOffHeapMatrix(int rows, int cols) {
+        assert rows > 0;
+        assert cols > 0;
+
+        setStorage(new DenseOffHeapMatrixStorage(rows, cols));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        DenseLocalOffHeapMatrix cp = new DenseLocalOffHeapMatrix(getStorage().rowSize(), getStorage().columnSize());
+
+        cp.assign(this);
+
+        return cp;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        return new DenseLocalOffHeapMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        return new DenseLocalOffHeapVector(crd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        getStorage().destroy();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Matrix likeIdentity() {
+        int n = rowSize();
+        Matrix res = like(n, n);
+
+        // IMPL NOTE as opposed to on-heap matrices this one isn't initialized with zeroes
+        for (int i = 0; i < n; i++)
+            for (int j = 0; j < n; j++)
+                res.setX(i, j, i == j ? 1.0 : 0.0);
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrix.java
new file mode 100644
index 0000000..3cc3e4f
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DenseLocalOnHeapMatrix.java
@@ -0,0 +1,86 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.storage.matrix.ArrayMatrixStorage;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+
+/**
+ * Basic implementation for matrix.
+ *
+ * This is a trivial implementation for matrix assuming dense logic, local on-heap JVM storage
+ * based on <code>double[][]</code> array. It is only suitable for data sets where
+ * local, non-distributed execution is satisfactory and on-heap JVM storage is enough
+ * to keep the entire data set.
+ */
+public class DenseLocalOnHeapMatrix extends AbstractMatrix {
+    /**
+     *
+     */
+    public DenseLocalOnHeapMatrix() {
+        // No-op.
+    }
+
+    /**
+     * @param rows Amount of rows in matrix.
+     * @param cols Amount of columns in matrix.
+     */
+    public DenseLocalOnHeapMatrix(int rows, int cols) {
+        assert rows > 0;
+        assert cols > 0;
+
+        setStorage(new ArrayMatrixStorage(rows, cols));
+    }
+
+    /**
+     * @param mtx Backing data array.
+     */
+    public DenseLocalOnHeapMatrix(double[][] mtx) {
+        assert mtx != null;
+
+        setStorage(new ArrayMatrixStorage(mtx));
+    }
+
+    /**
+     * @param orig Original matrix.
+     */
+    private DenseLocalOnHeapMatrix(DenseLocalOnHeapMatrix orig) {
+        assert orig != null;
+
+        setStorage(new ArrayMatrixStorage(orig.rowSize(), orig.columnSize()));
+
+        assign(orig);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        return new DenseLocalOnHeapMatrix(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        return new DenseLocalOnHeapMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        return new DenseLocalOnHeapVector(crd);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DiagonalMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DiagonalMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DiagonalMatrix.java
new file mode 100644
index 0000000..0b1f97e
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/DiagonalMatrix.java
@@ -0,0 +1,101 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.storage.matrix.DiagonalMatrixStorage;
+import org.apache.ignite.math.impls.vector.ConstantVector;
+import org.apache.ignite.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.math.impls.vector.SingleElementVectorView;
+
+/**
+ * Implementation of diagonal view of the {@link Matrix}.
+ *
+ * <p>See also: <a href="https://en.wikipedia.org/wiki/Diagonal_matrix">Wikipedia article</a>.</p>
+ */
+public class DiagonalMatrix extends AbstractMatrix {
+    /**
+     *
+     */
+    public DiagonalMatrix() {
+        // No-op.
+    }
+
+    /**
+     * @param diagonal Backing {@link Vector}.
+     */
+    public DiagonalMatrix(Vector diagonal) {
+        super(new DiagonalMatrixStorage(diagonal));
+    }
+
+    /**
+     * @param mtx Backing {@link Matrix}.
+     */
+    public DiagonalMatrix(Matrix mtx) {
+        super(new DiagonalMatrixStorage(mtx == null ? null : mtx.viewDiagonal()));
+    }
+
+    /**
+     * @param vals Backing array of values at diagonal.
+     */
+    public DiagonalMatrix(double[] vals) {
+        super(new DiagonalMatrixStorage(new DenseLocalOnHeapVector(vals)));
+    }
+
+    /**
+     *
+     *
+     */
+    private DiagonalMatrixStorage storage() {
+        return (DiagonalMatrixStorage)getStorage();
+    }
+
+    /**
+     * @param size Size of diagonal.
+     * @param val Constant value at diagonal.
+     */
+    public DiagonalMatrix(int size, double val) {
+        super(new DiagonalMatrixStorage(new ConstantVector(size, val)));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewRow(int row) {
+        return new SingleElementVectorView(storage().diagonal(), row);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewColumn(int col) {
+        return new SingleElementVectorView(storage().diagonal(), col);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        return new DiagonalMatrix(storage().diagonal());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        return storage().diagonal().likeMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        return storage().diagonal().like(crd);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/FunctionMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/FunctionMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/FunctionMatrix.java
new file mode 100644
index 0000000..b180b5b
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/FunctionMatrix.java
@@ -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.
+ */
+
+package org.apache.ignite.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IntIntDoubleToVoidFunction;
+import org.apache.ignite.math.functions.IntIntToDoubleFunction;
+import org.apache.ignite.math.impls.storage.matrix.FunctionMatrixStorage;
+
+/**
+ * Implementation of {@link Matrix} that maps row and column index to {@link java.util.function} interfaces.
+ */
+public class FunctionMatrix extends AbstractMatrix {
+    /**
+     *
+     */
+    public FunctionMatrix() {
+        // No-op.
+    }
+
+    /**
+     * Creates read-write or read-only function matrix.
+     *
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param getFunc Function that returns value corresponding to given row and column index.
+     * @param setFunc Set function. If {@code null} - this will be a read-only matrix.
+     */
+    public FunctionMatrix(int rows, int cols, IntIntToDoubleFunction getFunc, IntIntDoubleToVoidFunction setFunc) {
+        assert rows > 0;
+        assert cols > 0;
+        assert getFunc != null;
+
+        setStorage(new FunctionMatrixStorage(rows, cols, getFunc, setFunc));
+    }
+
+    /**
+     * Creates read-only function matrix.
+     *
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param getFunc Function that returns value corresponding to given row and column index.
+     */
+    public FunctionMatrix(int rows, int cols, IntIntToDoubleFunction getFunc) {
+        assert rows > 0;
+        assert cols > 0;
+        assert getFunc != null;
+
+        setStorage(new FunctionMatrixStorage(rows, cols, getFunc));
+    }
+
+    /**
+     *
+     *
+     */
+    private FunctionMatrixStorage storage() {
+        return (FunctionMatrixStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        FunctionMatrixStorage sto = storage();
+
+        return new FunctionMatrix(sto.rowSize(), sto.columnSize(), sto.getFunction(), sto.setFunction());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        FunctionMatrixStorage sto = storage();
+
+        return new FunctionMatrix(rows, cols, sto.getFunction(), sto.setFunction());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/MatrixView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/MatrixView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/MatrixView.java
new file mode 100644
index 0000000..7b04dde
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/MatrixView.java
@@ -0,0 +1,84 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.io.Externalizable;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.storage.matrix.MatrixDelegateStorage;
+
+/**
+ * Implements the rectangular view into the parent {@link Matrix}.
+ */
+public class MatrixView extends AbstractMatrix {
+    /**
+     * Constructor for {@link Externalizable} interface.
+     */
+    public MatrixView() {
+        // No-op.
+    }
+
+    /**
+     * @param parent Backing parent {@link Matrix}.
+     * @param rowOff Row offset to parent matrix.
+     * @param colOff Column offset to parent matrix.
+     * @param rows Amount of rows in the view.
+     * @param cols Amount of columns in the view.
+     */
+    public MatrixView(Matrix parent, int rowOff, int colOff, int rows, int cols) {
+        this(parent == null ? null : parent.getStorage(), rowOff, colOff, rows, cols);
+    }
+
+    /**
+     * @param sto Backing parent {@link MatrixStorage}.
+     * @param rowOff Row offset to parent storage.
+     * @param colOff Column offset to parent storage.
+     * @param rows Amount of rows in the view.
+     * @param cols Amount of columns in the view.
+     */
+    public MatrixView(MatrixStorage sto, int rowOff, int colOff, int rows, int cols) {
+        super(new MatrixDelegateStorage(sto, rowOff, colOff, rows, cols));
+    }
+
+    /**
+     *
+     *
+     */
+    private MatrixDelegateStorage storage() {
+        return (MatrixDelegateStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        MatrixDelegateStorage sto = storage();
+
+        return new MatrixView(sto.delegate(), sto.rowOffset(), sto.columnOffset(), sto.rowSize(), sto.columnSize());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/PivotedMatrixView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/PivotedMatrixView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/PivotedMatrixView.java
new file mode 100644
index 0000000..1f7b008
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/PivotedMatrixView.java
@@ -0,0 +1,243 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.storage.matrix.PivotedMatrixStorage;
+import org.apache.ignite.math.impls.vector.PivotedVectorView;
+
+/**
+ * Pivoted (index mapped) view over another matrix implementation.
+ */
+public class PivotedMatrixView extends AbstractMatrix {
+    /** Pivoted matrix. */
+    private Matrix mtx;
+
+    /**
+     *
+     */
+    public PivotedMatrixView() {
+        // No-op.
+    }
+
+    /**
+     * @param mtx
+     * @param rowPivot
+     * @param colPivot
+     */
+    public PivotedMatrixView(Matrix mtx, int[] rowPivot, int[] colPivot) {
+        super(new PivotedMatrixStorage(mtx == null ? null : mtx.getStorage(), rowPivot, colPivot));
+
+        this.mtx = mtx;
+    }
+
+    /**
+     * @param mtx
+     */
+    public PivotedMatrixView(Matrix mtx) {
+        super(new PivotedMatrixStorage(mtx == null ? null : mtx.getStorage()));
+
+        this.mtx = mtx;
+    }
+
+    /**
+     * @param mtx
+     * @param pivot
+     */
+    public PivotedMatrixView(Matrix mtx, int[] pivot) {
+        super(new PivotedMatrixStorage(mtx == null ? null : mtx.getStorage(), pivot));
+
+        this.mtx = mtx;
+    }
+
+    /**
+     * Swaps indexes {@code i} and {@code j} for both both row and column.
+     *
+     * @param i First index to swap.
+     * @param j Second index to swap.
+     */
+    public Matrix swap(int i, int j) {
+        swapRows(i, j);
+        swapColumns(i, j);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix swapRows(int i, int j) {
+        if (i < 0 || i >= storage().rowPivot().length)
+            throw new IndexException(i);
+        if (j < 0 || j >= storage().rowPivot().length)
+            throw new IndexException(j);
+
+        storage().swapRows(i, j);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix swapColumns(int i, int j) {
+        if (i < 0 || i >= storage().columnPivot().length)
+            throw new IndexException(i);
+        if (j < 0 || j >= storage().columnPivot().length)
+            throw new IndexException(j);
+
+        storage().swapColumns(i, j);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewRow(int row) {
+        return new PivotedVectorView(
+            mtx.viewRow(storage().rowPivot()[row]),
+            storage().columnPivot(),
+            storage().columnUnpivot()
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector viewColumn(int col) {
+        return new PivotedVectorView(
+            mtx.viewColumn(storage().columnPivot()[col]),
+            storage().rowPivot(),
+            storage().rowUnpivot()
+        );
+    }
+
+    /**
+     *
+     *
+     */
+    public Matrix getBaseMatrix() {
+        return mtx;
+    }
+
+    /**
+     *
+     *
+     */
+    public int[] rowPivot() {
+        return storage().rowPivot();
+    }
+
+    /**
+     *
+     *
+     */
+    public int[] columnPivot() {
+        return storage().columnPivot();
+    }
+
+    /**
+     * @param i
+     */
+    public int rowPivot(int i) {
+        return storage().rowPivot()[i];
+    }
+
+    /**
+     * @param i
+     */
+    public int columnPivot(int i) {
+        return storage().columnPivot()[i];
+    }
+
+    /**
+     * @param i
+     */
+    public int rowUnpivot(int i) {
+        return storage().rowUnpivot()[i];
+    }
+
+    /**
+     * @param i
+     */
+    public int columnUnpivot(int i) {
+        return storage().columnUnpivot()[i];
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(mtx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        mtx = (Matrix)in.readObject();
+    }
+
+    /**
+     *
+     *
+     */
+    private PivotedMatrixStorage storage() {
+        return (PivotedMatrixStorage)getStorage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        return new PivotedMatrixView(mtx, storage().rowPivot(), storage().columnPivot());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + mtx.hashCode();
+        res = res * 37 + getStorage().hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        PivotedMatrixView that = (PivotedMatrixView)o;
+
+        MatrixStorage sto = storage();
+
+        return mtx.equals(that.mtx) && sto.equals(that.storage());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/RandomMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/RandomMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/RandomMatrix.java
new file mode 100644
index 0000000..2c3dcb2
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/RandomMatrix.java
@@ -0,0 +1,97 @@
+/*
+ * 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.math.impls.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.storage.matrix.RandomMatrixStorage;
+import org.apache.ignite.math.impls.vector.RandomVector;
+
+/**
+ * Implementation of {@link Matrix} with random values in the elements.
+ */
+public class RandomMatrix extends AbstractMatrix {
+    /** Whether fast hash is used, see {@link RandomMatrixStorage}. */
+    private boolean fastHash;
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param fastHash Whether fast hash is used.
+     */
+    private MatrixStorage mkStorage(int rows, int cols, boolean fastHash) {
+        this.fastHash = fastHash;
+
+        return new RandomMatrixStorage(rows, cols, fastHash);
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     * @param fastHash Whether fast hash is used.
+     */
+    public RandomMatrix(int rows, int cols, boolean fastHash) {
+        setStorage(mkStorage(rows, cols, fastHash));
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     */
+    public RandomMatrix(int rows, int cols) {
+        this(rows, cols, true);
+    }
+
+    /** */
+    public RandomMatrix() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        return new RandomMatrix(rowSize(), columnSize(), fastHash);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        return new RandomMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        return new RandomVector(crd);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeBoolean(fastHash);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        fastHash = in.readBoolean();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrix.java
new file mode 100644
index 0000000..5c40d70
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseDistributedMatrix.java
@@ -0,0 +1,155 @@
+// @java.file.header
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.impls.CacheUtils;
+import org.apache.ignite.math.impls.storage.matrix.SparseDistributedMatrixStorage;
+
+/**
+ * Sparse distributed matrix implementation based on data grid.
+ *
+ * Unlike {@link CacheMatrix} that is based on existing cache, this implementation creates distributed
+ * cache internally and doesn't rely on pre-existing cache.
+ *
+ * You also need to call {@link #destroy()} to remove the underlying cache when you no longer need this
+ * matrix.
+ *
+ * <b>Currently fold supports only commutative operations.<b/>
+ */
+public class SparseDistributedMatrix extends AbstractMatrix implements StorageConstants {
+    /**
+     *
+     */
+    public SparseDistributedMatrix() {
+        // No-op.
+    }
+
+    /**
+     * @param rows
+     * @param cols
+     * @param stoMode
+     * @param acsMode
+     */
+    public SparseDistributedMatrix(int rows, int cols, int stoMode, int acsMode) {
+        assert rows > 0;
+        assert cols > 0;
+        assertAccessMode(acsMode);
+        assertStorageMode(stoMode);
+
+        setStorage(new SparseDistributedMatrixStorage(rows, cols, stoMode, acsMode));
+    }
+
+    /**
+     *
+     *
+     */
+    private SparseDistributedMatrixStorage storage() {
+        return (SparseDistributedMatrixStorage)getStorage();
+    }
+
+    /**
+     * Return the same matrix with updates values (broken contract).
+     *
+     * @param d
+     */
+    @Override public Matrix divide(double d) {
+        return mapOverValues((Double v) -> v / d);
+    }
+
+    /**
+     * Return the same matrix with updates values (broken contract).
+     *
+     * @param x
+     */
+    @Override public Matrix plus(double x) {
+        return mapOverValues((Double v) -> v + x);
+    }
+
+    /**
+     * Return the same matrix with updates values (broken contract).
+     *
+     * @param x
+     */
+    @Override public Matrix times(double x) {
+        return mapOverValues((Double v) -> v * x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix assign(double val) {
+        return mapOverValues((Double v) -> val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix map(IgniteDoubleFunction<Double> fun) {
+        return mapOverValues(fun::apply);
+    }
+
+    /**
+     * @param mapper
+     */
+    private Matrix mapOverValues(IgniteFunction<Double, Double> mapper) {
+        CacheUtils.sparseMap(storage().cache().getName(), mapper);
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double sum() {
+        return CacheUtils.sparseSum(storage().cache().getName());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double maxValue() {
+        return CacheUtils.sparseMax(storage().cache().getName());
+    }
+
+    /** {@inheritDoc} */
+    @Override public double minValue() {
+        return CacheUtils.sparseMin(storage().cache().getName());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrix.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrix.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrix.java
new file mode 100644
index 0000000..cb08939
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/SparseLocalOnHeapMatrix.java
@@ -0,0 +1,72 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.impls.storage.matrix.SparseLocalOnHeapMatrixStorage;
+import org.apache.ignite.math.impls.vector.SparseLocalVector;
+
+/**
+ * Sparse local onheap matrix with {@link SparseLocalVector} as rows.
+ */
+public class SparseLocalOnHeapMatrix extends AbstractMatrix implements StorageConstants {
+    /**
+     *
+     */
+    public SparseLocalOnHeapMatrix() {
+        // No-op.
+    }
+
+    /**
+     * Construct new {@link SparseLocalOnHeapMatrix}.
+     *
+     * By default storage sets in row optimized mode and in random access mode.
+     */
+    public SparseLocalOnHeapMatrix(int rows, int cols) {
+        setStorage(mkStorage(rows, cols));
+    }
+
+    /**
+     * Create new {@link SparseLocalOnHeapMatrixStorage}.
+     */
+    private MatrixStorage mkStorage(int rows, int cols) {
+        return new SparseLocalOnHeapMatrixStorage(rows, cols, StorageConstants.RANDOM_ACCESS_MODE, StorageConstants.ROW_STORAGE_MODE);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        return new SparseLocalOnHeapMatrix(rows, cols);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        return new SparseLocalVector(crd, StorageConstants.RANDOM_ACCESS_MODE);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        Matrix cp = like(rowSize(), columnSize());
+
+        cp.assign(this);
+
+        return cp;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/TransposedMatrixView.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/TransposedMatrixView.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/TransposedMatrixView.java
new file mode 100644
index 0000000..9da909b
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/TransposedMatrixView.java
@@ -0,0 +1,84 @@
+/*
+ * 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.math.impls.matrix;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.impls.storage.matrix.MatrixDelegateStorage;
+
+/**
+ * Implements transposed view of the parent {@link Matrix}.
+ */
+public class TransposedMatrixView extends AbstractMatrix {
+    /** */
+    public TransposedMatrixView() {
+        //No-op.
+    }
+
+    /**
+     * @param mtx Parent matrix.
+     */
+    public TransposedMatrixView(Matrix mtx) {
+        this(mtx == null ? null : mtx.getStorage());
+    }
+
+    /** */
+    private TransposedMatrixView(MatrixStorage sto) {
+        super(new MatrixDelegateStorage(sto, 0, 0,
+            sto == null ? 0 : sto.rowSize(), sto == null ? 0 : sto.columnSize()));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void storageSet(int row, int col, double v) {
+        super.storageSet(col, row, v);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected double storageGet(int row, int col) {
+        return super.storageGet(col, row);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return getStorage().columnSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return getStorage().rowSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix copy() {
+        MatrixDelegateStorage sto = (MatrixDelegateStorage)getStorage();
+
+        return new TransposedMatrixView(sto.delegate());
+    }
+
+    /** {@inheritDoc} */
+    @Override public Matrix like(int rows, int cols) {
+        throw new UnsupportedOperationException();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Vector likeVector(int crd) {
+        throw new UnsupportedOperationException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/package-info.java
new file mode 100644
index 0000000..75d7532
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/matrix/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains several matrix implementations.
+ */
+package org.apache.ignite.math.impls.matrix;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/impls/package-info.java
new file mode 100644
index 0000000..f1b2e36
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains specific implementations for core algebra.
+ */
+package org.apache.ignite.math.impls;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/ArrayMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/ArrayMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/ArrayMatrixStorage.java
new file mode 100644
index 0000000..eb65b1d
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/ArrayMatrixStorage.java
@@ -0,0 +1,161 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import org.apache.ignite.math.MatrixStorage;
+
+/**
+ * Array based {@link MatrixStorage} implementation.
+ */
+public class ArrayMatrixStorage implements MatrixStorage {
+    /** Backing data array. */
+    private double[][] data;
+    /** Amount of rows in the matrix. */
+    private int rows;
+    /** Amount of columns in the matrix. */
+    private int cols;
+
+    /**
+     *
+     */
+    public ArrayMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param rows Amount of rows in the matrix.
+     * @param cols Amount of columns in the matrix.
+     */
+    public ArrayMatrixStorage(int rows, int cols) {
+        assert rows > 0;
+        assert cols > 0;
+
+        this.data = new double[rows][cols];
+        this.rows = rows;
+        this.cols = cols;
+    }
+
+    /**
+     * @param data Backing data array.
+     */
+    public ArrayMatrixStorage(double[][] data) {
+        assert data != null;
+        assert data[0] != null;
+
+        this.data = data;
+        this.rows = data.length;
+        this.cols = data[0].length;
+
+        assert rows > 0;
+        assert cols > 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return data[x][y];
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        data[x][y] = v;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[][] data() {
+        return data;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+
+        out.writeObject(data);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+
+        data = (double[][])in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res += res * 37 + rows;
+        res += res * 37 + cols;
+        res += res * 37 + Arrays.deepHashCode(data);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        ArrayMatrixStorage that = (ArrayMatrixStorage)o;
+
+        return Arrays.deepEquals(data, that.data);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/CacheMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/CacheMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/CacheMatrixStorage.java
new file mode 100644
index 0000000..7aefa2c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/CacheMatrixStorage.java
@@ -0,0 +1,180 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.math.MatrixKeyMapper;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.ValueMapper;
+
+/**
+ * Matrix storage based on arbitrary cache and key and value mapping functions.
+ */
+public class CacheMatrixStorage<K, V> implements MatrixStorage {
+    /** */ private int rows;
+    /** */  private int cols;
+    /** */ private IgniteCache<K, V> cache;
+    /** */ private MatrixKeyMapper<K> keyMapper;
+    /** */ private ValueMapper<V> valMapper;
+
+    /**
+     *
+     */
+    public CacheMatrixStorage() {
+        // No-op.
+    }
+
+    /**
+     * @param rows
+     * @param cols
+     * @param cache
+     * @param keyMapper
+     * @param valMapper
+     */
+    public CacheMatrixStorage(int rows, int cols, IgniteCache<K, V> cache, MatrixKeyMapper<K> keyMapper,
+        ValueMapper<V> valMapper) {
+        assert rows > 0;
+        assert cols > 0;
+        assert cache != null;
+        assert keyMapper != null;
+        assert valMapper != null;
+
+        this.rows = rows;
+        this.cols = cols;
+        this.cache = cache;
+        this.keyMapper = keyMapper;
+        this.valMapper = valMapper;
+    }
+
+    /**
+     * @return Ignite cache.
+     */
+    public IgniteCache<K, V> cache() {
+        return cache;
+    }
+
+    /**
+     * @return Key mapper.
+     */
+    public MatrixKeyMapper<K> keyMapper() {
+        return keyMapper;
+    }
+
+    /**
+     * @return Value mapper.
+     */
+    public ValueMapper<V> valueMapper() {
+        return valMapper;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return valMapper.toDouble(cache.get(keyMapper.apply(x, y)));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        cache.put(keyMapper.apply(x, y), valMapper.fromDouble(v));
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+        out.writeUTF(cache.getName());
+        out.writeObject(keyMapper);
+        out.writeObject(valMapper);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked"})
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+        cache = Ignition.localIgnite().getOrCreateCache(in.readUTF());
+        keyMapper = (MatrixKeyMapper<K>)in.readObject();
+        valMapper = (ValueMapper<V>)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + rows;
+        res = res * 37 + cols;
+        res = res * 37 + cache.hashCode();
+        res = res * 37 + keyMapper.hashCode();
+        res = res * 37 + valMapper.hashCode();
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        CacheMatrixStorage that = (CacheMatrixStorage)o;
+
+        return (cache != null ? cache.equals(that.cache) : that.cache == null) &&
+            (keyMapper != null ? keyMapper.equals(that.keyMapper) : that.keyMapper == null) &&
+            (valMapper != null ? valMapper.equals(that.valMapper) : that.valMapper == null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
new file mode 100644
index 0000000..6695bc2
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
@@ -0,0 +1,197 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.math.MatrixStorage;
+
+/**
+ * Local, dense off-heap matrix storage.
+ */
+public class DenseOffHeapMatrixStorage implements MatrixStorage {
+    /** */ private int rows;
+    /** */ private int cols;
+    /** */ private transient long ptr;
+    //TODO: temp solution.
+    /** */ private int ptrInitHash;
+
+    /** */
+    public DenseOffHeapMatrixStorage() {
+        // No-op.
+    }
+
+    /** */
+    public DenseOffHeapMatrixStorage(int rows, int cols) {
+        assert rows > 0;
+        assert cols > 0;
+
+        this.rows = rows;
+        this.cols = cols;
+
+        allocateMemory(rows, cols);
+    }
+
+    /** */
+    public DenseOffHeapMatrixStorage(double[][] data) {
+        assert data != null;
+        assert data[0] != null;
+
+        this.rows = data.length;
+        this.cols = data[0].length;
+
+        assert rows > 0;
+        assert cols > 0;
+
+        allocateMemory(rows, cols);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                set(i, j, data[i][j]);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double get(int x, int y) {
+        return GridUnsafe.getDouble(pointerOffset(x, y));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void set(int x, int y, double v) {
+        GridUnsafe.putDouble(pointerOffset(x, y), v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int columnSize() {
+        return cols;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSequentialAccess() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDense() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isRandomAccess() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDistributed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int rowSize() {
+        return rows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isArrayBased() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double[][] data() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(rows);
+        out.writeInt(cols);
+        out.writeInt(ptrInitHash);
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                out.writeDouble(get(i, j));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rows = in.readInt();
+        cols = in.readInt();
+
+        allocateMemory(rows, cols);
+
+        ptrInitHash = in.readInt();
+
+        for (int i = 0; i < rows; i++)
+            for (int j = 0; j < cols; j++)
+                set(i, j, in.readDouble());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        GridUnsafe.freeMemory(ptr);
+    }
+
+    /** {@inheritDoc} */
+    private long pointerOffset(int x, int y) {
+        return ptr + x * cols * Double.BYTES + y * Double.BYTES;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj != null &&
+            getClass().equals(obj.getClass()) &&
+            (rows == ((DenseOffHeapMatrixStorage)obj).rows) &&
+            (cols == ((DenseOffHeapMatrixStorage)obj).cols) &&
+            (rows == 0 || cols == 0 || ptr == ((DenseOffHeapMatrixStorage)obj).ptr || isMemoryEquals((DenseOffHeapMatrixStorage)obj));
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = 1;
+
+        res = res * 37 + rows;
+        res = res * 37 + cols;
+        res = res * 37 + ptrInitHash;
+
+        return res;
+    }
+
+    /** */
+    private boolean isMemoryEquals(DenseOffHeapMatrixStorage otherStorage) {
+        boolean res = true;
+
+        for (int i = 0; i < otherStorage.rows; i++) {
+            for (int j = 0; j < otherStorage.cols; j++) {
+                if (Double.compare(get(i, j), otherStorage.get(i, j)) != 0) {
+                    res = false;
+                    break;
+                }
+            }
+        }
+
+        return res;
+    }
+
+    /** */
+    private void allocateMemory(int rows, int cols) {
+        ptr = GridUnsafe.allocateMemory(rows * cols * Double.BYTES);
+
+        ptrInitHash = Long.hashCode(ptr);
+    }
+}


[41/50] [abbrv] ignite git commit: IGNITE-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed - fix .NET

Posted by sb...@apache.org.
IGNITE-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed - fix .NET


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

Branch: refs/heads/ignite-1561-1
Commit: 7def66c46cd64fc7a402d74fddc893c60b88b681
Parents: 247282f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Apr 14 20:02:24 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Apr 14 20:02:24 2017 +0300

----------------------------------------------------------------------
 .../Cache/CacheConfigurationTest.cs             | 16 ++++++++++----
 .../IgniteConfigurationSerializerTest.cs        | 22 +++++++++++++++-----
 .../Cache/Configuration/CacheConfiguration.cs   |  6 ------
 3 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7def66c4/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 1fd7d05..7a120bc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -28,7 +28,7 @@ namespace Apache.Ignite.Core.Tests.Cache
     using Apache.Ignite.Core.Cache.Expiry;
     using Apache.Ignite.Core.Cache.Store;
     using Apache.Ignite.Core.Common;
-    using Apache.Ignite.Core.Tests.Plugin.Cache;
+    using Apache.Ignite.Core.Plugin.Cache;
     using NUnit.Framework;
 
     /// <summary>
@@ -479,7 +479,6 @@ namespace Apache.Ignite.Core.Tests.Cache
                 CopyOnRead = true,
                 WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
                 WriteBehindFlushSize = 7,
-                AtomicWriteOrderMode = CacheAtomicWriteOrderMode.Primary,
                 AtomicityMode = CacheAtomicityMode.Atomic,
                 Backups = 8,
                 CacheMode = CacheMode.Partitioned,
@@ -547,7 +546,7 @@ namespace Apache.Ignite.Core.Tests.Cache
                 },
                 ExpiryPolicyFactory = new ExpiryFactory(),
                 EnableStatistics = true,
-                PluginConfigurations = new[] { new CacheJavaPluginConfiguration() }
+                PluginConfigurations = new[] { new MyPluginConfiguration() }
             };
         }
         /// <summary>
@@ -566,7 +565,6 @@ namespace Apache.Ignite.Core.Tests.Cache
                 CopyOnRead = true,
                 WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
                 WriteBehindFlushSize = 7,
-                AtomicWriteOrderMode = CacheAtomicWriteOrderMode.Clock,
                 AtomicityMode = CacheAtomicityMode.Transactional,
                 Backups = 8,
                 CacheMode = CacheMode.Partitioned,
@@ -711,5 +709,15 @@ namespace Apache.Ignite.Core.Tests.Cache
                 return new ExpiryPolicy(null, null, null);
             }
         }
+
+        private class MyPluginConfiguration : ICachePluginConfiguration
+        {
+            public int? CachePluginConfigurationClosureFactoryId { get { return null; } }
+
+            public void WriteBinary(IBinaryRawWriter writer)
+            {
+                throw new NotImplementedException();
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7def66c4/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 8e10539..cba5647 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -47,9 +47,9 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Lifecycle;
     using Apache.Ignite.Core.Log;
+    using Apache.Ignite.Core.Plugin.Cache;
     using Apache.Ignite.Core.Tests.Binary;
     using Apache.Ignite.Core.Tests.Plugin;
-    using Apache.Ignite.Core.Tests.Plugin.Cache;
     using Apache.Ignite.Core.Transactions;
     using Apache.Ignite.NLog;
     using NUnit.Framework;
@@ -114,7 +114,7 @@ namespace Apache.Ignite.Core.Tests
                                     </nearConfiguration>
                                     <affinityFunction type='RendezvousAffinityFunction' partitions='99' excludeNeighbors='true' />
                                     <expiryPolicyFactory type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+MyPolicyFactory, Apache.Ignite.Core.Tests' />
-                                    <pluginConfigurations><iCachePluginConfiguration type='Apache.Ignite.Core.Tests.Plugin.Cache.CacheJavaPluginConfiguration, Apache.Ignite.Core.Tests' foo='baz' /></pluginConfigurations>
+                                    <pluginConfigurations><iCachePluginConfiguration type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+MyPluginConfiguration, Apache.Ignite.Core.Tests' /></pluginConfigurations>
                                 </cacheConfiguration>
                                 <cacheConfiguration name='secondCache' />
                             </cacheConfiguration>
@@ -241,8 +241,7 @@ namespace Apache.Ignite.Core.Tests
             Assert.IsNotNull(plugins);
             Assert.IsNotNull(plugins.Cast<TestIgnitePluginConfiguration>().SingleOrDefault());
 
-            var cachePlugCfg = cacheCfg.PluginConfigurations.Cast<CacheJavaPluginConfiguration>().Single();
-            Assert.AreEqual("baz", cachePlugCfg.Foo);
+            Assert.IsNotNull(cacheCfg.PluginConfigurations.Cast<MyPluginConfiguration>().SingleOrDefault());
 
             var eventStorage = cfg.EventStorageSpi as MemoryEventStorageSpi;
             Assert.IsNotNull(eventStorage);
@@ -677,7 +676,7 @@ namespace Apache.Ignite.Core.Tests
                         EnableStatistics = true,
                         PluginConfigurations = new[]
                         {
-                            new CacheJavaPluginConfiguration()
+                            new MyPluginConfiguration()
                         }
                     }
                 },
@@ -966,5 +965,18 @@ namespace Apache.Ignite.Core.Tests
                 throw new NotImplementedException();
             }
         }
+
+        public class MyPluginConfiguration : ICachePluginConfiguration
+        {
+            int? ICachePluginConfiguration.CachePluginConfigurationClosureFactoryId
+            {
+                get { return 0; }
+            }
+
+            void ICachePluginConfiguration.WriteBinary(IBinaryRawWriter writer)
+            {
+                throw new NotImplementedException();
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/7def66c4/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 a16edfb..91a5b1e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -335,12 +335,6 @@ namespace Apache.Ignite.Core.Cache.Configuration
                     }
                     else
                     {
-                        if (!cachePlugin.GetType().IsSerializable)
-                        {
-                            throw new InvalidOperationException("Invalid cache configuration: " +
-                                                                "ICachePluginConfiguration should be Serializable.");
-                        }
-
                         writer.WriteBoolean(false);
                         writer.WriteObject(cachePlugin);
                     }


[36/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest.java
new file mode 100644
index 0000000..267de66
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.configuration.IgniteConfiguration;
+
+/**
+ *
+ */
+public class GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest extends
+    GridCacheAtomicMultiNodeFullApiSelfTest {
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setLateAffinityAssignment(false);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java
deleted file mode 100644
index 0e10ef7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java
+++ /dev/null
@@ -1,35 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-
-/**
- *
- */
-public class GridCacheAtomicLateAffDisabledPrimaryWriteOrderMultiNodeFullApiSelfTest extends
-    GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        cfg.setLateAffinityAssignment(false);
-
-        return cfg;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeFullApiSelfTest.java
index 5040b00..01e4cb8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeFullApiSelfTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 
@@ -30,13 +28,6 @@ import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
  * Multi-node tests for partitioned cache.
  */
 public class GridCacheAtomicMultiNodeFullApiSelfTest extends GridCachePartitionedMultiNodeFullApiSelfTest {
-    /**
-     * @return Write order mode for atomic cache.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
     /** {@inheritDoc} */
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
@@ -53,7 +44,6 @@ public class GridCacheAtomicMultiNodeFullApiSelfTest extends GridCachePartitione
 
         cc.setRebalanceMode(SYNC);
         cc.setBackups(1);
-        cc.setAtomicWriteOrderMode(atomicWriteOrderMode());
 
         return cc;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.java
index 5458d01..6596d2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest.java
@@ -17,12 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -30,13 +27,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
  */
 public class GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest
     extends GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest {
-    /**
-     * @return Write order mode for atomic cache.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
     /** {@inheritDoc} */
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
@@ -56,13 +46,4 @@ public class GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest
     @Override protected boolean txEnabled() {
         return false;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
-        CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
-
-        ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
-
-        return ccfg;
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java
deleted file mode 100644
index 6355595..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
-/**
- * Multi-node tests for atomic cache with primary write order mode and near cache enabled.
- */
-public class GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest
-    extends GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest{
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return new NearCacheConfiguration();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
index d9c6e01..15497f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearRemoveFailureTest.java
@@ -17,13 +17,11 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
 /**
@@ -41,11 +39,6 @@ public class GridCacheAtomicNearRemoveFailureTest extends GridCacheAbstractRemov
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearCache() {
         return new NearCacheConfiguration();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNoStripedPoolMultiNodeFullApiSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapFullApiSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicOffHeapMultiNodeFullApiSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedMetricsSelfTest.java
index 3a69d9b..f757936 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedMetricsSelfTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractMetricsSelfTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -42,7 +41,6 @@ public class GridCacheAtomicPartitionedMetricsSelfTest extends GridCacheAbstract
         cfg.setRebalanceMode(SYNC);
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setAtomicityMode(ATOMIC);
-        cfg.setAtomicWriteOrderMode(PRIMARY);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java
deleted file mode 100644
index d8b5dfe..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- * Multi-node tests for atomic cache with primary write order mode.
- */
-public class GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest extends GridCacheAtomicMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest.java
deleted file mode 100644
index 4adda3c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest.java
+++ /dev/null
@@ -1,33 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- * Multi-node tests for partitioned cache with primary write order.
- */
-public class GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest extends
-        GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
deleted file mode 100644
index f6e7e2f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest.java
+++ /dev/null
@@ -1,52 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractRemoveFailureTest;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Tests that removes are not lost when topology changes.
- */
-public class GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest extends GridCacheAbstractRemoveFailureTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearCache() {
-        return new NearCacheConfiguration();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java
index 21ecf5e..e69de29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest.java
@@ -1,28 +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.
- *
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-public class GridCacheAtomicPrimaryWriteOrderOnheapFullApiSelfTest extends GridCacheAtomicOnheapFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CacheAtomicWriteOrderMode.PRIMARY;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java
index 99778c7..e69de29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest.java
@@ -1,29 +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.
- *
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-public class GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest
-    extends GridCacheAtomicOnheapMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CacheAtomicWriteOrderMode.PRIMARY;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index e7591f2..e46b7bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -33,7 +33,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -60,7 +59,6 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
         cc.setBackups(1);
         cc.setRebalanceMode(SYNC);
         cc.setAtomicityMode(atomicityMode());
-        cc.setAtomicWriteOrderMode(PRIMARY);
 
         NearCacheConfiguration nearCfg = new NearCacheConfiguration();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index 658c7a5..eed4b98 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -50,7 +50,6 @@ import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.transactions.Transaction;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_LOCKED;
 import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNLOCKED;
@@ -110,7 +109,6 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
-        cfg.setAtomicWriteOrderMode(PRIMARY);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index a546d89..d5c5635 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -98,8 +98,6 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         c0.putAll(putMap);
 
-        atomicClockModeDelay(c0);
-
         c1.removeAll(new HashSet<>(putMap.keySet()));
 
         for (int i = 0; i < size; i++) {
@@ -135,8 +133,6 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         for (int i = 0; i < size; i++)
             putMap.put(i, i * i);
 
-        atomicClockModeDelay(prj0);
-
         info(">>> Before second put.");
 
         prj1.putAll(putMap);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
index cc5f04a..359b12b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
@@ -22,7 +22,6 @@ import java.util.TreeMap;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -33,8 +32,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -66,33 +63,24 @@ public class NearCacheSyncUpdateTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void testNearCacheSyncUpdateAtomic1() throws Exception {
-        nearCacheSyncUpdateTx(ATOMIC, CLOCK);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNearCacheSyncUpdateAtomic2() throws Exception {
-        nearCacheSyncUpdateTx(ATOMIC, PRIMARY);
+    public void testNearCacheSyncUpdateAtomic() throws Exception {
+        nearCacheSyncUpdateTx(ATOMIC);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testNearCacheSyncUpdateTx() throws Exception {
-        nearCacheSyncUpdateTx(TRANSACTIONAL, null);
+        nearCacheSyncUpdateTx(TRANSACTIONAL);
     }
 
     /**
      * @param atomicityMode Atomicity mode.
-     * @param writeOrderMode Write order mode.
      * @throws Exception If failed.
      */
-    private void nearCacheSyncUpdateTx(CacheAtomicityMode atomicityMode,
-        CacheAtomicWriteOrderMode writeOrderMode) throws Exception {
+    private void nearCacheSyncUpdateTx(CacheAtomicityMode atomicityMode) throws Exception {
         final IgniteCache<Integer, Integer> cache =
-            ignite(0).createCache(cacheConfiguration(atomicityMode, writeOrderMode));
+            ignite(0).createCache(cacheConfiguration(atomicityMode));
 
         try {
             final AtomicInteger idx = new AtomicInteger();
@@ -148,18 +136,15 @@ public class NearCacheSyncUpdateTest extends GridCommonAbstractTest {
 
     /**
      * @param atomicityMode Atomicity mode.
-     * @param writeOrderMode Write order mode.
      * @return Cache configuration.
      */
-    private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode,
-        CacheAtomicWriteOrderMode writeOrderMode) {
+    private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
         CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setAtomicityMode(atomicityMode);
-        ccfg.setAtomicWriteOrderMode(writeOrderMode);
         ccfg.setNearConfiguration(new NearCacheConfiguration<Integer, Integer>());
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
index 61605b5..64ec3ec 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
@@ -60,7 +60,6 @@ import org.apache.ignite.services.ServiceContext;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
 /**
@@ -158,7 +157,6 @@ public class GridCacheRebalancingOrderingTest extends GridCommonAbstractTest {
         cfg.setCacheMode(CacheMode.PARTITIONED);
         cfg.setName(TEST_CACHE_NAME);
         cfg.setAffinity(new RendezvousAffinityFunction(true /* machine-safe */, 271));
-        cfg.setAtomicWriteOrderMode(PRIMARY);
         cfg.setBackups(1);
         cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
         cfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionDistributionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionDistributionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionDistributionTest.java
index eebafed..f0cbd38 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionDistributionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionDistributionTest.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ignite.Ignite;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheRebalanceMode;
@@ -53,7 +52,6 @@ public class GridCacheRebalancingPartitionDistributionTest extends GridRollingRe
                 .setCacheMode(CacheMode.PARTITIONED)
                 .setBackups(1)
                 .setAffinity(new RendezvousAffinityFunction(true /* machine-safe */, 1024))
-                .setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.CLOCK)
                 .setRebalanceMode(CacheRebalanceMode.SYNC)
                 .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAtomicReplicatedMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAtomicReplicatedMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAtomicReplicatedMetricsSelfTest.java
index 0ad86ad..57bb179 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAtomicReplicatedMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAtomicReplicatedMetricsSelfTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.replicated;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractMetricsSelfTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 
@@ -37,7 +36,6 @@ public class GridCacheAtomicReplicatedMetricsSelfTest extends GridCacheAbstractM
 
         cfg.setCacheMode(REPLICATED);
         cfg.setAtomicityMode(ATOMIC);
-        cfg.setAtomicWriteOrderMode(PRIMARY);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicMultiNodeFullApiSelfTest.java
index 7f31979..52a8996 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicMultiNodeFullApiSelfTest.java
@@ -17,24 +17,14 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.replicated;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.configuration.CacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
  * Multi-node tests for replicated atomic cache.
  */
 public class GridCacheReplicatedAtomicMultiNodeFullApiSelfTest extends GridCacheReplicatedMultiNodeFullApiSelfTest {
-    /**
-     * @return Write order mode for atomic cache.
-     */
-    protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
     /** {@inheritDoc} */
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
@@ -49,13 +39,4 @@ public class GridCacheReplicatedAtomicMultiNodeFullApiSelfTest extends GridCache
     @Override protected boolean lockingEnabled() {
         return false;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
-        CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
-
-        ccfg.setAtomicWriteOrderMode(atomicWriteOrderMode());
-
-        return ccfg;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java
deleted file mode 100644
index 9c4c77a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest.java
+++ /dev/null
@@ -1,33 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.replicated;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- * Multi-node tests for replicated atomic cache with primary write order.
- */
-public class GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest extends
-        GridCacheReplicatedAtomicMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyTest.java
index c2ee607..9871315 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.expiry;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -46,11 +44,6 @@ public class IgniteCacheAtomicExpiryPolicyTest extends IgniteCacheExpiryPolicyAb
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CLOCK;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyWithStoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyWithStoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyWithStoreTest.java
index e214273..1898c3b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyWithStoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicExpiryPolicyWithStoreTest.java
@@ -17,11 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache.expiry;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -43,9 +41,4 @@ public class IgniteCacheAtomicExpiryPolicyWithStoreTest extends IgniteCacheExpir
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest.java
deleted file mode 100644
index 7ba2cf0..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.expiry;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest extends IgniteCacheAtomicExpiryPolicyTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
index 75ddf52..e69de29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.java
@@ -1,32 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.expiry;
-
-import javax.cache.configuration.Factory;
-import org.apache.ignite.cache.store.CacheStore;
-
-/**
- *
- */
-public class IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest extends
-    IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest {
-    /** {@inheritDoc} */
-    @Override protected Factory<CacheStore> cacheStoreFactory() {
-        return new TestStoreFactory();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index a40c555..b77355b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -58,7 +58,6 @@ import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -867,7 +866,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         IgniteCache<Integer, Integer> cache1 = jcache(1);
 
-        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+        if (atomicityMode() == ATOMIC)
             Thread.sleep(100);
 
         // Update from another node.
@@ -875,7 +874,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         checkTtl(key, 61_000L);
 
-        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+        if (atomicityMode() == ATOMIC)
             Thread.sleep(100);
 
         // Update from another node with provided TTL.
@@ -890,7 +889,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         checkTtl(key, 60_000L);
 
-        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+        if (atomicityMode() == ATOMIC)
             Thread.sleep(100);
 
         // Update from near node with provided TTL.
@@ -919,7 +918,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         for (Integer key : vals.keySet())
             checkTtl(key, 60_000L);
 
-        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+        if (atomicityMode() == ATOMIC)
             Thread.sleep(100);
 
         IgniteCache<Integer, Integer> cache1 = jcache(1);
@@ -930,7 +929,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         for (Integer key : vals.keySet())
             checkTtl(key, 61_000L);
 
-        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+        if (atomicityMode() == ATOMIC)
             Thread.sleep(100);
 
         // Update from another node with provided TTL.
@@ -944,7 +943,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         // Try create again.
         cache0.putAll(vals);
 
-        if (atomicityMode() == ATOMIC && atomicWriteOrderMode() == CLOCK)
+        if (atomicityMode() == ATOMIC)
             Thread.sleep(100);
 
         // Update from near node with provided TTL.

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
index 58a8fdd..ebd9bb8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyTestSuite.java
@@ -39,8 +39,6 @@ public class IgniteCacheExpiryPolicyTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheAtomicLocalExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheAtomicExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheAtomicWithStoreExpiryPolicyTest.class);
-        suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderExpiryPolicyTest.class);
-        suite.addTestSuite(IgniteCacheAtomicPrimaryWriteOrderWithStoreExpiryPolicyTest.class);
         suite.addTestSuite(IgniteCacheAtomicReplicatedExpiryPolicyTest.class);
 
         suite.addTestSuite(IgniteCacheTxLocalExpiryPolicyTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoadAllTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoadAllTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoadAllTest.java
index 273224e..7db288f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoadAllTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoadAllTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -49,9 +47,4 @@ public class IgniteCacheAtomicLoadAllTest extends IgniteCacheLoadAllAbstractTest
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoaderWriterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoaderWriterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoaderWriterTest.java
index ebfe2c2..0e9224e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoaderWriterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicLoaderWriterTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -46,11 +44,6 @@ public class IgniteCacheAtomicLoaderWriterTest extends IgniteCacheLoaderWriterAb
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java
index e5537aa..6467dbc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoLoadPreviousValueTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -49,9 +47,4 @@ public class IgniteCacheAtomicNoLoadPreviousValueTest extends IgniteCacheNoLoadP
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoReadThroughTest.java
index 228d8c3..374bb8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoReadThroughTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -49,9 +47,4 @@ public class IgniteCacheAtomicNoReadThroughTest extends IgniteCacheNoReadThrough
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java
index 5654273..cd36a66 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicNoWriteThroughTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -49,9 +47,4 @@ public class IgniteCacheAtomicNoWriteThroughTest extends IgniteCacheNoWriteThrou
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionTest.java
index 9351d96..cd0b7dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionTest.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
@@ -49,9 +47,4 @@ public class IgniteCacheAtomicStoreSessionTest extends IgniteCacheStoreSessionAb
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionWriteBehindTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionWriteBehindTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionWriteBehindTest.java
index 0c343ef..68583e5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionWriteBehindTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheAtomicStoreSessionWriteBehindTest.java
@@ -17,10 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 
 /**
@@ -31,9 +29,4 @@ public class IgniteCacheAtomicStoreSessionWriteBehindTest extends IgniteCacheSto
     @Override protected CacheAtomicityMode atomicityMode() {
         return ATOMIC;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheJdbcBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheJdbcBlobStoreNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheJdbcBlobStoreNodeRestartTest.java
index 5eeb993..1c29098 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheJdbcBlobStoreNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheJdbcBlobStoreNodeRestartTest.java
@@ -17,15 +17,12 @@
 
 package org.apache.ignite.internal.processors.cache.integration;
 
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStore;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
 public class IgniteCacheJdbcBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
     /** {@inheritDoc} */
     @Override protected CacheStore getStore() {
@@ -46,9 +43,4 @@ public class IgniteCacheJdbcBlobStoreNodeRestartTest extends IgniteCacheStoreNod
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return PRIMARY;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalMetricsSelfTest.java
index 32b952a..ef66ee3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalMetricsSelfTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.local;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheAbstractMetricsSelfTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.LOCAL;
 
@@ -37,7 +36,6 @@ public class GridCacheAtomicLocalMetricsSelfTest extends GridCacheAbstractMetric
 
         cfg.setCacheMode(LOCAL);
         cfg.setAtomicityMode(ATOMIC);
-        cfg.setAtomicWriteOrderMode(PRIMARY);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java
deleted file mode 100644
index a86edc2..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.multijvm;
-
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest;
-
-/**
- * Multi-JVM tests.
- */
-public class GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest extends
-    GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    protected boolean isMultiJvm() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
deleted file mode 100644
index db01292..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.multijvm;
-
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest;
-
-/**
- * Multi-JVM tests.
- */
-public class GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest extends
-    GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    protected boolean isMultiJvm() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java
deleted file mode 100644
index caaa20a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.multijvm;
-
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest;
-
-/**
- * Multi-JVM tests.
- */
-public class GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest extends
-    GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest {
-    /** {@inheritDoc} */
-    protected boolean isMultiJvm() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest.java
deleted file mode 100644
index af69e66..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest.java
+++ /dev/null
@@ -1,29 +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.
- *
- */
-
-package org.apache.ignite.internal.processors.cache.multijvm;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest;
-
-public class GridCacheAtomicPrimaryWriteOrderOnheapMultiJvmFullApiSelfTest extends GridCacheAtomicPrimaryWriteOrderOnheapMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode atomicWriteOrderMode() {
-        return CacheAtomicWriteOrderMode.PRIMARY;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
deleted file mode 100644
index cc648f7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
+++ /dev/null
@@ -1,31 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.multijvm;
-
-import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest;
-
-/**
- * Multi-JVM tests.
- */
-public class GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest extends
-    GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest {
-    /** {@inheritDoc} */
-    protected boolean isMultiJvm() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest.java
deleted file mode 100644
index 62fd984..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest.java
+++ /dev/null
@@ -1,50 +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.
- */
-
-package org.apache.ignite.internal.processors.cache.query.continuous;
-
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-
-/**
- *
- */
-public class CacheContinuousQueryAsyncFailoverAtomicPrimaryWriteOrderSelfTest
-    extends CacheContinuousQueryFailoverAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicWriteOrderMode writeOrderMode() {
-        return PRIMARY;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean asyncCallback() {
-        return true;
-    }
-}


[30/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/LUDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/LUDecomposition.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/LUDecomposition.java
new file mode 100644
index 0000000..82c90ec
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/LUDecomposition.java
@@ -0,0 +1,366 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.exceptions.CardinalityException;
+import org.apache.ignite.math.exceptions.SingularMatrixException;
+
+/**
+ * Calculates the LU-decomposition of a square matrix.
+ *
+ * This class inspired by class from Apache Common Math with similar name.
+ *
+ * @see <a href="http://mathworld.wolfram.com/LUDecomposition.html">MathWorld</a>
+ * @see <a href="http://en.wikipedia.org/wiki/LU_decomposition">Wikipedia</a>
+ */
+public class LUDecomposition extends DecompositionSupport {
+    /** Default bound to determine effective singularity in LU decomposition. */
+    private static final double DEFAULT_TOO_SMALL = 1e-11;
+
+    /** Pivot permutation associated with LU decomposition. */
+    private final Vector pivot;
+    /** Parity of the permutation associated with the LU decomposition. */
+    private boolean even;
+    /** Singularity indicator. */
+    private boolean singular;
+    /** Cached value of L. */
+    private Matrix cachedL;
+    /** Cached value of U. */
+    private Matrix cachedU;
+    /** Cached value of P. */
+    private Matrix cachedP;
+    /** Original matrix. */
+    private Matrix matrix;
+    /** Entries of LU decomposition. */
+    private Matrix lu;
+
+    /**
+     * Calculates the LU-decomposition of the given matrix.
+     * This constructor uses 1e-11 as default value for the singularity
+     * threshold.
+     *
+     * @param matrix Matrix to decompose.
+     * @throws CardinalityException if matrix is not square.
+     */
+    public LUDecomposition(Matrix matrix) {
+        this(matrix, DEFAULT_TOO_SMALL);
+    }
+
+    /**
+     * Calculates the LUP-decomposition of the given matrix.
+     *
+     * @param matrix Matrix to decompose.
+     * @param singularityThreshold threshold (based on partial row norm).
+     * @throws CardinalityException if matrix is not square.
+     */
+    public LUDecomposition(Matrix matrix, double singularityThreshold) {
+        assert matrix != null;
+
+        int rows = matrix.rowSize();
+        int cols = matrix.columnSize();
+
+        if (rows != cols)
+            throw new CardinalityException(rows, cols);
+
+        this.matrix = matrix;
+
+        lu = copy(matrix);
+
+        pivot = likeVector(matrix);
+
+        for (int i = 0; i < pivot.size(); i++)
+            pivot.setX(i, i);
+
+        even = true;
+        singular = false;
+
+        cachedL = null;
+        cachedU = null;
+        cachedP = null;
+
+        for (int col = 0; col < cols; col++) {
+
+            //upper
+            for (int row = 0; row < col; row++) {
+                Vector luRow = lu.viewRow(row);
+                double sum = luRow.get(col);
+
+                for (int i = 0; i < row; i++)
+                    sum -= luRow.getX(i) * lu.getX(i, col);
+
+                luRow.setX(col, sum);
+            }
+
+            // permutation row
+            int max = col;
+
+            double largest = Double.NEGATIVE_INFINITY;
+
+            // lower
+            for (int row = col; row < rows; row++) {
+                Vector luRow = lu.viewRow(row);
+                double sum = luRow.getX(col);
+
+                for (int i = 0; i < col; i++)
+                    sum -= luRow.getX(i) * lu.getX(i, col);
+
+                luRow.setX(col, sum);
+
+                if (Math.abs(sum) > largest) {
+                    largest = Math.abs(sum);
+                    max = row;
+                }
+            }
+
+            // Singularity check
+            if (Math.abs(lu.getX(max, col)) < singularityThreshold) {
+                singular = true;
+                return;
+            }
+
+            // Pivot if necessary
+            if (max != col) {
+                double tmp;
+                Vector luMax = lu.viewRow(max);
+                Vector luCol = lu.viewRow(col);
+
+                for (int i = 0; i < cols; i++) {
+                    tmp = luMax.getX(i);
+                    luMax.setX(i, luCol.getX(i));
+                    luCol.setX(i, tmp);
+                }
+
+                int temp = (int)pivot.getX(max);
+                pivot.setX(max, pivot.getX(col));
+                pivot.setX(col, temp);
+
+                even = !even;
+            }
+
+            // Divide the lower elements by the "winning" diagonal elt.
+            final double luDiag = lu.getX(col, col);
+
+            for (int row = col + 1; row < cols; row++) {
+                double val = lu.getX(row, col) / luDiag;
+                lu.setX(row, col, val);
+            }
+        }
+    }
+
+    /**
+     * Destroys decomposition components and other internal components of decomposition.
+     */
+    @Override public void destroy() {
+        if (cachedL != null)
+            cachedL.destroy();
+        if (cachedU != null)
+            cachedU.destroy();
+        if (cachedP != null)
+            cachedP.destroy();
+        lu.destroy();
+    }
+
+    /**
+     * Returns the matrix L of the decomposition.
+     * <p>L is a lower-triangular matrix</p>
+     *
+     * @return the L matrix (or null if decomposed matrix is singular).
+     */
+    public Matrix getL() {
+        if ((cachedL == null) && !singular) {
+            final int m = pivot.size();
+
+            cachedL = like(matrix);
+            cachedL.assign(0.0);
+
+            for (int i = 0; i < m; ++i) {
+                for (int j = 0; j < i; ++j)
+                    cachedL.setX(i, j, lu.getX(i, j));
+
+                cachedL.setX(i, i, 1.0);
+            }
+        }
+
+        return cachedL;
+    }
+
+    /**
+     * Returns the matrix U of the decomposition.
+     * <p>U is an upper-triangular matrix</p>
+     *
+     * @return the U matrix (or null if decomposed matrix is singular).
+     */
+    public Matrix getU() {
+        if ((cachedU == null) && !singular) {
+            final int m = pivot.size();
+
+            cachedU = like(matrix);
+            cachedU.assign(0.0);
+
+            for (int i = 0; i < m; ++i)
+                for (int j = i; j < m; ++j)
+                    cachedU.setX(i, j, lu.getX(i, j));
+        }
+
+        return cachedU;
+    }
+
+    /**
+     * Returns the P rows permutation matrix.
+     * <p>P is a sparse matrix with exactly one element set to 1.0 in
+     * each row and each column, all other elements being set to 0.0.</p>
+     * <p>The positions of the 1 elements are given by the {@link #getPivot()
+     * pivot permutation vector}.</p>
+     *
+     * @return the P rows permutation matrix (or null if decomposed matrix is singular).
+     * @see #getPivot()
+     */
+    public Matrix getP() {
+        if ((cachedP == null) && !singular) {
+            final int m = pivot.size();
+
+            cachedP = like(matrix);
+            cachedP.assign(0.0);
+
+            for (int i = 0; i < m; ++i)
+                cachedP.setX(i, (int)pivot.get(i), 1.0);
+        }
+
+        return cachedP;
+    }
+
+    /**
+     * Returns the pivot permutation vector.
+     *
+     * @return the pivot permutation vector.
+     * @see #getP()
+     */
+    public Vector getPivot() {
+        return pivot.copy();
+    }
+
+    /**
+     * Return the determinant of the matrix.
+     *
+     * @return determinant of the matrix.
+     */
+    public double determinant() {
+        if (singular)
+            return 0;
+
+        final int m = pivot.size();
+        double determinant = even ? 1 : -1;
+
+        for (int i = 0; i < m; i++)
+            determinant *= lu.getX(i, i);
+
+        return determinant;
+    }
+
+    /** */
+    public Vector solve(Vector b) {
+        final int m = pivot.size();
+
+        if (b.size() != m)
+            throw new CardinalityException(b.size(), m);
+
+        if (singular)
+            throw new SingularMatrixException();
+
+        final double[] bp = new double[m];
+
+        // Apply permutations to b
+        for (int row = 0; row < m; row++)
+            bp[row] = b.get((int)pivot.get(row));
+
+        // Solve LY = b
+        for (int col = 0; col < m; col++) {
+            final double bpCol = bp[col];
+
+            for (int i = col + 1; i < m; i++)
+                bp[i] -= bpCol * lu.get(i, col);
+        }
+
+        // Solve UX = Y
+        for (int col = m - 1; col >= 0; col--) {
+            bp[col] /= lu.get(col, col);
+            final double bpCol = bp[col];
+
+            for (int i = 0; i < col; i++)
+                bp[i] -= bpCol * lu.get(i, col);
+        }
+
+        return b.like(m).assign(bp);
+    }
+
+    /** */
+    public Matrix solve(Matrix b) {
+        final int m = pivot.size();
+
+        if (b.rowSize() != m)
+            throw new CardinalityException(b.rowSize(), m);
+
+        if (singular)
+            throw new SingularMatrixException();
+
+        final int nColB = b.columnSize();
+
+        // Apply permutations to b
+        final double[][] bp = new double[m][nColB];
+        for (int row = 0; row < m; row++) {
+            final double[] bpRow = bp[row];
+            final int pRow = (int)pivot.get(row);
+
+            for (int col = 0; col < nColB; col++)
+                bpRow[col] = b.get(pRow, col);
+        }
+
+        // Solve LY = b
+        for (int col = 0; col < m; col++) {
+            final double[] bpCol = bp[col];
+            for (int i = col + 1; i < m; i++) {
+                final double[] bpI = bp[i];
+                final double luICol = lu.get(i, col);
+
+                for (int j = 0; j < nColB; j++)
+                    bpI[j] -= bpCol[j] * luICol;
+            }
+        }
+
+        // Solve UX = Y
+        for (int col = m - 1; col >= 0; col--) {
+            final double[] bpCol = bp[col];
+            final double luDiag = lu.getX(col, col);
+
+            for (int j = 0; j < nColB; j++)
+                bpCol[j] /= luDiag;
+
+            for (int i = 0; i < col; i++) {
+                final double[] bpI = bp[i];
+                final double luICol = lu.get(i, col);
+
+                for (int j = 0; j < nColB; j++)
+                    bpI[j] -= bpCol[j] * luICol;
+            }
+        }
+
+        return b.like(b.rowSize(), b.columnSize()).assign(bp);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/QRDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/QRDecomposition.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/QRDecomposition.java
new file mode 100644
index 0000000..9608ed5
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/QRDecomposition.java
@@ -0,0 +1,186 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.functions.Functions;
+
+/**
+ * For an {@code m x n} matrix {@code A} with {@code m >= n}, the QR decomposition
+ * is an {@code m x n} orthogonal matrix {@code Q} and an {@code n x n} upper
+ * triangular matrix {@code R} so that {@code A = Q*R}.
+ */
+public class QRDecomposition extends DecompositionSupport {
+    /** */
+    private final Matrix q;
+    /** */
+    private final Matrix r;
+
+    /** */
+    private final Matrix mType;
+    /** */
+    private final boolean fullRank;
+
+    /** */
+    private final int rows;
+    /** */
+    private final int cols;
+
+    /**
+     * @param v Value to be checked for being an ordinary double.
+     */
+    private void checkDouble(double v) {
+        if (Double.isInfinite(v) || Double.isNaN(v))
+            throw new ArithmeticException("Invalid intermediate result");
+    }
+
+    /**
+     * Constructs a new QR decomposition object computed by Householder reflections.
+     *
+     * @param mtx A rectangular matrix.
+     */
+    public QRDecomposition(Matrix mtx) {
+        assert mtx != null;
+
+        rows = mtx.rowSize();
+
+        int min = Math.min(mtx.rowSize(), mtx.columnSize());
+
+        cols = mtx.columnSize();
+
+        mType = like(mtx, 1, 1);
+
+        Matrix qTmp = copy(mtx);
+
+        boolean fullRank = true;
+
+        r = like(mtx, min, cols);
+
+        for (int i = 0; i < min; i++) {
+            Vector qi = qTmp.viewColumn(i);
+
+            double alpha = qi.kNorm(2);
+
+            if (Math.abs(alpha) > Double.MIN_VALUE)
+                qi.map(Functions.div(alpha));
+            else {
+                checkDouble(alpha);
+
+                fullRank = false;
+            }
+
+            r.set(i, i, alpha);
+
+            for (int j = i + 1; j < cols; j++) {
+                Vector qj = qTmp.viewColumn(j);
+
+                double norm = qj.kNorm(2);
+
+                if (Math.abs(norm) > Double.MIN_VALUE) {
+                    double beta = qi.dot(qj);
+
+                    r.set(i, j, beta);
+
+                    if (j < min)
+                        qj.map(qi, Functions.plusMult(-beta));
+                }
+                else
+                    checkDouble(norm);
+            }
+        }
+
+        if (cols > min)
+            q = qTmp.viewPart(0, rows, 0, min).copy();
+        else
+            q = qTmp;
+
+        this.fullRank = fullRank;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() {
+        q.destroy();
+        r.destroy();
+        mType.destroy();
+    }
+
+    /**
+     * Gets orthogonal factor {@code Q}.
+     */
+    public Matrix getQ() {
+        return q;
+    }
+
+    /**
+     * Gets triangular factor {@code R}.
+     */
+    public Matrix getR() {
+        return r;
+    }
+
+    /**
+     * Returns whether the matrix {@code A} has full rank.
+     *
+     * @return true if {@code R}, and hence {@code A} , has full rank.
+     */
+    public boolean hasFullRank() {
+        return fullRank;
+    }
+
+    /**
+     * Least squares solution of {@code A*X = B}; {@code returns X}.
+     *
+     * @param mtx A matrix with as many rows as {@code A} and any number of cols.
+     * @return {@code X<} that minimizes the two norm of {@code Q*R*X - B}.
+     * @throws IllegalArgumentException if {@code B.rows() != A.rows()}.
+     */
+    public Matrix solve(Matrix mtx) {
+        if (mtx.rowSize() != rows)
+            throw new IllegalArgumentException("Matrix row dimensions must agree.");
+
+        int cols = mtx.columnSize();
+
+        Matrix x = like(mType, this.cols, cols);
+
+        Matrix qt = getQ().transpose();
+        Matrix y = qt.times(mtx);
+
+        Matrix r = getR();
+
+        for (int k = Math.min(this.cols, rows) - 1; k > 0; k--) {
+            // X[k,] = Y[k,] / R[k,k], note that X[k,] starts with 0 so += is same as =
+            x.viewRow(k).map(y.viewRow(k), Functions.plusMult(1 / r.get(k, k)));
+
+            // Y[0:(k-1),] -= R[0:(k-1),k] * X[k,]
+            Vector rCol = r.viewColumn(k).viewPart(0, k);
+
+            for (int c = 0; c < cols; c++)
+                y.viewColumn(c).viewPart(0, k).map(rCol, Functions.plusMult(-x.get(k, c)));
+        }
+
+        return x;
+    }
+
+    /**
+     * Returns a rough string rendition of a QR.
+     */
+    @Override public String toString() {
+        return String.format("QR(%d x %d, fullRank=%s)", rows, cols, hasFullRank());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/SingularValueDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/SingularValueDecomposition.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/SingularValueDecomposition.java
new file mode 100644
index 0000000..75eb206
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/SingularValueDecomposition.java
@@ -0,0 +1,620 @@
+/*
+ * 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.math.decompositions;
+
+import org.apache.ignite.math.Algebra;
+import org.apache.ignite.math.Matrix;
+
+/**
+ * Compute a singular value decomposition (SVD) of {@code (l x k)} matrix {@code m}.
+ * <p>This decomposition can be thought
+ * as an extension of {@link EigenDecomposition} to rectangular matrices. The factorization we get is following:</p>
+ * <p>{@code m = u * s * v^{*}}, where</p>
+ * <ul><li>{@code u} is a real or complex unitary matrix.</li>
+ * <li>{@code s} is a rectangular diagonal matrix with non-negative real numbers on diagonal
+ * (these numbers are singular values of {@code m}).</li>
+ * <li>{@code v} is a real or complex unitary matrix.</li></ul>
+ * <p>If {@code m} is real then {@code u} and {@code v} are also real.</p>
+ * <p>See also: <a href="https://en.wikipedia.org/wiki/Singular_value_decomposition">Wikipedia article on SVD</a>.</p>
+ * <p>Note: complex case is currently not supported.</p>
+ */
+public class SingularValueDecomposition extends DecompositionSupport {
+    // U and V.
+    /** */
+    private final double[][] u;
+    /** */
+    private final double[][] v;
+
+    /** Singular values. */
+    private final double[] s;
+
+    /** Row dimension. */
+    private final int m;
+    /** Column dimension. */
+    private final int n;
+
+    /** */
+    private Matrix arg;
+
+    /** */
+    private boolean transpositionNeeded;
+
+    /**
+     * Singular value decomposition object.
+     *
+     * @param arg A rectangular matrix.
+     */
+    public SingularValueDecomposition(Matrix arg) {
+        assert arg != null;
+
+        this.arg = arg;
+
+        if (arg.rowSize() < arg.columnSize())
+            transpositionNeeded = true;
+
+        double[][] a;
+
+        if (transpositionNeeded) {
+            // Use the transpose matrix.
+            m = arg.columnSize();
+            n = arg.rowSize();
+
+            a = new double[m][n];
+
+            for (int i = 0; i < m; i++)
+                for (int j = 0; j < n; j++)
+                    a[i][j] = arg.get(j, i);
+        }
+        else {
+            m = arg.rowSize();
+            n = arg.columnSize();
+
+            a = new double[m][n];
+
+            for (int i = 0; i < m; i++)
+                for (int j = 0; j < n; j++)
+                    a[i][j] = arg.get(i, j);
+        }
+
+        int nu = Math.min(m, n);
+
+        s = new double[Math.min(m + 1, n)];
+        u = new double[m][nu];
+        v = new double[n][n];
+
+        double[] e = new double[n];
+        double[] work = new double[m];
+
+        int nct = Math.min(m - 1, n);
+        int nrt = Math.max(0, Math.min(n - 2, m));
+
+        for (int k = 0; k < Math.max(nct, nrt); k++) {
+            if (k < nct) {
+                // Compute the transformation for the k-th column and
+                // place the k-th diagonal in s[k]. Compute 2-norm of k-th
+                // column without under/overflow.
+                s[k] = 0;
+
+                for (int i = k; i < m; i++)
+                    s[k] = Algebra.hypot(s[k], a[i][k]);
+
+                if (s[k] != 0.0) {
+                    if (a[k][k] < 0.0)
+                        s[k] = -s[k];
+
+                    for (int i = k; i < m; i++)
+                        a[i][k] /= s[k];
+
+                    a[k][k] += 1.0;
+                }
+
+                s[k] = -s[k];
+            }
+
+            for (int j = k + 1; j < n; j++) {
+                if (k < nct && s[k] != 0.0) {
+                    // Apply the transformation.
+                    double t = 0;
+
+                    for (int i = k; i < m; i++)
+                        t += a[i][k] * a[i][j];
+
+                    t = -t / a[k][k];
+
+                    for (int i = k; i < m; i++)
+                        a[i][j] += t * a[i][k];
+                }
+
+                // Place the k-th row of A into e for the
+                // subsequent calculation of the row transformation.
+                e[j] = a[k][j];
+            }
+
+            if (k < nct)
+                // Place the transformation in U for subsequent back
+                // multiplication.
+                for (int i = k; i < m; i++)
+                    u[i][k] = a[i][k];
+
+            if (k < nrt) {
+                // Compute the k-th row transformation and place the
+                // k-th super-diagonal in e[k].
+                // Compute 2-norm without under/overflow.
+                e[k] = 0;
+
+                for (int i = k + 1; i < n; i++)
+                    e[k] = Algebra.hypot(e[k], e[i]);
+
+                if (e[k] != 0.0) {
+                    if (e[k + 1] < 0.0)
+                        e[k] = -e[k];
+
+                    for (int i = k + 1; i < n; i++)
+                        e[i] /= e[k];
+
+                    e[k + 1] += 1.0;
+                }
+
+                e[k] = -e[k];
+
+                if (k + 1 < m && e[k] != 0.0) {
+                    // Apply the transformation.
+                    for (int i = k + 1; i < m; i++)
+                        work[i] = 0.0;
+
+                    for (int j = k + 1; j < n; j++)
+                        for (int i = k + 1; i < m; i++)
+                            work[i] += e[j] * a[i][j];
+
+                    for (int j = k + 1; j < n; j++) {
+                        double t = -e[j] / e[k + 1];
+
+                        for (int i = k + 1; i < m; i++)
+                            a[i][j] += t * work[i];
+                    }
+                }
+
+                // Place the transformation in V for subsequent
+                // back multiplication.
+                for (int i = k + 1; i < n; i++)
+                    v[i][k] = e[i];
+            }
+        }
+
+        // Set up the final bi-diagonal matrix or order p.
+        int p = Math.min(n, m + 1);
+
+        if (nct < n)
+            s[nct] = a[nct][nct];
+
+        if (m < p)
+            s[p - 1] = 0.0;
+
+        if (nrt + 1 < p)
+            e[nrt] = a[nrt][p - 1];
+
+        e[p - 1] = 0.0;
+
+        // Generate U.
+        for (int j = nct; j < nu; j++) {
+            for (int i = 0; i < m; i++)
+                u[i][j] = 0.0;
+
+            u[j][j] = 1.0;
+        }
+
+        for (int k = nct - 1; k >= 0; k--) {
+            if (s[k] != 0.0) {
+                for (int j = k + 1; j < nu; j++) {
+                    double t = 0;
+
+                    for (int i = k; i < m; i++)
+                        t += u[i][k] * u[i][j];
+
+                    t = -t / u[k][k];
+
+                    for (int i = k; i < m; i++)
+                        u[i][j] += t * u[i][k];
+                }
+
+                for (int i = k; i < m; i++)
+                    u[i][k] = -u[i][k];
+
+                u[k][k] = 1.0 + u[k][k];
+
+                for (int i = 0; i < k - 1; i++)
+                    u[i][k] = 0.0;
+            }
+            else {
+                for (int i = 0; i < m; i++)
+                    u[i][k] = 0.0;
+
+                u[k][k] = 1.0;
+            }
+        }
+
+        // Generate V.
+        for (int k = n - 1; k >= 0; k--) {
+            if (k < nrt && e[k] != 0.0) {
+                for (int j = k + 1; j < nu; j++) {
+                    double t = 0;
+
+                    for (int i = k + 1; i < n; i++)
+                        t += v[i][k] * v[i][j];
+
+                    t = -t / v[k + 1][k];
+
+                    for (int i = k + 1; i < n; i++)
+                        v[i][j] += t * v[i][k];
+                }
+            }
+
+            for (int i = 0; i < n; i++)
+                v[i][k] = 0.0;
+
+            v[k][k] = 1.0;
+        }
+
+        // Main iteration loop for the singular values.
+        int pp = p - 1;
+        int iter = 0;
+
+        double eps = Math.pow(2.0, -52.0);
+        double tiny = Math.pow(2.0, -966.0);
+
+        while (p > 0) {
+            int k;
+
+            for (k = p - 2; k >= -1; k--) {
+                if (k == -1)
+                    break;
+
+                if (Math.abs(e[k]) <= tiny + eps * (Math.abs(s[k]) + Math.abs(s[k + 1]))) {
+                    e[k] = 0.0;
+
+                    break;
+                }
+            }
+
+            int kase;
+
+            if (k == p - 2)
+                kase = 4;
+            else {
+                int ks;
+
+                for (ks = p - 1; ks >= k; ks--) {
+                    if (ks == k)
+                        break;
+
+                    double t =
+                        (ks != p ? Math.abs(e[ks]) : 0.) +
+                            (ks != k + 1 ? Math.abs(e[ks - 1]) : 0.);
+
+                    if (Math.abs(s[ks]) <= tiny + eps * t) {
+                        s[ks] = 0.0;
+
+                        break;
+                    }
+                }
+
+                if (ks == k)
+                    kase = 3;
+                else if (ks == p - 1)
+                    kase = 1;
+                else {
+                    kase = 2;
+
+                    k = ks;
+                }
+            }
+
+            k++;
+
+            // Perform the task indicated by kase.
+            switch (kase) {
+                // Deflate negligible s(p).
+                case 1: {
+                    double f = e[p - 2];
+
+                    e[p - 2] = 0.0;
+
+                    for (int j = p - 2; j >= k; j--) {
+                        double t = Algebra.hypot(s[j], f);
+                        double cs = s[j] / t;
+                        double sn = f / t;
+
+                        s[j] = t;
+
+                        if (j != k) {
+                            f = -sn * e[j - 1];
+                            e[j - 1] = cs * e[j - 1];
+                        }
+
+                        for (int i = 0; i < n; i++) {
+                            t = cs * v[i][j] + sn * v[i][p - 1];
+
+                            v[i][p - 1] = -sn * v[i][j] + cs * v[i][p - 1];
+                            v[i][j] = t;
+                        }
+                    }
+                }
+
+                break;
+
+                // Split at negligible s(k).
+                case 2: {
+                    double f = e[k - 1];
+                    e[k - 1] = 0.0;
+
+                    for (int j = k; j < p; j++) {
+                        double t = Algebra.hypot(s[j], f);
+                        double cs = s[j] / t;
+                        double sn = f / t;
+
+                        s[j] = t;
+                        f = -sn * e[j];
+                        e[j] = cs * e[j];
+
+                        for (int i = 0; i < m; i++) {
+                            t = cs * u[i][j] + sn * u[i][k - 1];
+
+                            u[i][k - 1] = -sn * u[i][j] + cs * u[i][k - 1];
+                            u[i][j] = t;
+                        }
+                    }
+                }
+
+                break;
+
+                // Perform one qr step.
+                case 3: {
+                    // Calculate the shift.
+                    double scale = Math.max(Math.max(Math.max(Math.max(
+                        Math.abs(s[p - 1]), Math.abs(s[p - 2])), Math.abs(e[p - 2])),
+                        Math.abs(s[k])), Math.abs(e[k]));
+
+                    double sp = s[p - 1] / scale;
+                    double spm1 = s[p - 2] / scale;
+                    double epm1 = e[p - 2] / scale;
+                    double sk = s[k] / scale;
+                    double ek = e[k] / scale;
+                    double b = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) / 2.0;
+                    double c = sp * epm1 * sp * epm1;
+                    double shift = 0.0;
+
+                    if (b != 0.0 || c != 0.0) {
+                        shift = Math.sqrt(b * b + c);
+
+                        if (b < 0.0)
+                            shift = -shift;
+
+                        shift = c / (b + shift);
+                    }
+
+                    double f = (sk + sp) * (sk - sp) + shift;
+                    double g = sk * ek;
+
+                    // Chase zeros.
+                    for (int j = k; j < p - 1; j++) {
+                        double t = Algebra.hypot(f, g);
+                        double cs = f / t;
+                        double sn = g / t;
+
+                        if (j != k)
+                            e[j - 1] = t;
+
+                        f = cs * s[j] + sn * e[j];
+                        e[j] = cs * e[j] - sn * s[j];
+                        g = sn * s[j + 1];
+                        s[j + 1] = cs * s[j + 1];
+
+                        for (int i = 0; i < n; i++) {
+                            t = cs * v[i][j] + sn * v[i][j + 1];
+
+                            v[i][j + 1] = -sn * v[i][j] + cs * v[i][j + 1];
+                            v[i][j] = t;
+                        }
+
+                        t = Algebra.hypot(f, g);
+                        cs = f / t;
+                        sn = g / t;
+                        s[j] = t;
+                        f = cs * e[j] + sn * s[j + 1];
+                        s[j + 1] = -sn * e[j] + cs * s[j + 1];
+                        g = sn * e[j + 1];
+                        e[j + 1] = cs * e[j + 1];
+
+                        if (j < m - 1)
+                            for (int i = 0; i < m; i++) {
+                                t = cs * u[i][j] + sn * u[i][j + 1];
+
+                                u[i][j + 1] = -sn * u[i][j] + cs * u[i][j + 1];
+                                u[i][j] = t;
+                            }
+                    }
+
+                    e[p - 2] = f;
+                    iter = iter + 1;
+                }
+
+                break;
+
+                // Convergence.
+                case 4: {
+                    // Make the singular values positive.
+                    if (s[k] <= 0.0) {
+                        s[k] = s[k] < 0.0 ? -s[k] : 0.0;
+
+                        for (int i = 0; i <= pp; i++)
+                            v[i][k] = -v[i][k];
+                    }
+
+                    // Order the singular values.
+                    while (k < pp) {
+                        if (s[k] >= s[k + 1])
+                            break;
+
+                        double t = s[k];
+
+                        s[k] = s[k + 1];
+                        s[k + 1] = t;
+
+                        if (k < n - 1)
+                            for (int i = 0; i < n; i++) {
+                                t = v[i][k + 1];
+
+                                v[i][k + 1] = v[i][k];
+                                v[i][k] = t;
+                            }
+
+                        if (k < m - 1)
+                            for (int i = 0; i < m; i++) {
+                                t = u[i][k + 1];
+
+                                u[i][k + 1] = u[i][k];
+                                u[i][k] = t;
+                            }
+
+                        k++;
+                    }
+
+                    iter = 0;
+                    p--;
+                }
+
+                break;
+
+                default:
+                    throw new IllegalStateException();
+            }
+        }
+    }
+
+    /**
+     * Gets the two norm condition number, which is {@code max(S) / min(S)} .
+     */
+    public double cond() {
+        return s[0] / s[Math.min(m, n) - 1];
+    }
+
+    /**
+     * @return the diagonal matrix of singular values.
+     */
+    public Matrix getS() {
+        double[][] s = new double[n][n];
+
+        for (int i = 0; i < n; i++) {
+            for (int j = 0; j < n; j++)
+                s[i][j] = 0.0;
+
+            s[i][i] = this.s[i];
+        }
+
+        return like(arg, n, n).assign(s);
+    }
+
+    /**
+     * Gets the diagonal of {@code S}, which is a one-dimensional array of
+     * singular values.
+     *
+     * @return diagonal of {@code S}.
+     */
+    public double[] getSingularValues() {
+        return s;
+    }
+
+    /**
+     * Gets the left singular vectors {@code U}.
+     *
+     * @return {@code U}
+     */
+    public Matrix getU() {
+        if (transpositionNeeded)
+            return like(arg, v.length, v.length).assign(v);
+        else {
+            int numCols = Math.min(m + 1, n);
+
+            Matrix r = like(arg, m, numCols);
+
+            for (int i = 0; i < m; i++)
+                for (int j = 0; j < numCols; j++)
+                    r.set(i, j, u[i][j]);
+
+            return r;
+        }
+    }
+
+    /**
+     * Gets the right singular vectors {@code V}.
+     *
+     * @return {@code V}
+     */
+    public Matrix getV() {
+        if (transpositionNeeded) {
+            int numCols = Math.min(m + 1, n);
+
+            Matrix r = like(arg, m, numCols);
+
+            for (int i = 0; i < m; i++)
+                for (int j = 0; j < numCols; j++)
+                    r.set(i, j, u[i][j]);
+
+            return r;
+        }
+        else
+            return like(arg, v.length, v.length).assign(v);
+    }
+
+    /**
+     * Gets the two norm, which is {@code max(S)}.
+     */
+    public double norm2() {
+        return s[0];
+    }
+
+    /**
+     * Gets effective numerical matrix rank.
+     */
+    public int rank() {
+        double eps = Math.pow(2.0, -52.0);
+        double tol = Math.max(m, n) * s[0] * eps;
+        int r = 0;
+
+        for (double value : s)
+            if (value > tol)
+                r++;
+
+        return r;
+    }
+
+    /**
+     * Gets [n � n] covariance matrix.
+     *
+     * @param minSingularVal Value below which singular values are ignored.
+     */
+    Matrix getCovariance(double minSingularVal) {
+        Matrix j = like(arg, s.length, s.length);
+        Matrix vMat = like(arg, v.length, v.length).assign(v);
+
+        for (int i = 0; i < s.length; i++)
+            j.set(i, i, s[i] >= minSingularVal ? 1 / (s[i] * s[i]) : 0.0);
+
+        return vMat.times(j).times(vMat.transpose());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/decompositions/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/decompositions/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/decompositions/package-info.java
new file mode 100644
index 0000000..dcfa0f8
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/decompositions/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains matrix decompositions for distributed code algebra.
+ */
+package org.apache.ignite.math.decompositions;

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/CardinalityException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/CardinalityException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/CardinalityException.java
new file mode 100644
index 0000000..fc87a27
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/CardinalityException.java
@@ -0,0 +1,38 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * Indicates a cardinality mismatch in matrix or vector operations.
+ */
+public class CardinalityException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Creates new cardinality violation exception.
+     *
+     * @param exp Expected cardinality.
+     * @param act Actual cardinality.
+     */
+    public CardinalityException(int exp, int act) {
+        super("Cardinality violation [expected=" + exp + ", actual=" + act + "]");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/ColumnIndexException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/ColumnIndexException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/ColumnIndexException.java
new file mode 100644
index 0000000..7670caf
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/ColumnIndexException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * This exception is used to indicate any error condition accessing matrix elements by invalid column index.
+ */
+public class ColumnIndexException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * @param idx Index value that caused this exception.
+     */
+    public ColumnIndexException(int idx) {
+        super("Invalid (out of bound) column index: " + idx);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/IndexException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/IndexException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/IndexException.java
new file mode 100644
index 0000000..9ada706
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/IndexException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * Indicates an invalid, i.e. out of bound, index on matrix or vector operations.
+ */
+public class IndexException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * @param idx Index value that caused this exception.
+     */
+    public IndexException(int idx) {
+        super("Invalid (out of bound) index: " + idx);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonPositiveDefiniteMatrixException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonPositiveDefiniteMatrixException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonPositiveDefiniteMatrixException.java
new file mode 100644
index 0000000..b6017c2
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonPositiveDefiniteMatrixException.java
@@ -0,0 +1,20 @@
+package org.apache.ignite.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * This exception is used to indicate error condition of matrix elements failing the positivity check.
+ */
+public class NonPositiveDefiniteMatrixException extends IgniteException {
+    /**
+     * Construct an exception.
+     *
+     * @param wrong Value that fails the positivity check.
+     * @param idx Row (and column) index.
+     * @param threshold Absolute positivity threshold.
+     */
+    public NonPositiveDefiniteMatrixException(double wrong, int idx, double threshold) {
+        super("Matrix must be positive, wrong element located on diagonal with index "
+            + idx + " and has value " + wrong + " with this threshold " + threshold);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonSymmetricMatrixException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonSymmetricMatrixException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonSymmetricMatrixException.java
new file mode 100644
index 0000000..8b4cbdb
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/NonSymmetricMatrixException.java
@@ -0,0 +1,18 @@
+package org.apache.ignite.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * This exception is used to indicate error condition of matrix failing the symmetry check.
+ */
+public class NonSymmetricMatrixException extends IgniteException {
+    /**
+     * @param row Row.
+     * @param col Column.
+     * @param threshold Threshold.
+     */
+    public NonSymmetricMatrixException(int row, int col, double threshold) {
+        super("Symmetric matrix expected, the symmetry is broken on row "
+            + row + " and col " + col + " with this threshold " + threshold);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/RowIndexException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/RowIndexException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/RowIndexException.java
new file mode 100644
index 0000000..f74ae2c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/RowIndexException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * This exception is used to indicate any error condition accessing matrix elements by invalid row index.
+ */
+public class RowIndexException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * @param idx Index value that caused this exception.
+     */
+    public RowIndexException(int idx) {
+        super("Invalid (out of bound) row index: " + idx);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/SingularMatrixException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/SingularMatrixException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/SingularMatrixException.java
new file mode 100644
index 0000000..4ed3410
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/SingularMatrixException.java
@@ -0,0 +1,30 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * Exception to be thrown when a non-singular matrix is expected.
+ */
+public class SingularMatrixException extends IgniteException {
+    /** */
+    public SingularMatrixException() {
+        super("Regular (or non-singular) matrix expected.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnknownProviderException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnknownProviderException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnknownProviderException.java
new file mode 100644
index 0000000..3e6498a
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnknownProviderException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * Indicates that no provider has been found for a given vector or matrix flavor.
+ */
+public class UnknownProviderException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * @param flv Flavor (a.k.a. operation performance hints) that has no registered provider for.
+     */
+    public UnknownProviderException(String flv) {
+        super("No provider has been found for the flavor: " + flv);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnsupportedOperationException.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnsupportedOperationException.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnsupportedOperationException.java
new file mode 100644
index 0000000..be5264c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/UnsupportedOperationException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.math.exceptions;
+
+import org.apache.ignite.IgniteException;
+
+/**
+ * Indicate that a specific operation is not supported by the underlying implementation.
+ * In some cases, an operation may be unsupported only in certain cases where, for example,
+ * it could not be deterministically completed in polynomial time.
+ */
+public class UnsupportedOperationException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * @param errMsg Error message.
+     */
+    public UnsupportedOperationException(String errMsg) {
+        super(errMsg);
+    }
+
+    /**
+     *
+     */
+    public UnsupportedOperationException() {
+        this("Unsupported operation.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/exceptions/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/exceptions/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/exceptions/package-info.java
new file mode 100644
index 0000000..83f3fa4
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/exceptions/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains exceptions for distributed code algebra.
+ */
+package org.apache.ignite.math.exceptions;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/Functions.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/Functions.java b/modules/math/src/main/java/org/apache/ignite/math/functions/Functions.java
new file mode 100644
index 0000000..7100908
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/Functions.java
@@ -0,0 +1,136 @@
+/*
+ * 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.math.functions;
+
+/**
+ * Compatibility with Apache Mahout.
+ */
+public final class Functions {
+    /** Function that returns {@code Math.abs(a)}. */
+    public static final IgniteDoubleFunction<Double> ABS = Math::abs;
+
+    /** Function that returns its argument. */
+    public static final IgniteDoubleFunction<Double> IDENTITY = (a) -> a;
+
+    /** Function that returns {@code Math.log(a) / Math.log(2)}. */
+    public static final IgniteDoubleFunction<Double> LOG2 = (a) -> Math.log(a) * 1.4426950408889634;
+
+    /** Function that returns {@code -a}. */
+    public static final IgniteDoubleFunction<Double> NEGATE = (a) -> -a;
+
+    /** Function that returns {@code  a < 0 ? -1 : a > 0 ? 1 : 0 }. */
+    public static final IgniteDoubleFunction<Double> SIGN = (a) -> a < 0.0 ? -1.0 : a > 0.0 ? 1.0 : 0.0;
+
+    /** Function that returns {@code a * a}. */
+    public static final IgniteDoubleFunction<Double> SQUARE = (a) -> a * a;
+
+    /** Function that returns {@code  1 / (1 + exp(-a) } */
+    public static final IgniteDoubleFunction<Double> SIGMOID = (a) -> 1.0 / (1.0 + Math.exp(-a));
+
+    /** Function that returns {@code  1 / a } */
+    public static final IgniteDoubleFunction<Double> INV = (a) -> 1.0 / a;
+
+    /** Function that returns {@code  a * (1-a) } */
+    public static final IgniteDoubleFunction<Double> SIGMOIDGRADIENT = (a) -> a * (1.0 - a);
+
+    /** Function that returns {@code a % b}. */
+    public static final IgniteBiFunction<Double, Double, Double> MOD = (a, b) -> a % b;
+
+    /** Function that returns {@code a * b}. */
+    public static final IgniteBiFunction<Double, Double, Double> MULT = (a, b) -> a * b;
+
+    /** Function that returns {@code Math.log(a) / Math.log(b)}. */
+    public static final IgniteBiFunction<Double, Double, Double> LG = (a, b) -> Math.log(a) / Math.log(b);
+
+    /** Function that returns {@code a + b}. */
+    public static final IgniteBiFunction<Double, Double, Double> PLUS = (a, b) -> a + b;
+
+    /** Function that returns {@code a - b}. */
+    public static final IgniteBiFunction<Double, Double, Double> MINUS = (a, b) -> a - b;
+
+    /** Function that returns {@code abs(a - b)}. */
+    public static final IgniteBiFunction<Double, Double, Double> MINUS_ABS = (a, b) -> Math.abs(a - b);
+
+    /** Function that returns {@code max(abs(a), abs(b))}. */
+    public static final IgniteBiFunction<Double, Double, Double> MAX_ABS = (a, b) -> Math.max(Math.abs(a), Math.abs(b));
+
+    /** Function that returns {@code min(abs(a), abs(b))}. */
+    public static final IgniteBiFunction<Double, Double, Double> MIN_ABS = (a, b) -> Math.min(Math.abs(a), Math.abs(b));
+
+    /** Function that returns {@code Math.abs(a) + Math.abs(b)}. */
+    public static final IgniteBiFunction<Double, Double, Double> PLUS_ABS = (a, b) -> Math.abs(a) + Math.abs(b);
+
+    /** Function that returns {@code (a - b) * (a - b)} */
+    public static final IgniteBiFunction<Double, Double, Double> MINUS_SQUARED = (a, b) -> (a - b) * (a - b);
+
+    /**
+     * Function that returns {@code a &lt; b ? -1 : a &gt; b ? 1 : 0}.
+     */
+    public static final IgniteBiFunction<Double, Double, Double> COMPARE = (a, b) -> a < b ? -1.0 : a > b ? 1.0 : 0.0;
+
+    /**
+     * Function that returns {@code a + b}. {@code a} is a variable, {@code b} is fixed.
+     *
+     * @param b
+     */
+    public static IgniteDoubleFunction<Double> plus(final double b) {
+        return (a) -> a + b;
+    }
+
+    /**
+     * Function that returns {@code a * b}. {@code a} is a variable, {@code b} is fixed.
+     *
+     * @param b
+     */
+    public static IgniteDoubleFunction<Double> mult(final double b) {
+        return (a) -> a * b;
+    }
+
+    /** Function that returns {@code a / b}. {@code a} is a variable, {@code b} is fixed. */
+    public static IgniteDoubleFunction<Double> div(double b) {
+        return mult(1 / b);
+    }
+
+    /**
+     * Function that returns {@code a + b*constant}. {@code a} and {@code b} are variables,
+     * {@code constant} is fixed.
+     */
+    public static IgniteBiFunction<Double, Double, Double> plusMult(double constant) {
+        return (a, b) -> a + b * constant;
+    }
+
+    /**
+     * Function that returns {@code a - b*constant}. {@code a} and {@code b} are variables,
+     * {@code constant} is fixed.
+     */
+    public static IgniteBiFunction<Double, Double, Double> minusMult(double constant) {
+        return (a, b) -> a - b * constant;
+    }
+
+    /**
+     * @param b
+     */
+    public static IgniteDoubleFunction<Double> pow(final double b) {
+        return (a) -> {
+            if (b == 2)
+                return a * a;
+            else
+                return Math.pow(a, b);
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiConsumer.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiConsumer.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiConsumer.java
new file mode 100644
index 0000000..22e8274
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiConsumer.java
@@ -0,0 +1,12 @@
+package org.apache.ignite.math.functions;
+
+import java.io.Serializable;
+import java.util.function.BiConsumer;
+
+/**
+ * Serializable binary consumer.
+ *
+ * @see java.util.function.BiConsumer
+ */
+public interface IgniteBiConsumer<T, U> extends BiConsumer<T, U>, Serializable {
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiFunction.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiFunction.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiFunction.java
new file mode 100644
index 0000000..9d9c147
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteBiFunction.java
@@ -0,0 +1,29 @@
+/*
+ * 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.math.functions;
+
+import java.io.Serializable;
+import java.util.function.BiFunction;
+
+/**
+ * Serializable binary function.
+ *
+ * @see java.util.function.BiFunction
+ */
+public interface IgniteBiFunction<A, B, T> extends BiFunction<A, B, T>, Serializable {
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteConsumer.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteConsumer.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteConsumer.java
new file mode 100644
index 0000000..1f7ca07
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteConsumer.java
@@ -0,0 +1,29 @@
+/*
+ * 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.math.functions;
+
+import java.io.Serializable;
+import java.util.function.Consumer;
+
+/**
+ * Serializable consumer.
+ *
+ * @see java.util.function.Consumer
+ */
+public interface IgniteConsumer<T> extends Consumer<T>, Serializable {
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteDoubleFunction.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteDoubleFunction.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteDoubleFunction.java
new file mode 100644
index 0000000..7a23d50
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteDoubleFunction.java
@@ -0,0 +1,29 @@
+/*
+ * 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.math.functions;
+
+import java.io.Serializable;
+import java.util.function.DoubleFunction;
+
+/**
+ * Serializable double function.
+ *
+ * @see java.util.function.DoubleFunction
+ */
+public interface IgniteDoubleFunction<Double> extends DoubleFunction<Double>, Serializable {
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteFunction.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteFunction.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteFunction.java
new file mode 100644
index 0000000..cfe89a4
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IgniteFunction.java
@@ -0,0 +1,30 @@
+/*
+ * 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.math.functions;
+
+import java.io.Serializable;
+import java.util.function.Function;
+
+/**
+ * Serializable function.
+ *
+ * @see java.util.function.Function
+ */
+public interface IgniteFunction<T, R> extends Function<T, R>, Serializable {
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IntDoubleToVoidFunction.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IntDoubleToVoidFunction.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IntDoubleToVoidFunction.java
new file mode 100644
index 0000000..e5d69c7
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IntDoubleToVoidFunction.java
@@ -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.
+ */
+
+package org.apache.ignite.math.functions;
+
+/**
+ * Setter function for the vector.
+ */
+public interface IntDoubleToVoidFunction extends IgniteBiConsumer<Integer, Double> {
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntDoubleToVoidFunction.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntDoubleToVoidFunction.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntDoubleToVoidFunction.java
new file mode 100644
index 0000000..cad8c3c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntDoubleToVoidFunction.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.math.functions;
+
+import java.io.Serializable;
+
+/**
+ * Setter function for matrices.
+ */
+public interface IntIntDoubleToVoidFunction extends Serializable {
+    /** */
+    public void apply(int x, int y, double v);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntToDoubleFunction.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntToDoubleFunction.java b/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntToDoubleFunction.java
new file mode 100644
index 0000000..b31d9f9
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/IntIntToDoubleFunction.java
@@ -0,0 +1,24 @@
+/*
+ * 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.math.functions;
+
+/**
+ * Getters functions for matrices.
+ */
+public interface IntIntToDoubleFunction extends IgniteBiFunction<Integer, Integer, Double> {
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/functions/package-info.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/functions/package-info.java b/modules/math/src/main/java/org/apache/ignite/math/functions/package-info.java
new file mode 100644
index 0000000..133e62c
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/functions/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains serializable functions for distributed code algebra.
+ */
+package org.apache.ignite.math.functions;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/main/java/org/apache/ignite/math/impls/CacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/math/src/main/java/org/apache/ignite/math/impls/CacheUtils.java b/modules/math/src/main/java/org/apache/ignite/math/impls/CacheUtils.java
new file mode 100644
index 0000000..df33895
--- /dev/null
+++ b/modules/math/src/main/java/org/apache/ignite/math/impls/CacheUtils.java
@@ -0,0 +1,356 @@
+/*
+ * 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.math.impls;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.math.KeyMapper;
+import org.apache.ignite.math.ValueMapper;
+import org.apache.ignite.math.functions.IgniteBiFunction;
+import org.apache.ignite.math.functions.IgniteConsumer;
+import org.apache.ignite.math.functions.IgniteFunction;
+
+/**
+ * Distribution-related misc. support.
+ */
+public class CacheUtils {
+    /**
+     * Cache entry support.
+     *
+     * @param <K>
+     * @param <V>
+     */
+    public static class CacheEntry<K, V> {
+        /** */
+        private Cache.Entry<K, V> entry;
+        /** */
+        private IgniteCache<K, V> cache;
+
+        /**
+         * @param entry Original cache entry.
+         * @param cache Cache instance.
+         */
+        CacheEntry(Cache.Entry<K, V> entry, IgniteCache<K, V> cache) {
+            this.entry = entry;
+            this.cache = cache;
+        }
+
+        /**
+         *
+         *
+         */
+        public Cache.Entry<K, V> entry() {
+            return entry;
+        }
+
+        /**
+         *
+         *
+         */
+        public IgniteCache<K, V> cache() {
+            return cache;
+        }
+    }
+
+    /**
+     * Gets local Ignite instance.
+     */
+    public static Ignite ignite() {
+        return Ignition.localIgnite();
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param k Key into the cache.
+     * @param <K> Key type.
+     * @return Cluster group for given key.
+     */
+    public static <K> ClusterGroup groupForKey(String cacheName, K k) {
+        return ignite().cluster().forNode(ignite().affinity(cacheName).mapKeyToNode(k));
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param keyMapper {@link KeyMapper} to validate cache key.
+     * @param valMapper {@link ValueMapper} to obtain double value for given cache key.
+     * @param <K> Cache key object type.
+     * @param <V> Cache value object type.
+     * @return Sum of the values obtained for valid keys.
+     */
+    public static <K, V> double sum(String cacheName, KeyMapper<K> keyMapper, ValueMapper<V> valMapper) {
+        Collection<Double> subSums = fold(cacheName, (CacheEntry<K, V> ce, Double acc) -> {
+            if (keyMapper.isValid(ce.entry().getKey())) {
+                double v = valMapper.toDouble(ce.entry().getValue());
+
+                return acc == null ? v : acc + v;
+            }
+            else
+                return acc;
+        });
+
+        return sum(subSums);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Sum obtained using sparse logic.
+     */
+    public static <K, V> double sparseSum(String cacheName) {
+        Collection<Double> subSums = fold(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce, Double acc) -> {
+            Map<Integer, Double> map = ce.entry().getValue();
+
+            double sum = sum(map.values());
+
+            return acc == null ? sum : acc + sum;
+        });
+
+        return sum(subSums);
+    }
+
+    /**
+     * @param c {@link Collection} of double values to sum.
+     * @return Sum of the values.
+     */
+    private static double sum(Collection<Double> c) {
+        double sum = 0.0;
+
+        for (double d : c)
+            sum += d;
+
+        return sum;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param keyMapper {@link KeyMapper} to validate cache key.
+     * @param valMapper {@link ValueMapper} to obtain double value for given cache key.
+     * @param <K> Cache key object type.
+     * @param <V> Cache value object type.
+     * @return Minimum value for valid keys.
+     */
+    public static <K, V> double min(String cacheName, KeyMapper<K> keyMapper, ValueMapper<V> valMapper) {
+        Collection<Double> mins = fold(cacheName, (CacheEntry<K, V> ce, Double acc) -> {
+            if (keyMapper.isValid(ce.entry().getKey())) {
+                double v = valMapper.toDouble(ce.entry().getValue());
+
+                if (acc == null)
+                    return v;
+                else
+                    return Math.min(acc, v);
+            }
+            else
+                return acc;
+        });
+
+        return Collections.min(mins);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Minimum value obtained using sparse logic.
+     */
+    public static <K, V> double sparseMin(String cacheName) {
+        Collection<Double> mins = fold(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce, Double acc) -> {
+            Map<Integer, Double> map = ce.entry().getValue();
+
+            double min = Collections.min(map.values());
+
+            if (acc == null)
+                return min;
+            else
+                return Math.min(acc, min);
+        });
+
+        return Collections.min(mins);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Maximum value obtained using sparse logic.
+     */
+    public static <K, V> double sparseMax(String cacheName) {
+        Collection<Double> maxes = fold(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce, Double acc) -> {
+            Map<Integer, Double> map = ce.entry().getValue();
+
+            double max = Collections.max(map.values());
+
+            if (acc == null)
+                return max;
+            else
+                return Math.max(acc, max);
+        });
+
+        return Collections.max(maxes);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param keyMapper {@link KeyMapper} to validate cache key.
+     * @param valMapper {@link ValueMapper} to obtain double value for given cache key.
+     * @param <K> Cache key object type.
+     * @param <V> Cache value object type.
+     * @return Maximum value for valid keys.
+     */
+    public static <K, V> double max(String cacheName, KeyMapper<K> keyMapper, ValueMapper<V> valMapper) {
+        Collection<Double> maxes = fold(cacheName, (CacheEntry<K, V> ce, Double acc) -> {
+            if (keyMapper.isValid(ce.entry().getKey())) {
+                double v = valMapper.toDouble(ce.entry().getValue());
+
+                if (acc == null)
+                    return v;
+                else
+                    return Math.max(acc, v);
+            }
+            else
+                return acc;
+        });
+
+        return Collections.max(maxes);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param keyMapper {@link KeyMapper} to validate cache key.
+     * @param valMapper {@link ValueMapper} to obtain double value for given cache key.
+     * @param mapper Mapping {@link IgniteFunction}.
+     * @param <K> Cache key object type.
+     * @param <V> Cache value object type.
+     */
+    public static <K, V> void map(String cacheName, KeyMapper<K> keyMapper, ValueMapper<V> valMapper,
+        IgniteFunction<Double, Double> mapper) {
+        foreach(cacheName, (CacheEntry<K, V> ce) -> {
+            K k = ce.entry().getKey();
+
+            if (keyMapper.isValid(k))
+                // Actual assignment.
+                ce.cache().put(k, valMapper.fromDouble(mapper.apply(valMapper.toDouble(ce.entry().getValue()))));
+        });
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param mapper Mapping {@link IgniteFunction}.
+     */
+    public static <K, V> void sparseMap(String cacheName, IgniteFunction<Double, Double> mapper) {
+        foreach(cacheName, (CacheEntry<Integer, Map<Integer, Double>> ce) -> {
+            Integer k = ce.entry().getKey();
+            Map<Integer, Double> v = ce.entry().getValue();
+
+            for (Map.Entry<Integer, Double> e : v.entrySet())
+                e.setValue(mapper.apply(e.getValue()));
+
+            ce.cache().put(k, v);
+        });
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param fun An operation that accepts a cache entry and processes it.
+     * @param <K> Cache key object type.
+     * @param <V> Cache value object type.
+     */
+    public static <K, V> void foreach(String cacheName, IgniteConsumer<CacheEntry<K, V>> fun) {
+        bcast(cacheName, () -> {
+            Ignite ignite = Ignition.localIgnite();
+            IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
+
+            int partsCnt = ignite.affinity(cacheName).partitions();
+
+            // Use affinity in filter for scan query. Otherwise we accept consumer in each node which is wrong.
+            Affinity affinity = ignite.affinity(cacheName);
+            ClusterNode locNode = ignite.cluster().localNode();
+
+            // Iterate over all partitions. Some of them will be stored on that local node.
+            for (int part = 0; part < partsCnt; part++) {
+                int p = part;
+
+                // Iterate over given partition.
+                // Query returns an empty cursor if this partition is not stored on this node.
+                for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, V>(part,
+                    (k, v) -> affinity.mapPartitionToNode(p) == locNode)))
+                    fun.accept(new CacheEntry<>(entry, cache));
+            }
+        });
+    }
+
+    /**
+     * <b>Currently fold supports only commutative operations.<b/>
+     *
+     * @param cacheName Cache name.
+     * @param folder Fold function operating over cache entries.
+     * @param <K> Cache key object type.
+     * @param <V> Cache value object type.
+     * @param <A> Fold result type.
+     * @return Fold operation result.
+     */
+    public static <K, V, A> Collection<A> fold(String cacheName, IgniteBiFunction<CacheEntry<K, V>, A, A> folder) {
+        return bcast(cacheName, () -> {
+            Ignite ignite = Ignition.localIgnite();
+            IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
+
+            int partsCnt = ignite.affinity(cacheName).partitions();
+
+            // Use affinity in filter for ScanQuery. Otherwise we accept consumer in each node which is wrong.
+            Affinity affinity = ignite.affinity(cacheName);
+            ClusterNode locNode = ignite.cluster().localNode();
+
+            A a = null;
+
+            // Iterate over all partitions. Some of them will be stored on that local node.
+            for (int part = 0; part < partsCnt; part++) {
+                int p = part;
+
+                // Iterate over given partition.
+                // Query returns an empty cursor if this partition is not stored on this node.
+                for (Cache.Entry<K, V> entry : cache.query(new ScanQuery<K, V>(part,
+                    (k, v) -> affinity.mapPartitionToNode(p) == locNode)))
+                    a = folder.apply(new CacheEntry<>(entry, cache), a);
+            }
+
+            return a;
+        });
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param run {@link Runnable} to broadcast to cache nodes for given cache name.
+     */
+    public static void bcast(String cacheName, IgniteRunnable run) {
+        ignite().compute(ignite().cluster().forCacheNodes(cacheName)).broadcast(run);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param call {@link IgniteCallable} to broadcast to cache nodes for given cache name.
+     * @param <A> Type returned by the callable.
+     */
+    public static <A> Collection<A> bcast(String cacheName, IgniteCallable<A> call) {
+        return ignite().compute(ignite().cluster().forCacheNodes(cacheName)).broadcast(call);
+    }
+}


[39/50] [abbrv] ignite git commit: ignite-4587 CacheAtomicWriteOrderMode.CLOCK mode is removed

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java
index 36f2902..e69de29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshot.java
@@ -1,235 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.managers.discovery.GridDiscoveryTopologySnapshot;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Snapshot of time deltas for given topology.
- */
-public class GridClockDeltaSnapshot {
-    /** Time delta version. */
-    private final GridClockDeltaVersion ver;
-
-    /** Deltas between coordinator and nodes by node ID. */
-    private final Map<UUID, Long> deltas;
-
-    /** Pending delta values. */
-    @GridToStringExclude
-    private final Map<UUID, DeltaAverage> pendingDeltas;
-
-    /**
-     * @param ver Snapshot version.
-     * @param locNodeId Local node ID.
-     * @param discoSnap Discovery snapshot.
-     * @param avgSize Average size.
-     */
-    public GridClockDeltaSnapshot(
-        GridClockDeltaVersion ver,
-        UUID locNodeId,
-        GridDiscoveryTopologySnapshot discoSnap,
-        int avgSize
-    ) {
-        assert ver.topologyVersion() == discoSnap.topologyVersion();
-
-        this.ver = ver;
-
-        deltas = new HashMap<>(discoSnap.topologyNodes().size(), 1.0f);
-
-        pendingDeltas = new HashMap<>(discoSnap.topologyNodes().size(), 1.0f);
-
-        for (ClusterNode n : discoSnap.topologyNodes()) {
-            if (!locNodeId.equals(n.id()))
-                pendingDeltas.put(n.id(), new DeltaAverage(avgSize));
-        }
-    }
-
-    /**
-     * @param ver Snapshot version.
-     * @param deltas Deltas map.
-     */
-    public GridClockDeltaSnapshot(GridClockDeltaVersion ver, Map<UUID, Long> deltas) {
-        this.ver = ver;
-        this.deltas = deltas;
-
-        pendingDeltas = Collections.emptyMap();
-    }
-
-    /**
-     * @return Version.
-     */
-    public GridClockDeltaVersion version() {
-        return ver;
-    }
-
-    /**
-     * @return Map of collected deltas.
-     */
-    public Map<UUID, Long> deltas() {
-        return deltas;
-    }
-
-    /**
-     * Awaits either until snapshot is ready or timeout elapses.
-     *
-     * @param timeout Timeout to wait.
-     * @throws IgniteInterruptedCheckedException If wait was interrupted.
-     */
-    public synchronized void awaitReady(long timeout) throws IgniteInterruptedCheckedException {
-        long start = System.currentTimeMillis();
-
-        try {
-            while (!ready()) {
-                long now = System.currentTimeMillis();
-
-                if (start + timeout - now <= 0)
-                    return;
-
-                wait(start + timeout - now);
-            }
-        }
-        catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-
-            throw new IgniteInterruptedCheckedException(e);
-        }
-    }
-
-    /**
-     * Callback invoked when time delta is received from remote node.
-     *
-     * @param nodeId Node ID.
-     * @param timeDelta Calculated time delta.
-     * @return {@code True} if more samples needed from that node.
-     */
-    public synchronized boolean onDeltaReceived(UUID nodeId, long timeDelta) {
-        DeltaAverage avg = pendingDeltas.get(nodeId);
-
-        if (avg != null) {
-            avg.onValue(timeDelta);
-
-            if (avg.ready()) {
-                pendingDeltas.remove(nodeId);
-
-                deltas.put(nodeId, avg.average());
-
-                if (ready())
-                    notifyAll();
-
-                return false;
-            }
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Callback invoked when node left.
-     *
-     * @param nodeId Left node ID.
-     */
-    public synchronized void onNodeLeft(UUID nodeId) {
-        pendingDeltas.remove(nodeId);
-
-        deltas.put(nodeId, 0L);
-
-        if (ready())
-            notifyAll();
-    }
-
-    /**
-     * @return {@code True} if snapshot is ready.
-     */
-    public synchronized boolean ready() {
-        return pendingDeltas.isEmpty();
-    }
-
-    /**
-     * @return Collection of node IDs for which response was not received so far.
-     */
-    public synchronized Collection<UUID> pendingNodeIds() {
-        // Must return copy.
-        return new HashSet<>(pendingDeltas.keySet());
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridClockDeltaSnapshot.class, this);
-    }
-
-    /**
-     * Delta average.
-     */
-    private static class DeltaAverage {
-        /** Delta values. */
-        private long[] vals;
-
-        /** Current index. */
-        private int idx;
-
-        /**
-         * @param size Accumulator size.
-         */
-        private DeltaAverage(int size) {
-            vals = new long[size];
-        }
-
-        /**
-         * Adds value to accumulator.
-         *
-         * @param val Value to add.
-         */
-        public void onValue(long val) {
-            if (idx < vals.length)
-                vals[idx++] = val;
-        }
-
-        /**
-         * Whether this average is complete.
-         *
-         * @return {@code True} if enough values is collected.
-         */
-        public boolean ready() {
-            return idx == vals.length;
-        }
-
-        /**
-         * @return Average delta.
-         */
-        public long average() {
-            long sum = 0;
-
-            for (long val : vals)
-                sum += val;
-
-            return sum / vals.length;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
index 4306d7e..e69de29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
@@ -1,154 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.internal.GridDirectMap;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * Message containing time delta map for all nodes.
- */
-public class GridClockDeltaSnapshotMessage implements Message {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Snapshot version. */
-    private GridClockDeltaVersion snapVer;
-
-    /** Grid time deltas. */
-    @GridToStringInclude
-    @GridDirectMap(keyType = UUID.class, valueType = long.class)
-    private Map<UUID, Long> deltas;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridClockDeltaSnapshotMessage() {
-        // No-op.
-    }
-
-    /**
-     * @param snapVer Snapshot version.
-     * @param deltas Deltas map.
-     */
-    public GridClockDeltaSnapshotMessage(GridClockDeltaVersion snapVer, Map<UUID, Long> deltas) {
-        this.snapVer = snapVer;
-        this.deltas = deltas;
-    }
-
-    /**
-     * @return Snapshot version.
-     */
-    public GridClockDeltaVersion snapshotVersion() {
-        return snapVer;
-    }
-
-    /**
-     * @return Time deltas map.
-     */
-    public Map<UUID, Long> deltas() {
-        return deltas;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeMap("deltas", deltas, MessageCollectionItemType.UUID, MessageCollectionItemType.LONG))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
-                if (!writer.writeMessage("snapVer", snapVer))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        switch (reader.state()) {
-            case 0:
-                deltas = reader.readMap("deltas", MessageCollectionItemType.UUID, MessageCollectionItemType.LONG, false);
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                snapVer = reader.readMessage("snapVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridClockDeltaSnapshotMessage.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public short directType() {
-        return 60;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 2;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridClockDeltaSnapshotMessage.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
index 19c75e6..e69de29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaVersion.java
@@ -1,194 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.nio.ByteBuffer;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * Version for time delta snapshot.
- */
-public class GridClockDeltaVersion implements Message, Comparable<GridClockDeltaVersion>, Externalizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Snapshot local version. */
-    private long ver;
-
-    /** Topology version. */
-    private long topVer;
-
-    /**
-     * Empty constructor required by {@link Externalizable}.
-     */
-    public GridClockDeltaVersion() {
-        // No-op.
-    }
-
-    /**
-     * @param ver Version.
-     * @param topVer Topology version.
-     */
-    public GridClockDeltaVersion(long ver, long topVer) {
-        this.ver = ver;
-        this.topVer = topVer;
-    }
-
-    /**
-     * @return Snapshot local version.
-     */
-    public long version() {
-        return ver;
-    }
-
-    /**
-     * @return Snapshot topology version.
-     */
-    public long topologyVersion() {
-        return topVer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onAckReceived() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public int compareTo(GridClockDeltaVersion o) {
-        int res = Long.compare(topVer, o.topVer);
-
-        if (res == 0)
-            res = Long.compare(ver, o.ver);
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (!(o instanceof GridClockDeltaVersion))
-            return false;
-
-        GridClockDeltaVersion that = (GridClockDeltaVersion)o;
-
-        return topVer == that.topVer && ver == that.ver;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = (int)(ver ^ (ver >>> 32));
-
-        res = 31 * res + (int)(topVer ^ (topVer >>> 32));
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(ver);
-        out.writeLong(topVer);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        ver = in.readLong();
-        topVer = in.readLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType(), fieldsCount()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeLong("topVer", topVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
-                if (!writer.writeLong("ver", ver))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        if (!reader.beforeMessageRead())
-            return false;
-
-        switch (reader.state()) {
-            case 0:
-                topVer = reader.readLong("topVer");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                ver = reader.readLong("ver");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return reader.afterMessageRead(GridClockDeltaVersion.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public short directType() {
-        return 83;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte fieldsCount() {
-        return 2;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridClockDeltaVersion.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockMessage.java
deleted file mode 100644
index 99dc817..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockMessage.java
+++ /dev/null
@@ -1,171 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-/**
- * Time server message.
- */
-public class GridClockMessage {
-    /** Packet size. */
-    public static final int PACKET_SIZE = 48;
-
-    /** Originating node ID. */
-    private UUID origNodeId;
-
-    /** Target node ID. */
-    private UUID targetNodeId;
-
-    /** Originating timestamp. */
-    private long origTs;
-
-    /** Remote node reply ts. */
-    private long replyTs;
-
-    /**
-     * @param origNodeId Originating node ID.
-     * @param targetNodeId Target node ID.
-     * @param origTs Originating timestamp.
-     * @param replyTs Reply timestamp.
-     */
-    public GridClockMessage(UUID origNodeId, UUID targetNodeId, long origTs, long replyTs) {
-        this.origNodeId = origNodeId;
-        this.targetNodeId = targetNodeId;
-        this.origTs = origTs;
-        this.replyTs = replyTs;
-    }
-
-    /**
-     * @return Originating node ID.
-     */
-    public UUID originatingNodeId() {
-        return origNodeId;
-    }
-
-    /**
-     * @param origNodeId Originating node ID.
-     */
-    public void originatingNodeId(UUID origNodeId) {
-        this.origNodeId = origNodeId;
-    }
-
-    /**
-     * @return Target node ID.
-     */
-    public UUID targetNodeId() {
-        return targetNodeId;
-    }
-
-    /**
-     * @param targetNodeId Target node ID.
-     */
-    public void targetNodeId(UUID targetNodeId) {
-        this.targetNodeId = targetNodeId;
-    }
-
-    /**
-     * @return Originating timestamp.
-     */
-    public long originatingTimestamp() {
-        return origTs;
-    }
-
-    /**
-     * @param origTs Originating timestamp.
-     */
-    public void originatingTimestamp(long origTs) {
-        this.origTs = origTs;
-    }
-
-    /**
-     * @return Reply timestamp.
-     */
-    public long replyTimestamp() {
-        return replyTs;
-    }
-
-    /**
-     * @param replyTs Reply timestamp.
-     */
-    public void replyTimestamp(long replyTs) {
-        this.replyTs = replyTs;
-    }
-
-    /**
-     * Converts message to bytes to send over network.
-     *
-     * @return Bytes representing this packet.
-     */
-    public byte[] toBytes() {
-        byte[] buf = new byte[PACKET_SIZE];
-
-        int off = 0;
-
-        off = U.longToBytes(origNodeId.getLeastSignificantBits(), buf, off);
-        off = U.longToBytes(origNodeId.getMostSignificantBits(), buf, off);
-
-        off = U.longToBytes(targetNodeId.getLeastSignificantBits(), buf, off);
-        off = U.longToBytes(targetNodeId.getMostSignificantBits(), buf, off);
-
-        off = U.longToBytes(origTs, buf, off);
-
-        off = U.longToBytes(replyTs, buf, off);
-
-        assert off == PACKET_SIZE;
-
-        return buf;
-    }
-
-    /**
-     * Constructs message from bytes.
-     *
-     * @param buf Bytes.
-     * @param off Offset.
-     * @param len Packet length.
-     * @return Assembled message.
-     * @throws IgniteCheckedException If message length is invalid.
-     */
-    public static GridClockMessage fromBytes(byte[] buf, int off, int len) throws IgniteCheckedException {
-        if (len < PACKET_SIZE)
-            throw new IgniteCheckedException("Failed to assemble time server packet (message is too short).");
-
-        long lsb = U.bytesToLong(buf, off);
-        long msb = U.bytesToLong(buf, off + 8);
-
-        UUID origNodeId = new UUID(msb, lsb);
-
-        lsb = U.bytesToLong(buf, off + 16);
-        msb = U.bytesToLong(buf, off + 24);
-
-        UUID targetNodeId = new UUID(msb, lsb);
-
-        long origTs = U.bytesToLong(buf, off + 32);
-        long replyTs = U.bytesToLong(buf, off + 40);
-
-        return new GridClockMessage(origNodeId, targetNodeId, origTs, replyTs);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridClockMessage.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
index 51d396a..e69de29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
@@ -1,222 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.SocketException;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.apache.ignite.thread.IgniteThread;
-
-/**
- * Time server that enables time synchronization between nodes.
- */
-public class GridClockServer {
-    /** Kernal context. */
-    private GridKernalContext ctx;
-
-    /** Datagram socket for message exchange. */
-    private DatagramSocket sock;
-
-    /** Logger. */
-    private IgniteLogger log;
-
-    /** Read worker. */
-    private GridWorker readWorker;
-
-    /** Instance of time processor. */
-    private GridClockSyncProcessor clockSync;
-
-    /**
-     * Starts server.
-     *
-     * @param ctx Kernal context.
-     * @throws IgniteCheckedException If server could not be started.
-     */
-    public void start(GridKernalContext ctx) throws IgniteCheckedException {
-        this.ctx = ctx;
-
-        clockSync = ctx.clockSync();
-        log = ctx.log(GridClockServer.class);
-
-        try {
-            int startPort = ctx.config().getTimeServerPortBase();
-            int portRange = ctx.config().getTimeServerPortRange();
-            int endPort = portRange == 0 ? startPort : startPort + portRange - 1;
-
-            InetAddress locHost;
-
-            if (F.isEmpty(ctx.config().getLocalHost())) {
-                try {
-                    locHost = U.getLocalHost();
-                }
-                catch (IOException ignored) {
-                    locHost = InetAddress.getLoopbackAddress();
-
-                    U.warn(log, "Failed to get local host address, will use loopback address: " + locHost);
-                }
-            }
-            else
-                locHost = InetAddress.getByName(ctx.config().getLocalHost());
-
-            for (int p = startPort; p <= endPort; p++) {
-                try {
-                    sock = new DatagramSocket(p, locHost);
-
-                    if (log.isDebugEnabled())
-                        log.debug("Successfully bound time server [host=" + locHost + ", port=" + p + ']');
-
-                    break;
-                }
-                catch (SocketException e) {
-                    if (log.isDebugEnabled())
-                        log.debug("Failed to bind time server socket [host=" + locHost + ", port=" + p +
-                            ", err=" + e.getMessage() + ']');
-                }
-            }
-
-            if (sock == null)
-                throw new IgniteCheckedException("Failed to bind time server socket within specified port range " +
-                    "[locHost=" + locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']');
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to start time server (failed to get local host address)", e);
-        }
-    }
-
-    /**
-     * After start callback.
-     */
-    public void afterStart() {
-        readWorker = new ReadWorker();
-
-        IgniteThread th = new IgniteThread(readWorker);
-
-        th.setPriority(Thread.MAX_PRIORITY);
-
-        th.start();
-    }
-
-    /**
-     * Stops server.
-     */
-    public void stop() {
-        // No-op.
-    }
-
-    /**
-     * Before stop callback.
-     */
-    public void beforeStop() {
-        if (readWorker != null)
-            readWorker.cancel();
-
-        U.closeQuiet(sock);
-
-        if (readWorker != null)
-            U.join(readWorker, log);
-    }
-
-    /**
-     * Sends packet to remote node.
-     *
-     * @param msg Message to send.
-     * @param addr Address.
-     * @param port Port.
-     * @throws IgniteCheckedException If send failed.
-     */
-    public void sendPacket(GridClockMessage msg, InetAddress addr, int port) throws IgniteCheckedException {
-        try {
-            DatagramPacket packet = new DatagramPacket(msg.toBytes(), GridClockMessage.PACKET_SIZE, addr, port);
-
-            if (log.isDebugEnabled())
-                log.debug("Sending time sync packet [msg=" + msg + ", addr=" + addr + ", port=" + port);
-
-            sock.send(packet);
-        }
-        catch (IOException e) {
-            if (!sock.isClosed())
-                throw new IgniteCheckedException("Failed to send datagram message to remote node [addr=" + addr +
-                    ", port=" + port + ", msg=" + msg + ']', e);
-        }
-    }
-
-    /**
-     * @return Address to which this server is bound.
-     */
-    public InetAddress host() {
-        return sock.getLocalAddress();
-    }
-
-    /**
-     * @return Port to which this server is bound.
-     */
-    public int port() {
-        return sock.getLocalPort();
-    }
-
-    /**
-     * Message read worker.
-     */
-    private class ReadWorker extends GridWorker {
-        /**
-         * Creates read worker.
-         */
-        protected ReadWorker() {
-            super(ctx.igniteInstanceName(), "grid-time-server-reader", GridClockServer.this.log);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
-            DatagramPacket packet = new DatagramPacket(new byte[GridClockMessage.PACKET_SIZE],
-                GridClockMessage.PACKET_SIZE);
-
-            while (!isCancelled()) {
-                try {
-                    // Read packet from buffer.
-                    sock.receive(packet);
-
-                    if (log.isDebugEnabled())
-                        log.debug("Received clock sync message from remote node [host=" + packet.getAddress() +
-                            ", port=" + packet.getPort() + ']');
-
-                    GridClockMessage msg = GridClockMessage.fromBytes(packet.getData(), packet.getOffset(),
-                        packet.getLength());
-
-                    clockSync.onMessageReceived(msg, packet.getAddress(), packet.getPort());
-                }
-                catch (IgniteCheckedException e) {
-                    U.warn(log, "Failed to assemble clock server message (will ignore the packet) [host=" +
-                        packet.getAddress() + ", port=" + packet.getPort() + ", err=" + e.getMessage() + ']');
-                }
-                catch (IOException e) {
-                    if (!isCancelled())
-                        U.warn(log, "Failed to receive message on datagram socket: " + e);
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSource.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSource.java
deleted file mode 100644
index ef7dc06..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSource.java
+++ /dev/null
@@ -1,30 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-/**
- * Interface representing time source for time processor.
- */
-public interface GridClockSource {
-    /**
-     * Gets current time in milliseconds past since 1 January, 1970.
-     *
-     * @return Current time in milliseconds.
-     */
-    public long currentTimeMillis();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
index 6c9ffe8..e69de29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
@@ -1,481 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-import java.net.InetAddress;
-import java.util.Collection;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.events.DiscoveryEvent;
-import org.apache.ignite.events.Event;
-import org.apache.ignite.events.EventType;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.managers.communication.GridMessageListener;
-import org.apache.ignite.internal.managers.discovery.GridDiscoveryTopologySnapshot;
-import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
-import org.apache.ignite.internal.processors.GridProcessorAdapter;
-import org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap;
-import org.apache.ignite.internal.util.GridSpinReadWriteLock;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.LT;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.apache.ignite.thread.IgniteThread;
-
-import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
-import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
-import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
-import static org.apache.ignite.internal.GridTopic.TOPIC_TIME_SYNC;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_TIME_SERVER_HOST;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_TIME_SERVER_PORT;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
-
-/**
- * Time synchronization processor.
- */
-public class GridClockSyncProcessor extends GridProcessorAdapter {
-    /** Maximum size for time sync history. */
-    private static final int MAX_TIME_SYNC_HISTORY = 100;
-
-    /** Time server instance. */
-    private GridClockServer srv;
-
-    /** Shutdown lock. */
-    private GridSpinReadWriteLock rw = new GridSpinReadWriteLock();
-
-    /** Stopping flag. */
-    private volatile boolean stopping;
-
-    /** Time coordinator thread. */
-    private volatile TimeCoordinator timeCoord;
-
-    /** Time delta history. Constructed on coordinator. */
-    private NavigableMap<GridClockDeltaVersion, GridClockDeltaSnapshot> timeSyncHist =
-        new GridBoundedConcurrentOrderedMap<>(MAX_TIME_SYNC_HISTORY);
-
-    /** Last recorded. */
-    private volatile T2<GridClockDeltaVersion, GridClockDeltaSnapshot> lastSnapshot;
-
-    /** Time source. */
-    private GridClockSource clockSrc;
-
-    /**
-     * @param ctx Kernal context.
-     */
-    public GridClockSyncProcessor(GridKernalContext ctx) {
-        super(ctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void start(boolean activeOnStart) throws IgniteCheckedException {
-        super.start(activeOnStart);
-
-        clockSrc = ctx.timeSource();
-
-        srv = new GridClockServer();
-
-        srv.start(ctx);
-
-        ctx.io().addMessageListener(TOPIC_TIME_SYNC, new GridMessageListener() {
-            @Override public void onMessage(UUID nodeId, Object msg) {
-                assert msg instanceof GridClockDeltaSnapshotMessage;
-
-                GridClockDeltaSnapshotMessage msg0 = (GridClockDeltaSnapshotMessage)msg;
-
-                GridClockDeltaVersion ver = msg0.snapshotVersion();
-
-                GridClockDeltaSnapshot snap = new GridClockDeltaSnapshot(ver, msg0.deltas());
-
-                lastSnapshot = new T2<>(ver, snap);
-
-                timeSyncHist.put(ver, snap);
-            }
-        });
-
-        // We care only about node leave and fail events.
-        ctx.event().addLocalEventListener(new GridLocalEventListener() {
-            @Override public void onEvent(Event evt) {
-                assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_JOINED;
-
-                DiscoveryEvent discoEvt = (DiscoveryEvent)evt;
-
-                if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED)
-                    checkLaunchCoordinator(discoEvt);
-
-                TimeCoordinator timeCoord0 = timeCoord;
-
-                if (timeCoord0 != null)
-                    timeCoord0.onDiscoveryEvent(discoEvt);
-            }
-        }, EVT_NODE_LEFT, EVT_NODE_FAILED, EVT_NODE_JOINED);
-
-        ctx.addNodeAttribute(ATTR_TIME_SERVER_HOST, srv.host());
-        ctx.addNodeAttribute(ATTR_TIME_SERVER_PORT, srv.port());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onKernalStart(boolean activeOnStart) throws IgniteCheckedException {
-        super.onKernalStart(activeOnStart);
-
-        srv.afterStart();
-
-        // Check at startup if this node is a fragmentizer coordinator.
-        DiscoveryEvent locJoinEvt = ctx.discovery().localJoinEvent();
-
-        checkLaunchCoordinator(locJoinEvt);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onKernalStop(boolean cancel) {
-        super.onKernalStop(cancel);
-
-        rw.writeLock();
-
-        try {
-            stopping = false;
-
-            if (timeCoord != null) {
-                timeCoord.cancel();
-
-                U.join(timeCoord, log);
-
-                timeCoord = null;
-            }
-
-            if (srv != null)
-                srv.beforeStop();
-        }
-        finally {
-            rw.writeUnlock();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop(boolean cancel) throws IgniteCheckedException {
-        super.stop(cancel);
-
-        if (srv != null)
-            srv.stop();
-    }
-
-    /**
-     * Gets current time on local node.
-     *
-     * @return Current time in milliseconds.
-     */
-    private long currentTime() {
-        return clockSrc.currentTimeMillis();
-    }
-
-    /**
-     * @return Time sync history.
-     */
-    public NavigableMap<GridClockDeltaVersion, GridClockDeltaSnapshot> timeSyncHistory() {
-        return timeSyncHist;
-    }
-
-    /**
-     * Callback from server for message receiving.
-     *
-     * @param msg Received message.
-     * @param addr Remote node address.
-     * @param port Remote node port.
-     */
-    public void onMessageReceived(GridClockMessage msg, InetAddress addr, int port) {
-        long rcvTs = currentTime();
-
-        if (!msg.originatingNodeId().equals(ctx.localNodeId())) {
-            // We received time request from remote node, set current time and reply back.
-            msg.replyTimestamp(rcvTs);
-
-            try {
-                srv.sendPacket(msg, addr, port);
-            }
-            catch (IgniteCheckedException e) {
-                U.error(log, "Failed to send time server reply to remote node: " + msg, e);
-            }
-        }
-        else
-            timeCoord.onMessage(msg, rcvTs);
-    }
-
-    /**
-     * Checks if local node is the oldest node in topology and starts time coordinator if so.
-     *
-     * @param discoEvt Discovery event.
-     */
-    private void checkLaunchCoordinator(DiscoveryEvent discoEvt) {
-        rw.readLock();
-
-        try {
-            if (stopping)
-                return;
-
-            if (timeCoord == null) {
-                long minNodeOrder = Long.MAX_VALUE;
-
-                Collection<ClusterNode> nodes = discoEvt.topologyNodes();
-
-                for (ClusterNode node : nodes) {
-                    if (node.order() < minNodeOrder)
-                        minNodeOrder = node.order();
-                }
-
-                ClusterNode locNode = ctx.discovery().localNode();
-
-                if (locNode.order() == minNodeOrder) {
-                    if (log.isDebugEnabled())
-                        log.debug("Detected local node to be the eldest node in topology, starting time " +
-                            "coordinator thread [discoEvt=" + discoEvt + ", locNode=" + locNode + ']');
-
-                    synchronized (this) {
-                        if (timeCoord == null && !stopping) {
-                            timeCoord = new TimeCoordinator(discoEvt);
-
-                            IgniteThread th = new IgniteThread(timeCoord);
-
-                            th.setPriority(Thread.MAX_PRIORITY);
-
-                            th.start();
-                        }
-                    }
-                }
-            }
-        }
-        finally {
-            rw.readUnlock();
-        }
-    }
-
-    /**
-     * Gets time adjusted with time coordinator on given topology version.
-     *
-     * @param topVer Topology version.
-     * @return Adjusted time.
-     */
-    public long adjustedTime(long topVer) {
-        T2<GridClockDeltaVersion, GridClockDeltaSnapshot> fastSnap = lastSnapshot;
-
-        GridClockDeltaSnapshot snap;
-
-        if (fastSnap != null && fastSnap.get1().topologyVersion() == topVer)
-            snap = fastSnap.get2();
-        else {
-            // Get last synchronized time on given topology version.
-            Map.Entry<GridClockDeltaVersion, GridClockDeltaSnapshot> entry = timeSyncHistory().lowerEntry(
-                new GridClockDeltaVersion(0, topVer + 1));
-
-            snap = entry == null ? null : entry.getValue();
-        }
-
-        long now = clockSrc.currentTimeMillis();
-
-        if (snap == null)
-            return now;
-
-        Long delta = snap.deltas().get(ctx.localNodeId());
-
-        if (delta == null)
-            delta = 0L;
-
-        return now + delta;
-    }
-
-    /**
-     * Publishes snapshot to topology.
-     *
-     * @param snapshot Snapshot to publish.
-     * @param top Topology to send given snapshot to.
-     */
-    private void publish(GridClockDeltaSnapshot snapshot, GridDiscoveryTopologySnapshot top) {
-        if (!rw.tryReadLock())
-            return;
-
-        try {
-            lastSnapshot = new T2<>(snapshot.version(), snapshot);
-
-            timeSyncHist.put(snapshot.version(), snapshot);
-
-            for (ClusterNode n : top.topologyNodes()) {
-                GridClockDeltaSnapshotMessage msg = new GridClockDeltaSnapshotMessage(
-                    snapshot.version(), snapshot.deltas());
-
-                try {
-                    ctx.io().sendToGridTopic(n, TOPIC_TIME_SYNC, msg, SYSTEM_POOL);
-                }
-                catch (IgniteCheckedException e) {
-                    if (ctx.discovery().pingNodeNoError(n.id()))
-                        U.error(log, "Failed to send time sync snapshot to remote node (did not leave grid?) " +
-                            "[nodeId=" + n.id() + ", msg=" + msg + ", err=" + e.getMessage() + ']');
-                    else if (log.isDebugEnabled())
-                        log.debug("Failed to send time sync snapshot to remote node (did not leave grid?) " +
-                            "[nodeId=" + n.id() + ", msg=" + msg + ", err=" + e.getMessage() + ']');
-                }
-            }
-        }
-        finally {
-            rw.readUnlock();
-        }
-    }
-
-    /**
-     * Time coordinator thread.
-     */
-    private class TimeCoordinator extends GridWorker {
-        /** Last discovery topology snapshot. */
-        private volatile GridDiscoveryTopologySnapshot lastSnapshot;
-
-        /** Snapshot being constructed. May be not null only on coordinator node. */
-        private volatile GridClockDeltaSnapshot pendingSnapshot;
-
-        /** Version counter. */
-        private long verCnt = 1;
-
-        /**
-         * Time coordinator thread constructor.
-         *
-         * @param evt Discovery event on which this node became a coordinator.
-         */
-        protected TimeCoordinator(DiscoveryEvent evt) {
-            super(ctx.igniteInstanceName(), "grid-time-coordinator", GridClockSyncProcessor.this.log);
-
-            lastSnapshot = new GridDiscoveryTopologySnapshot(evt.topologyVersion(), evt.topologyNodes());
-        }
-
-        /** {@inheritDoc} */
-        @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
-            while (!isCancelled()) {
-                GridDiscoveryTopologySnapshot top = lastSnapshot;
-
-                if (log.isDebugEnabled())
-                    log.debug("Creating time sync snapshot for topology: " + top);
-
-                GridClockDeltaSnapshot snapshot = new GridClockDeltaSnapshot(
-                    new GridClockDeltaVersion(verCnt++, top.topologyVersion()),
-                    ctx.localNodeId(),
-                    top,
-                    ctx.config().getClockSyncSamples());
-
-                pendingSnapshot = snapshot;
-
-                while (!snapshot.ready()) {
-                    if (log.isDebugEnabled())
-                        log.debug("Requesting time from remote nodes: " + snapshot.pendingNodeIds());
-
-                    for (UUID nodeId : snapshot.pendingNodeIds())
-                        requestTime(nodeId);
-
-                    if (log.isDebugEnabled())
-                        log.debug("Waiting for snapshot to be ready: " + snapshot);
-
-                    // Wait for all replies
-                    snapshot.awaitReady(1000);
-                }
-
-                // No more messages should be processed.
-                pendingSnapshot = null;
-
-                if (log.isDebugEnabled())
-                    log.debug("Collected time sync results: " + snapshot.deltas());
-
-                publish(snapshot, top);
-
-                synchronized (this) {
-                    if (top.topologyVersion() == lastSnapshot.topologyVersion())
-                        wait(ctx.config().getClockSyncFrequency());
-                }
-            }
-        }
-
-        /**
-         * @param evt Discovery event.
-         */
-        public void onDiscoveryEvent(DiscoveryEvent evt) {
-            if (log.isDebugEnabled())
-                log.debug("Processing discovery event: " + evt);
-
-            if (evt.type() == EventType.EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT)
-                onNodeLeft(evt.eventNode().id());
-
-            synchronized (this) {
-                lastSnapshot = new GridDiscoveryTopologySnapshot(evt.topologyVersion(), evt.topologyNodes());
-
-                notifyAll();
-            }
-        }
-
-        /**
-         * @param msg Message received from remote node.
-         * @param rcvTs Receive timestamp.
-         */
-        private void onMessage(GridClockMessage msg, long rcvTs) {
-            GridClockDeltaSnapshot curr = pendingSnapshot;
-
-            if (curr != null) {
-                long delta = (msg.originatingTimestamp() + rcvTs) / 2 - msg.replyTimestamp();
-
-                boolean needMore = curr.onDeltaReceived(msg.targetNodeId(), delta);
-
-                if (needMore)
-                    requestTime(msg.targetNodeId());
-            }
-        }
-
-        /**
-         * Requests time from remote node.
-         *
-         * @param rmtNodeId Remote node ID.
-         */
-        private void requestTime(UUID rmtNodeId) {
-            ClusterNode node = ctx.discovery().node(rmtNodeId);
-
-            if (node != null) {
-                InetAddress addr = node.attribute(ATTR_TIME_SERVER_HOST);
-                int port = node.attribute(ATTR_TIME_SERVER_PORT);
-
-                try {
-                    GridClockMessage req = new GridClockMessage(ctx.localNodeId(), rmtNodeId, currentTime(), 0);
-
-                    srv.sendPacket(req, addr, port);
-                }
-                catch (IgniteCheckedException e) {
-                    LT.error(log, e, "Failed to send time request to remote node [rmtNodeId=" + rmtNodeId +
-                        ", addr=" + addr + ", port=" + port + ']');
-                }
-            }
-            else
-                onNodeLeft(rmtNodeId);
-        }
-
-        /**
-         * Node left callback.
-         *
-         * @param nodeId Left node ID.
-         */
-        private void onNodeLeft(UUID nodeId) {
-            GridClockDeltaSnapshot curr = pendingSnapshot;
-
-            if (curr != null)
-                curr.onNodeLeft(nodeId);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridJvmClockSource.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridJvmClockSource.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridJvmClockSource.java
deleted file mode 100644
index 77bc3eb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridJvmClockSource.java
+++ /dev/null
@@ -1,28 +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.
- */
-
-package org.apache.ignite.internal.processors.clock;
-
-/**
- * JVM time source.
- */
-public class GridJvmClockSource implements GridClockSource {
-    /** {@inheritDoc} */
-    @Override public long currentTimeMillis() {
-        return System.currentTimeMillis();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index e4cb0ce..102db96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -85,7 +85,6 @@ import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupp
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
@@ -975,7 +974,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen
         ccfg.setAtomicityMode(cfg.getAtomicityMode());
         ccfg.setNodeFilter(cfg.getNodeFilter());
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
         ccfg.setRebalanceMode(SYNC);
 
         return ccfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 3cf88d3..bb11b7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -25,7 +25,6 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cluster.ClusterNode;
@@ -528,7 +527,6 @@ public class IgfsUtils {
      */
     private static CacheConfiguration defaultCacheConfig() {
         CacheConfiguration cfg = new CacheConfiguration();
-        cfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.PRIMARY);
         cfg.setAtomicityMode(TRANSACTIONAL);
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/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 17a5a16..6a15b85 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
@@ -36,7 +36,6 @@ import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheRebalanceMode;
@@ -140,7 +139,6 @@ public class PlatformConfigurationUtils {
         CacheConfiguration ccfg = new CacheConfiguration();
 
         ccfg.setAtomicityMode(CacheAtomicityMode.fromOrdinal(in.readInt()));
-        ccfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.fromOrdinal((byte)in.readInt()));
         ccfg.setBackups(in.readInt());
         ccfg.setCacheMode(CacheMode.fromOrdinal(in.readInt()));
         ccfg.setCopyOnRead(in.readBoolean());
@@ -740,7 +738,6 @@ public class PlatformConfigurationUtils {
         assert ccfg != null;
 
         writeEnumInt(writer, ccfg.getAtomicityMode(), CacheConfiguration.DFLT_CACHE_ATOMICITY_MODE);
-        writeEnumInt(writer, ccfg.getAtomicWriteOrderMode());
         writer.writeInt(ccfg.getBackups());
         writeEnumInt(writer, ccfg.getCacheMode(), CacheConfiguration.DFLT_CACHE_MODE);
         writer.writeBoolean(ccfg.isCopyOnRead());

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 2023749..7d7d071 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -9285,10 +9285,6 @@ public abstract class IgniteUtils {
 
             off += 4;
 
-            GridUnsafe.putLong(arr, off, drVer.globalTime());
-
-            off += 8;
-
             GridUnsafe.putLong(arr, off, drVer.order());
 
             off += 8;
@@ -9302,10 +9298,6 @@ public abstract class IgniteUtils {
 
         off += 4;
 
-        GridUnsafe.putLong(arr, off, ver.globalTime());
-
-        off += 8;
-
         GridUnsafe.putLong(arr, off, ver.order());
 
         off += 8;
@@ -9321,16 +9313,14 @@ public abstract class IgniteUtils {
     public static GridCacheVersion readVersion(long ptr, boolean verEx) {
         GridCacheVersion ver = new GridCacheVersion(GridUnsafe.getInt(ptr),
             GridUnsafe.getInt(ptr + 4),
-            GridUnsafe.getLong(ptr + 8),
-            GridUnsafe.getLong(ptr + 16));
+            GridUnsafe.getLong(ptr + 8));
 
         if (verEx) {
-            ptr += 24;
+            ptr += 16;
 
             ver = new GridCacheVersionEx(GridUnsafe.getInt(ptr),
                 GridUnsafe.getInt(ptr + 4),
                 GridUnsafe.getLong(ptr + 8),
-                GridUnsafe.getLong(ptr + 16),
                 ver);
         }
 
@@ -9352,15 +9342,11 @@ public abstract class IgniteUtils {
 
         off += 4;
 
-        long globalTime = GridUnsafe.getLong(arr, off);
-
-        off += 8;
-
         long order = GridUnsafe.getLong(arr, off);
 
         off += 8;
 
-        GridCacheVersion ver = new GridCacheVersion(topVer, nodeOrderDrId, globalTime, order);
+        GridCacheVersion ver = new GridCacheVersion(topVer, nodeOrderDrId, order);
 
         if (verEx) {
             topVer = GridUnsafe.getInt(arr, off);
@@ -9371,13 +9357,9 @@ public abstract class IgniteUtils {
 
             off += 4;
 
-            globalTime = GridUnsafe.getLong(arr, off);
-
-            off += 8;
-
             order = GridUnsafe.getLong(arr, off);
 
-            ver = new GridCacheVersionEx(topVer, nodeOrderDrId, globalTime, order, ver);
+            ver = new GridCacheVersionEx(topVer, nodeOrderDrId, order, ver);
         }
 
         return ver;

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index 91a501c..391b120 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.List;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -53,9 +52,6 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
     /** Cache atomicity mode. */
     private CacheAtomicityMode atomicityMode;
 
-    /** Cache atomicity write ordering mode. */
-    private CacheAtomicWriteOrderMode atomicWriteOrderMode;
-
     /** Eager ttl flag. */
     private boolean eagerTtl;
 
@@ -148,7 +144,6 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
         name = ccfg.getName();
         mode = ccfg.getCacheMode();
         atomicityMode = ccfg.getAtomicityMode();
-        atomicWriteOrderMode = ccfg.getAtomicWriteOrderMode();
         eagerTtl = ccfg.isEagerTtl();
         writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
         invalidate = ccfg.isInvalidate();
@@ -202,10 +197,10 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
     }
 
     /**
-     * @return Cache atomicity write ordering mode.
+     * @return Eager ttl flag
      */
-    public CacheAtomicWriteOrderMode getAtomicWriteOrderMode() {
-        return atomicWriteOrderMode;
+    public boolean eagerTtl() {
+        return eagerTtl;
     }
 
     /**
@@ -395,7 +390,6 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
         U.writeString(out, name);
         U.writeEnum(out, mode);
         U.writeEnum(out, atomicityMode);
-        U.writeEnum(out, atomicWriteOrderMode);
         out.writeBoolean(eagerTtl);
         U.writeEnum(out, writeSynchronizationMode);
         out.writeBoolean(invalidate);
@@ -429,7 +423,6 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
         name = U.readString(in);
         mode = CacheMode.fromOrdinal(in.readByte());
         atomicityMode = CacheAtomicityMode.fromOrdinal(in.readByte());
-        atomicWriteOrderMode = CacheAtomicWriteOrderMode.fromOrdinal(in.readByte());
         eagerTtl = in.readBoolean();
         writeSynchronizationMode = CacheWriteSynchronizationMode.fromOrdinal(in.readByte());
         invalidate = in.readBoolean();

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java b/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java
index a5e83c1..aa84706 100644
--- a/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/startup/BasicWarmupClosure.java
@@ -413,8 +413,7 @@ public class BasicWarmupClosure implements IgniteInClosure<IgniteConfiguration>
         return
             F.eq(ccfg0.getCacheMode(), ccfg1.getCacheMode()) &&
             F.eq(ccfg0.getBackups(), ccfg1.getBackups()) &&
-            F.eq(ccfg0.getAtomicityMode(), ccfg1.getAtomicityMode()) &&
-            F.eq(ccfg0.getAtomicWriteOrderMode(), ccfg1.getAtomicWriteOrderMode());
+            F.eq(ccfg0.getAtomicityMode(), ccfg1.getAtomicityMode());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index ebd28d8..22124af 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -29,7 +29,6 @@ org.apache.ignite.binary.BinaryInvalidTypeException
 org.apache.ignite.binary.BinaryObject
 org.apache.ignite.binary.BinaryObjectException
 org.apache.ignite.cache.CacheAtomicUpdateTimeoutException
-org.apache.ignite.cache.CacheAtomicWriteOrderMode
 org.apache.ignite.cache.CacheAtomicityMode
 org.apache.ignite.cache.CacheEntryEventSerializableFilter
 org.apache.ignite.cache.CacheEntryProcessor
@@ -977,8 +976,8 @@ org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx
 org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserCacheObjectByteArrayImpl
 org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserCacheObjectImpl
 org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserKeyCacheObjectImpl
-org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage
-org.apache.ignite.internal.processors.clock.GridClockDeltaVersion
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1
+org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLA
 org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1
 org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLA
 org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/config/websession/example-cache-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/websession/example-cache-base.xml b/modules/core/src/test/config/websession/example-cache-base.xml
index 20f103e..9654fab 100644
--- a/modules/core/src/test/config/websession/example-cache-base.xml
+++ b/modules/core/src/test/config/websession/example-cache-base.xml
@@ -65,7 +65,6 @@
                     <property name="name" value="partitioned_primary"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
                     <property name="backups" value="1"/>
                 </bean>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/config/websession/spring-cache-1.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/websession/spring-cache-1.xml b/modules/core/src/test/config/websession/spring-cache-1.xml
index 9d049fa..f810282 100644
--- a/modules/core/src/test/config/websession/spring-cache-1.xml
+++ b/modules/core/src/test/config/websession/spring-cache-1.xml
@@ -40,8 +40,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="backups" value="1"/>
 
                     <property name="rebalanceMode" value="SYNC"/>
@@ -56,8 +54,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="backups" value="1"/>
 
                     <property name="rebalanceMode" value="SYNC"/>
@@ -72,8 +68,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="rebalanceMode" value="SYNC"/>
                 </bean>
             </list>

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/config/websession/spring-cache-2.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/websession/spring-cache-2.xml b/modules/core/src/test/config/websession/spring-cache-2.xml
index 7545ec7..ec20ed9 100644
--- a/modules/core/src/test/config/websession/spring-cache-2.xml
+++ b/modules/core/src/test/config/websession/spring-cache-2.xml
@@ -40,8 +40,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="backups" value="1"/>
 
                     <property name="rebalanceMode" value="SYNC"/>
@@ -56,8 +54,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="backups" value="1"/>
 
                     <property name="rebalanceMode" value="SYNC"/>
@@ -72,8 +68,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="rebalanceMode" value="SYNC"/>
                 </bean>
             </list>

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/config/websession/spring-cache-3.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/websession/spring-cache-3.xml b/modules/core/src/test/config/websession/spring-cache-3.xml
index a0fb189..6996c40 100644
--- a/modules/core/src/test/config/websession/spring-cache-3.xml
+++ b/modules/core/src/test/config/websession/spring-cache-3.xml
@@ -40,8 +40,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="backups" value="1"/>
 
                     <property name="rebalanceMode" value="SYNC"/>
@@ -56,8 +54,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="backups" value="1"/>
 
                     <property name="rebalanceMode" value="SYNC"/>
@@ -72,8 +68,6 @@
 
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
 
-                    <property name="atomicWriteOrderMode" value="PRIMARY"/>
-
                     <property name="rebalanceMode" value="SYNC"/>
                 </bean>
             </list>

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index dff827d..5e3b896 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -38,7 +38,6 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteTransactions;
 import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cluster.ClusterGroup;
@@ -74,9 +73,6 @@ import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.values;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -176,7 +172,6 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setName("nearCache");
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         final IgniteCache<Object, Object> nearCache = client.getOrCreateCache(ccfg, new NearCacheConfiguration<>());
 
@@ -215,7 +210,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                             catch (CacheException e) {
                                 log.info("Expected exception: " + e);
 
-                                IgniteClientDisconnectedException e0 = (IgniteClientDisconnectedException) e.getCause();
+                                IgniteClientDisconnectedException e0 = (IgniteClientDisconnectedException)e.getCause();
 
                                 e0.reconnectFuture().get();
                             }
@@ -229,7 +224,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     }));
 
                     disconnectLatch.countDown();
-                } else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
+                }
+                else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
                     info("Reconnected: " + evt);
 
                     assertEquals(0, disconnectLatch.getCount());
@@ -344,7 +340,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     tx.commit();
 
                     fail();
-                } catch (IgniteClientDisconnectedException e) {
+                }
+                catch (IgniteClientDisconnectedException e) {
                     log.info("Expected error: " + e);
 
                     assertNotNull(e.reconnectFuture());
@@ -354,7 +351,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     txs.txStart();
 
                     fail();
-                } catch (IgniteClientDisconnectedException e) {
+                }
+                catch (IgniteClientDisconnectedException e) {
                     log.info("Expected error: " + e);
 
                     assertNotNull(e.reconnectFuture());
@@ -412,8 +410,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
     private void reconnectTransactionInProgress1(IgniteEx client,
         final TransactionConcurrency txConcurrency,
         final IgniteCache<Object, Object> cache)
-        throws Exception
-    {
+        throws Exception {
         Ignite srv = clientRouter(client);
 
         final TestTcpDiscoverySpi clientSpi = spi(client);
@@ -432,7 +429,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                     info("Disconnected: " + evt);
 
                     disconnectLatch.countDown();
-                } else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
+                }
+                else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) {
                     info("Reconnected: " + evt);
 
                     reconnectLatch.countDown();
@@ -787,42 +785,34 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         int cnt = 0;
 
         for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) {
-            CacheAtomicWriteOrderMode[] writeOrders =
-                atomicityMode == ATOMIC ? values() : new CacheAtomicWriteOrderMode[]{CLOCK};
-
-            for (CacheAtomicWriteOrderMode writeOrder : writeOrders) {
-                for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) {
-                    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
-
-                    ccfg.setAtomicityMode(atomicityMode);
+            for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) {
+                CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
 
-                    ccfg.setAtomicWriteOrderMode(writeOrder);
+                ccfg.setAtomicityMode(atomicityMode);
 
-                    ccfg.setName("cache-" + cnt++);
+                ccfg.setName("cache-" + cnt++);
 
-                    ccfg.setWriteSynchronizationMode(syncMode);
+                ccfg.setWriteSynchronizationMode(syncMode);
 
-                    if (syncMode != FULL_ASYNC) {
-                        Class<?> cls = (ccfg.getAtomicityMode() == ATOMIC) ?
-                            GridNearAtomicUpdateResponse.class : GridNearTxPrepareResponse.class;
+                if (syncMode != FULL_ASYNC) {
+                    Class<?> cls = (ccfg.getAtomicityMode() == ATOMIC) ?
+                        GridNearAtomicUpdateResponse.class : GridNearTxPrepareResponse.class;
 
-                        log.info("Test cache put [atomicity=" + atomicityMode +
-                            ", writeOrder=" + writeOrder +
-                            ", syncMode=" + syncMode + ']');
+                    log.info("Test cache put [atomicity=" + atomicityMode +
+                        ", syncMode=" + syncMode + ']');
 
-                        checkOperationInProgressFails(client, ccfg, cls, putOp);
+                    checkOperationInProgressFails(client, ccfg, cls, putOp);
 
-                        client.destroyCache(ccfg.getName());
-                    }
+                    client.destroyCache(ccfg.getName());
+                }
 
-                    log.info("Test cache get [atomicity=" + atomicityMode + ", syncMode=" + syncMode + ']');
+                log.info("Test cache get [atomicity=" + atomicityMode + ", syncMode=" + syncMode + ']');
 
-                    checkOperationInProgressFails(client, ccfg, GridNearSingleGetResponse.class, getOp);
+                checkOperationInProgressFails(client, ccfg, GridNearSingleGetResponse.class, getOp);
 
-                    checkOperationInProgressFails(client, ccfg, GridNearGetResponse.class, getAllOp);
+                checkOperationInProgressFails(client, ccfg, GridNearGetResponse.class, getAllOp);
 
-                    client.destroyCache(ccfg.getName());
-                }
+                client.destroyCache(ccfg.getName());
             }
         }
     }
@@ -1121,7 +1111,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
                 @Override public Void call() throws Exception {
                     int idx = nodeIdx.incrementAndGet();
 
-                    for (int i  = 0; i < 25; i++) {
+                    for (int i = 0; i < 25; i++) {
                         startGrid(idx);
 
                         stopGrid(idx);
@@ -1260,27 +1250,32 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
     /**
      *
      */
-    static class TestClass1 implements Serializable {}
+    static class TestClass1 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass2 implements Serializable {}
+    static class TestClass2 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass3 implements Serializable {}
+    static class TestClass3 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass4 implements Serializable {}
+    static class TestClass4 implements Serializable {
+    }
 
     /**
      *
      */
-    static class TestClass5 implements Serializable {}
+    static class TestClass5 implements Serializable {
+    }
 
     /**
      * @param client Client.
@@ -1293,8 +1288,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         final CacheConfiguration<Object, Object> ccfg,
         Class<?> msgToBlock,
         final IgniteInClosure<IgniteCache<Object, Object>> c)
-        throws Exception
-    {
+        throws Exception {
         Ignite srv = clientRouter(client);
 
         TestTcpDiscoverySpi srvSpi = spi(srv);
@@ -1381,8 +1375,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         String cacheName,
         boolean cacheExists,
         boolean clientCache,
-        boolean clientNear)
-    {
+        boolean clientNear) {
         GridDiscoveryManager srvDisco = ((IgniteKernal)srv).context().discovery();
         GridDiscoveryManager clientDisco = ((IgniteKernal)client).context().discovery();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
index a4c59ea..991735b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
@@ -42,7 +42,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -72,7 +71,6 @@ public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTes
         cCfg.setCacheMode(PARTITIONED);
         cCfg.setBackups(1);
         cCfg.setWriteSynchronizationMode(FULL_SYNC);
-        cCfg.setAtomicWriteOrderMode(PRIMARY);
 
         cfg.setCacheConfiguration(cCfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
index 2017365..efaaee8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
@@ -34,7 +34,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -240,7 +239,6 @@ public abstract class CacheEnumOperationsAbstractTest extends GridCommonAbstract
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
index 5b7769e..7d49c11 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
@@ -60,7 +60,6 @@ import org.jetbrains.annotations.NotNull;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -729,7 +728,6 @@ public class CacheInterceptorPartitionCounterRandomOperationsTest extends GridCo
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicWriteOrderMode(PRIMARY);
 
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/247282f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
index cdd9072..70f2fc5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
@@ -26,7 +26,6 @@ import javax.cache.configuration.Factory;
 import javax.cache.integration.CacheLoaderException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cache.store.CacheStore;
@@ -105,7 +104,6 @@ public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbs
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode());
-        ccfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.PRIMARY);
         ccfg.setBackups(1);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 


[18/50] [abbrv] ignite git commit: Removed unused GridCacheConcurrentMap.randomEntry() method.

Posted by sb...@apache.org.
Removed unused GridCacheConcurrentMap.randomEntry() method.


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

Branch: refs/heads/ignite-1561-1
Commit: af55d7292215dd872ddd2620942655ea6bdf5c01
Parents: 8b56a43
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 17:08:50 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 17:08:50 2017 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheConcurrentMap.java |  5 -----
 .../processors/cache/GridCacheConcurrentMapImpl.java      | 10 ----------
 .../internal/processors/cache/GridNoStorageCacheMap.java  |  5 -----
 .../dht/GridCachePartitionedConcurrentMap.java            |  5 -----
 4 files changed, 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/af55d729/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index a6738f3..9378f74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -91,11 +91,6 @@ public interface GridCacheConcurrentMap {
     public void decrementPublicSize(GridCacheEntryEx e);
 
     /**
-     * @return Partition random entry.
-     */
-    @Nullable public GridCacheMapEntry randomEntry();
-
-    /**
      * @return Random entry out of hash map.
      */
     public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter);

http://git-wip-us.apache.org/repos/asf/ignite/blob/af55d729/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
index 0ef1fdb..76d961a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
@@ -343,16 +343,6 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM
     }
 
     /** {@inheritDoc} */
-    @Deprecated @Nullable @Override public GridCacheMapEntry randomEntry() {
-        Iterator<GridCacheMapEntry> iterator = map.values().iterator();
-
-        if (iterator.hasNext())
-            return iterator.next();
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
     @Override public Set<GridCacheMapEntry> entrySet(final CacheEntryPredicate... filter) {
         final IgnitePredicate<GridCacheMapEntry> p = new IgnitePredicate<GridCacheMapEntry>() {
             @Override public boolean apply(GridCacheMapEntry entry) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/af55d729/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
index db3533d..00827ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
@@ -79,11 +79,6 @@ public class GridNoStorageCacheMap implements GridCacheConcurrentMap {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public GridCacheMapEntry randomEntry() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
     @Override public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter) {
         return Collections.emptySet();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/af55d729/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
index 6230c85..357bf89 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
@@ -137,11 +137,6 @@ public class GridCachePartitionedConcurrentMap implements GridCacheConcurrentMap
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public GridCacheMapEntry randomEntry() {
-        return entries().iterator().next();
-    }
-
-    /** {@inheritDoc} */
     @Override public Set<KeyCacheObject> keySet(final CacheEntryPredicate... filter) {
         return new PartitionedSet<KeyCacheObject>() {
             @Override protected Set<KeyCacheObject> set(GridDhtLocalPartition part) {


[06/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 3751f5c..f88736a 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -82,7 +82,6 @@ export default class IgniteConfigurationGenerator {
         this.clusterODBC(cluster.odbc, cfg);
         this.clusterMarshaller(cluster, cfg);
         this.clusterMetrics(cluster, cfg);
-        this.clusterSwap(cluster, cfg);
         this.clusterTime(cluster, cfg);
         this.clusterPools(cluster, cfg);
         this.clusterTransactions(cluster.transactionConfiguration, cfg);
@@ -1209,9 +1208,7 @@ export default class IgniteConfigurationGenerator {
         if (bean)
             cfg.beanProperty('marshaller', bean);
 
-        cfg.intProperty('marshalLocalJobs')
-            .intProperty('marshallerCacheKeepAliveTime')
-            .intProperty('marshallerCacheThreadPoolSize', 'marshallerCachePoolSize');
+        cfg.intProperty('marshalLocalJobs');
 
         return cfg;
     }
@@ -1248,14 +1245,14 @@ export default class IgniteConfigurationGenerator {
             const bean = new Bean('org.apache.ignite.ssl.SslContextFactory', 'sslCtxFactory',
                 cluster.sslContextFactory);
 
-            bean.intProperty('keyAlgorithm')
+            bean.stringProperty('keyAlgorithm')
                 .pathProperty('keyStoreFilePath');
 
             if (_.nonEmpty(bean.valueOf('keyStoreFilePath')))
                 bean.propertyChar('keyStorePassword', 'ssl.key.storage.password', 'YOUR_SSL_KEY_STORAGE_PASSWORD');
 
-            bean.intProperty('keyStoreType')
-                .intProperty('protocol');
+            bean.stringProperty('keyStoreType')
+                .stringProperty('protocol');
 
             if (_.nonEmpty(cluster.sslContextFactory.trustManagers)) {
                 bean.arrayProperty('trustManagers', 'trustManagers',
@@ -1268,7 +1265,7 @@ export default class IgniteConfigurationGenerator {
                 if (_.nonEmpty(bean.valueOf('trustStoreFilePath')))
                     bean.propertyChar('trustStorePassword', 'ssl.trust.storage.password', 'YOUR_SSL_TRUST_STORAGE_PASSWORD');
 
-                bean.intProperty('trustStoreType');
+                bean.stringProperty('trustStoreType');
             }
 
             cfg.beanProperty('sslContextFactory', bean);
@@ -1277,24 +1274,6 @@ export default class IgniteConfigurationGenerator {
         return cfg;
     }
 
-    // Generate swap group.
-    static clusterSwap(cluster, cfg = this.igniteConfigurationBean(cluster)) {
-        if (_.get(cluster.swapSpaceSpi, 'kind') === 'FileSwapSpaceSpi') {
-            const bean = new Bean('org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi', 'swapSpaceSpi',
-                cluster.swapSpaceSpi.FileSwapSpaceSpi);
-
-            bean.pathProperty('baseDirectory')
-                .intProperty('readStripesNumber')
-                .floatProperty('maximumSparsity')
-                .intProperty('maxWriteQueueSize')
-                .intProperty('writeBufferSize');
-
-            cfg.beanProperty('swapSpaceSpi', bean);
-        }
-
-        return cfg;
-    }
-
     // Generate time group.
     static clusterTime(cluster, cfg = this.igniteConfigurationBean(cluster)) {
         cfg.intProperty('clockSyncSamples')
@@ -1461,6 +1440,8 @@ export default class IgniteConfigurationGenerator {
                 .intProperty('readFromBackup');
         }
 
+        ccfg.enumProperty('partitionLossPolicy');
+
         ccfg.intProperty('copyOnRead');
 
         if (ccfg.valueOf('cacheMode') === 'PARTITIONED' && ccfg.valueOf('atomicityMode') === 'TRANSACTIONAL')
@@ -1506,15 +1487,9 @@ export default class IgniteConfigurationGenerator {
 
     // Generate cache memory group.
     static cacheMemory(cache, ccfg = this.cacheConfigurationBean(cache)) {
-        ccfg.enumProperty('memoryMode');
-
-        if (ccfg.valueOf('memoryMode') !== 'OFFHEAP_VALUES')
-            ccfg.intProperty('offHeapMaxMemory');
-
         this._evictionPolicy(ccfg, 'evictionPolicy', cache.evictionPolicy, cacheDflts.evictionPolicy);
 
-        ccfg.intProperty('startSize')
-            .boolProperty('swapEnabled');
+        ccfg.intProperty('startSize');
 
         return ccfg;
     }
@@ -1533,6 +1508,7 @@ export default class IgniteConfigurationGenerator {
             .intProperty('longQueryWarningTimeout')
             .arrayProperty('indexedTypes', 'indexedTypes', indexedTypes, 'java.lang.Class')
             .intProperty('queryDetailMetricsSize')
+            .intProperty('queryParallelism')
             .arrayProperty('sqlFunctionClasses', 'sqlFunctionClasses', cache.sqlFunctionClasses, 'java.lang.Class')
             .intProperty('snapshotableIndex')
             .intProperty('sqlEscapeAll');
@@ -1876,7 +1852,7 @@ export default class IgniteConfigurationGenerator {
     // Generate IGFS miscellaneous group.
     static igfsMisc(igfs, cfg = this.igfsConfigurationBean(igfs)) {
         cfg.intProperty('blockSize')
-            .intProperty('streamBufferSize')
+            .intProperty('bufferSize')
             .intProperty('maxSpaceSize')
             .intProperty('maximumTaskRangeLength')
             .intProperty('managementPort')

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
index 9590779..df10b23 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
@@ -778,6 +778,9 @@ export default class IgniteJavaTransformer extends AbstractTransformer {
                     if (this._isBean(prop.typeClsName))
                         _.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
 
+                    if (prop.typeClsName === 'java.lang.Class')
+                        _.forEach(prop.items, (item) => imports.push(item));
+
                     break;
                 case 'COLLECTION':
                     imports.push(prop.typeClsName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
index b076193..a78f078 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
@@ -282,6 +282,8 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo
                     .intProperty('readFromBackup');
             }
 
+            ccfg.enumProperty('partitionLossPolicy');
+
             ccfg.intProperty('copyOnRead');
 
             if (ccfg.valueOf('cacheMode') === 'PARTITIONED' && ccfg.valueOf('atomicityMode') === 'TRANSACTIONAL')
@@ -292,15 +294,9 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo
 
         // Generate cache memory group.
         static cacheMemory(cache, ccfg = this.cacheConfigurationBean(cache)) {
-            ccfg.enumProperty('memoryMode');
-
-            if (ccfg.valueOf('memoryMode') !== 'OFFHEAP_VALUES')
-                ccfg.intProperty('offHeapMaxMemory');
-
             // this._evictionPolicy(ccfg, 'evictionPolicy', cache.evictionPolicy, cacheDflts.evictionPolicy);
 
-            ccfg.intProperty('startSize')
-                .boolProperty('swapEnabled', 'EnableSwap');
+            ccfg.intProperty('startSize');
 
             return ccfg;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
index eeac3a0..3253ba9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.platform.service.js
@@ -28,11 +28,6 @@ const DFLT_CACHE = {
         clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheAtomicityMode',
         mapper: enumValueMapper
     },
-    memoryMode: {
-        clsName: 'Apache.Ignite.Core.Cache.Configuration.CacheMemoryMode',
-        value: 'ONHEAP_TIERED',
-        mapper: enumValueMapper
-    },
     atomicWriteOrderMode: {
         clsName: 'org.apache.ignite.cache.CacheAtomicWriteOrderMode',
         mapper: enumValueMapper

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
index 14b315f..1a4c7c9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cache.service.js
@@ -22,13 +22,11 @@ const DFLT_CACHE = {
     atomicityMode: {
         clsName: 'org.apache.ignite.cache.CacheAtomicityMode'
     },
-    memoryMode: {
-        clsName: 'org.apache.ignite.cache.CacheMemoryMode',
-        value: 'ONHEAP_TIERED'
+    partitionLossPolicy: {
+        clsName: 'org.apache.ignite.cache.PartitionLossPolicy',
+        value: 'IGNORE'
     },
-    offHeapMaxMemory: -1,
     startSize: 1500000,
-    swapEnabled: false,
     sqlOnheapRowCacheSize: 10240,
     longQueryWarningTimeout: 3000,
     snapshotableIndex: false,
@@ -93,6 +91,8 @@ const DFLT_CACHE = {
         }
     },
     queryMetadata: 'Configuration',
+    queryDetailMetricsSize: 0,
+    queryParallelism: 1,
     fields: {
         keyClsName: 'java.lang.String',
         valClsName: 'java.lang.String',

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
index b2e91c8..8dcd6bc 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/Cluster.service.js
@@ -183,7 +183,6 @@ const DFLT_CLUSTER = {
         }
     },
     marshalLocalJobs: false,
-    marshallerCacheKeepAliveTime: 10000,
     metricsHistorySize: 10000,
     metricsLogFrequency: 60000,
     metricsUpdateFrequency: 2000,

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
index 985a56e..7cdc59a 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/defaults/IGFS.service.js
@@ -38,7 +38,7 @@ const DFLT_IGFS = {
     dualModeMaxPendingPutsSize: 0,
     dualModePutExecutorServiceShutdown: false,
     blockSize: 65536,
-    streamBufferSize: 65536,
+    bufferSize: 65536,
     maxSpaceSize: 0,
     maximumTaskRangeLength: 0,
     managementPort: 11400,

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index b1cd3d0..11700dd 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -26,12 +26,6 @@ const TIME_LINE = {value: -1, type: 'java.sql.Date', label: 'TIME_LINE'};
 // Row index X axis descriptor.
 const ROW_IDX = {value: -2, type: 'java.lang.Integer', label: 'ROW_IDX'};
 
-/** Prefix for node local key for SCAN near queries. */
-const SCAN_CACHE_WITH_FILTER = 'VISOR_SCAN_CACHE_WITH_FILTER';
-
-/** Prefix for node local key for SCAN near queries. */
-const SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE = 'VISOR_SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE';
-
 const NON_COLLOCATED_JOINS_SINCE = '1.7.0';
 
 const ENFORCE_JOIN_VERS = [['1.7.9', '1.8.0'], ['1.8.4', '1.9.0'], ['1.9.1']];
@@ -1493,11 +1487,12 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
         };
 
         $scope.scan = (paragraph, local = false) => {
-            const {filter, caseSensitive} = paragraph;
-            const prefix = caseSensitive ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE : SCAN_CACHE_WITH_FILTER;
-            const query = `${prefix}${filter}`;
+            const cacheName = paragraph.cacheName;
+            const filter = paragraph.filter;
+            const caseSensitive = !!paragraph.caseSensitive;
+            const pageSize = paragraph.pageSize;
 
-            $scope.actionAvailable(paragraph, false) && _chooseNode(paragraph.cacheName, local)
+            $scope.actionAvailable(paragraph, false) && _chooseNode(cacheName, local)
                 .then((nid) => {
                     Notebook.save($scope.notebook)
                         .catch(Messages.showError);
@@ -1508,18 +1503,20 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
 
                     _closeOldQuery(paragraph)
                         .then(() => {
-                            const args = paragraph.queryArgs = {
+                            paragraph.queryArgs = {
                                 type: 'SCAN',
-                                cacheName: paragraph.cacheName,
-                                query,
+                                cacheName,
                                 filter,
-                                pageSize: paragraph.pageSize,
+                                regEx: false,
+                                caseSensitive,
+                                near: false,
+                                pageSize,
                                 localNid: local ? nid : null
                             };
 
                             ActivitiesData.post({ action: '/queries/scan' });
 
-                            return agentMonitor.query(nid, args.cacheName, query, false, false, local, args.pageSize);
+                            return agentMonitor.scan(nid, cacheName, filter, false, caseSensitive, false, local, pageSize);
                         })
                         .then((res) => _processQueryResult(paragraph, true, res))
                         .catch((err) => {
@@ -1640,8 +1637,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
             const args = paragraph.queryArgs;
 
             return Promise.resolve(args.localNid || _chooseNode(args.cacheName, false))
-                .then((nid) => agentMonitor.queryGetAll(nid, args.cacheName, args.query, !!args.nonCollocatedJoins,
-                    !!args.enforceJoinOrder, !!args.localNid))
+                .then((nid) =>
+                    args.type === 'SCAN'
+                        ? agentMonitor.scanGetAll(nid, args.cacheName, args.filter, !!args.regEx, !!args.caseSensitive, !!args.near, !!args.localNid)
+                        : agentMonitor.queryGetAll(nid, args.cacheName, args.query, !!args.nonCollocatedJoins, !!args.enforceJoinOrder, !!args.localNid))
                 .then((res) => _export(paragraph.name + '-all.csv', paragraph.gridOptions.columnDefs, res.columns, res.rows))
                 .catch(Messages.showError)
                 .then(() => paragraph.ace && paragraph.ace.focus());
@@ -1755,21 +1754,15 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
             if (!_.isNil(paragraph)) {
                 const scope = $scope.$new();
 
-                if (_.isNil(paragraph.queryArgs.query)) {
-                    scope.title = 'SCAN query';
-                    scope.content = [`SCAN query for cache: <b>${maskCacheName(paragraph.queryArgs.cacheName, true)}</b>`];
-                }
-                else if (paragraph.queryArgs.query.startsWith(SCAN_CACHE_WITH_FILTER)) {
+                if (paragraph.queryArgs.type === 'SCAN') {
                     scope.title = 'SCAN query';
 
-                    let filter = '';
+                    const filter = paragraph.queryArgs.filter;
 
-                    if (paragraph.queryArgs.query.startsWith(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE))
-                        filter = paragraph.queryArgs.query.substr(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length);
+                    if (_.isEmpty(filter))
+                        scope.content = [`SCAN query for cache: <b>${maskCacheName(paragraph.queryArgs.cacheName, true)}</b>`];
                     else
-                        filter = paragraph.queryArgs.query.substr(SCAN_CACHE_WITH_FILTER.length);
-
-                    scope.content = [`SCAN query for cache: <b>${maskCacheName(paragraph.queryArgs.cacheName, true)}</b> with filter: <b>${filter}</b>`];
+                        scope.content = [`SCAN query for cache: <b>${maskCacheName(paragraph.queryArgs.cacheName, true)}</b> with filter: <b>${filter}</b>`];
                 }
                 else if (paragraph.queryArgs.query .startsWith('EXPLAIN ')) {
                     scope.title = 'Explain query';
@@ -1794,9 +1787,12 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
 
                 let cause = paragraph.error.root;
 
+                const tab = '&nbsp;&nbsp;&nbsp;&nbsp;';
+
                 while (_.nonNil(cause)) {
-                    scope.content.push((scope.content.length > 0 ? '&nbsp;&nbsp;&nbsp;&nbsp;' : '') +
-                        '[' + JavaTypes.shortClassName(cause.className) + '] ' + cause.message);
+                    const clsName = _.isEmpty(cause.className) ? '' : '[' + JavaTypes.shortClassName(cause.className) + '] ';
+
+                    scope.content.push((scope.content.length > 0 ? tab : '') + clsName + cause.message);
 
                     cause = cause.cause;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug
index 70b90bd..14857fc 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/affinity.pug
@@ -33,7 +33,7 @@ include /app/helpers/jade/mixins
         label Affinity Collocation
         ignite-form-field-tooltip.tipLabel
             | Collocate data with data to improve performance and scalability of your application#[br]
-            | #[a(href="http://apacheignite.gridgain.org/docs/affinity-collocation" target="_blank") More info]
+            | #[a(href="http://apacheignite.readme.io/docs/affinity-collocation" target="_blank") More info]
         ignite-form-revert
     .panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
         .panel-body(ng-if=`ui.isPanelLoaded('${form}')`)

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
index 89676f2..2be5c53 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
@@ -58,6 +58,31 @@ include /app/helpers/jade/mixins
                         'Flag indicating whether data can be read from backup<br/>\
                         If not set then always get data from primary node (never from backup)')
                 .settings-row
+                    +dropdown('Partition loss policy:', `${model}.partitionLossPolicy`, '"partitionLossPolicy"', 'true', 'IGNORE',
+                    '[\
+                        {value: "READ_ONLY_SAFE", label: "READ_ONLY_SAFE"},\
+                        {value: "READ_ONLY_ALL", label: "READ_ONLY_ALL"},\
+                        {value: "READ_WRITE_SAFE", label: "READ_WRITE_SAFE"},\
+                        {value: "READ_WRITE_ALL", label: "READ_WRITE_ALL"},\
+                        {value: "IGNORE", label: "IGNORE"}\
+                    ]',
+                    'Partition loss policies:\
+                    <ul>\
+                        <li>READ_ONLY_SAFE - in this mode all writes to the cache will be failed with an exception,\
+                            reads will only be allowed for keys in  non-lost partitions.\
+                            Reads from lost partitions will be failed with an exception.</li>\
+                        <li>READ_ONLY_ALL - in this mode \u0444ll writes to the cache will be failed with an exception.\
+                            All reads will proceed as if all partitions were in a consistent state.\
+                            The result of reading from a lost partition is undefined and may be different on different nodes in the cluster.</li>\
+                        <li>READ_WRITE_SAFE - in this mode Aall reads and writes will be allowed for keys in valid partitions.\
+                            All reads and writes for keys in lost partitions will be failed with an exception.</li>\
+                        <li>READ_WRITE_ALL - in this mode all reads and writes will proceed as if all partitions were in a consistent state.\
+                            The result of reading from a lost partition is undefined and may be different on different nodes in the cluster.</li>\
+                        <li>IGNORE - in this mode if partition is lost, reset it state and do not clear intermediate data.\
+                            The result of reading from a previously lost and not cleared partition is undefined and may be different\
+                            on different nodes in the cluster.</li>\
+                    </ul>')
+                .settings-row
                     +checkbox('Copy on read', `${model}.copyOnRead`, '"copyOnRead"',
                         'Flag indicating whether copy of the value stored in cache should be created for cache operation implying return value<br/>\
                         Also if this flag is set copies are created for values passed to CacheInterceptor and to CacheEntryProcessor')

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/caches/memory.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/memory.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/memory.pug
index 38482a7..8384be9 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/memory.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/memory.pug
@@ -31,63 +31,11 @@ include /app/helpers/jade/mixins
         .panel-body(ng-if=`ui.isPanelLoaded('${form}')`)
             .col-sm-6
                 .settings-row
-                    +dropdown('Mode:', `${model}.memoryMode`, '"memoryMode"', 'true', 'ONHEAP_TIERED',
-                        '[\
-                            {value: "ONHEAP_TIERED", label: "ONHEAP_TIERED"},\
-                            {value: "OFFHEAP_TIERED", label: "OFFHEAP_TIERED"},\
-                            {value: "OFFHEAP_VALUES", label: "OFFHEAP_VALUES"}\
-                        ]',
-                        'Memory modes control whether value is stored in on-heap memory, off-heap memory, or swap space\
-                        <ul>\
-                            <li>\
-                                ONHEAP_TIERED - entries are cached on heap memory first<br/>\
-                                <ul>\
-                                    <li>\
-                                        If offheap memory is enabled and eviction policy evicts an entry from heap memory, entry will be moved to offheap memory<br/>\
-                                        If offheap memory is disabled, then entry is simply discarded\
-                                    </li>\
-                                    <li>\
-                                        If swap space is enabled and offheap memory fills up, then entry will be evicted into swap space<br/>\
-                                        If swap space is disabled, then entry will be discarded. If swap is enabled and offheap memory is disabled, then entry will be evicted directly from heap memory into swap\
-                                    </li>\
-                                </ul>\
-                            </li>\
-                            <li>\
-                                OFFHEAP_TIERED - works the same as ONHEAP_TIERED, except that entries never end up in heap memory and get stored in offheap memory right away<br/>\
-                                Entries get cached in offheap memory first and then get evicted to swap, if one is configured\
-                            </li>\
-                            <li>\
-                                OFFHEAP_VALUES - entry keys will be stored on heap memory, and values will be stored in offheap memory<br/>\
-                                Note that in this mode entries can be evicted only to swap\
-                            </li>\
-                        </ul>')
-                .settings-row(ng-show=`${model}.memoryMode !== 'OFFHEAP_VALUES'`)
-                    +dropdown-required('Off-heap memory:', `${model}.offHeapMode`, '"offHeapMode"', 'true', `${model}.memoryMode === 'OFFHEAP_TIERED'`,
-                        'Disabled',
-                        '[\
-                            {value: -1, label: "Disabled"},\
-                            {value: 1, label: "Limited"},\
-                            {value: 0, label: "Unlimited"}\
-                        ]',
-                        'Off-heap storage mode\
-                        <ul>\
-                            <li>Disabled - Off-heap storage is disabled</li>\
-                            <li>Limited - Off-heap storage has limited size</li>\
-                            <li>Unlimited - Off-heap storage grow infinitely (it is up to user to properly add and remove entries from cache to ensure that off-heap storage does not grow infinitely)</li>\
-                        </ul>')
-                .settings-row(ng-if=`${model}.offHeapMode === 1 && ${model}.memoryMode !== 'OFFHEAP_VALUES'`)
-                    +number-required('Off-heap memory max size:', `${model}.offHeapMaxMemory`, '"offHeapMaxMemory"', 'true',
-                        `${model}.offHeapMode === 1`, 'Enter off-heap memory size', '1',
-                        'Maximum amount of memory available to off-heap storage in bytes')
-                .settings-row
-                    -var onHeapTired = model + '.memoryMode === "ONHEAP_TIERED"'
-                    -var swapEnabled = model + '.swapEnabled'
-                    -var offHeapMaxMemory = model + '.offHeapMaxMemory'
-
-                    +evictionPolicy(`${model}.evictionPolicy`, '"evictionPolicy"', 'true',
-                        onHeapTired  + ' && (' + swapEnabled + '|| _.isNumber(' + offHeapMaxMemory + ') &&' + offHeapMaxMemory + ' >= 0)',
-                        'Optional cache eviction policy<br/>\
-                        Must be set for entries to be evicted from on-heap to off-heap or swap\
+                    +checkbox('On-heap cache enabled', `${model}.onheapCacheEnabled`, '"onheapCacheEnabled"', 'On-heap cache enabled flag')
+                .settings-row(ng-show=`${model}.onheapCacheEnabled`)
+                    +evictionPolicy(`${model}.evictionPolicy`, '"evictionPolicy"', 'true', 'false',
+                        'Cache eviction policy<br/>\
+                        Must be set for entries to be evicted to off-heap\
                         <ul>\
                             <li>Least Recently Used(LRU) - Eviction policy based on LRU algorithm and supports batch eviction</li>\
                             <li>First In First Out (FIFO) - Eviction policy based on FIFO algorithm and supports batch eviction</li>\
@@ -102,7 +50,5 @@ include /app/helpers/jade/mixins
                         This will save a lot of CPU resources during the load time, because the map would not have to resize.\
                         For example, if you expect to load 10 million entries into cache, you can set this property to 10 000 000.\
                         This will save you from cache internal map resizes.')
-                .settings-row
-                    +checkbox('Swap enabled', `${model}.swapEnabled`, '"swapEnabled"', 'Flag indicating whether swap storage is enabled or not for this cache')
             .col-sm-6
                 +preview-xml-java(model, 'cacheMemory')

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
index 5bb515a..52425ba 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/query.pug
@@ -56,6 +56,9 @@ include /app/helpers/jade/mixins
                     +number('History size:', `${model}.queryDetailMetricsSize`, '"queryDetailMetricsSize"', 'true', '0', '0',
                         'Size of queries detail metrics that will be stored in memory for monitoring purposes')
                 .settings-row
+                    +number('Parallelism:', `${model}.queryParallelism`, '"queryParallelism"', 'true', '1', '1',
+                        'Defines a hint to query execution engine on desired degree of parallelism within a single node.')
+                .settings-row
                     -var form = 'querySqlFunctionClasses';
                     -var sqlFunctionClasses = `${model}.sqlFunctionClasses`;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/clusters/events.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/events.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/events.pug
index 70fb714..09cd40c 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/events.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/events.pug
@@ -40,15 +40,17 @@ include /app/helpers/jade/mixins
                     Note, that either the include event types or the exclude event types can be established')
 
                 .settings-row
-                    +dropdown('Event storage:', modelEventStorageKind, '"eventStorageKind"', 'true', '',
+                    +dropdown('Event storage:', modelEventStorageKind, '"eventStorageKind"', 'true', 'Disabled',
                     '[\
                         {value: "Memory", label: "Memory"},\
-                        {value: "Custom", label: "Custom"}\
+                        {value: "Custom", label: "Custom"},\
+                        {value: undefined, label: "Disabled"}\
                     ]',
                     'Regulate how grid store events locally on node\
                     <ul>\
                         <li>Memory - All events are kept in the FIFO queue in-memory</li>\
                         <li>Custom - Custom implementation of event storage SPI</li>\
+                        <li>Disabled - Events are not collected</li>\
                     </ul>')
 
                 div(ng-show=eventStorageMemory)

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/clusters/marshaller.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/marshaller.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/marshaller.pug
index f9d29b5..274b014 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/marshaller.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/marshaller.pug
@@ -66,11 +66,5 @@ include /app/helpers/jade/mixins
                                 'Whether marshaller should require Serializable interface or not')
                 .settings-row
                     +checkbox('Marshal local jobs', `${model}.marshalLocalJobs`, '"marshalLocalJobs"', 'If this flag is enabled, jobs mapped to local node will be marshalled as if it was remote node')
-                .settings-row
-                    +number('Keep alive time:', `${model}.marshallerCacheKeepAliveTime`, '"marshallerCacheKeepAliveTime"', 'true', '10000', '0',
-                        'Keep alive time of thread pool that is in charge of processing marshaller messages')
-                .settings-row
-                    +number('Pool size:', `${model}.marshallerCacheThreadPoolSize`, '"marshallerCacheThreadPoolSize"', 'true', 'max(8, availableProcessors) * 2', '1',
-                        'Default size of thread pool that is in charge of processing marshaller messages')
             .col-sm-6
                 +preview-xml-java(model, 'clusterMarshaller')

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
deleted file mode 100644
index 54b6db0..0000000
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/swap.pug
+++ /dev/null
@@ -1,72 +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.
-
-include /app/helpers/jade/mixins
-
--var form = 'swap'
--var model = 'backupItem'
--var swapModel = model + '.swapSpaceSpi'
--var fileSwapModel = swapModel + '.FileSwapSpaceSpi'
-
-.panel.panel-default(ng-form=form novalidate)
-    .panel-heading(bs-collapse-toggle ng-click=`ui.loadPanel('${form}')`)
-        ignite-form-panel-chevron
-        label Swap
-        ignite-form-field-tooltip.tipLabel
-            | Settings for overflow data to disk if it cannot fit in memory#[br]
-            | #[a(href="https://apacheignite.readme.io/docs/off-heap-memory#swap-space" target="_blank") More info]
-        ignite-form-revert
-    .panel-collapse(role='tabpanel' bs-collapse-target id=`${form}`)
-        .panel-body(ng-if=`ui.isPanelLoaded('${form}')`)
-            .col-sm-6
-                .settings-row
-                    +dropdown('Swap space SPI:', `${swapModel}.kind`, '"swapSpaceSpi"', 'true', 'Choose swap SPI',
-                        '[\
-                            {value: "FileSwapSpaceSpi", label: "File-based swap"},\
-                            {value: undefined, label: "Not set"}\
-                        ]',
-                        'Provides a mechanism in grid for storing data on disk<br/>\
-                        Ignite cache uses swap space to overflow data to disk if it cannot fit in memory\
-                        <ul>\
-                            <li>File-based swap - File-based swap space SPI implementation which holds keys in memory</li>\
-                            <li>Not set - File-based swap space SPI with default configuration when it needed</li>\
-                        </ul>')
-                    a.customize(
-                        ng-if=`${swapModel}.kind`
-                        ng-click=`${swapModel}.expanded = !${swapModel}.expanded`
-                    ) {{ #{swapModel}.expanded ? 'Hide settings' : 'Show settings'}}
-                .settings-row
-                    .panel-details(ng-show=`${swapModel}.expanded && ${swapModel}.kind`)
-                        .details-row
-                            +text('Base directory:', `${fileSwapModel}.baseDirectory`, '"baseDirectory"', 'false', 'swapspace',
-                                'Base directory where to write files')
-                        .details-row
-                            +number('Read stripe size:', `${fileSwapModel}.readStripesNumber`, '"readStripesNumber"', 'true', 'availableProcessors', '0',
-                                'Read stripe size defines number of file channels to be used concurrently')
-                        .details-row
-                            +number-min-max-step('Maximum sparsity:', `${fileSwapModel}.maximumSparsity`, '"maximumSparsity"', 'true', '0.5', '0', '0.999', '0.05',
-                                'This property defines maximum acceptable wasted file space to whole file size ratio<br/>\
-                                When this ratio becomes higher than specified number compacting thread starts working')
-                        .details-row
-                            +number('Max write queue size:', `${fileSwapModel}.maxWriteQueueSize`, '"maxWriteQueueSize"', 'true', '1024 * 1024', '0',
-                                'Max write queue size in bytes<br/>\
-                                If there are more values are waiting for being written to disk then specified size, SPI will block on store operation')
-                        .details-row
-                            +number('Write buffer size:', `${fileSwapModel}.writeBufferSize`, '"writeBufferSize"', 'true', '64 * 1024', '0',
-                                'Write buffer size in bytes<br/>\
-                                Write to disk occurs only when this buffer is full')
-            .col-sm-6
-                +preview-xml-java(model, 'clusterSwap')

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug b/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
index aa4b957..7df7e7e 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/igfs/misc.pug
@@ -55,7 +55,7 @@ mixin table-igfs-path-mode-edit(prefix, focusId, index)
                 .settings-row
                     +number('Block size:', `${model}.blockSize`, '"blockSize"', 'true', '65536', '0', 'File data block size in bytes')
                 .settings-row
-                    +number('Stream buffer size:', `${model}.streamBufferSize`, '"streamBufferSize"', 'true', '65536', '0', 'Read/write buffer size for IGFS stream operations in bytes')
+                    +number('Buffer size:', `${model}.bufferSize`, '"bufferSize"', 'true', '65536', '0', 'Read/write buffer size for IGFS stream operations in bytes')
                 .settings-row
                     +number('Maximum space size:', `${model}.maxSpaceSize`, '"maxSpaceSize"', 'true', '0', '0', 'Maximum space available for data cache to store file system entries')
                 .settings-row

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/caches-controller.js b/modules/web-console/frontend/controllers/caches-controller.js
index d4a13e5..176a634 100644
--- a/modules/web-console/frontend/controllers/caches-controller.js
+++ b/modules/web-console/frontend/controllers/caches-controller.js
@@ -82,22 +82,6 @@ export default ['cachesController', [
             }, []);
         }
 
-        const setOffHeapMode = (item) => {
-            if (_.isNil(item.offHeapMaxMemory))
-                return;
-
-            return item.offHeapMode = Math.sign(item.offHeapMaxMemory);
-        };
-
-        const setOffHeapMaxMemory = (value) => {
-            const item = $scope.backupItem;
-
-            if (_.isNil(value) || value <= 0)
-                return item.offHeapMaxMemory = value;
-
-            item.offHeapMaxMemory = item.offHeapMaxMemory > 0 ? item.offHeapMaxMemory : null;
-        };
-
         $scope.tablePairSave = LegacyTable.tablePairSave;
         $scope.tablePairSaveVisible = LegacyTable.tablePairSaveVisible;
         $scope.tableNewItem = LegacyTable.tableNewItem;
@@ -236,8 +220,6 @@ export default ['cachesController', [
                         form.$setDirty();
                 }, true);
 
-                $scope.$watch('backupItem.offHeapMode', setOffHeapMaxMemory);
-
                 $scope.$watch('ui.activePanels.length', () => {
                     ErrorPopover.hide();
                 });
@@ -281,8 +263,6 @@ export default ['cachesController', [
                     $scope.ui.inputForm.$setPristine();
                 }
 
-                setOffHeapMode($scope.backupItem);
-
                 __original_value = ModelNormalizer.normalize($scope.backupItem);
 
                 if (LegacyUtils.getQueryVariable('new'))
@@ -436,18 +416,9 @@ export default ['cachesController', [
             if (LegacyUtils.isEmptyString(item.name))
                 return ErrorPopover.show('cacheNameInput', 'Cache name should not be empty!', $scope.ui, 'general');
 
-            if (item.memoryMode === 'ONHEAP_TIERED' && item.offHeapMaxMemory > 0 && !LegacyUtils.isDefined(item.evictionPolicy.kind))
-                return ErrorPopover.show('evictionPolicyKindInput', 'Eviction policy should be configured!', $scope.ui, 'memory');
-
             if (!LegacyUtils.checkFieldValidators($scope.ui))
                 return false;
 
-            if (item.memoryMode === 'OFFHEAP_VALUES' && !_.isEmpty(item.domains))
-                return ErrorPopover.show('memoryModeInput', 'Query indexing could not be enabled while values are stored off-heap!', $scope.ui, 'memory');
-
-            if (item.memoryMode === 'OFFHEAP_TIERED' && item.offHeapMaxMemory === -1)
-                return ErrorPopover.show('offHeapModeInput', 'Invalid value!', $scope.ui, 'memory');
-
             if (!checkEvictionPolicy(item.evictionPolicy))
                 return false;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index e936955..dba56fc 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -48,7 +48,6 @@ export default ['clustersController', [
             sslContextFactory: {
                 trustManagers: []
             },
-            swapSpaceSpi: {},
             transactionConfiguration: {},
             collision: {}
         };
@@ -232,11 +231,6 @@ export default ['clustersController', [
             {value: 'Kubernetes', label: 'Kubernetes'}
         ];
 
-        $scope.swapSpaceSpis = [
-            {value: 'FileSwapSpaceSpi', label: 'File-based swap'},
-            {value: null, label: 'Not set'}
-        ];
-
         $scope.eventGroups = igniteEventGroups;
 
         $scope.clusters = [];
@@ -282,9 +276,6 @@ export default ['clustersController', [
                     if (!cluster.logger)
                         cluster.logger = {Log4j: { mode: 'Default'}};
 
-                    if (!cluster.eventStorage)
-                        cluster.eventStorage = { kind: 'Memory' };
-
                     if (!cluster.peerClassLoadingLocalClassPathExclude)
                         cluster.peerClassLoadingLocalClassPathExclude = [];
 
@@ -411,7 +402,6 @@ export default ['clustersController', [
                 communication: {tcpNoDelay: true},
                 connector: {noDelay: true},
                 collision: {kind: 'Noop', JobStealing: {stealingEnabled: true}, PriorityQueue: {starvationPreventionEnabled: true}},
-                eventStorage: {kind: 'Memory'},
                 failoverSpi: [],
                 logger: {Log4j: { mode: 'Default'}},
                 caches: linkId && _.find($scope.caches, {value: linkId}) ? [linkId] : [],
@@ -619,26 +609,6 @@ export default ['clustersController', [
             return true;
         }
 
-        function checkSwapConfiguration(item) {
-            const swapKind = item.swapSpaceSpi && item.swapSpaceSpi.kind;
-
-            if (swapKind && item.swapSpaceSpi[swapKind]) {
-                const swap = item.swapSpaceSpi[swapKind];
-
-                const sparsity = swap.maximumSparsity;
-
-                if (LegacyUtils.isDefined(sparsity) && (sparsity < 0 || sparsity >= 1))
-                    return ErrorPopover.show('maximumSparsityInput', 'Maximum sparsity should be more or equal 0 and less than 1!', $scope.ui, 'swap');
-
-                const readStripesNumber = swap.readStripesNumber;
-
-                if (readStripesNumber && !(readStripesNumber === -1 || (readStripesNumber & (readStripesNumber - 1)) === 0))
-                    return ErrorPopover.show('readStripesNumberInput', 'Read stripe size must be positive and power of two!', $scope.ui, 'swap');
-            }
-
-            return true;
-        }
-
         function checkSslConfiguration(item) {
             const r = item.connector;
 
@@ -702,9 +672,6 @@ export default ['clustersController', [
             if (!checkODBC(item))
                 return false;
 
-            if (!checkSwapConfiguration(item))
-                return false;
-
             if (!checkSslConfiguration(item))
                 return false;
 
@@ -759,11 +726,6 @@ export default ['clustersController', [
         $scope.saveItem = function() {
             const item = $scope.backupItem;
 
-            const swapConfigured = item.swapSpaceSpi && item.swapSpaceSpi.kind;
-
-            if (!swapConfigured && _.find(clusterCaches(item), (cache) => cache.swapEnabled))
-                _.merge(item, {swapSpaceSpi: {kind: 'FileSwapSpaceSpi'}});
-
             if (validate(item))
                 save(item);
         };

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/frontend/views/configuration/clusters.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/clusters.tpl.pug b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
index c979012..4a1df33 100644
--- a/modules/web-console/frontend/views/configuration/clusters.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/clusters.tpl.pug
@@ -59,7 +59,6 @@ include /app/helpers/jade/mixins
                             include /app/modules/states/configuration/clusters/metrics
                             include /app/modules/states/configuration/clusters/odbc
                             include /app/modules/states/configuration/clusters/ssl
-                            include /app/modules/states/configuration/clusters/swap
                             include /app/modules/states/configuration/clusters/thread
                             include /app/modules/states/configuration/clusters/time
                             include /app/modules/states/configuration/clusters/transactions

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
index 088ae39..3bd0b5a 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
@@ -41,6 +41,7 @@ import org.apache.ignite.logger.log4j.Log4JLogger;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
 import org.apache.log4j.Logger;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
@@ -78,6 +79,7 @@ public class AgentClusterDemo {
 
         cfg.setIgniteInstanceName((client ? "demo-client-" : "demo-server-" ) + gridIdx);
         cfg.setLocalHost("127.0.0.1");
+        cfg.setEventStorageSpi(new MemoryEventStorageSpi());
         cfg.setIncludeEventTypes(EVTS_DISCOVERY);
 
         TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/web-console/web-agent/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/resources/log4j.properties b/modules/web-console/web-agent/src/main/resources/log4j.properties
index 3b7767c..c4116ac 100644
--- a/modules/web-console/web-agent/src/main/resources/log4j.properties
+++ b/modules/web-console/web-agent/src/main/resources/log4j.properties
@@ -17,7 +17,6 @@ log4j.rootLogger=INFO,console_err,file
 
 log4j.logger.org.apache.http=WARN
 log4j.logger.org.apache.ignite.spi.checkpoint.noop.NoopCheckpointSpi=OFF
-log4j.logger.org.apache.ignite.spi.swapspace.noop.NoopSwapSpaceSpi=OFF
 log4j.logger.org.apache.ignite.internal.managers.collision.GridCollisionManager=ERROR
 log4j.logger.org.apache.commons.beanutils=WARN
 log4j.logger.sun.net.www.protocol.http=WARN


[08/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
index d996f6c..303e6b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
@@ -17,16 +17,35 @@
 
 package org.apache.ignite.internal.visor.query;
 
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
 import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorEither;
+import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
 import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
-import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteBiPredicate;
+
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SQL_QRY_NAME;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchSqlQueryRows;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.scheduleResultSetHolderRemoval;
 
 /**
- * Task for execute SCAN or SQL query and get first page of results.
+ * Task for execute SQL fields query and get first page of results.
  */
 @GridInternal
-public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
+public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, VisorEither<VisorQueryResult>> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -34,4 +53,97 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTupl
     @Override protected VisorQueryJob job(VisorQueryArg arg) {
         return new VisorQueryJob(arg, debug);
     }
-}
\ No newline at end of file
+
+    /**
+     * Job for execute SCAN or SQL query and get first page of results.
+     */
+    private static class VisorQueryJob extends VisorJob<VisorQueryArg, VisorEither<VisorQueryResult>> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with specified argument.
+         *
+         * @param arg Job argument.
+         * @param debug Debug flag.
+         */
+        private VisorQueryJob(VisorQueryArg arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /**
+         * Execute scan query.
+         *
+         * @param c Cache to scan.
+         * @param arg Job argument with query parameters.
+         * @return Query cursor.
+         */
+        private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorQueryArg arg,
+            IgniteBiPredicate<Object, Object> filter) {
+            ScanQuery<Object, Object> qry = new ScanQuery<>(filter);
+            qry.setPageSize(arg.getPageSize());
+            qry.setLocal(arg.isLocal());
+
+            return c.withKeepBinary().query(qry);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected VisorEither<VisorQueryResult> run(final VisorQueryArg arg) {
+            try {
+                IgniteCache<Object, Object> c = ignite.context().cache().jcache(arg.getCacheName());
+                UUID nid = ignite.localNode().id();
+
+                SqlFieldsQuery qry = new SqlFieldsQuery(arg.getQueryText());
+                qry.setPageSize(arg.getPageSize());
+                qry.setLocal(arg.isLocal());
+                qry.setDistributedJoins(arg.isDistributedJoins());
+                qry.setEnforceJoinOrder(arg.isEnforceJoinOrder());
+
+                long start = U.currentTimeMillis();
+
+                VisorQueryCursor<List<?>> cur = new VisorQueryCursor<>(c.withKeepBinary().query(qry));
+
+                Collection<GridQueryFieldMetadata> meta = cur.fieldsMeta();
+
+                if (meta == null)
+                    return new VisorEither<>(
+                        new VisorExceptionWrapper(new SQLException("Fail to execute query. No metadata available.")));
+                else {
+                    List<VisorQueryField> names = new ArrayList<>(meta.size());
+
+                    for (GridQueryFieldMetadata col : meta)
+                        names.add(new VisorQueryField(col.schemaName(), col.typeName(),
+                            col.fieldName(), col.fieldTypeName()));
+
+                    List<Object[]> rows = fetchSqlQueryRows(cur, arg.getPageSize());
+
+                    // Query duration + fetch duration.
+                    long duration = U.currentTimeMillis() - start;
+
+                    boolean hasNext = cur.hasNext();
+
+                    // Generate query ID to store query cursor in node local storage.
+                    String qryId = SQL_QRY_NAME + "-" + UUID.randomUUID();
+
+                    if (hasNext) {
+                        ignite.cluster().<String, VisorQueryCursor<List<?>>>nodeLocalMap().put(qryId, cur);
+
+                        scheduleResultSetHolderRemoval(qryId, ignite);
+                    }
+                    else
+                        cur.close();
+
+                    return new VisorEither<>(new VisorQueryResult(nid, qryId, names, rows, hasNext, duration));
+                }
+            }
+            catch (Throwable e) {
+                return new VisorEither<>(new VisorExceptionWrapper(e));
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorQueryJob.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
index 5faeac0..9a0262d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
@@ -21,14 +21,16 @@ import java.math.BigDecimal;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.ConcurrentMap;
 import javax.cache.Cache;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.binary.BinaryObjectEx;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.SB;
@@ -46,17 +48,8 @@ public class VisorQueryUtils {
     /** Prefix for node local key for SCAN queries. */
     public static final String SCAN_QRY_NAME = "VISOR_SCAN_QUERY";
 
-    /** Prefix for node local key for SCAN near queries. */
-    public static final String SCAN_NEAR_CACHE = "VISOR_SCAN_NEAR_CACHE";
-
-    /** Prefix for node local key for SCAN near queries. */
-    public static final String SCAN_CACHE_WITH_FILTER = "VISOR_SCAN_CACHE_WITH_FILTER";
-
-    /** Prefix for node local key for SCAN near queries. */
-    public static final String SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE = "VISOR_SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE";
-
     /** Columns for SCAN queries. */
-    public static final Collection<VisorQueryField> SCAN_COL_NAMES = Arrays.asList(
+    public static final List<VisorQueryField> SCAN_COL_NAMES = Arrays.asList(
         new VisorQueryField(null, null, "Key Class", ""), new VisorQueryField(null, null, "Key", ""),
         new VisorQueryField(null, null, "Value Class", ""), new VisorQueryField(null, null, "Value", "")
     );
@@ -264,4 +257,32 @@ public class VisorQueryUtils {
 
         return rows;
     }
+
+    /**
+     * @param qryId Unique query result id.
+     */
+    public static void scheduleResultSetHolderRemoval(final String qryId, final IgniteEx ignite) {
+        ignite.context().timeout().addTimeoutObject(new GridTimeoutObjectAdapter(RMV_DELAY) {
+            @Override public void onTimeout() {
+                ConcurrentMap<String, VisorQueryCursor> storage = ignite.cluster().nodeLocalMap();
+
+                VisorQueryCursor cur = storage.get(qryId);
+
+                if (cur != null) {
+                    // If cursor was accessed since last scheduling, set access flag to false and reschedule.
+                    if (cur.accessed()) {
+                        cur.accessed(false);
+
+                        scheduleResultSetHolderRemoval(qryId, ignite);
+                    }
+                    else {
+                        // Remove stored cursor otherwise.
+                        storage.remove(qryId);
+
+                        cur.close();
+                    }
+                }
+            }
+        });
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java
new file mode 100644
index 0000000..a267f06
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQueriesCollectorTask.java
@@ -0,0 +1,96 @@
+/*
+ * 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.internal.visor.query;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Task to collect currently running queries.
+ */
+@GridInternal
+public class VisorRunningQueriesCollectorTask extends VisorMultiNodeTask<Long, Map<UUID, Collection<VisorRunningQuery>>, Collection<VisorRunningQuery>> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorCollectRunningQueriesJob job(Long arg) {
+        return new VisorCollectRunningQueriesJob(arg, debug);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected Map<UUID, Collection<VisorRunningQuery>> reduce0(List<ComputeJobResult> results) throws IgniteException {
+        Map<UUID, Collection<VisorRunningQuery>> map = new HashMap<>();
+
+        for (ComputeJobResult res : results)
+            if (res.getException() == null) {
+                Collection<VisorRunningQuery> queries = res.getData();
+
+                map.put(res.getNode().id(), queries);
+            }
+
+        return map;
+    }
+
+    /**
+     * Job to collect currently running queries from node.
+     */
+    private static class VisorCollectRunningQueriesJob extends VisorJob<Long, Collection<VisorRunningQuery>> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with specified argument.
+         *
+         * @param arg Job argument.
+         * @param debug Flag indicating whether debug information should be printed into node log.
+         */
+        protected VisorCollectRunningQueriesJob(@Nullable Long arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Collection<VisorRunningQuery> run(@Nullable Long duration) throws IgniteException {
+            Collection<GridRunningQueryInfo> queries = ignite.context().query()
+                .runningQueries(duration != null ? duration : 0);
+
+            Collection<VisorRunningQuery> res = new ArrayList<>(queries.size());
+
+            long curTime = U.currentTimeMillis();
+
+            for (GridRunningQueryInfo qry : queries)
+                res.add(new VisorRunningQuery(qry.id(), qry.query(), qry.queryType(), qry.cache(),
+                    qry.startTime(), curTime - qry.startTime(),
+                    qry.cancelable(), qry.local()));
+
+            return res;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
index fc6bc7a..1864718 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
@@ -17,13 +17,18 @@
 
 package org.apache.ignite.internal.visor.query;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Descriptor of running query.
  */
-public class VisorRunningQuery implements Serializable {
+public class VisorRunningQuery extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -52,6 +57,15 @@ public class VisorRunningQuery implements Serializable {
     private boolean loc;
 
     /**
+     * Default constructor.
+     */
+    public VisorRunningQuery() {
+        // No-op.
+    }
+
+    /**
+     * Construct data transfer object for running query information.
+     *
      * @param id Query ID.
      * @param qry Query text.
      * @param qryType Query type.
@@ -129,4 +143,33 @@ public class VisorRunningQuery implements Serializable {
     public boolean isLocal() {
         return loc;
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(id);
+        U.writeString(out, qry);
+        U.writeEnum(out, qryType);
+        U.writeString(out, cache);
+        out.writeLong(startTime);
+        out.writeLong(duration);
+        out.writeBoolean(cancellable);
+        out.writeBoolean(loc);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        id = in.readLong();
+        qry = U.readString(in);
+        qryType = GridCacheQueryType.fromOrdinal(in.readByte());
+        cache = U.readString(in);
+        startTime = in.readLong();
+        duration = in.readLong();
+        cancellable = in.readBoolean();
+        loc = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorRunningQuery.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryArg.java
new file mode 100644
index 0000000..cc12ac5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryArg.java
@@ -0,0 +1,157 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Arguments for {@link VisorScanQueryTask}.
+ */
+public class VisorScanQueryArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Cache name for query. */
+    private String cacheName;
+
+    /** Filter text. */
+    private String filter;
+
+    /** Filter is regular expression */
+    private boolean regEx;
+
+    /** Case sensitive filtration */
+    private boolean caseSensitive;
+
+    /** Scan of near cache */
+    private boolean near;
+
+    /** Flag whether to execute query locally. */
+    private boolean loc;
+
+    /** Result batch size. */
+    private int pageSize;
+
+    /**
+     * Default constructor.
+     */
+    public VisorScanQueryArg() {
+        // No-op.
+    }
+
+    /**
+     * @param cacheName Cache name for query.
+     * @param filter Filter text.
+     * @param regEx Filter is regular expression.
+     * @param caseSensitive Case sensitive filtration.
+     * @param near Scan near cache.
+     * @param loc Flag whether to execute query locally.
+     * @param pageSize Result batch size.
+     */
+    public VisorScanQueryArg(String cacheName, String filter, boolean regEx, boolean caseSensitive, boolean near,
+        boolean loc, int pageSize) {
+        this.cacheName = cacheName;
+        this.filter = filter;
+        this.regEx = regEx;
+        this.caseSensitive = caseSensitive;
+        this.near = near;
+        this.loc = loc;
+        this.pageSize = pageSize;
+    }
+
+    /**
+     * @return Cache name.
+     */
+    public String getCacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @return Filter is regular expression.
+     */
+    public boolean isRegEx() {
+        return regEx;
+    }
+
+    /**
+     * @return Filter.
+     */
+    public String getFilter() {
+        return filter;
+    }
+
+    /**
+     * @return Case sensitive filtration.
+     */
+    public boolean isCaseSensitive() {
+        return caseSensitive;
+    }
+
+    /**
+     * @return Scan of near cache.
+     */
+    public boolean isNear() {
+        return near;
+    }
+
+    /**
+     * @return {@code true} if query should be executed locally.
+     */
+    public boolean isLocal() {
+        return loc;
+    }
+
+    /**
+     * @return Page size.
+     */
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, cacheName);
+        U.writeString(out, filter);
+        out.writeBoolean(regEx);
+        out.writeBoolean(caseSensitive);
+        out.writeBoolean(near);
+        out.writeBoolean(loc);
+        out.writeInt(pageSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        cacheName = U.readString(in);
+        filter = U.readString(in);
+        regEx = in.readBoolean();
+        caseSensitive = in.readBoolean();
+        near = in.readBoolean();
+        loc = in.readBoolean();
+        pageSize = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorScanQueryArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java
new file mode 100644
index 0000000..b8173ba
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorScanQueryTask.java
@@ -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.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.internal.processors.task.GridInternal;
+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.internal.visor.VisorEither;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+import org.apache.ignite.lang.IgniteBiPredicate;
+
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_COL_NAMES;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_QRY_NAME;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchScanQueryRows;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.scheduleResultSetHolderRemoval;
+
+/**
+ * Task for execute SCAN query and get first page of results.
+ */
+@GridInternal
+public class VisorScanQueryTask extends VisorOneNodeTask<VisorScanQueryArg, VisorEither<VisorQueryResult>> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorScanQueryJob job(VisorScanQueryArg arg) {
+        return new VisorScanQueryJob(arg, debug);
+    }
+
+    /**
+     * Job for execute SCAN query and get first page of results.
+     */
+    private static class VisorScanQueryJob extends VisorJob<VisorScanQueryArg, VisorEither<VisorQueryResult>> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with specified argument.
+         *
+         * @param arg Job argument.
+         * @param debug Debug flag.
+         */
+        private VisorScanQueryJob(VisorScanQueryArg arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /**
+         * Execute scan query.
+         *
+         * @param c Cache to scan.
+         * @param arg Job argument with query parameters.
+         * @return Query cursor.
+         */
+        private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorScanQueryArg arg,
+            IgniteBiPredicate<Object, Object> filter) {
+            ScanQuery<Object, Object> qry = new ScanQuery<>(filter);
+            qry.setPageSize(arg.getPageSize());
+            qry.setLocal(arg.isLocal());
+
+            return c.withKeepBinary().query(qry);
+        }
+
+        /**
+         * Scan near cache.
+         *
+         * @param c Cache to scan near entries.
+         * @return Cache entries iterator wrapped with query cursor.
+         */
+        private QueryCursor<Cache.Entry<Object, Object>> near(IgniteCache<Object, Object> c) {
+            return new VisorNearCacheCursor<>(c.localEntries(CachePeekMode.NEAR).iterator());
+        }
+
+        /** {@inheritDoc} */
+        @Override protected VisorEither<VisorQueryResult> run(final VisorScanQueryArg arg) {
+            try {
+                IgniteCache<Object, Object> c = ignite.context().cache().jcache(arg.getCacheName());
+                UUID nid = ignite.localNode().id();
+
+                String filterText = arg.getFilter();
+
+                long start = U.currentTimeMillis();
+
+                IgniteBiPredicate<Object, Object> filter = null;
+
+                if (!F.isEmpty(filterText))
+                    filter = new VisorQueryScanRegexFilter(arg.isCaseSensitive(), arg.isRegEx(), filterText);
+
+                VisorQueryCursor<Cache.Entry<Object, Object>> cur =
+                    new VisorQueryCursor<>(arg.isNear() ? near(c) : scan(c, arg, filter));
+
+                List<Object[]> rows = fetchScanQueryRows(cur, arg.getPageSize());
+
+                long duration = U.currentTimeMillis() - start; // Scan duration + fetch duration.
+
+                boolean hasNext = cur.hasNext();
+
+                // Generate query ID to store query cursor in node local storage.
+                String qryId = SCAN_QRY_NAME + "-" + UUID.randomUUID();
+
+                if (hasNext) {
+                    ignite.cluster().<String, VisorQueryCursor>nodeLocalMap().put(qryId, cur);
+
+                    scheduleResultSetHolderRemoval(qryId, ignite);
+                }
+                else
+                    cur.close();
+
+                return new VisorEither<>(new VisorQueryResult(nid, qryId, SCAN_COL_NAMES, rows, hasNext,
+                    duration));
+            }
+            catch (Throwable e) {
+                return new VisorEither<>(new VisorExceptionWrapper(e));
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorScanQueryJob.class, this);
+        }
+
+        /**
+         * Wrapper for cache iterator to behave like {@link QueryCursor}.
+         */
+        private static class VisorNearCacheCursor<T> implements QueryCursor<T> {
+            /** Wrapped iterator.  */
+            private final Iterator<T> it;
+
+            /**
+             * Wrapping constructor.
+             *
+             * @param it Near cache iterator to wrap.
+             */
+            private VisorNearCacheCursor(Iterator<T> it) {
+                this.it = it;
+            }
+
+            /** {@inheritDoc} */
+            @Override public List<T> getAll() {
+                List<T> all = new ArrayList<>();
+
+                while(it.hasNext())
+                    all.add(it.next());
+
+                return all;
+            }
+
+            /** {@inheritDoc} */
+            @Override public void close() {
+                // Nothing to close.
+            }
+
+            /** {@inheritDoc} */
+            @Override public Iterator<T> iterator() {
+                return it;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
index 26f5c10..4cfd150 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/service/VisorServiceDescriptor.java
@@ -17,17 +17,21 @@
 
 package org.apache.ignite.internal.visor.service;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 import org.apache.ignite.internal.visor.util.VisorTaskUtils;
 import org.apache.ignite.services.ServiceDescriptor;
 
 /**
  * Data transfer object for {@link ServiceDescriptor} object.
  */
-public class VisorServiceDescriptor implements Serializable {
+public class VisorServiceDescriptor extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -65,6 +69,7 @@ public class VisorServiceDescriptor implements Serializable {
     /**
      * Create task result with given parameters
      *
+     * @param srvc Service descriptor to transfer.
      */
     public VisorServiceDescriptor(ServiceDescriptor srvc) {
         name = srvc.name();
@@ -133,6 +138,28 @@ public class VisorServiceDescriptor implements Serializable {
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeString(out, srvcCls);
+        out.writeInt(totalCnt);
+        out.writeInt(maxPerNodeCnt);
+        U.writeString(out, cacheName);
+        U.writeUuid(out, originNodeId);
+        U.writeMap(out, topSnapshot);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        srvcCls = U.readString(in);
+        totalCnt = in.readInt();
+        maxPerNodeCnt = in.readInt();
+        cacheName = U.readString(in);
+        originNodeId = U.readUuid(in);
+        topSnapshot = U.readMap(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorServiceDescriptor.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index e1cd7cf..897ac89 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -52,7 +52,6 @@ import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cache.eviction.EvictionPolicy;
 import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyMBean;
 import org.apache.ignite.cache.eviction.lru.LruEvictionPolicyMBean;
-import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyMBean;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.processors.igfs.IgfsEx;
@@ -66,6 +65,7 @@ import org.apache.ignite.internal.visor.file.VisorFileBlock;
 import org.apache.ignite.internal.visor.log.VisorLogFile;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
 import org.jetbrains.annotations.Nullable;
 
 import static java.lang.System.getProperty;
@@ -138,7 +138,7 @@ public class VisorTaskUtils {
     /** Comparator for log files by last modified date. */
     private static final Comparator<VisorLogFile> LAST_MODIFIED = new Comparator<VisorLogFile>() {
         @Override public int compare(VisorLogFile f1, VisorLogFile f2) {
-            return Long.compare(f2.lastModified(), f1.lastModified());
+            return Long.compare(f2.getLastModified(), f1.getLastModified());
         }
     };
 
@@ -255,7 +255,7 @@ public class VisorTaskUtils {
                     sb.append(", ");
             }
 
-            sb.append("]");
+            sb.append(']');
 
             return sb.toString();
         }
@@ -290,6 +290,26 @@ public class VisorTaskUtils {
     }
 
     /**
+     * Compact classes names.
+
+     * @param clss Classes to compact.
+     * @return Compacted string.
+     */
+    @Nullable public static List<String> compactClasses(Class<?>[] clss) {
+        if (clss == null)
+            return null;
+
+        int len = clss.length;
+
+        List<String> res = new ArrayList<>(len);
+
+        for (Class<?> cls: clss)
+            res.add(U.compact(cls.getName()));
+
+        return res;
+    }
+
+    /**
      * Joins array elements to string.
      *
      * @param arr Array.
@@ -417,7 +437,7 @@ public class VisorTaskUtils {
      * @param evtMapper Closure to map grid events to Visor data transfer objects.
      * @return Collections of node events
      */
-    public static Collection<VisorGridEvent> collectEvents(Ignite ignite, String evtOrderKey, String evtThrottleCntrKey,
+    public static List<VisorGridEvent> collectEvents(Ignite ignite, String evtOrderKey, String evtThrottleCntrKey,
         int[] evtTypes, IgniteClosure<Event, VisorGridEvent> evtMapper) {
         assert ignite != null;
         assert evtTypes != null && evtTypes.length > 0;
@@ -449,7 +469,9 @@ public class VisorTaskUtils {
             }
         };
 
-        Collection<Event> evts = ignite.events().localQuery(p, evtTypes);
+        Collection<Event> evts = ignite.configuration().getEventStorageSpi() instanceof NoopEventStorageSpi
+            ? Collections.<Event>emptyList()
+            : ignite.events().localQuery(p, evtTypes);
 
         // Update latest order in node local, if not empty.
         if (!evts.isEmpty()) {
@@ -464,7 +486,7 @@ public class VisorTaskUtils {
 
         boolean lost = !lastFound.get() && throttle == 0;
 
-        Collection<VisorGridEvent> res = new ArrayList<>(evts.size() + (lost ? 1 : 0));
+        List<VisorGridEvent> res = new ArrayList<>(evts.size() + (lost ? 1 : 0));
 
         if (lost)
             res.add(new VisorGridEventsLost(ignite.cluster().localNode().id()));
@@ -630,6 +652,7 @@ public class VisorTaskUtils {
                 raf.seek(pos);
 
                 byte[] buf = new byte[toRead];
+
                 int cntRead = raf.read(buf, 0, toRead);
 
                 if (cntRead != toRead)
@@ -681,9 +704,6 @@ public class VisorTaskUtils {
         if (plc instanceof FifoEvictionPolicyMBean)
             return ((FifoEvictionPolicyMBean)plc).getMaxSize();
 
-        if (plc instanceof SortedEvictionPolicyMBean)
-            return ((SortedEvictionPolicyMBean)plc).getMaxSize();
-
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
index 9961501..2415fad 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecurityPermissionSet.java
@@ -20,7 +20,6 @@ package org.apache.ignite.plugin.security;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Map;
-import org.apache.ignite.internal.LessNamingBean;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -32,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
  * Property {@link #defaultAllowAll()} specifies whether to allow or deny
  * cache and task operations if they were not explicitly specified.
  */
-public interface SecurityPermissionSet extends Serializable, LessNamingBean {
+public interface SecurityPermissionSet extends Serializable {
     /**
      * Flag indicating whether to allow or deny cache and task operations
      * if they were not explicitly specified.

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
index b4005ea..66e3c7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/SecuritySubject.java
@@ -20,12 +20,11 @@ package org.apache.ignite.plugin.security;
 import java.io.Serializable;
 import java.net.InetSocketAddress;
 import java.util.UUID;
-import org.apache.ignite.internal.LessNamingBean;
 
 /**
  * Security subject representing authenticated node with a set of permissions.
  */
-public interface SecuritySubject extends Serializable, LessNamingBean {
+public interface SecuritySubject extends Serializable {
     /**
      * Gets subject ID.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
index 69ec1ae..3c0f69e 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/segmentation/SegmentationPolicy.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.plugin.segmentation;
 
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Policy that defines how node will react on topology segmentation. Note that default
@@ -45,5 +46,18 @@ public enum SegmentationPolicy {
      * {@link org.apache.ignite.events.EventType#EVT_NODE_SEGMENTED} event and it is up to user to
      * implement logic to handle this event.
      */
-    NOOP
-}
\ No newline at end of file
+    NOOP;
+
+    /** Enumerated values. */
+    private static final SegmentationPolicy[] VALS = values();
+
+    /**
+     * Efficiently gets enumerated value from its ordinal.
+     *
+     * @param ord Ordinal value.
+     * @return Enumerated value or {@code null} if ordinal out of range.
+     */
+    @Nullable public static SegmentationPolicy fromOrdinal(int ord) {
+        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 53550ff..ebd28d8 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -37,13 +37,11 @@ org.apache.ignite.cache.CacheExistsException
 org.apache.ignite.cache.CacheInterceptor
 org.apache.ignite.cache.CacheInterceptorAdapter
 org.apache.ignite.cache.CacheKeyConfiguration
-org.apache.ignite.cache.CacheMemoryMode
 org.apache.ignite.cache.CacheMode
 org.apache.ignite.cache.CachePartialUpdateException
 org.apache.ignite.cache.CachePeekMode
 org.apache.ignite.cache.CacheRebalanceMode
 org.apache.ignite.cache.CacheServerNotFoundException
-org.apache.ignite.cache.CacheTypeFieldMetadata
 org.apache.ignite.cache.CacheWriteSynchronizationMode
 org.apache.ignite.cache.PartitionLossPolicy
 org.apache.ignite.cache.QueryEntity
@@ -53,11 +51,6 @@ org.apache.ignite.cache.affinity.AffinityFunction
 org.apache.ignite.cache.affinity.AffinityKey
 org.apache.ignite.cache.affinity.AffinityKeyMapper
 org.apache.ignite.cache.affinity.AffinityUuid
-org.apache.ignite.cache.affinity.fair.FairAffinityFunction
-org.apache.ignite.cache.affinity.fair.FairAffinityFunction$1
-org.apache.ignite.cache.affinity.fair.FairAffinityFunction$FullAssignmentMap$1
-org.apache.ignite.cache.affinity.fair.FairAffinityFunction$FullAssignmentMap$2
-org.apache.ignite.cache.affinity.fair.FairAffinityFunction$PartitionSetComparator
 org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction
 org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction$HashComparator
 org.apache.ignite.cache.eviction.AbstractEvictionPolicy
@@ -140,6 +133,7 @@ org.apache.ignite.compute.gridify.aop.GridifyDefaultTask
 org.apache.ignite.configuration.CacheConfiguration
 org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate
 org.apache.ignite.configuration.CollectionConfiguration
+org.apache.ignite.configuration.DataPageEvictionMode
 org.apache.ignite.configuration.DeploymentMode
 org.apache.ignite.configuration.IgniteReflectionFactory
 org.apache.ignite.configuration.MemoryConfiguration
@@ -329,6 +323,7 @@ org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage
 org.apache.ignite.internal.managers.indexing.GridIndexingManager$1
 org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerAdapter
 org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager$1
+org.apache.ignite.internal.marshaller.optimized.OptimizedFieldType
 org.apache.ignite.internal.mem.OutOfMemoryException
 org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl$Segment
 org.apache.ignite.internal.pagemem.snapshot.SnapshotFinishedMessage
@@ -461,19 +456,10 @@ org.apache.ignite.internal.processors.cache.GridCacheContext$4
 org.apache.ignite.internal.processors.cache.GridCacheContext$5
 org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper
 org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper$1
-org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper$2
 org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager$3
 org.apache.ignite.internal.processors.cache.GridCacheEntryInfo
 org.apache.ignite.internal.processors.cache.GridCacheEntryRedeployException
 org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException
-org.apache.ignite.internal.processors.cache.GridCacheEvictionManager$2
-org.apache.ignite.internal.processors.cache.GridCacheEvictionManager$3
-org.apache.ignite.internal.processors.cache.GridCacheEvictionManager$5
-org.apache.ignite.internal.processors.cache.GridCacheEvictionManager$6
-org.apache.ignite.internal.processors.cache.GridCacheEvictionManager$7
-org.apache.ignite.internal.processors.cache.GridCacheEvictionManager$EvictionFuture$2
-org.apache.ignite.internal.processors.cache.GridCacheEvictionRequest
-org.apache.ignite.internal.processors.cache.GridCacheEvictionResponse
 org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan
 org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan$1
 org.apache.ignite.internal.processors.cache.GridCacheFilterFailedException
@@ -491,9 +477,9 @@ org.apache.ignite.internal.processors.cache.GridCacheMessage
 org.apache.ignite.internal.processors.cache.GridCacheMultiTxFuture$1
 org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate
 org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate$Mask
-org.apache.ignite.internal.processors.cache.GridCacheMvccManager$4
 org.apache.ignite.internal.processors.cache.GridCacheMvccManager$5
 org.apache.ignite.internal.processors.cache.GridCacheMvccManager$6
+org.apache.ignite.internal.processors.cache.GridCacheMvccManager$7
 org.apache.ignite.internal.processors.cache.GridCacheMvccManager$FinishLockFuture$1
 org.apache.ignite.internal.processors.cache.GridCacheOperation
 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$1$1
@@ -627,7 +613,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetSingleFutu
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetSingleFuture$2
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtGetSingleFuture$3
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition$1
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$1
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$2
 org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture$3
@@ -701,6 +686,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$3
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$30
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$31
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$32
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$4
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5
 org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6
@@ -889,15 +875,12 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$FieldsResult
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$1
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$2
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$3
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$PeekValueExpiryAwareIterator
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$QueryResult
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$RequestFutureMap
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$RequestFutureMap$1
 org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsAdapter
@@ -939,7 +922,6 @@ org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Stor
 org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$ValueStatus
 org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx$FinalizationStatus
 org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter$1
 org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry
 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$1
 org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$10
@@ -1107,7 +1089,6 @@ org.apache.ignite.internal.processors.datastructures.GridCacheLockImpl$Sync
 org.apache.ignite.internal.processors.datastructures.GridCacheLockState
 org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$AddProcessor
 org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$ClearProcessor
-org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$CollocatedItemKey
 org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$PollProcessor
 org.apache.ignite.internal.processors.datastructures.GridCacheQueueAdapter$RemoveProcessor
 org.apache.ignite.internal.processors.datastructures.GridCacheQueueHeader
@@ -1119,7 +1100,6 @@ org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl$Sync
 org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreState
 org.apache.ignite.internal.processors.datastructures.GridCacheSetHeader
 org.apache.ignite.internal.processors.datastructures.GridCacheSetHeaderKey
-org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl$CollocatedItemKey
 org.apache.ignite.internal.processors.datastructures.GridCacheSetImpl$SumReducer
 org.apache.ignite.internal.processors.datastructures.GridCacheSetItemKey
 org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy
@@ -1307,7 +1287,6 @@ org.apache.ignite.internal.processors.query.GridQueryProcessor$6
 org.apache.ignite.internal.processors.query.GridQueryProcessor$7
 org.apache.ignite.internal.processors.query.GridQueryProcessor$8
 org.apache.ignite.internal.processors.query.IgniteSQLException
-org.apache.ignite.internal.processors.query.QueryUtils$IndexType
 org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
 org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
 org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
@@ -1415,8 +1394,6 @@ org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
 org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException
 org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException
 org.apache.ignite.internal.util.F0$1
-org.apache.ignite.internal.util.F0$10
-org.apache.ignite.internal.util.F0$11
 org.apache.ignite.internal.util.F0$2
 org.apache.ignite.internal.util.F0$3
 org.apache.ignite.internal.util.F0$4
@@ -1515,7 +1492,6 @@ org.apache.ignite.internal.util.future.GridEmbeddedFuture$AL1
 org.apache.ignite.internal.util.future.GridEmbeddedFuture$AL2
 org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1
 org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener2
-org.apache.ignite.internal.util.future.GridFutureAdapter$ArrayListener
 org.apache.ignite.internal.util.future.GridFutureChainListener
 org.apache.ignite.internal.util.future.IgniteFutureImpl$1
 org.apache.ignite.internal.util.future.IgniteFutureImpl$InternalFutureListener
@@ -1537,78 +1513,6 @@ org.apache.ignite.internal.util.lang.GridAbsClosure
 org.apache.ignite.internal.util.lang.GridAbsClosureX
 org.apache.ignite.internal.util.lang.GridCloseableIterator
 org.apache.ignite.internal.util.lang.GridClosureException
-org.apache.ignite.internal.util.lang.GridFunc$1
-org.apache.ignite.internal.util.lang.GridFunc$10
-org.apache.ignite.internal.util.lang.GridFunc$11
-org.apache.ignite.internal.util.lang.GridFunc$12
-org.apache.ignite.internal.util.lang.GridFunc$13
-org.apache.ignite.internal.util.lang.GridFunc$14
-org.apache.ignite.internal.util.lang.GridFunc$15
-org.apache.ignite.internal.util.lang.GridFunc$16
-org.apache.ignite.internal.util.lang.GridFunc$17
-org.apache.ignite.internal.util.lang.GridFunc$18
-org.apache.ignite.internal.util.lang.GridFunc$19
-org.apache.ignite.internal.util.lang.GridFunc$2
-org.apache.ignite.internal.util.lang.GridFunc$20
-org.apache.ignite.internal.util.lang.GridFunc$21
-org.apache.ignite.internal.util.lang.GridFunc$22
-org.apache.ignite.internal.util.lang.GridFunc$23
-org.apache.ignite.internal.util.lang.GridFunc$24
-org.apache.ignite.internal.util.lang.GridFunc$25
-org.apache.ignite.internal.util.lang.GridFunc$26
-org.apache.ignite.internal.util.lang.GridFunc$27
-org.apache.ignite.internal.util.lang.GridFunc$28
-org.apache.ignite.internal.util.lang.GridFunc$29
-org.apache.ignite.internal.util.lang.GridFunc$3
-org.apache.ignite.internal.util.lang.GridFunc$30
-org.apache.ignite.internal.util.lang.GridFunc$31
-org.apache.ignite.internal.util.lang.GridFunc$32
-org.apache.ignite.internal.util.lang.GridFunc$32$1
-org.apache.ignite.internal.util.lang.GridFunc$33
-org.apache.ignite.internal.util.lang.GridFunc$33$1
-org.apache.ignite.internal.util.lang.GridFunc$35
-org.apache.ignite.internal.util.lang.GridFunc$36
-org.apache.ignite.internal.util.lang.GridFunc$37
-org.apache.ignite.internal.util.lang.GridFunc$38
-org.apache.ignite.internal.util.lang.GridFunc$39
-org.apache.ignite.internal.util.lang.GridFunc$4
-org.apache.ignite.internal.util.lang.GridFunc$40
-org.apache.ignite.internal.util.lang.GridFunc$41
-org.apache.ignite.internal.util.lang.GridFunc$42
-org.apache.ignite.internal.util.lang.GridFunc$43
-org.apache.ignite.internal.util.lang.GridFunc$44
-org.apache.ignite.internal.util.lang.GridFunc$45
-org.apache.ignite.internal.util.lang.GridFunc$46
-org.apache.ignite.internal.util.lang.GridFunc$47
-org.apache.ignite.internal.util.lang.GridFunc$48
-org.apache.ignite.internal.util.lang.GridFunc$49
-org.apache.ignite.internal.util.lang.GridFunc$49$1
-org.apache.ignite.internal.util.lang.GridFunc$49$2
-org.apache.ignite.internal.util.lang.GridFunc$5
-org.apache.ignite.internal.util.lang.GridFunc$50
-org.apache.ignite.internal.util.lang.GridFunc$50$1
-org.apache.ignite.internal.util.lang.GridFunc$50$2
-org.apache.ignite.internal.util.lang.GridFunc$51
-org.apache.ignite.internal.util.lang.GridFunc$51$1
-org.apache.ignite.internal.util.lang.GridFunc$51$2
-org.apache.ignite.internal.util.lang.GridFunc$52
-org.apache.ignite.internal.util.lang.GridFunc$52$1
-org.apache.ignite.internal.util.lang.GridFunc$52$2
-org.apache.ignite.internal.util.lang.GridFunc$53
-org.apache.ignite.internal.util.lang.GridFunc$54
-org.apache.ignite.internal.util.lang.GridFunc$55
-org.apache.ignite.internal.util.lang.GridFunc$56
-org.apache.ignite.internal.util.lang.GridFunc$57
-org.apache.ignite.internal.util.lang.GridFunc$58
-org.apache.ignite.internal.util.lang.GridFunc$59
-org.apache.ignite.internal.util.lang.GridFunc$6
-org.apache.ignite.internal.util.lang.GridFunc$60
-org.apache.ignite.internal.util.lang.GridFunc$61
-org.apache.ignite.internal.util.lang.GridFunc$62
-org.apache.ignite.internal.util.lang.GridFunc$63
-org.apache.ignite.internal.util.lang.GridFunc$7
-org.apache.ignite.internal.util.lang.GridFunc$8
-org.apache.ignite.internal.util.lang.GridFunc$9
 org.apache.ignite.internal.util.lang.GridIterable
 org.apache.ignite.internal.util.lang.GridIterableAdapter
 org.apache.ignite.internal.util.lang.GridIterableAdapter$IteratorWrapper
@@ -1639,9 +1543,57 @@ org.apache.ignite.internal.util.lang.IgniteReducer3
 org.apache.ignite.internal.util.lang.IgniteReducer3X
 org.apache.ignite.internal.util.lang.IgniteReducerX
 org.apache.ignite.internal.util.lang.IgniteSingletonIterator
+org.apache.ignite.internal.util.lang.gridfunc.AlwaysFalsePredicate
+org.apache.ignite.internal.util.lang.gridfunc.AlwaysTruePredicate
+org.apache.ignite.internal.util.lang.gridfunc.AlwaysTrueReducer
+org.apache.ignite.internal.util.lang.gridfunc.AtomicIntegerFactoryCallable
+org.apache.ignite.internal.util.lang.gridfunc.CacheEntryGetValueClosure
+org.apache.ignite.internal.util.lang.gridfunc.CacheEntryHasPeekPredicate
+org.apache.ignite.internal.util.lang.gridfunc.ClusterNodeGetIdClosure
+org.apache.ignite.internal.util.lang.gridfunc.ConcurrentDequeFactoryCallable
+org.apache.ignite.internal.util.lang.gridfunc.ConcurrentHashSetFactoryCallable
+org.apache.ignite.internal.util.lang.gridfunc.ConcurrentMapFactoryCallable
+org.apache.ignite.internal.util.lang.gridfunc.ContainsNodeIdsPredicate
+org.apache.ignite.internal.util.lang.gridfunc.ContainsPredicate
+org.apache.ignite.internal.util.lang.gridfunc.EntryByKeyEvaluationPredicate
+org.apache.ignite.internal.util.lang.gridfunc.EqualsClusterNodeIdPredicate
+org.apache.ignite.internal.util.lang.gridfunc.EqualsUuidPredicate
+org.apache.ignite.internal.util.lang.gridfunc.FlatCollectionWrapper
+org.apache.ignite.internal.util.lang.gridfunc.FlatIterator
+org.apache.ignite.internal.util.lang.gridfunc.HasEqualIdPredicate
+org.apache.ignite.internal.util.lang.gridfunc.HasNotEqualIdPredicate
+org.apache.ignite.internal.util.lang.gridfunc.IdentityClosure
+org.apache.ignite.internal.util.lang.gridfunc.IntSumReducer
+org.apache.ignite.internal.util.lang.gridfunc.IsAllPredicate
+org.apache.ignite.internal.util.lang.gridfunc.IsNotAllPredicate
+org.apache.ignite.internal.util.lang.gridfunc.IsNotNullPredicate
+org.apache.ignite.internal.util.lang.gridfunc.LongSumReducer
+org.apache.ignite.internal.util.lang.gridfunc.MapFactoryCallable
+org.apache.ignite.internal.util.lang.gridfunc.MultipleIterator
+org.apache.ignite.internal.util.lang.gridfunc.NoOpClosure
+org.apache.ignite.internal.util.lang.gridfunc.NotContainsPredicate
+org.apache.ignite.internal.util.lang.gridfunc.NotEqualPredicate
+org.apache.ignite.internal.util.lang.gridfunc.PredicateCollectionView
+org.apache.ignite.internal.util.lang.gridfunc.PredicateMapView
+org.apache.ignite.internal.util.lang.gridfunc.PredicateMapView$1
+org.apache.ignite.internal.util.lang.gridfunc.PredicateSetView
+org.apache.ignite.internal.util.lang.gridfunc.PredicateSetView$1
+org.apache.ignite.internal.util.lang.gridfunc.ReadOnlyCollectionView
+org.apache.ignite.internal.util.lang.gridfunc.ReadOnlyCollectionView$1
+org.apache.ignite.internal.util.lang.gridfunc.ReadOnlyCollectionView2X
+org.apache.ignite.internal.util.lang.gridfunc.ReadOnlyCollectionView2X$1
+org.apache.ignite.internal.util.lang.gridfunc.RunnableWrapperClosure
+org.apache.ignite.internal.util.lang.gridfunc.SetFactoryCallable
+org.apache.ignite.internal.util.lang.gridfunc.StringConcatReducer
+org.apache.ignite.internal.util.lang.gridfunc.ToStringClosure
+org.apache.ignite.internal.util.lang.gridfunc.TransformCollectionView
+org.apache.ignite.internal.util.lang.gridfunc.TransformFilteringIterator
+org.apache.ignite.internal.util.lang.gridfunc.TransformMapView
+org.apache.ignite.internal.util.lang.gridfunc.TransformMapView$1
+org.apache.ignite.internal.util.lang.gridfunc.TransformMapView2
+org.apache.ignite.internal.util.lang.gridfunc.TransformMapView2$1
 org.apache.ignite.internal.util.nio.GridNioEmbeddedFuture$1
 org.apache.ignite.internal.util.nio.GridNioException
-org.apache.ignite.internal.util.nio.GridNioFutureImpl
 org.apache.ignite.internal.util.nio.GridNioMessageTracker
 org.apache.ignite.internal.util.nio.GridNioServer$NioOperation
 org.apache.ignite.internal.util.nio.GridNioServer$RandomBalancer
@@ -1698,32 +1650,42 @@ org.apache.ignite.internal.util.typedef.T4
 org.apache.ignite.internal.util.typedef.T5
 org.apache.ignite.internal.util.typedef.T6
 org.apache.ignite.internal.util.typedef.internal.SB
+org.apache.ignite.internal.visor.VisorDataTransferObject
+org.apache.ignite.internal.visor.VisorEither
 org.apache.ignite.internal.visor.VisorJob
 org.apache.ignite.internal.visor.VisorMultiNodeTask
 org.apache.ignite.internal.visor.VisorOneNodeTask
 org.apache.ignite.internal.visor.VisorTaskArgument
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadata
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTask
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTask$VisorBinaryCollectMetadataJob
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataCollectorTaskResult
+org.apache.ignite.internal.visor.binary.VisorBinaryMetadataField
 org.apache.ignite.internal.visor.cache.VisorCache
 org.apache.ignite.internal.visor.cache.VisorCacheAffinityConfiguration
 org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTask
 org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTask$VisorCacheAffinityNodeJob
+org.apache.ignite.internal.visor.cache.VisorCacheAffinityNodeTaskArg
 org.apache.ignite.internal.visor.cache.VisorCacheAggregatedMetrics
 org.apache.ignite.internal.visor.cache.VisorCacheClearTask
-org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearCallable
 org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob
 org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob$1
-org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheSizeCallable
+org.apache.ignite.internal.visor.cache.VisorCacheClearTaskResult
 org.apache.ignite.internal.visor.cache.VisorCacheConfiguration
 org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorJob
 org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorTask
-org.apache.ignite.internal.visor.cache.VisorCacheDefaultConfiguration
 org.apache.ignite.internal.visor.cache.VisorCacheEvictionConfiguration
+org.apache.ignite.internal.visor.cache.VisorCacheJdbcType
+org.apache.ignite.internal.visor.cache.VisorCacheJdbcTypeField
 org.apache.ignite.internal.visor.cache.VisorCacheLoadTask
 org.apache.ignite.internal.visor.cache.VisorCacheLoadTask$VisorCachesLoadJob
+org.apache.ignite.internal.visor.cache.VisorCacheLoadTaskArg
 org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask
 org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask$VisorCacheMetadataJob
 org.apache.ignite.internal.visor.cache.VisorCacheMetrics
 org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask
 org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask$VisorCacheMetricsCollectorJob
+org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTaskArg
 org.apache.ignite.internal.visor.cache.VisorCacheNearConfiguration
 org.apache.ignite.internal.visor.cache.VisorCacheNodesTask
 org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob
@@ -1731,39 +1693,33 @@ org.apache.ignite.internal.visor.cache.VisorCachePartition
 org.apache.ignite.internal.visor.cache.VisorCachePartitions
 org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
 org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
-org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetrics
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
-org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
 org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
 org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
 org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob
 org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask
 org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask$VisorCacheResetQueryMetricsJob
+org.apache.ignite.internal.visor.cache.VisorCacheSqlIndexMetadata
+org.apache.ignite.internal.visor.cache.VisorCacheSqlMetadata
+org.apache.ignite.internal.visor.cache.VisorCacheStartArg
 org.apache.ignite.internal.visor.cache.VisorCacheStartTask
-org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg
 org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
 org.apache.ignite.internal.visor.cache.VisorCacheStopTask
 org.apache.ignite.internal.visor.cache.VisorCacheStopTask$VisorCacheStopJob
 org.apache.ignite.internal.visor.cache.VisorCacheStoreConfiguration
-org.apache.ignite.internal.visor.cache.VisorCacheTypeFieldMetadata
-org.apache.ignite.internal.visor.cache.VisorCacheTypeMetadata
+org.apache.ignite.internal.visor.cache.VisorPartitionMap
 org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask
 org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob
 org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask
 org.apache.ignite.internal.visor.compute.VisorComputeResetMetricsTask$VisorComputeResetMetricsJob
 org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask
 org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTask$VisorComputeToggleMonitoringJob
+org.apache.ignite.internal.visor.compute.VisorComputeToggleMonitoringTaskArg
 org.apache.ignite.internal.visor.compute.VisorGatewayTask
 org.apache.ignite.internal.visor.compute.VisorGatewayTask$VisorGatewayJob
 org.apache.ignite.internal.visor.compute.VisorGatewayTask$VisorGatewayJob$1
 org.apache.ignite.internal.visor.debug.VisorThreadDumpTask
 org.apache.ignite.internal.visor.debug.VisorThreadDumpTask$VisorDumpThreadJob
+org.apache.ignite.internal.visor.debug.VisorThreadDumpTaskResult
 org.apache.ignite.internal.visor.debug.VisorThreadInfo
 org.apache.ignite.internal.visor.debug.VisorThreadLockInfo
 org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo
@@ -1774,11 +1730,12 @@ org.apache.ignite.internal.visor.event.VisorGridEventsLost
 org.apache.ignite.internal.visor.event.VisorGridJobEvent
 org.apache.ignite.internal.visor.event.VisorGridTaskEvent
 org.apache.ignite.internal.visor.file.VisorFileBlock
+org.apache.ignite.internal.visor.file.VisorFileBlockArg
 org.apache.ignite.internal.visor.file.VisorFileBlockTask
-org.apache.ignite.internal.visor.file.VisorFileBlockTask$VisorFileBlockArg
 org.apache.ignite.internal.visor.file.VisorFileBlockTask$VisorFileBlockJob
 org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask
 org.apache.ignite.internal.visor.file.VisorLatestTextFilesTask$VisorLatestTextFilesJob
+org.apache.ignite.internal.visor.file.VisorLatestTextFilesTaskArg
 org.apache.ignite.internal.visor.igfs.VisorIgfs
 org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint
 org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask
@@ -1786,6 +1743,7 @@ org.apache.ignite.internal.visor.igfs.VisorIgfsFormatTask$VisorIgfsFormatJob
 org.apache.ignite.internal.visor.igfs.VisorIgfsMetrics
 org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask
 org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTask$VisorIgfsProfilerClearJob
+org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerClearTaskResult
 org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerEntry
 org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask
 org.apache.ignite.internal.visor.igfs.VisorIgfsProfilerTask$VisorIgfsProfilerJob
@@ -1794,11 +1752,13 @@ org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask
 org.apache.ignite.internal.visor.igfs.VisorIgfsResetMetricsTask$VisorIgfsResetMetricsJob
 org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask
 org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTask$VisorIgfsSamplingStateJob
+org.apache.ignite.internal.visor.igfs.VisorIgfsSamplingStateTaskArg
 org.apache.ignite.internal.visor.log.VisorLogFile
+org.apache.ignite.internal.visor.log.VisorLogSearchArg
 org.apache.ignite.internal.visor.log.VisorLogSearchResult
 org.apache.ignite.internal.visor.log.VisorLogSearchTask
-org.apache.ignite.internal.visor.log.VisorLogSearchTask$VisorLogSearchArg
 org.apache.ignite.internal.visor.log.VisorLogSearchTask$VisorLogSearchJob
+org.apache.ignite.internal.visor.log.VisorLogSearchTaskResult
 org.apache.ignite.internal.visor.misc.VisorAckTask
 org.apache.ignite.internal.visor.misc.VisorAckTask$VisorAckJob
 org.apache.ignite.internal.visor.misc.VisorChangeGridActiveStateTask
@@ -1828,38 +1788,58 @@ org.apache.ignite.internal.visor.node.VisorNodeDataCollectorTaskResult
 org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
 org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask$VisorNodeEventsCollectorJob
 org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask$VisorNodeEventsCollectorJob$1
-org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask$VisorNodeEventsCollectorTaskArg
+org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTaskArg
 org.apache.ignite.internal.visor.node.VisorNodeGcTask
 org.apache.ignite.internal.visor.node.VisorNodeGcTask$VisorNodeGcJob
+org.apache.ignite.internal.visor.node.VisorNodeGcTaskResult
 org.apache.ignite.internal.visor.node.VisorNodePingTask
 org.apache.ignite.internal.visor.node.VisorNodePingTask$VisorNodePingJob
+org.apache.ignite.internal.visor.node.VisorNodePingTaskResult
 org.apache.ignite.internal.visor.node.VisorNodeRestartTask
 org.apache.ignite.internal.visor.node.VisorNodeRestartTask$VisorNodesRestartJob
 org.apache.ignite.internal.visor.node.VisorNodeStopTask
 org.apache.ignite.internal.visor.node.VisorNodeStopTask$VisorNodesStopJob
+org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrors
 org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask
 org.apache.ignite.internal.visor.node.VisorNodeSuppressedErrorsTask$VisorNodeSuppressedErrorsJob
 org.apache.ignite.internal.visor.node.VisorPeerToPeerConfiguration
 org.apache.ignite.internal.visor.node.VisorRestConfiguration
 org.apache.ignite.internal.visor.node.VisorSegmentationConfiguration
+org.apache.ignite.internal.visor.node.VisorSpiDescription
 org.apache.ignite.internal.visor.node.VisorSpisConfiguration
+org.apache.ignite.internal.visor.node.VisorSuppressedError
 org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
-org.apache.ignite.internal.visor.query.VisorCancelQueriesTask
-org.apache.ignite.internal.visor.query.VisorCancelQueriesTask$VisorCancelQueriesJob
-org.apache.ignite.internal.visor.query.VisorCollectRunningQueriesTask
-org.apache.ignite.internal.visor.query.VisorCollectRunningQueriesTask$VisorCollectRunningQueriesJob
 org.apache.ignite.internal.visor.query.VisorQueryArg
+org.apache.ignite.internal.visor.query.VisorQueryCancelTask
+org.apache.ignite.internal.visor.query.VisorQueryCancelTask$VisorCancelQueriesJob
 org.apache.ignite.internal.visor.query.VisorQueryCleanupTask
 org.apache.ignite.internal.visor.query.VisorQueryCleanupTask$VisorQueryCleanupJob
+org.apache.ignite.internal.visor.query.VisorQueryConfiguration
+org.apache.ignite.internal.visor.query.VisorQueryDetailMetrics
+org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTask
+org.apache.ignite.internal.visor.query.VisorQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
+org.apache.ignite.internal.visor.query.VisorQueryEntity
 org.apache.ignite.internal.visor.query.VisorQueryField
-org.apache.ignite.internal.visor.query.VisorQueryJob
+org.apache.ignite.internal.visor.query.VisorQueryIndex
+org.apache.ignite.internal.visor.query.VisorQueryIndexField
+org.apache.ignite.internal.visor.query.VisorQueryMetrics
 org.apache.ignite.internal.visor.query.VisorQueryNextPageTask
 org.apache.ignite.internal.visor.query.VisorQueryNextPageTask$VisorQueryNextPageJob
+org.apache.ignite.internal.visor.query.VisorQueryNextPageTaskArg
+org.apache.ignite.internal.visor.query.VisorQueryResetDetailMetricsTask
+org.apache.ignite.internal.visor.query.VisorQueryResetDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
+org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTask
+org.apache.ignite.internal.visor.query.VisorQueryResetMetricsTask$VisorQueryResetMetricsJob
 org.apache.ignite.internal.visor.query.VisorQueryResult
-org.apache.ignite.internal.visor.query.VisorQueryResultEx
-org.apache.ignite.internal.visor.query.VisorQueryScanSubstringFilter
+org.apache.ignite.internal.visor.query.VisorQueryScanRegexFilter
 org.apache.ignite.internal.visor.query.VisorQueryTask
+org.apache.ignite.internal.visor.query.VisorQueryTask$VisorQueryJob
+org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTask
+org.apache.ignite.internal.visor.query.VisorRunningQueriesCollectorTask$VisorCollectRunningQueriesJob
 org.apache.ignite.internal.visor.query.VisorRunningQuery
+org.apache.ignite.internal.visor.query.VisorScanQueryArg
+org.apache.ignite.internal.visor.query.VisorScanQueryTask
+org.apache.ignite.internal.visor.query.VisorScanQueryTask$VisorScanQueryJob
 org.apache.ignite.internal.visor.service.VisorCancelServiceTask
 org.apache.ignite.internal.visor.service.VisorCancelServiceTask$VisorCancelServiceJob
 org.apache.ignite.internal.visor.service.VisorServiceDescriptor
@@ -1888,7 +1868,6 @@ org.apache.ignite.lang.IgniteRunnable
 org.apache.ignite.lang.IgniteUuid
 org.apache.ignite.lifecycle.LifecycleEventType
 org.apache.ignite.marshaller.jdk.JdkMarshallerDummySerializable
-org.apache.ignite.internal.marshaller.optimized.OptimizedFieldType
 org.apache.ignite.messaging.MessagingListenActor
 org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction
 org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory
@@ -1923,8 +1902,8 @@ org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointData
 org.apache.ignite.spi.collision.jobstealing.JobStealingRequest
 org.apache.ignite.spi.collision.priorityqueue.PriorityQueueCollisionSpi$PriorityGridCollisionJobContextComparator
 org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$1
+org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$10
 org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$11
-org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$12
 org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure
 org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosure$1
 org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2$ConnectClosureNew
@@ -1983,6 +1962,7 @@ org.apache.ignite.stream.StreamVisitor
 org.apache.ignite.stream.StreamVisitor$1
 org.apache.ignite.transactions.TransactionConcurrency
 org.apache.ignite.transactions.TransactionDeadlockException
+org.apache.ignite.transactions.TransactionException
 org.apache.ignite.transactions.TransactionHeuristicException
 org.apache.ignite.transactions.TransactionIsolation
 org.apache.ignite.transactions.TransactionMetrics

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/hadoop/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/resources/META-INF/classnames.properties b/modules/hadoop/src/main/resources/META-INF/classnames.properties
index d8848ac..051094d 100644
--- a/modules/hadoop/src/main/resources/META-INF/classnames.properties
+++ b/modules/hadoop/src/main/resources/META-INF/classnames.properties
@@ -27,14 +27,6 @@ org.apache.ignite.hadoop.util.KerberosUserNameMapper$State
 org.apache.ignite.hadoop.util.UserNameMapper
 org.apache.ignite.internal.processors.hadoop.HadoopAttributes
 org.apache.ignite.internal.processors.hadoop.HadoopExternalSplit
-org.apache.ignite.internal.processors.hadoop.HadoopFileBlock
-org.apache.ignite.hadoop.HadoopInputSplit
-org.apache.ignite.internal.processors.hadoop.HadoopJobId
-org.apache.ignite.internal.processors.hadoop.HadoopJobInfo
-org.apache.ignite.internal.processors.hadoop.HadoopJobPhase
-org.apache.ignite.internal.processors.hadoop.HadoopJobProperty
-org.apache.ignite.internal.processors.hadoop.HadoopJobStatus
-org.apache.ignite.hadoop.HadoopMapReducePlan
 org.apache.ignite.internal.processors.hadoop.HadoopSplitWrapper
 org.apache.ignite.internal.processors.hadoop.HadoopTaskCancelledException
 org.apache.ignite.internal.processors.hadoop.counter.HadoopCounterAdapter

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
index 6289bdb..44dd09c 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyObjectMapper.java
@@ -29,19 +29,11 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
 import com.fasterxml.jackson.databind.ser.SerializerFactory;
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.sql.SQLException;
 import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
 import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.ignite.internal.LessNamingBean;
-import org.apache.ignite.internal.visor.cache.VisorCache;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
 import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteUuid;
@@ -63,7 +55,8 @@ public class GridJettyObjectMapper extends ObjectMapper {
         module.addSerializer(Throwable.class, THROWABLE_SERIALIZER);
         module.addSerializer(IgniteBiTuple.class, IGNITE_TUPLE_SERIALIZER);
         module.addSerializer(IgniteUuid.class, IGNITE_UUID_SERIALIZER);
-        module.addSerializer(LessNamingBean.class, LESS_NAMING_SERIALIZER);
+        module.addSerializer(GridCacheSqlMetadata.class, IGNITE_SQL_METADATA_SERIALIZER);
+        module.addSerializer(GridCacheSqlIndexMetadata.class, IGNITE_SQL_INDEX_METADATA_SERIALIZER);
 
         registerModule(module);
     }
@@ -186,89 +179,35 @@ public class GridJettyObjectMapper extends ObjectMapper {
         }
     };
 
-    /**
-     * Custom serializer for Visor classes with non JavaBeans getters.
-     */
-    private static final JsonSerializer<Object> LESS_NAMING_SERIALIZER = new JsonSerializer<Object>() {
-        /** Methods to exclude. */
-        private final Collection<String> exclMtds = Arrays.asList("toString", "hashCode", "clone", "getClass");
+    /** Custom serializer for {@link GridCacheSqlMetadata} */
+    private static final JsonSerializer<GridCacheSqlMetadata> IGNITE_SQL_METADATA_SERIALIZER = new JsonSerializer<GridCacheSqlMetadata>() {
+        /** {@inheritDoc} */
+        @Override public void serialize(GridCacheSqlMetadata m, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeStartObject();
 
-        /** */
-        private final Map<Class<?>, Collection<Method>> clsCache = new HashMap<>();
+            gen.writeStringField("cacheName", m.cacheName());
+            gen.writeObjectField("types", m.types());
+            gen.writeObjectField("keyClasses", m.keyClasses());
+            gen.writeObjectField("valClasses", m.valClasses());
+            gen.writeObjectField("fields", m.fields());
+            gen.writeObjectField("indexes", m.indexes());
 
-        /** */
-        private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
+            gen.writeEndObject();
+        }
+    };
 
+    /** Custom serializer for {@link GridCacheSqlIndexMetadata} */
+    private static final JsonSerializer<GridCacheSqlIndexMetadata> IGNITE_SQL_INDEX_METADATA_SERIALIZER = new JsonSerializer<GridCacheSqlIndexMetadata>() {
         /** {@inheritDoc} */
-        @Override public void serialize(Object bean, JsonGenerator gen, SerializerProvider ser) throws IOException {
-            if (bean != null) {
-                gen.writeStartObject();
-
-                Class<?> cls = bean.getClass();
-
-                Collection<Method> methods;
-
-                // Get descriptor from cache.
-                rwLock.readLock().lock();
-
-                try {
-                    methods = clsCache.get(cls);
-                }
-                finally {
-                    rwLock.readLock().unlock();
-                }
-
-                // If missing in cache - build descriptor
-                if (methods == null) {
-                    Method[] publicMtds = cls.getMethods();
-
-                    methods = new ArrayList<>(publicMtds.length);
-
-                    for (Method mtd : publicMtds) {
-                        Class retType = mtd.getReturnType();
-
-                        String mtdName = mtd.getName();
-
-                        if (mtd.getParameterTypes().length != 0 ||
-                            retType == void.class || retType == cls ||
-                            exclMtds.contains(mtdName) ||
-                            (VisorCache.class.isAssignableFrom(retType) && "history".equals(mtdName)))
-                            continue;
-
-                        mtd.setAccessible(true);
-
-                        methods.add(mtd);
-                    }
-
-                    // Allow multiple puts for the same class - they will simply override.
-                    rwLock.writeLock().lock();
-
-                    try {
-                        clsCache.put(cls, methods);
-                    }
-                    finally {
-                        rwLock.writeLock().unlock();
-                    }
-                }
-
-                // Extract fields values using descriptor and build JSONObject.
-                for (Method mtd : methods) {
-                    try {
-                        Object prop = mtd.invoke(bean);
-
-                        if (prop != null)
-                            gen.writeObjectField(mtd.getName(), prop);
-                    }
-                    catch (IOException ioe) {
-                        throw ioe;
-                    }
-                    catch (Exception e) {
-                        throw new IOException(e);
-                    }
-                }
-
-                gen.writeEndObject();
-            }
+        @Override public void serialize(GridCacheSqlIndexMetadata idx, JsonGenerator gen, SerializerProvider ser) throws IOException {
+            gen.writeStartObject();
+
+            gen.writeStringField("name", idx.name());
+            gen.writeObjectField("fields", idx.fields());
+            gen.writeObjectField("descendings", idx.descendings());
+            gen.writeBooleanField("unique", idx.unique());
+
+            gen.writeEndObject();
         }
     };
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
index 67aaa14..517028a 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
@@ -105,7 +105,7 @@ class VisorCacheClearCommand {
 
             val res = executeOne(nid, classOf[VisorCacheClearTask], cacheName)
 
-            t += (nodeId8(nid), res.get1(), res.get2())
+            t += (nodeId8(nid), res.getSizeBefore, res.getSizeAfter)
 
             println("Cleared cache with name: " + escapeName(cacheName))
 


[09/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
index 00587b4..1cb1f0d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
@@ -17,32 +17,44 @@
 
 package org.apache.ignite.internal.visor.query;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Arguments for {@link VisorQueryTask}.
  */
-public class VisorQueryArg implements Serializable {
+public class VisorQueryArg extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Cache name for query. */
-    private final String cacheName;
+    private String cacheName;
 
     /** Query text. */
-    private final String qryTxt;
+    private String qryTxt;
 
     /** Distributed joins enabled flag. */
-    private final boolean distributedJoins;
+    private boolean distributedJoins;
 
     /** Enforce join order flag. */
-    private final boolean enforceJoinOrder;
+    private boolean enforceJoinOrder;
 
     /** Flag whether to execute query locally. */
-    private final boolean loc;
+    private boolean loc;
 
     /** Result batch size. */
-    private final int pageSize;
+    private int pageSize;
+
+    /**
+     * Default constructor.
+     */
+    public VisorQueryArg() {
+        // No-op.
+    }
 
     /**
      * @param cacheName Cache name for query.
@@ -65,42 +77,67 @@ public class VisorQueryArg implements Serializable {
     /**
      * @return Cache name.
      */
-    public String cacheName() {
+    public String getCacheName() {
         return cacheName;
     }
 
     /**
      * @return Query txt.
      */
-    public String queryText() {
+    public String getQueryText() {
         return qryTxt;
     }
 
     /**
      * @return Distributed joins enabled flag.
      */
-    public boolean distributedJoins() {
+    public boolean isDistributedJoins() {
         return distributedJoins;
     }
 
     /**
      * @return Enforce join order flag.
      */
-    public boolean enforceJoinOrder() {
+    public boolean isEnforceJoinOrder() {
         return enforceJoinOrder;
     }
 
     /**
      * @return {@code true} if query should be executed locally.
      */
-    public boolean local() {
+    public boolean isLocal() {
         return loc;
     }
 
     /**
      * @return Page size.
      */
-    public int pageSize() {
+    public int getPageSize() {
         return pageSize;
     }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, cacheName);
+        U.writeString(out, qryTxt);
+        out.writeBoolean(distributedJoins);
+        out.writeBoolean(enforceJoinOrder);
+        out.writeBoolean(loc);
+        out.writeInt(pageSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        cacheName = U.readString(in);
+        qryTxt = U.readString(in);
+        distributedJoins = in.readBoolean();
+        enforceJoinOrder = in.readBoolean();
+        loc = in.readBoolean();
+        pageSize = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryArg.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java
new file mode 100644
index 0000000..6b81dc4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCancelTask.java
@@ -0,0 +1,72 @@
+/*
+ * 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.internal.visor.query;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Task to cancel queries.
+ */
+@GridInternal
+public class VisorQueryCancelTask extends VisorOneNodeTask<Long, Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorCancelQueriesJob job(Long arg) {
+        return new VisorCancelQueriesJob(arg, debug);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected Void reduce0(List<ComputeJobResult> results) throws IgniteException {
+        return null;
+    }
+
+    /**
+     * Job to cancel queries on node.
+     */
+    private static class VisorCancelQueriesJob extends VisorJob<Long, Void> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with specified argument.
+         *
+         * @param arg Job argument.
+         * @param debug Flag indicating whether debug information should be printed into node log.
+         */
+        protected VisorCancelQueriesJob(@Nullable Long arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Void run(@Nullable Long queries) throws IgniteException {
+            ignite.context().query().cancelQueries(Collections.singleton(queries));
+
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
index c1f06ae..572cf3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryCleanupTask.java
@@ -65,10 +65,10 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID, Collecti
                     map.put(new VisorQueryCleanupJob(taskArg.get(node.id()), debug), node);
 
             if (map.isEmpty()) {
-                String notFoundNodes = "";
+                StringBuilder notFoundNodes = new StringBuilder();
 
                 for (UUID nid : nodeIds)
-                    notFoundNodes = notFoundNodes + (notFoundNodes.isEmpty() ? "" : ",")  + U.id8(nid);
+                    notFoundNodes.append((notFoundNodes.length() == 0) ? "" : ",").append(U.id8(nid));
 
                 throw new VisorClusterGroupEmptyException("Failed to clear query results. Nodes are not available: [" +
                     notFoundNodes + "]");
@@ -123,4 +123,4 @@ public class VisorQueryCleanupTask extends VisorMultiNodeTask<Map<UUID, Collecti
             return S.toString(VisorQueryCleanupJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
new file mode 100644
index 0000000..92921b2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryConfiguration.java
@@ -0,0 +1,142 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClasses;
+
+/**
+ * Data transfer object for cache query configuration data.
+ */
+public class VisorQueryConfiguration extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private List<String> sqlFuncClss;
+
+    /** */
+    private long longQryWarnTimeout;
+
+    /** */
+    private boolean sqlEscapeAll;
+
+    /** */
+    private List<String> indexedTypes;
+
+    /** */
+    private int sqlOnheapRowCacheSize;
+
+    /** */
+    private String sqlSchema;
+
+    /**
+     * Default constructor.
+     */
+    public VisorQueryConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object with cache query configuration data.
+     *
+     * @param ccfg Cache configuration.
+     */
+    public VisorQueryConfiguration(CacheConfiguration ccfg) {
+        sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses());
+        longQryWarnTimeout = ccfg.getLongQueryWarningTimeout();
+        sqlEscapeAll = ccfg.isSqlEscapeAll();
+        indexedTypes = compactClasses(ccfg.getIndexedTypes());
+        sqlSchema = ccfg.getSqlSchema();
+    }
+
+    /**
+     * @return Classes names with SQL functions.
+     */
+    public List<String> getSqlFunctionClasses() {
+        return sqlFuncClss;
+    }
+
+    /**
+     * @return Timeout in milliseconds after which long query warning will be printed.
+     */
+    public long getLongQueryWarningTimeout() {
+        return longQryWarnTimeout;
+    }
+
+    /**
+     * @return {@code true} if SQL engine generate SQL statements with escaped names.
+     */
+    public boolean isSqlEscapeAll() {
+        return sqlEscapeAll;
+    }
+
+    /**
+     * @return Array of key and value classes names to be indexed.
+     */
+    public List<String> getIndexedTypes() {
+        return indexedTypes;
+    }
+
+    /**
+     * @return Number of SQL rows which will be cached onheap to avoid deserialization on each SQL index access.
+     */
+    public int getSqlOnheapRowCacheSize() {
+        return sqlOnheapRowCacheSize;
+    }
+
+    /**
+     * @return Schema name, which is used by SQL engine for SQL statements generation.
+     */
+    public String getSqlSchema() {
+        return sqlSchema;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeCollection(out, sqlFuncClss);
+        out.writeLong(longQryWarnTimeout);
+        out.writeBoolean(sqlEscapeAll);
+        U.writeCollection(out, indexedTypes);
+        out.writeInt(sqlOnheapRowCacheSize);
+        U.writeString(out, sqlSchema);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        sqlFuncClss = U.readList(in);
+        longQryWarnTimeout = in.readLong();
+        sqlEscapeAll = in.readBoolean();
+        indexedTypes = U.readList(in);
+        sqlOnheapRowCacheSize = in.readInt();
+        sqlSchema = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryConfiguration.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java
new file mode 100644
index 0000000..b747845
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetrics.java
@@ -0,0 +1,205 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for cache query detail metrics.
+ */
+public class VisorQueryDetailMetrics extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Query type. */
+    private String qryType;
+
+    /** Textual query representation. */
+    private String qry;
+
+    /** Cache name. */
+    private String cache;
+
+    /** Number of executions. */
+    private int execs;
+
+    /** Number of completions executions. */
+    private int completions;
+
+    /** Number of failures. */
+    private int failures;
+
+    /** Minimum time of execution. */
+    private long minTime;
+
+    /** Maximum time of execution. */
+    private long maxTime;
+
+    /** Average time of execution. */
+    private double avgTime;
+
+    /** Sum of execution time of completions time. */
+    private long totalTime;
+
+    /** Sum of execution time of completions time. */
+    private long lastStartTime;
+
+    /**
+     * Default constructor
+     */
+    public VisorQueryDetailMetrics() {
+        // No-op.
+    }
+
+    /**
+     * @param m Cache query metrics.
+     */
+    public VisorQueryDetailMetrics(QueryDetailMetrics m) {
+        qryType = m.queryType();
+        qry = m.query();
+        cache = m.cache();
+
+        execs = m.executions();
+        completions = m.completions();
+        failures = m.failures();
+
+        minTime = m.minimumTime();
+        maxTime = m.maximumTime();
+        avgTime = m.averageTime();
+        totalTime = m.totalTime();
+        lastStartTime = m.lastStartTime();
+    }
+
+    /**
+     * @return Query type
+     */
+    public String getQueryType() {
+        return qryType;
+    }
+
+    /**
+     * @return Query type
+     */
+    public String getQuery() {
+        return qry;
+    }
+
+    /**
+     * @return Cache name where query was executed.
+     */
+    public String getCache() {
+        return cache;
+    }
+
+    /**
+     * @return Number of executions.
+     */
+    public int getExecutions() {
+        return execs;
+    }
+
+    /**
+     * @return Number of completed executions.
+     */
+    public int getCompletions() {
+        return completions;
+    }
+
+    /**
+     * @return Total number of times a query execution failed.
+     */
+    public int getFailures() {
+        return failures;
+    }
+
+    /**
+     * @return Minimum execution time of query.
+     */
+    public long getMinimumTime() {
+        return minTime;
+    }
+
+    /**
+     * @return Maximum execution time of query.
+     */
+    public long getMaximumTime() {
+        return maxTime;
+    }
+
+    /**
+     * @return Average execution time of query.
+     */
+    public double getAverageTime() {
+        return avgTime;
+    }
+
+    /**
+     * @return Total time of all query executions.
+     */
+    public long getTotalTime() {
+        return totalTime;
+    }
+
+    /**
+     * @return Latest time query was stared.
+     */
+    public long getLastStartTime() {
+        return lastStartTime;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, qryType);
+        U.writeString(out, qry);
+        U.writeString(out, cache);
+        out.writeInt(execs);
+        out.writeInt(completions);
+        out.writeInt(failures);
+        out.writeLong(minTime);
+        out.writeLong(maxTime);
+        out.writeDouble(avgTime);
+        out.writeLong(totalTime);
+        out.writeLong(lastStartTime);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        qryType = U.readString(in);
+        qry = U.readString(in);
+        cache = U.readString(in);
+        execs = in.readInt();
+        completions = in.readInt();
+        failures = in.readInt();
+        minTime = in.readLong();
+        maxTime = in.readLong();
+        avgTime = in.readDouble();
+        totalTime = in.readLong();
+        lastStartTime = in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryDetailMetrics.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java
new file mode 100644
index 0000000..7c1379f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryDetailMetricsCollectorTask.java
@@ -0,0 +1,146 @@
+/*
+ * 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.internal.visor.query;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
+
+/**
+ * Task to collect cache query metrics.
+ */
+@GridInternal
+public class VisorQueryDetailMetricsCollectorTask extends VisorMultiNodeTask<Long, Collection<VisorQueryDetailMetrics>,
+    Collection<? extends QueryDetailMetrics>> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorCacheQueryDetailMetricsCollectorJob job(Long arg) {
+        return new VisorCacheQueryDetailMetricsCollectorJob(arg, debug);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected Collection<VisorQueryDetailMetrics> reduce0(List<ComputeJobResult> results)
+        throws IgniteException {
+        Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> taskRes = new HashMap<>();
+
+        for (ComputeJobResult res : results) {
+            if (res.getException() != null)
+                throw res.getException();
+
+            Collection<GridCacheQueryDetailMetricsAdapter> metrics = res.getData();
+
+            VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics);
+        }
+
+        Collection<GridCacheQueryDetailMetricsAdapter> aggMetrics = taskRes.values();
+
+        Collection<VisorQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
+
+        for (GridCacheQueryDetailMetricsAdapter m: aggMetrics)
+            res.add(new VisorQueryDetailMetrics(m));
+
+        return res;
+    }
+
+    /**
+     * Job that will actually collect query metrics.
+     */
+    private static class VisorCacheQueryDetailMetricsCollectorJob extends VisorJob<Long, Collection<? extends QueryDetailMetrics>> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Create job with specified argument.
+         *
+         * @param arg Last time when metrics were collected.
+         * @param debug Debug flag.
+         */
+        protected VisorCacheQueryDetailMetricsCollectorJob(@Nullable Long arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /**
+         * @param since Time when metrics were collected last time.
+         * @param res Response.
+         * @param metrics Metrics.
+         */
+        private static void aggregateMetrics(long since, Map<GridCacheQueryDetailMetricsKey,
+            GridCacheQueryDetailMetricsAdapter> res, Collection<GridCacheQueryDetailMetricsAdapter> metrics) {
+            for (GridCacheQueryDetailMetricsAdapter m : metrics) {
+                if (m.lastStartTime() > since) {
+                    GridCacheQueryDetailMetricsKey key = m.key();
+
+                    GridCacheQueryDetailMetricsAdapter aggMetrics = res.get(key);
+
+                    res.put(key, aggMetrics == null ? m : aggMetrics.aggregate(m));
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Collection<? extends QueryDetailMetrics> run(@Nullable Long arg) throws IgniteException {
+            assert arg != null;
+
+            IgniteConfiguration cfg = ignite.configuration();
+
+            GridCacheProcessor cacheProc = ignite.context().cache();
+
+            Collection<String> cacheNames = cacheProc.cacheNames();
+
+            Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> aggMetrics = new HashMap<>();
+
+            for (String cacheName : cacheNames) {
+                if (!isSystemCache(cacheName) && !isIgfsCache(cfg, cacheName)) {
+                    IgniteInternalCache<Object, Object> cache = cacheProc.cache(cacheName);
+
+                    if (cache == null || !cache.context().started())
+                        continue;
+
+                    aggregateMetrics(arg, aggMetrics, cache.context().queries().detailMetrics());
+                }
+            }
+
+            return new ArrayList<>(aggMetrics.values());
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorCacheQueryDetailMetricsCollectorJob.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryEntity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryEntity.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryEntity.java
new file mode 100644
index 0000000..9f4dfe7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryEntity.java
@@ -0,0 +1,188 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+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.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for {@link QueryEntity}.
+ */
+public class VisorQueryEntity extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Key class used to store key in cache. */
+    private String keyType;
+
+    /** Value class used to store value in cache. */
+    private String valType;
+
+    /** Fields to be queried, in addition to indexed fields. */
+    private Map<String, String> qryFlds;
+
+    /** Key fields. */
+    private List<String> keyFields;
+
+    /** Aliases. */
+    private Map<String, String> aliases;
+
+    /** Table name. */
+    private String tblName;
+
+    /** Fields to create group indexes for. */
+    private List<VisorQueryIndex> grps;
+
+    /**
+     * @param qryEntities Collection of query entities.
+     * @return Data transfer object for query entities.
+     */
+    public static List<VisorQueryEntity> list(Collection<QueryEntity> qryEntities) {
+        List<VisorQueryEntity> entities = new ArrayList<>();
+
+        // Add query entries.
+        if (!F.isEmpty(qryEntities))
+            for (QueryEntity qryEntity : qryEntities)
+                entities.add(new VisorQueryEntity(qryEntity));
+
+        return entities;
+    }
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     */
+    public VisorQueryEntity() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     *
+     * @param q Actual cache query entities.
+     */
+    private VisorQueryEntity(QueryEntity q) {
+        assert q != null;
+
+        keyType = q.getKeyType();
+        valType = q.getValueType();
+
+        keyFields = toList(q.getKeyFields());
+
+        LinkedHashMap<String, String> qryFields = q.getFields();
+
+        qryFlds = new LinkedHashMap<>(qryFields);
+
+        aliases = U.copyMap(q.getAliases());
+
+        Collection<QueryIndex> qryIdxs = q.getIndexes();
+
+        grps = new ArrayList<>(qryIdxs.size());
+
+        for (QueryIndex qryIdx : qryIdxs)
+            grps.add(new VisorQueryIndex(qryIdx));
+    }
+
+    /**
+     * @return Key class used to store key in cache.
+     */
+    public String getKeyType() {
+        return keyType;
+    }
+
+    /**
+     * @return Value class used to store value in cache.
+     */
+    public String getValueType() {
+        return valType;
+    }
+
+    /**
+     * @return Key fields.
+     */
+    public List<String> getKeyFields() {
+        return keyFields;
+    }
+
+    /**
+     * @return Fields to be queried, in addition to indexed fields.
+     */
+    public Map<String, String> getQueryFields() {
+        return qryFlds;
+    }
+
+    /**
+     * @return Field aliases.
+     */
+    public Map<String, String> getAliases() {
+        return aliases;
+    }
+
+    /**
+     * @return Table name.
+     */
+    public String getTableName() {
+        return tblName;
+    }
+
+    /**
+     * @return Fields to create group indexes for.
+     */
+    public List<VisorQueryIndex> getGroups() {
+        return grps;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, keyType);
+        U.writeString(out, valType);
+        U.writeCollection(out, keyFields);
+        IgfsUtils.writeStringMap(out, qryFlds);
+        U.writeMap(out, aliases);
+        U.writeString(out, tblName);
+        U.writeCollection(out, grps);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        keyType = U.readString(in);
+        valType = U.readString(in);
+        keyFields = U.readList(in);
+        qryFlds = IgfsUtils.readStringMap(in);
+        aliases = U.readMap(in);
+        tblName = U.readString(in);
+        grps = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryEntity.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
index 18b0d71..ad84dda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryField.java
@@ -17,15 +17,18 @@
 
 package org.apache.ignite.internal.visor.query;
 
-import java.io.Serializable;
-import org.apache.ignite.internal.LessNamingBean;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 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.internal.visor.VisorDataTransferObject;
 
 /**
  * Data transfer object for query field type description.
  */
-public class VisorQueryField implements Serializable, LessNamingBean {
+public class VisorQueryField extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -42,6 +45,13 @@ public class VisorQueryField implements Serializable, LessNamingBean {
     private String fieldTypeName;
 
     /**
+     * Default constructor.
+     */
+    public VisorQueryField() {
+        // No-op.
+    }
+
+    /**
      * Create data transfer object with given parameters.
      *
      * @param schemaName Schema name.
@@ -59,28 +69,28 @@ public class VisorQueryField implements Serializable, LessNamingBean {
     /**
      * @return Schema name.
      */
-    public String schemaName() {
+    public String getSchemaName() {
         return schemaName;
     }
 
     /**
      * @return Type name.
      */
-    public String typeName() {
+    public String getTypeName() {
         return typeName;
     }
 
     /**
      * @return Field name.
      */
-    public String fieldName() {
+    public String getFieldName() {
         return fieldName;
     }
 
     /**
      * @return Field type name.
      */
-    public String fieldTypeName() {
+    public String getFieldTypeName() {
         return fieldTypeName;
     }
 
@@ -88,7 +98,7 @@ public class VisorQueryField implements Serializable, LessNamingBean {
      * @param schema If {@code true} then add schema name to full name.
      * @return Fully qualified field name with type name and schema name.
      */
-    public String fullName(boolean schema) {
+    public String getFullName(boolean schema) {
         if (!F.isEmpty(typeName)) {
             if (schema && !F.isEmpty(schemaName))
                 return schemaName + "." + typeName + "." + fieldName;
@@ -100,6 +110,22 @@ public class VisorQueryField implements Serializable, LessNamingBean {
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, schemaName);
+        U.writeString(out, typeName);
+        U.writeString(out, fieldName);
+        U.writeString(out, fieldTypeName);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        schemaName = U.readString(in);
+        typeName = U.readString(in);
+        fieldName = U.readString(in);
+        fieldTypeName = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorQueryField.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndex.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndex.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndex.java
new file mode 100644
index 0000000..d9fa2a4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndex.java
@@ -0,0 +1,105 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for {@link QueryIndex}.
+ */
+public class VisorQueryIndex extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Name of index. */
+    private String name;
+
+    /** Type of index. */
+    private QueryIndexType type;
+
+    /** Fields to create group indexes for. */
+    private List<VisorQueryIndexField> fields;
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     */
+    public VisorQueryIndex() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     *
+     * @param idx Actual cache query entity index.
+     */
+    public VisorQueryIndex(QueryIndex idx) {
+        assert idx != null;
+
+        name = idx.getName();
+        type = idx.getIndexType();
+        fields = VisorQueryIndexField.list(idx);
+    }
+
+    /**
+     * @return Name of index.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @return Type of index.
+     */
+    public QueryIndexType getType() {
+        return type;
+    }
+
+    /**
+     * @return Fields to create group indexes for.
+     */
+    public List<VisorQueryIndexField> getFields() {
+        return fields;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, name);
+        U.writeEnum(out, type);
+        U.writeCollection(out, fields);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        name = U.readString(in);
+        type = QueryIndexType.fromOrdinal(in.readByte());
+        fields = U.readList(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryIndex.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
new file mode 100644
index 0000000..fb32dd1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
@@ -0,0 +1,106 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for {@link QueryEntity}.
+ */
+public class VisorQueryIndexField extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Index field name. */
+    private String fldName;
+
+    /** Index field sort order. */
+    private boolean fldSort;
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     */
+    public VisorQueryIndexField() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache type metadata.
+     *
+     * @param fldName Index field name.
+     * @param fldSort Index field sort order.
+     */
+    public VisorQueryIndexField(String fldName, boolean fldSort) {
+        this.fldName = fldName;
+        this.fldSort = fldSort;
+    }
+
+    /**
+     * @param idx Query entity index.
+     * @return Data transfer object for query entity index fields.
+     */
+    public static List<VisorQueryIndexField> list(QueryIndex idx) {
+        List<VisorQueryIndexField> res = new ArrayList<>();
+
+        for (Map.Entry<String, Boolean> field: idx.getFields().entrySet())
+            res.add(new VisorQueryIndexField(field.getKey(), !field.getValue()));
+
+        return res;
+    }
+
+    /**
+     * @return Index field name.
+     */
+    public String getFieldName() {
+        return fldName;
+    }
+
+    /**
+     * @return Index field sort order.
+     */
+    public boolean isFieldSort() {
+        return fldSort;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, fldName);
+        out.writeBoolean(fldSort);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        fldName = U.readString(in);
+        fldSort = in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryIndexField.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
deleted file mode 100644
index 61ccac2..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ /dev/null
@@ -1,275 +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.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
-import javax.cache.Cache;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.ScanQuery;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
-import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
-import org.apache.ignite.lang.IgniteBiPredicate;
-import org.apache.ignite.lang.IgniteBiTuple;
-
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.RMV_DELAY;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_CACHE_WITH_FILTER;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_COL_NAMES;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_QRY_NAME;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_NEAR_CACHE;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SQL_QRY_NAME;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchScanQueryRows;
-import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchSqlQueryRows;
-
-/**
- * Job for execute SCAN or SQL query and get first page of results.
- */
-public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Create job with specified argument.
-     *
-     * @param arg Job argument.
-     * @param debug Debug flag.
-     */
-    protected VisorQueryJob(VisorQueryArg arg, boolean debug) {
-        super(arg, debug);
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @return Cache to execute query.
-     */
-    protected IgniteCache<Object, Object> cache(String cacheName) {
-        GridCacheProcessor cacheProcessor = ignite.context().cache();
-
-        return cacheProcessor.jcache(cacheName);
-    }
-
-    /**
-     * Execute scan query.
-     *
-     * @param c Cache to scan.
-     * @param arg Job argument with query parameters.
-     * @return Query cursor.
-     */
-    private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorQueryArg arg,
-        IgniteBiPredicate<Object, Object> filter) {
-        ScanQuery<Object, Object> qry = new ScanQuery<>(filter);
-        qry.setPageSize(arg.pageSize());
-        qry.setLocal(arg.local());
-
-        return c.withKeepBinary().query(qry);
-    }
-
-    /**
-     * Scan near cache.
-     *
-     * @param c Cache to scan near entries.
-     * @return Cache entries iterator wrapped with query cursor.
-     */
-    private QueryCursor<Cache.Entry<Object, Object>> near(IgniteCache<Object, Object> c) {
-        return new VisorNearCacheCursor<>(c.localEntries(CachePeekMode.NEAR).iterator());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(final VisorQueryArg arg) {
-        try {
-            UUID nid = ignite.localNode().id();
-
-            String qryTxt = arg.queryText();
-
-            boolean scan = qryTxt == null;
-
-            boolean scanWithFilter = qryTxt != null && qryTxt.startsWith(SCAN_CACHE_WITH_FILTER);
-
-            boolean near = qryTxt != null && qryTxt.startsWith(SCAN_NEAR_CACHE);
-
-            boolean scanAny = scan || scanWithFilter || near;
-
-            // Generate query ID to store query cursor in node local storage.
-            String qryId = (scanAny ? SCAN_QRY_NAME : SQL_QRY_NAME) + "-" + UUID.randomUUID();
-
-            IgniteCache<Object, Object> c = cache(arg.cacheName());
-
-            if (scanAny) {
-                long start = U.currentTimeMillis();
-
-                IgniteBiPredicate<Object, Object> filter = null;
-
-                if (scanWithFilter) {
-                    boolean caseSensitive = qryTxt.startsWith(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE);
-
-                    String ptrn =  qryTxt.substring(caseSensitive
-                        ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length()
-                        : SCAN_CACHE_WITH_FILTER.length());
-
-                    filter = new VisorQueryScanSubstringFilter(caseSensitive, ptrn);
-                }
-
-                VisorQueryCursor<Cache.Entry<Object, Object>> cur = new VisorQueryCursor<>(near ? near(c) : scan(c, arg, filter));
-
-                List<Object[]> rows = fetchScanQueryRows(cur, arg.pageSize());
-
-                long duration = U.currentTimeMillis() - start; // Scan duration + fetch duration.
-
-                boolean hasNext = cur.hasNext();
-
-                if (hasNext) {
-                    ignite.cluster().<String, VisorQueryCursor>nodeLocalMap().put(qryId, cur);
-
-                    scheduleResultSetHolderRemoval(qryId);
-                }
-                else
-                    cur.close();
-
-                return new IgniteBiTuple<>(null, new VisorQueryResultEx(nid, qryId, SCAN_COL_NAMES, rows, hasNext,
-                    duration));
-            }
-            else {
-                SqlFieldsQuery qry = new SqlFieldsQuery(arg.queryText());
-                qry.setPageSize(arg.pageSize());
-                qry.setDistributedJoins(arg.distributedJoins());
-                qry.setEnforceJoinOrder(arg.enforceJoinOrder());
-                qry.setLocal(arg.local());
-
-                long start = U.currentTimeMillis();
-
-                VisorQueryCursor<List<?>> cur = new VisorQueryCursor<>(c.withKeepBinary().query(qry));
-
-                Collection<GridQueryFieldMetadata> meta = cur.fieldsMeta();
-
-                if (meta == null)
-                    return new IgniteBiTuple<>(
-                        new VisorExceptionWrapper(new SQLException("Fail to execute query. No metadata available.")), null);
-                else {
-                    List<VisorQueryField> names = new ArrayList<>(meta.size());
-
-                    for (GridQueryFieldMetadata col : meta)
-                        names.add(new VisorQueryField(col.schemaName(), col.typeName(),
-                            col.fieldName(), col.fieldTypeName()));
-
-                    List<Object[]> rows = fetchSqlQueryRows(cur, arg.pageSize());
-
-                    long duration = U.currentTimeMillis() - start; // Query duration + fetch duration.
-
-                    boolean hasNext = cur.hasNext();
-
-                    if (hasNext) {
-                        ignite.cluster().<String, VisorQueryCursor<List<?>>>nodeLocalMap().put(qryId, cur);
-
-                        scheduleResultSetHolderRemoval(qryId);
-                    }
-                    else
-                        cur.close();
-
-                    return new IgniteBiTuple<>(null, new VisorQueryResultEx(nid, qryId, names, rows, hasNext, duration));
-                }
-            }
-        }
-        catch (Throwable e) {
-            return new IgniteBiTuple<>(new VisorExceptionWrapper(e), null);
-        }
-    }
-
-    /**
-     * @param qryId Unique query result id.
-     */
-    private void scheduleResultSetHolderRemoval(final String qryId) {
-        ignite.context().timeout().addTimeoutObject(new GridTimeoutObjectAdapter(RMV_DELAY) {
-            @Override public void onTimeout() {
-                ConcurrentMap<String, VisorQueryCursor> storage = ignite.cluster().nodeLocalMap();
-
-                VisorQueryCursor cur = storage.get(qryId);
-
-                if (cur != null) {
-                    // If cursor was accessed since last scheduling, set access flag to false and reschedule.
-                    if (cur.accessed()) {
-                        cur.accessed(false);
-
-                        scheduleResultSetHolderRemoval(qryId);
-                    }
-                    else {
-                        // Remove stored cursor otherwise.
-                        storage.remove(qryId);
-
-                        cur.close();
-                    }
-                }
-            }
-        });
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorQueryJob.class, this);
-    }
-
-    /**
-     * Wrapper for cache iterator to behave like {@link QueryCursor}.
-     */
-    private static class VisorNearCacheCursor<T> implements QueryCursor<T> {
-        /** Wrapped iterator.  */
-        private final Iterator<T> it;
-
-        /**
-         * Wrapping constructor.
-         *
-         * @param it Near cache iterator to wrap.
-         */
-        private VisorNearCacheCursor(Iterator<T> it) {
-            this.it = it;
-        }
-
-        /** {@inheritDoc} */
-        @Override public List<T> getAll() {
-            List<T> all = new ArrayList<>();
-
-            while(it.hasNext())
-                all.add(it.next());
-
-            return all;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void close() {
-            // Nothing to close.
-        }
-
-        /** {@inheritDoc} */
-        @Override public Iterator<T> iterator() {
-            return it;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java
new file mode 100644
index 0000000..f878ab6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryMetrics.java
@@ -0,0 +1,125 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.cache.query.QueryMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for cache query metrics.
+ */
+public class VisorQueryMetrics extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Minimum execution time of query. */
+    private long minTime;
+
+    /** Maximum execution time of query. */
+    private long maxTime;
+
+    /** Average execution time of query. */
+    private double avgTime;
+
+    /** Number of executions. */
+    private int execs;
+
+    /** Total number of times a query execution failed. */
+    private int fails;
+
+    /**
+     * Default constructor.
+     */
+    public VisorQueryMetrics() {
+        // No-op.
+    }
+
+    /**
+     * Create data transfer object for given cache metrics.
+     * @param m Cache query metrics.
+     */
+    public VisorQueryMetrics(QueryMetrics m) {
+        minTime = m.minimumTime();
+        maxTime = m.maximumTime();
+        avgTime = m.averageTime();
+        execs = m.executions();
+        fails = m.fails();
+    }
+
+    /**
+     * @return Minimum execution time of query.
+     */
+    public long getMinimumTime() {
+        return minTime;
+    }
+
+    /**
+     * @return Maximum execution time of query.
+     */
+    public long getMaximumTime() {
+        return maxTime;
+    }
+
+    /**
+     * @return Average execution time of query.
+     */
+    public double getAverageTime() {
+        return avgTime;
+    }
+
+    /**
+     * @return Number of executions.
+     */
+    public int getExecutions() {
+        return execs;
+    }
+
+    /**
+     * @return Total number of times a query execution failed.
+     */
+    public int getFailures() {
+        return fails;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        out.writeLong(minTime);
+        out.writeLong(maxTime);
+        out.writeDouble(avgTime);
+        out.writeInt(execs);
+        out.writeInt(fails);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        minTime = in.readLong();
+        maxTime = in.readLong();
+        avgTime = in.readDouble();
+        execs = in.readInt();
+        fails = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryMetrics.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java
index 52a167d..4684c49 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTask.java
@@ -26,25 +26,24 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.apache.ignite.lang.IgniteBiTuple;
 
 /**
  * Task for collecting next page previously executed SQL or SCAN query.
  */
 @GridInternal
-public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<String, Integer>, VisorQueryResult> {
+public class VisorQueryNextPageTask extends VisorOneNodeTask<VisorQueryNextPageTaskArg, VisorQueryResult> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** {@inheritDoc} */
-    @Override protected VisorQueryNextPageJob job(IgniteBiTuple<String, Integer> arg) {
+    @Override protected VisorQueryNextPageJob job(VisorQueryNextPageTaskArg arg) {
         return new VisorQueryNextPageJob(arg, debug);
     }
 
     /**
      * Job for collecting next page previously executed SQL or SCAN query.
      */
-    private static class VisorQueryNextPageJob extends VisorJob<IgniteBiTuple<String, Integer>, VisorQueryResult> {
+    private static class VisorQueryNextPageJob extends VisorJob<VisorQueryNextPageTaskArg, VisorQueryResult> {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -54,13 +53,13 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
          * @param arg Job argument.
          * @param debug Debug flag.
          */
-        private VisorQueryNextPageJob(IgniteBiTuple<String, Integer> arg, boolean debug) {
+        private VisorQueryNextPageJob(VisorQueryNextPageTaskArg arg, boolean debug) {
             super(arg, debug);
         }
 
         /** {@inheritDoc} */
-        @Override protected VisorQueryResult run(IgniteBiTuple<String, Integer> arg) {
-            return arg.get1().startsWith(VisorQueryUtils.SCAN_QRY_NAME) ? nextScanPage(arg) : nextSqlPage(arg);
+        @Override protected VisorQueryResult run(VisorQueryNextPageTaskArg arg) {
+            return arg.getQueryId().startsWith(VisorQueryUtils.SCAN_QRY_NAME) ? nextScanPage(arg) : nextSqlPage(arg);
         }
 
         /**
@@ -69,19 +68,19 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
          * @param arg Query name and page size.
          * @return Query result with next page.
          */
-        private VisorQueryResult nextSqlPage(IgniteBiTuple<String, Integer> arg) {
+        private VisorQueryResult nextSqlPage(VisorQueryNextPageTaskArg arg) {
             long start = U.currentTimeMillis();
 
             ConcurrentMap<String, VisorQueryCursor<List<?>>> storage = ignite.cluster().nodeLocalMap();
 
-            String qryId = arg.get1();
+            String qryId = arg.getQueryId();
 
             VisorQueryCursor<List<?>> cur = storage.get(qryId);
 
             if (cur == null)
                 throw new IgniteException("SQL query results are expired.");
 
-            List<Object[]> nextRows = VisorQueryUtils.fetchSqlQueryRows(cur, arg.get2());
+            List<Object[]> nextRows = VisorQueryUtils.fetchSqlQueryRows(cur, arg.getPageSize());
 
             boolean hasMore = cur.hasNext();
 
@@ -93,7 +92,8 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
                 cur.close();
             }
 
-            return new VisorQueryResult(nextRows, hasMore, U.currentTimeMillis() - start);
+            return new VisorQueryResult(ignite.localNode().id(), qryId, null, nextRows, hasMore,
+                U.currentTimeMillis() - start);
         }
 
         /**
@@ -102,19 +102,19 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
          * @param arg Query name and page size.
          * @return Next page with data.
          */
-        private VisorQueryResult nextScanPage(IgniteBiTuple<String, Integer> arg) {
+        private VisorQueryResult nextScanPage(VisorQueryNextPageTaskArg arg) {
             long start = U.currentTimeMillis();
 
             ConcurrentMap<String, VisorQueryCursor<Cache.Entry<Object, Object>>> storage = ignite.cluster().nodeLocalMap();
 
-            String qryId = arg.get1();
+            String qryId = arg.getQueryId();
 
             VisorQueryCursor<Cache.Entry<Object, Object>> cur = storage.get(qryId);
 
             if (cur == null)
                 throw new IgniteException("Scan query results are expired.");
 
-            List<Object[]> rows = VisorQueryUtils.fetchScanQueryRows(cur, arg.get2());
+            List<Object[]> rows = VisorQueryUtils.fetchScanQueryRows(cur, arg.getPageSize());
 
             boolean hasMore = cur.hasNext();
 
@@ -126,7 +126,8 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
                 cur.close();
             }
 
-            return new VisorQueryResult(rows, hasMore, U.currentTimeMillis() - start);
+            return new VisorQueryResult(ignite.localNode().id(), qryId, null, rows, hasMore,
+                U.currentTimeMillis() - start);
         }
 
         /** {@inheritDoc} */
@@ -134,4 +135,4 @@ public class VisorQueryNextPageTask extends VisorOneNodeTask<IgniteBiTuple<Strin
             return S.toString(VisorQueryNextPageJob.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java
new file mode 100644
index 0000000..d0f62b9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryNextPageTaskArg.java
@@ -0,0 +1,86 @@
+/*
+ * 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.internal.visor.query;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Arguments for {@link VisorQueryNextPageTask}.
+ */
+public class VisorQueryNextPageTaskArg extends VisorDataTransferObject {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** ID of query execution. */
+    private String qryId;
+
+    /** Number of rows to load. */
+    private int pageSize;
+
+    /**
+     * Default constructor.
+     */
+    public VisorQueryNextPageTaskArg() {
+        // No-op.
+    }
+
+    /**
+     * @param qryId ID of query execution.
+     * @param pageSize Number of rows to load.
+     */
+    public VisorQueryNextPageTaskArg(String qryId, int pageSize) {
+        this.qryId = qryId;
+        this.pageSize = pageSize;
+    }
+
+    /**
+     * @return ID of query execution.
+     */
+    public String getQueryId() {
+        return qryId;
+    }
+
+    /**
+     * @return Number of rows to load.
+     */
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeString(out, qryId);
+        out.writeInt(pageSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        qryId = U.readString(in);
+        pageSize = in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorQueryNextPageTaskArg.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java
new file mode 100644
index 0000000..6d35e32
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetDetailMetricsTask.java
@@ -0,0 +1,71 @@
+/*
+ * 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.internal.visor.query;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * Reset query detail metrics.
+ */
+@GridInternal
+public class VisorQueryResetDetailMetricsTask extends VisorOneNodeTask<Void, Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorCacheResetQueryDetailMetricsJob job(Void arg) {
+        return new VisorCacheResetQueryDetailMetricsJob(arg, debug);
+    }
+
+    /**
+     * Job that reset query detail metrics.
+     */
+    private static class VisorCacheResetQueryDetailMetricsJob extends VisorJob<Void, Void> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param arg Task argument.
+         * @param debug Debug flag.
+         */
+        private VisorCacheResetQueryDetailMetricsJob(Void arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Void run(Void arg) {
+            for (String cacheName : ignite.cacheNames()) {
+                IgniteCache cache = ignite.cache(cacheName);
+
+                if (cache != null)
+                    cache.resetQueryDetailMetrics();
+            }
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorCacheResetQueryDetailMetricsJob.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java
new file mode 100644
index 0000000..3c5c668
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResetMetricsTask.java
@@ -0,0 +1,69 @@
+/*
+ * 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.internal.visor.query;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * Reset compute grid query metrics.
+ */
+@GridInternal
+public class VisorQueryResetMetricsTask extends VisorOneNodeTask<String, Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorQueryResetMetricsJob job(String arg) {
+        return new VisorQueryResetMetricsJob(arg, debug);
+    }
+
+    /**
+     * Job that reset cache query metrics.
+     */
+    private static class VisorQueryResetMetricsJob extends VisorJob<String, Void> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param arg Cache name to reset query metrics for.
+         * @param debug Debug flag.
+         */
+        private VisorQueryResetMetricsJob(String arg, boolean debug) {
+            super(arg, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Void run(String cacheName) {
+            IgniteCache cache = ignite.cache(cacheName);
+
+            if (cache != null)
+                cache.resetQueryMetrics();
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(VisorQueryResetMetricsJob.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
index 21d1ed7..f7beae2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResult.java
@@ -17,62 +17,135 @@
 
 package org.apache.ignite.internal.visor.query;
 
-import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collection;
 import java.util.List;
-import org.apache.ignite.internal.LessNamingBean;
+import java.util.UUID;
 import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
 
 /**
  * Result for cache query tasks.
  */
-public class VisorQueryResult implements Serializable, LessNamingBean {
+public class VisorQueryResult extends VisorDataTransferObject {
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** Node where query executed. */
+    private UUID resNodeId;
+
+    /** Query ID to store in node local. */
+    private String qryId;
+
+    /** Query columns descriptors. */
+    private List<VisorQueryField> cols;
+
     /** Rows fetched from query. */
-    private final List<Object[]> rows;
+    private List<Object[]> rows;
 
     /** Whether query has more rows to fetch. */
-    private final boolean hasMore;
+    private boolean hasMore;
 
     /** Query duration */
-    private final long duration;
+    private long duration;
+
+    /**
+     * Default constructor.
+     */
+    public VisorQueryResult() {
+        // No-op.
+    }
 
     /**
-     * Create task result with given parameters
-     *
+     * @param resNodeId Node where query executed.
+     * @param qryId Query ID for future extraction in nextPage() access.
+     * @param cols Columns descriptors.
      * @param rows Rows fetched from query.
      * @param hasMore Whether query has more rows to fetch.
      * @param duration Query duration.
      */
-    public VisorQueryResult(List<Object[]> rows, boolean hasMore, long duration) {
+    public VisorQueryResult(
+        UUID resNodeId,
+        String qryId,
+        List<VisorQueryField> cols,
+        List<Object[]> rows,
+        boolean hasMore,
+        long duration
+    ) {
+        this.resNodeId = resNodeId;
+        this.qryId = qryId;
+        this.cols = cols;
         this.rows = rows;
         this.hasMore = hasMore;
         this.duration = duration;
     }
 
     /**
+     * @return Response node id.
+     */
+    public UUID getResponseNodeId() {
+        return resNodeId;
+    }
+
+    /**
+     * @return Query id.
+     */
+    public String getQueryId() {
+        return qryId;
+    }
+
+    /**
+     * @return Columns.
+     */
+    public Collection<VisorQueryField> getColumns() {
+        return cols;
+    }
+
+    /**
      * @return Rows fetched from query.
      */
-    public List<Object[]> rows() {
+    public List<Object[]> getRows() {
         return rows;
     }
 
     /**
      * @return Whether query has more rows to fetch.
      */
-    public boolean hasMore() {
+    public boolean isHasMore() {
         return hasMore;
     }
 
     /**
      * @return Duration of next page fetching.
      */
-    public long duration() {
+    public long getDuration() {
         return duration;
     }
 
     /** {@inheritDoc} */
+    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+        U.writeUuid(out, resNodeId);
+        U.writeString(out, qryId);
+        U.writeCollection(out, cols);
+        U.writeCollection(out, rows);
+        out.writeBoolean(hasMore);
+        out.writeLong(duration);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+        resNodeId = U.readUuid(in);
+        qryId = U.readString(in);
+        cols = U.readList(in);
+        rows = U.readList(in);
+        hasMore = in.readBoolean();
+        duration = in.readLong();
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorQueryResult.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
deleted file mode 100644
index 218cb36..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryResultEx.java
+++ /dev/null
@@ -1,89 +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.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Result for cache query tasks.
- */
-public class VisorQueryResultEx extends VisorQueryResult {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Node where query executed. */
-    private final UUID resNodeId;
-
-    /** Query ID to store in node local. */
-    private final String qryId;
-
-    /** Query columns descriptors. */
-    private final Collection<VisorQueryField> cols;
-
-    /**
-     * @param resNodeId Node where query executed.
-     * @param qryId Query ID for future extraction in nextPage() access.
-     * @param cols Columns descriptors.
-     * @param rows Rows fetched from query.
-     * @param hasMore Whether query has more rows to fetch.
-     * @param duration Query duration.
-     */
-    public VisorQueryResultEx(
-        UUID resNodeId,
-        String qryId,
-        Collection<VisorQueryField> cols,
-        List<Object[]> rows,
-        boolean hasMore,
-        long duration
-    ) {
-        super(rows, hasMore, duration);
-
-        this.resNodeId = resNodeId;
-        this.qryId = qryId;
-        this.cols = cols;
-    }
-
-    /**
-     * @return Response node id.
-     */
-    public UUID responseNodeId() {
-        return resNodeId;
-    }
-
-    /**
-     * @return Query id.
-     */
-    public String queryId() {
-        return qryId;
-    }
-
-    /**
-     * @return Columns.
-     */
-    public Collection<VisorQueryField> columns() {
-        return cols;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(VisorQueryResultEx.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/12dfe9e8/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java
new file mode 100644
index 0000000..fa4a596
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanRegexFilter.java
@@ -0,0 +1,59 @@
+/*
+ * 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.internal.visor.query;
+
+import java.util.regex.Pattern;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.lang.IgniteBiPredicate;
+
+/**
+ * Filter scan results by specified substring in string presentation of key or value.
+ */
+public class VisorQueryScanRegexFilter implements IgniteBiPredicate<Object, Object> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Regex pattern to search data. */
+    private final Pattern ptrn;
+
+    /**
+     * Create filter instance.
+     *
+     * @param caseSensitive Case sensitive flag.
+     * @param regex Regex search flag.
+     * @param ptrn String to search in string presentation of key or value.
+     */
+    public VisorQueryScanRegexFilter(boolean caseSensitive, boolean regex, String ptrn) {
+        int flags = caseSensitive ? 0 : Pattern.CASE_INSENSITIVE;
+
+        this.ptrn = Pattern.compile(regex ? ptrn : ".*?" + Pattern.quote(ptrn) + ".*?", flags);
+    }
+    /**
+     * Check that key or value contains specified string.
+     *
+     * @param key Key object.
+     * @param val Value object.
+     * @return {@code true} when string presentation of key or value contain specified string.
+     */
+    @Override public boolean apply(Object key, Object val) {
+        String k = key instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)key) : key.toString();
+        String v = val instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)val) : val.toString();
+
+        return ptrn.matcher(k).find() || ptrn.matcher(v).find();
+    }
+}


[23/50] [abbrv] ignite git commit: IGNITE-4572 Machine Learning: Develop distributed algebra support for dense and sparse data sets.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixBaseStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixBaseStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixBaseStorageTest.java
new file mode 100644
index 0000000..8df19e4
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixBaseStorageTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.MatrixStorage;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Abstract class with base tests for each matrix storage.
+ */
+public abstract class MatrixBaseStorageTest<T extends MatrixStorage> extends ExternalizeTest<T> {
+    /** */
+    protected T storage;
+
+    /** */
+    @Before
+    public abstract void setUp();
+
+    /** */
+    @After
+    public void tearDown() throws Exception {
+        storage.destroy();
+    }
+
+    /** */
+    @Test
+    public void getSet() throws Exception {
+        int rows = MathTestConstants.STORAGE_SIZE;
+        int cols = MathTestConstants.STORAGE_SIZE;
+
+        for (int i = 0; i < rows; i++) {
+            for (int j = 0; j < cols; j++) {
+                double data = Math.random();
+
+                storage.set(i, j, data);
+
+                Assert.assertEquals(MathTestConstants.VAL_NOT_EQUALS, storage.get(i, j), data, MathTestConstants.NIL_DELTA);
+            }
+        }
+    }
+
+    /** */
+    @Test
+    public void columnSize() throws Exception {
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, storage.columnSize(), MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void rowSize() throws Exception {
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, storage.rowSize(), MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Override public void externalizeTest() {
+        fillMatrix();
+        super.externalizeTest(storage);
+    }
+
+    /** */
+    protected void fillMatrix() {
+        for (int i = 0; i < storage.rowSize(); i++) {
+            for (int j = 0; j < storage.columnSize(); j++)
+                storage.set(i, j, Math.random());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixOffHeapStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixOffHeapStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixOffHeapStorageTest.java
new file mode 100644
index 0000000..a3b21bb
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixOffHeapStorageTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNull;
+
+/**
+ * Unit tests for {@link DenseOffHeapMatrixStorage}.
+ */
+public class MatrixOffHeapStorageTest extends MatrixBaseStorageTest<DenseOffHeapMatrixStorage> {
+    /** {@inheritDoc} */
+    @Override public void setUp() {
+        storage = new DenseOffHeapMatrixStorage(MathTestConstants.STORAGE_SIZE, MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void data() throws Exception {
+        assertNull(MathTestConstants.UNEXPECTED_VAL, storage.data());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageFixtures.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageFixtures.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageFixtures.java
new file mode 100644
index 0000000..6353c38
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageFixtures.java
@@ -0,0 +1,141 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.function.BiConsumer;
+import java.util.function.Supplier;
+import org.apache.ignite.math.MatrixStorage;
+import org.jetbrains.annotations.NotNull;
+
+import static org.apache.ignite.math.StorageConstants.COLUMN_STORAGE_MODE;
+import static org.apache.ignite.math.StorageConstants.RANDOM_ACCESS_MODE;
+import static org.apache.ignite.math.StorageConstants.ROW_STORAGE_MODE;
+import static org.apache.ignite.math.StorageConstants.SEQUENTIAL_ACCESS_MODE;
+
+/**
+ *
+ */
+class MatrixStorageFixtures {
+    /** */
+    private static final List<Supplier<Iterable<MatrixStorage>>> suppliers = Collections.singletonList(
+        (Supplier<Iterable<MatrixStorage>>) SparseLocalMatrixStorageFixture::new
+    );
+
+    /** */
+    void consumeSampleStorages(BiConsumer<Integer, Integer> paramsConsumer,
+        BiConsumer<MatrixStorage, String> consumer) {
+        for (Supplier<Iterable<MatrixStorage>> fixtureSupplier : suppliers) {
+            final Iterable<MatrixStorage> fixture = fixtureSupplier.get();
+
+            for (MatrixStorage matrixStorage : fixture) {
+                if (paramsConsumer != null)
+                    paramsConsumer.accept(matrixStorage.rowSize(), matrixStorage.columnSize());
+
+                consumer.accept(matrixStorage, fixture.toString());
+            }
+        }
+    }
+
+    /** */
+    private static class SparseLocalMatrixStorageFixture implements Iterable<MatrixStorage> {
+        /** */
+        private final Integer[] rows = new Integer[] {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 512, 1024, null};
+        /** */
+        private final Integer[] cols = new Integer[] {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 1024, 512, null};
+        /** */
+        private final Integer[] randomAccess = new Integer[] {SEQUENTIAL_ACCESS_MODE, RANDOM_ACCESS_MODE, null};
+        /** */
+        private final Integer[] rowStorage = new Integer[] {ROW_STORAGE_MODE, COLUMN_STORAGE_MODE, null};
+        /** */
+        private int sizeIdx = 0;
+        /** */
+        private int acsModeIdx = 0;
+        /** */
+        private int stoModeIdx = 0;
+
+        /** {@inheritDoc} */
+        @NotNull
+        @Override public Iterator<MatrixStorage> iterator() {
+            return new Iterator<MatrixStorage>() {
+                /** {@inheritDoc} */
+                @Override public boolean hasNext() {
+                    return hasNextCol(sizeIdx) && hasNextRow(sizeIdx)
+                        && hasNextAcsMode(acsModeIdx) && hasNextStoMode(stoModeIdx);
+                }
+
+                /** {@inheritDoc} */
+                @Override public MatrixStorage next() {
+                    if (!hasNext())
+                        throw new NoSuchElementException(SparseLocalMatrixStorageFixture.this.toString());
+
+                    MatrixStorage storage = new SparseLocalOnHeapMatrixStorage(
+                        rows[sizeIdx], cols[sizeIdx], randomAccess[acsModeIdx], rowStorage[stoModeIdx]);
+
+                    nextIdx();
+
+                    return storage;
+                }
+
+                private void nextIdx() {
+                    if (hasNextStoMode(stoModeIdx + 1)) {
+                        stoModeIdx++;
+
+                        return;
+                    }
+
+                    stoModeIdx = 0;
+
+                    if (hasNextAcsMode(acsModeIdx + 1)) {
+                        acsModeIdx++;
+
+                        return;
+                    }
+
+                    acsModeIdx = 0;
+                    sizeIdx++;
+                }
+            };
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return "SparseLocalMatrixStorageFixture{ " + "rows=" + rows[sizeIdx] + ", cols=" + cols[sizeIdx] +
+                ", access mode=" + randomAccess[acsModeIdx] + ", storage mode=" + rowStorage[stoModeIdx] + "}";
+        }
+
+        /** */ private boolean hasNextRow(int idx) {
+            return rows[idx] != null;
+        }
+
+        /** */ private boolean hasNextCol(int idx) {
+            return cols[idx] != null;
+        }
+
+        /** */ private boolean hasNextAcsMode(int idx) {
+            return randomAccess[idx] != null;
+        }
+
+        /** */ private boolean hasNextStoMode(int idx) {
+            return rowStorage[idx] != null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageImplementationTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageImplementationTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageImplementationTest.java
new file mode 100644
index 0000000..6ec09bd
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/MatrixStorageImplementationTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.MatrixStorage;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit tests for {@link MatrixStorage} implementations.
+ *
+ * TODO: add attribute tests.
+ */
+public class MatrixStorageImplementationTest extends ExternalizeTest<MatrixStorage> {
+    /**
+     * The columnSize() and the rowSize() test.
+     */
+    @Test
+    public void sizeTest() {
+        final AtomicReference<Integer> expRowSize = new AtomicReference<>(0);
+        final AtomicReference<Integer> expColSize = new AtomicReference<>(0);
+
+        consumeSampleStorages((x, y) -> {
+                expRowSize.set(x);
+                expColSize.set(y);
+            },
+            (ms, desc) -> assertTrue("Expected size for " + desc, expColSize.get().equals(ms.columnSize()) && expRowSize.get().equals(ms.rowSize())));
+    }
+
+    /** */
+    @Test
+    public void getSetTest() {
+        consumeSampleStorages(null, (ms, desc) -> {
+            for (int i = 0; i < ms.rowSize(); i++) {
+                for (int j = 0; j < ms.columnSize(); j++) {
+                    double random = Math.random();
+                    ms.set(i, j, random);
+                    assertTrue("Unexpected value for " + desc + " x:" + i + ", y:" + j, Double.compare(random, ms.get(i, j)) == 0);
+                }
+            }
+        });
+    }
+
+    /** */
+    @Override public void externalizeTest() {
+        consumeSampleStorages(null, (ms, desc) -> externalizeTest(ms));
+    }
+
+    /** */
+    private void consumeSampleStorages(BiConsumer<Integer, Integer> paramsConsumer,
+        BiConsumer<MatrixStorage, String> consumer) {
+        new MatrixStorageFixtures().consumeSampleStorages(paramsConsumer, consumer);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorageTest.java
new file mode 100644
index 0000000..66fe9b4
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/matrix/SparseDistributedMatrixStorageTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.math.impls.storage.matrix;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Tests for {@link SparseDistributedMatrixStorage}.
+ */
+@GridCommonTest(group = "Distributed Models")
+public class SparseDistributedMatrixStorageTest extends GridCommonAbstractTest {
+    /** Number of nodes in grid */
+    private static final int NODE_COUNT = 3;
+    /** Cache name. */
+    private static final String CACHE_NAME = "test-cache";
+    /** */
+    private static final String UNEXPECTED_ATTRIBUTE_VALUE = "Unexpected attribute value.";
+    /** Grid instance. */
+    private Ignite ignite;
+
+    /**
+     * Default constructor.
+     */
+    public SparseDistributedMatrixStorageTest() {
+        super(false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        for (int i = 1; i <= NODE_COUNT; i++)
+            startGrid(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override protected void beforeTest() throws Exception {
+        ignite = grid(NODE_COUNT);
+
+        ignite.configuration().setPeerClassLoadingEnabled(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        ignite.destroyCache(CACHE_NAME);
+    }
+
+    /** */
+    public void testCacheCreation() throws Exception {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        final int rows = MathTestConstants.STORAGE_SIZE;
+        final int cols = MathTestConstants.STORAGE_SIZE;
+
+        SparseDistributedMatrixStorage storage = new SparseDistributedMatrixStorage(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        assertNotNull("SparseDistributedMatrixStorage cache is null.", storage.cache());
+    }
+
+    /** */
+    public void testSetGet() throws Exception {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        final int rows = MathTestConstants.STORAGE_SIZE;
+        final int cols = MathTestConstants.STORAGE_SIZE;
+
+        SparseDistributedMatrixStorage storage = new SparseDistributedMatrixStorage(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        for (int i = 0; i < rows; i++) {
+            for (int j = 0; j < cols; j++) {
+                double v = Math.random();
+                storage.set(i, j, v);
+
+                assert Double.compare(v, storage.get(i, j)) == 0;
+                assert Double.compare(v, storage.get(i, j)) == 0;
+            }
+        }
+    }
+
+    /** */
+    public void testAttributes() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        final int rows = MathTestConstants.STORAGE_SIZE;
+        final int cols = MathTestConstants.STORAGE_SIZE;
+
+        SparseDistributedMatrixStorage storage = new SparseDistributedMatrixStorage(rows, cols, StorageConstants.ROW_STORAGE_MODE, StorageConstants.RANDOM_ACCESS_MODE);
+
+        assertEquals(UNEXPECTED_ATTRIBUTE_VALUE, storage.rowSize(), rows);
+        assertEquals(UNEXPECTED_ATTRIBUTE_VALUE, storage.columnSize(), cols);
+
+        assertFalse(UNEXPECTED_ATTRIBUTE_VALUE, storage.isArrayBased());
+        assertFalse(UNEXPECTED_ATTRIBUTE_VALUE, storage.isDense());
+        assertTrue(UNEXPECTED_ATTRIBUTE_VALUE, storage.isDistributed());
+
+        assertEquals(UNEXPECTED_ATTRIBUTE_VALUE, storage.isRandomAccess(), !storage.isSequentialAccess());
+        assertTrue(UNEXPECTED_ATTRIBUTE_VALUE, storage.isRandomAccess());
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/RandomAccessSparseVectorStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/RandomAccessSparseVectorStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/RandomAccessSparseVectorStorageTest.java
new file mode 100644
index 0000000..8a223fc
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/RandomAccessSparseVectorStorageTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import org.apache.ignite.math.StorageConstants;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Unit tests for {@link SparseLocalOnHeapVectorStorage}.
+ */
+public class RandomAccessSparseVectorStorageTest extends VectorBaseStorageTest<SparseLocalOnHeapVectorStorage> {
+    /** */
+    @Override public void setUp() {
+        storage = new SparseLocalOnHeapVectorStorage(MathTestConstants.STORAGE_SIZE, StorageConstants.RANDOM_ACCESS_MODE);
+    }
+
+    /** */
+    @Test
+    public void data() throws Exception {
+        assertNull(MathTestConstants.NULL_VAL, storage.data());
+    }
+
+    /** */
+    @Test
+    public void isSequentialAccess() throws Exception {
+        assertFalse(MathTestConstants.UNEXPECTED_VAL, storage.isSequentialAccess());
+    }
+
+    /** */
+    @Test
+    public void isDense() throws Exception {
+        assertFalse(MathTestConstants.UNEXPECTED_VAL, storage.isDense());
+    }
+
+    /** */
+    @Test
+    public void isArrayBased() throws Exception {
+        assertFalse(MathTestConstants.UNEXPECTED_VAL, storage.isArrayBased());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorageTest.java
new file mode 100644
index 0000000..a7751d8
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/SparseLocalOffHeapVectorStorageTest.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.math.impls.storage.vector;
+
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.apache.ignite.math.impls.MathTestConstants.STORAGE_SIZE;
+import static org.apache.ignite.math.impls.MathTestConstants.UNEXPECTED_VAL;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link SparseLocalOffHeapVectorStorage}.
+ */
+public class SparseLocalOffHeapVectorStorageTest extends ExternalizeTest<SparseLocalOffHeapVectorStorage> {
+    /** */ private SparseLocalOffHeapVectorStorage testVectorStorage;
+
+    /** */
+    @Before
+    public void setup() {
+        testVectorStorage = new SparseLocalOffHeapVectorStorage(STORAGE_SIZE);
+    }
+
+    /** */
+    @After
+    public void teardown() {
+        testVectorStorage.destroy();
+        testVectorStorage = null;
+    }
+
+    /** */
+    @Test
+    public void testBasic() {
+        for (int i = 0; i < STORAGE_SIZE; i++) {
+            double testVal = Math.random();
+            testVectorStorage.set(i, testVal);
+            assertEquals(UNEXPECTED_VAL, testVal, testVectorStorage.get(i), 0d);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Test(expected = UnsupportedOperationException.class)
+    @Override public void externalizeTest() {
+        super.externalizeTest(new SparseLocalOffHeapVectorStorage(STORAGE_SIZE));
+    }
+
+    /** */
+    @Test
+    public void testAttributes() {
+        SparseLocalOffHeapVectorStorage testVectorStorage = new SparseLocalOffHeapVectorStorage(STORAGE_SIZE);
+
+        assertTrue(UNEXPECTED_VAL, testVectorStorage.isRandomAccess());
+        assertFalse(UNEXPECTED_VAL, testVectorStorage.isSequentialAccess());
+        assertFalse(UNEXPECTED_VAL, testVectorStorage.isDense());
+        assertFalse(UNEXPECTED_VAL, testVectorStorage.isArrayBased());
+        assertFalse(UNEXPECTED_VAL, testVectorStorage.isDistributed());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorArrayStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorArrayStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorArrayStorageTest.java
new file mode 100644
index 0000000..2afc97b
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorArrayStorageTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import java.util.Arrays;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit test for {@link ArrayVectorStorage}.
+ */
+public class VectorArrayStorageTest extends VectorBaseStorageTest<ArrayVectorStorage> {
+    /** */
+    @Override public void setUp() {
+        storage = new ArrayVectorStorage(MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void isArrayBased() throws Exception {
+        assertTrue(MathTestConstants.WRONG_ATTRIBUTE_VAL, storage.isArrayBased());
+
+        assertTrue(MathTestConstants.WRONG_ATTRIBUTE_VAL, new ArrayVectorStorage().isArrayBased());
+    }
+
+    /** */
+    @Test
+    public void data() throws Exception {
+        assertNotNull(MathTestConstants.NULL_DATA_STORAGE, storage.data());
+
+        assertEquals(MathTestConstants.WRONG_DATA_SIZE, storage.data().length, MathTestConstants.STORAGE_SIZE);
+
+        assertTrue(MathTestConstants.UNEXPECTED_DATA_VAL, Arrays.equals(storage.data(), new double[MathTestConstants.STORAGE_SIZE]));
+
+        assertNull(MathTestConstants.UNEXPECTED_DATA_VAL, new ArrayVectorStorage().data());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorBaseStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorBaseStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorBaseStorageTest.java
new file mode 100644
index 0000000..988f8c3
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorBaseStorageTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import org.apache.ignite.math.ExternalizeTest;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Abstract class with base tests for each vector storage.
+ */
+public abstract class VectorBaseStorageTest<T extends VectorStorage> extends ExternalizeTest<T> {
+    /** */
+    protected T storage;
+
+    /** */
+    @Before
+    public abstract void setUp();
+
+    /** */
+    @After
+    public void tearDown() throws Exception {
+        storage.destroy();
+    }
+
+    /** */
+    @Test
+    public void getSet() throws Exception {
+        for (int i = 0; i < MathTestConstants.STORAGE_SIZE; i++) {
+            double random = Math.random();
+
+            storage.set(i, random);
+
+            assertEquals(MathTestConstants.WRONG_DATA_ELEMENT, storage.get(i), random, MathTestConstants.NIL_DELTA);
+        }
+    }
+
+    /** */
+    @Test
+    public void size() {
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, storage.size() == MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Override public void externalizeTest() {
+        super.externalizeTest(storage);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorOffheapStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorOffheapStorageTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorOffheapStorageTest.java
new file mode 100644
index 0000000..2645926
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/storage/vector/VectorOffheapStorageTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.math.impls.storage.vector;
+
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit tests for {@link DenseLocalOffHeapVectorStorage}.
+ */
+public class VectorOffheapStorageTest extends VectorBaseStorageTest<DenseLocalOffHeapVectorStorage> {
+    /** */
+    @Before
+    public void setUp() {
+        storage = new DenseLocalOffHeapVectorStorage(MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void isArrayBased() throws Exception {
+        assertFalse(MathTestConstants.UNEXPECTED_VAL, storage.isArrayBased());
+    }
+
+    /** */
+    @Test
+    public void data() throws Exception {
+        assertNull(MathTestConstants.NULL_VAL, storage.data());
+    }
+
+    /** */
+    @Test
+    public void isSequentialAccess() throws Exception {
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, storage.isSequentialAccess());
+    }
+
+    /** */
+    @Test
+    public void isDense() throws Exception {
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, storage.isDense());
+    }
+
+    /** */
+    @Test
+    public void equalsTest() {
+        //noinspection EqualsWithItself
+        assertTrue(MathTestConstants.VAL_NOT_EQUALS, storage.equals(storage));
+
+        //noinspection EqualsBetweenInconvertibleTypes
+        assertFalse(MathTestConstants.VALUES_SHOULD_BE_NOT_EQUALS,
+            storage.equals(new ArrayVectorStorage(MathTestConstants.STORAGE_SIZE)));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/AbstractVectorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/AbstractVectorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/AbstractVectorTest.java
new file mode 100644
index 0000000..c7927a5
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/AbstractVectorTest.java
@@ -0,0 +1,543 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.Arrays;
+import java.util.stream.StreamSupport;
+import org.apache.ignite.math.Matrix;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorStorage;
+import org.apache.ignite.math.exceptions.IndexException;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.math.impls.storage.vector.ArrayVectorStorage;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit test for {@link AbstractVector}.
+ */
+public class AbstractVectorTest {
+    /** */
+    private AbstractVector testVector;
+
+    /** */
+    @Before
+    public void setUp() {
+        testVector = getAbstractVector();
+    }
+
+    /** */
+    @Test
+    public void setStorage() {
+        testVector.setStorage(createStorage());
+
+        assertTrue(testVector.size() == MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void size() {
+        testVector.setStorage(createStorage());
+        assertTrue(testVector.size() == MathTestConstants.STORAGE_SIZE);
+
+        testVector.setStorage(new ArrayVectorStorage(MathTestConstants.STORAGE_SIZE + MathTestConstants.STORAGE_SIZE));
+        assertTrue(testVector.size() == MathTestConstants.STORAGE_SIZE + MathTestConstants.STORAGE_SIZE);
+
+        testVector = getAbstractVector(createStorage());
+        assertTrue(testVector.size() == MathTestConstants.STORAGE_SIZE);
+    }
+
+    /** */
+    @Test
+    public void getPositive() {
+        testVector = getAbstractVector(createStorage());
+
+        for (int i = 0; i < MathTestConstants.STORAGE_SIZE; i++)
+            assertNotNull(MathTestConstants.NULL_VALUES, testVector.get(i));
+
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void getNegative0() {
+        testVector.get(0);
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void getNegative1() {
+        testVector.setStorage(createStorage());
+
+        testVector.get(-1);
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void getNegative2() {
+        testVector.setStorage(createStorage());
+
+        testVector.get(testVector.size() + 1);
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void getXNegative0() {
+        testVector.getX(0);
+    }
+
+    /** */
+    @Test(expected = ArrayIndexOutOfBoundsException.class)
+    public void getXNegative1() {
+        testVector.setStorage(createStorage());
+
+        testVector.getX(-1);
+    }
+
+    /** */
+    @Test(expected = ArrayIndexOutOfBoundsException.class)
+    public void getXNegative2() {
+        testVector.setStorage(createStorage());
+
+        testVector.getX(MathTestConstants.STORAGE_SIZE + 1);
+    }
+
+    /** */
+    @Test
+    public void set() {
+        double[] data = initVector();
+
+        for (int i = 0; i < MathTestConstants.STORAGE_SIZE; i++)
+            testVector.set(i, Math.exp(data[i]));
+
+        for (int i = 0; i < MathTestConstants.STORAGE_SIZE; i++)
+            assertEquals(MathTestConstants.VAL_NOT_EQUALS, testVector.get(i), Math.exp(data[i]), MathTestConstants.NIL_DELTA);
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void setNegative0() {
+        testVector.set(-1, -1);
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void setNegative1() {
+        initVector();
+
+        testVector.set(-1, -1);
+    }
+
+    /** */
+    @Test(expected = IndexException.class)
+    public void setNegative2() {
+        initVector();
+
+        testVector.set(MathTestConstants.STORAGE_SIZE + 1, -1);
+    }
+
+    /** */
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void setXNegative0() {
+        initVector();
+
+        testVector.setX(-1, -1);
+    }
+
+    /** */
+    @Test(expected = IndexOutOfBoundsException.class)
+    public void setXNegative1() {
+        initVector();
+
+        testVector.setX(MathTestConstants.STORAGE_SIZE + 1, -1);
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void setXNegative2() {
+        testVector.setX(-1, -1);
+    }
+
+    /** */
+    @Test
+    public void isZero() {
+        assertTrue(MathTestConstants.UNEXPECTED_VAL, testVector.isZero(0d));
+
+        assertFalse(MathTestConstants.UNEXPECTED_VAL, testVector.isZero(1d));
+    }
+
+    /** */
+    @Test
+    public void guid() {
+        assertNotNull(MathTestConstants.NULL_GUID, testVector.guid());
+
+        assertEquals(MathTestConstants.UNEXPECTED_GUID_VAL, testVector.guid(), testVector.guid());
+
+        assertFalse(MathTestConstants.EMPTY_GUID, testVector.guid().toString().isEmpty());
+
+        testVector = getAbstractVector(createStorage());
+
+        assertNotNull(MathTestConstants.NULL_GUID, testVector.guid());
+
+        assertEquals(MathTestConstants.UNEXPECTED_GUID_VAL, testVector.guid(), testVector.guid());
+
+        assertFalse(MathTestConstants.EMPTY_GUID, testVector.guid().toString().isEmpty());
+    }
+
+    /** */
+    @Test
+    public void equalsTest() {
+        VectorStorage storage = createStorage();
+
+        AbstractVector testVector1 = getAbstractVector();
+
+        testVector1.setStorage(storage);
+
+        AbstractVector testVector2 = getAbstractVector();
+
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, testVector, testVector);
+
+        testVector2.setStorage(storage);
+
+        assertTrue(MathTestConstants.VAL_NOT_EQUALS, testVector1.equals(testVector2));
+
+        assertFalse(MathTestConstants.VALUES_SHOULD_BE_NOT_EQUALS, testVector1.equals(testVector));
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void all() {
+        assertNotNull(MathTestConstants.NULL_VAL, testVector.all());
+
+        assertNotNull(MathTestConstants.NULL_VAL, getAbstractVector(createStorage()).all());
+
+        getAbstractVector().all().iterator().next();
+    }
+
+    /** */
+    @Test
+    public void nonZeroElements() {
+        VectorStorage storage = createStorage();
+
+        double[] data = storage.data();
+
+        testVector = getAbstractVector(storage);
+
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, testVector.nonZeroElements(), Arrays.stream(data).filter(x -> x != 0d).count());
+
+        addNilValues(data);
+
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, testVector.nonZeroElements(), Arrays.stream(data).filter(x -> x != 0d).count());
+    }
+
+    /** */
+    @Test
+    public void foldMapWithSecondVector() {
+        double[] data0 = initVector();
+
+        VectorStorage storage1 = createStorage();
+
+        double[] data1 = storage1.data().clone();
+
+        AbstractVector testVector1 = getAbstractVector(storage1);
+
+        String testVal = "";
+
+        for (int i = 0; i < data0.length; i++)
+            testVal += data0[i] + data1[i];
+
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, testVector.foldMap(testVector1, (string, xi) -> string.concat(xi.toString()), Functions.PLUS, ""), testVal);
+    }
+
+    /** */
+    @Test
+    public void nonZeroes() {
+        assertNotNull(MathTestConstants.NULL_VAL, testVector.nonZeroes());
+
+        double[] data = initVector();
+
+        assertNotNull(MathTestConstants.NULL_VAL, testVector.nonZeroes());
+
+        Assert.assertEquals(MathTestConstants.VAL_NOT_EQUALS, StreamSupport.stream(testVector.nonZeroes().spliterator(), false).count(), Arrays.stream(data).filter(x -> x != 0d).count());
+
+        addNilValues(data);
+
+        Assert.assertEquals(MathTestConstants.VAL_NOT_EQUALS, StreamSupport.stream(testVector.nonZeroes().spliterator(), false).count(), Arrays.stream(data).filter(x -> x != 0d).count());
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void nonZeroesEmpty() {
+        testVector.nonZeroes().iterator().next();
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void assign() {
+        testVector.assign(MathTestConstants.TEST_VAL);
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void assignArr() {
+        testVector.assign(new double[1]);
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void assignArrEmpty() {
+        testVector.assign(new double[0]);
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void dotNegative() {
+        testVector.dot(getAbstractVector(createEmptyStorage()));
+    }
+
+    /** */
+    @Test
+    public void dotSelf() {
+        double[] data = initVector();
+
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, testVector.dotSelf(), Arrays.stream(data).reduce(0, (x, y) -> x + y * y), MathTestConstants.NIL_DELTA);
+    }
+
+    /** */
+    @Test
+    public void getStorage() {
+        assertNotNull(MathTestConstants.NULL_VAL, getAbstractVector(createEmptyStorage()));
+        assertNotNull(MathTestConstants.NULL_VAL, getAbstractVector(createStorage()));
+        testVector.setStorage(createStorage());
+        assertNotNull(MathTestConstants.NULL_VAL, testVector.getStorage());
+    }
+
+    /** */
+    @Test
+    public void getElement() {
+        double[] data = initVector();
+
+        for (int i = 0; i < data.length; i++) {
+            assertNotNull(MathTestConstants.NULL_VAL, testVector.getElement(i));
+
+            assertEquals(MathTestConstants.UNEXPECTED_VAL, testVector.getElement(i).get(), data[i], MathTestConstants.NIL_DELTA);
+
+            testVector.getElement(i).set(++data[i]);
+
+            assertEquals(MathTestConstants.UNEXPECTED_VAL, testVector.getElement(i).get(), data[i], MathTestConstants.NIL_DELTA);
+        }
+    }
+
+    /**
+     * Create {@link AbstractVector} with storage for tests.
+     *
+     * @param storage {@link VectorStorage}
+     * @return AbstractVector.
+     */
+    private AbstractVector getAbstractVector(VectorStorage storage) {
+        return new AbstractVector(storage) { // TODO: find out how to fix warning about missing constructor
+            /** */
+            @Override public boolean isDense() {
+                return false;
+            }
+
+            /** */
+            @Override public boolean isSequentialAccess() {
+                return false;
+            }
+
+            /** */
+            @Override public Matrix likeMatrix(int rows, int cols) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector copy() {
+                return getAbstractVector(this.getStorage());
+            }
+
+            /** */
+            @Override public Vector like(int crd) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector normalize() {
+                return null;
+            }
+
+            /** */
+            @Override public Vector normalize(double power) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector logNormalize() {
+                return null;
+            }
+
+            /** */
+            @Override public Vector logNormalize(double power) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector viewPart(int off, int len) {
+                return null;
+            }
+
+            /** {@inheritDoc} */
+            @Override public boolean isRandomAccess() {
+                return true;
+            }
+
+            /** {@inheritDoc} */
+            @Override public boolean isDistributed() {
+                return false;
+            }
+        };
+    }
+
+    /**
+     * Create empty {@link AbstractVector} for tests.
+     *
+     * @return AbstractVector.
+     */
+    private AbstractVector getAbstractVector() {
+        return new AbstractVector() { // TODO: find out how to fix warning about missing constructor
+            /** */
+            @Override public boolean isDense() {
+                return false;
+            }
+
+            /** */
+            @Override public Matrix likeMatrix(int rows, int cols) {
+                return null;
+            }
+
+            /** */
+            @Override public boolean isSequentialAccess() {
+                return false;
+            }
+
+            /** */
+            @Override public Vector copy() {
+                return getAbstractVector(this.getStorage());
+            }
+
+            /** */
+            @Override public Vector like(int crd) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector normalize() {
+                return null;
+            }
+
+            /** */
+            @Override public Vector normalize(double power) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector logNormalize() {
+                return null;
+            }
+
+            /** */
+            @Override public Vector logNormalize(double power) {
+                return null;
+            }
+
+            /** */
+            @Override public Vector viewPart(int off, int len) {
+                return null;
+            }
+
+            /** {@inheritDoc} */
+            @Override public boolean isRandomAccess() {
+                return true;
+            }
+
+            /** {@inheritDoc} */
+            @Override public boolean isDistributed() {
+                return false;
+            }
+        };
+    }
+
+    /**
+     * Create {@link VectorStorage} for tests.
+     *
+     * @return VectorStorage
+     */
+    private VectorStorage createEmptyStorage() {
+        return new ArrayVectorStorage(MathTestConstants.STORAGE_SIZE);
+    }
+
+    /**
+     * Create filled {@link VectorStorage} for tests.
+     *
+     * @return VectorStorage.
+     */
+    private VectorStorage createStorage() {
+        ArrayVectorStorage storage = new ArrayVectorStorage(MathTestConstants.STORAGE_SIZE);
+
+        for (int i = 0; i < MathTestConstants.STORAGE_SIZE; i++)
+            storage.set(i, Math.random());
+
+        return storage;
+    }
+
+    /**
+     * Init vector and return initialized values.
+     *
+     * @return Initial values.
+     */
+    private double[] initVector() {
+        VectorStorage storage = createStorage();
+        double[] data = storage.data().clone();
+
+        testVector = getAbstractVector(storage);
+        return data;
+    }
+
+    /**
+     * Add some zeroes to vector elements.
+     */
+    private void addNilValues() {
+        testVector.set(10, 0);
+        testVector.set(50, 0);
+    }
+
+    /**
+     * Add some zeroes to vector elements. Also set zeroes to the same elements in reference array data
+     */
+    private void addNilValues(double[] testRef) {
+        addNilValues();
+        testRef[10] = 0;
+        testRef[50] = 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/CacheVectorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/CacheVectorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/CacheVectorTest.java
new file mode 100644
index 0000000..f276820
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/CacheVectorTest.java
@@ -0,0 +1,417 @@
+package org.apache.ignite.math.impls.vector;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.stream.IntStream;
+import junit.framework.TestCase;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.math.IdentityValueMapper;
+import org.apache.ignite.math.Vector;
+import org.apache.ignite.math.VectorKeyMapper;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.Functions;
+import org.apache.ignite.math.impls.MathTestConstants;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Tests for {@link CacheVector}.
+ */
+@GridCommonTest(group = "Distributed Models")
+public class CacheVectorTest extends GridCommonAbstractTest {
+    /** Number of nodes in grid */
+    private static final int NODE_COUNT = 3;
+    /** Cache name. */
+    private static final String CACHE_NAME = "test-cache";
+    /** Cache size. */
+    private static final int size = MathTestConstants.STORAGE_SIZE;
+    /** Grid instance. */
+    private Ignite ignite;
+    /** Default key mapper. */
+    private VectorKeyMapper<Integer> keyMapper = new TestKeyMapper();
+
+    /**
+     * Default constructor.
+     */
+    public CacheVectorTest() {
+        super(false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        for (int i = 1; i <= NODE_COUNT; i++)
+            startGrid(i);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        ignite = grid(NODE_COUNT);
+
+        ignite.configuration().setPeerClassLoadingEnabled(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        ignite.destroyCache(CACHE_NAME);
+    }
+
+    /** */
+    public void testGetSet() throws Exception {
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        for (int i = 0; i < size; i++) {
+            double random = Math.random();
+            cacheVector.set(i, random);
+            assertEquals("Unexpected value.", random, cacheVector.get(i), 0d);
+        }
+    }
+
+    /** */
+    public void testMap() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+
+        cacheVector.map(value -> 110d);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), 110d, 0d);
+    }
+
+    /** */
+    public void testMapBiFunc() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+
+        cacheVector.map(Functions.PLUS, 1d);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), 1d, 0d);
+    }
+
+    /** */
+    public void testSum() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+
+        assertEquals("Unexpected value.", cacheVector.sum(), 0d, 0d);
+
+        cacheVector.assign(1d);
+
+        assertEquals("Unexpected value.", cacheVector.sum(), size, 0d);
+    }
+
+    /** */
+    public void testSumNegative() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        try {
+            double d = cacheVector.sum();
+            fail();
+        }
+        catch (NullPointerException e) {
+            // No-op.
+        }
+    }
+
+    /** */
+    public void testAssign() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+
+        cacheVector.assign(1d);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), 1d, 0d);
+    }
+
+    /** */
+    public void testAssignRange() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        cacheVector.assign(IntStream.range(0, size).asDoubleStream().toArray());
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), i, 0d);
+    }
+
+    /** */
+    public void testAssignVector() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        Vector testVec = new DenseLocalOnHeapVector(IntStream.range(0, size).asDoubleStream().toArray());
+
+        cacheVector.assign(testVec);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), testVec.get(i), 0d);
+    }
+
+    /** */
+    public void testAssignFunc() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        cacheVector.assign(idx -> idx);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), i, 0d);
+    }
+
+    /** */
+    public void testPlus() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+
+        cacheVector.plus(1d);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), 1d, 0d);
+    }
+
+    /** */
+    public void testPlusVec() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        Vector testVec = new DenseLocalOnHeapVector(IntStream.range(0, size).asDoubleStream().toArray());
+
+        try {
+            cacheVector.plus(testVec);
+            TestCase.fail();
+        }
+        catch (UnsupportedOperationException ignored) {
+
+        }
+    }
+
+    /** */
+    public void testDivide() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        final int size = MathTestConstants.STORAGE_SIZE;
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+        cacheVector.assign(1d);
+
+        cacheVector.divide(2d);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), 1d / 2d, 0d);
+    }
+
+    /** */
+    public void testTimes() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        final int size = MathTestConstants.STORAGE_SIZE;
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        initVector(cacheVector);
+        cacheVector.assign(1d);
+
+        cacheVector.times(2d);
+
+        for (int i = 0; i < size; i++)
+            assertEquals("Unexpected value.", cacheVector.get(i), 2d, 0d);
+    }
+
+    /** */
+    public void testTimesVector() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        cacheVector.assign(1d);
+        Vector testVec = new DenseLocalOnHeapVector(IntStream.range(0, size).asDoubleStream().toArray());
+
+        try {
+            cacheVector.times(testVec);
+            TestCase.fail();
+        }
+        catch (UnsupportedOperationException ignored) {
+
+        }
+
+    }
+
+    /** */
+    public void testMin() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        Vector testVec = new DenseLocalOnHeapVector(IntStream.range(0, size).asDoubleStream().toArray());
+
+        cacheVector.assign(testVec);
+
+        assertEquals("Unexpected value.", cacheVector.minValue(), 0d, 0d);
+    }
+
+    /** */
+    public void testMax() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        Vector testVec = new DenseLocalOnHeapVector(IntStream.range(0, size).asDoubleStream().toArray());
+
+        cacheVector.assign(testVec);
+
+        assertEquals("Unexpected value.", cacheVector.maxValue(), testVec.get(size - 1), 0d);
+    }
+
+    /** */
+    public void testLike() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        try {
+            cacheVector.like(size);
+            TestCase.fail("Unsupported case");
+        }
+        catch (UnsupportedOperationException ignored) {
+
+        }
+    }
+
+    /** */
+    public void testLikeMatrix() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        try {
+            cacheVector.likeMatrix(size, size);
+            TestCase.fail("Unsupported case");
+        }
+        catch (UnsupportedOperationException ignored) {
+
+        }
+    }
+
+    /** */
+    public void testCopy() {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        try {
+            cacheVector.copy();
+            TestCase.fail("Unsupported case");
+        }
+        catch (UnsupportedOperationException ignored) {
+
+        }
+    }
+
+    /** */
+    public void testExternalize() throws IOException, ClassNotFoundException {
+        IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
+
+        IdentityValueMapper valMapper = new IdentityValueMapper();
+        CacheVector<Integer, Double> cacheVector = new CacheVector<>(size, getCache(), keyMapper, valMapper);
+
+        cacheVector.set(1, 1.0);
+
+        ByteArrayOutputStream byteArrOutputStream = new ByteArrayOutputStream();
+        ObjectOutputStream objOutputStream = new ObjectOutputStream(byteArrOutputStream);
+
+        objOutputStream.writeObject(cacheVector);
+
+        ByteArrayInputStream byteArrInputStream = new ByteArrayInputStream(byteArrOutputStream.toByteArray());
+        ObjectInputStream objInputStream = new ObjectInputStream(byteArrInputStream);
+
+        CacheVector objRestored = (CacheVector)objInputStream.readObject();
+
+        assertTrue(MathTestConstants.VAL_NOT_EQUALS, cacheVector.equals(objRestored));
+        assertEquals(MathTestConstants.VAL_NOT_EQUALS, objRestored.get(1), 1.0, 0.0);
+    }
+
+    /** */
+    private void initVector(CacheVector cacheVector) {
+        for (int i = 0; i < cacheVector.size(); i++)
+            cacheVector.set(i, 0d);
+    }
+
+    /** */
+    private IgniteCache<Integer, Double> getCache() {
+        assert ignite != null;
+
+        CacheConfiguration cfg = new CacheConfiguration();
+        cfg.setName(CACHE_NAME);
+
+        IgniteCache<Integer, Double> cache = ignite.getOrCreateCache(CACHE_NAME);
+
+        assert cache != null;
+        return cache;
+    }
+
+    /** */ private static class TestKeyMapper implements VectorKeyMapper<Integer> {
+        /** {@inheritDoc} */
+        @Override public Integer apply(int i) {
+            return i;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isValid(Integer i) {
+            return i < size;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/ConstantVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/ConstantVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/ConstantVectorConstructorTest.java
new file mode 100644
index 0000000..2ed42bc
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/ConstantVectorConstructorTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.math.impls.vector;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class ConstantVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new ConstantVector(-1, 1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void zeroSizeTest() {
+        assertEquals("Zero size.", IMPOSSIBLE_SIZE,
+            new ConstantVector(0, 1).size());
+    }
+
+    /** */
+    @Test
+    public void primitiveTest() {
+        assertEquals("1 size.", 1,
+            new ConstantVector(1, 1).size());
+
+        assertEquals("2 size.", 2,
+            new ConstantVector(2, 1).size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DelegatingVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DelegatingVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DelegatingVectorConstructorTest.java
new file mode 100644
index 0000000..82e4e0b
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DelegatingVectorConstructorTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.math.impls.vector;
+
+import org.apache.ignite.math.Vector;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class DelegatingVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test
+    public void basicTest() {
+        final Vector parent = new DenseLocalOnHeapVector(new double[] {0, 1});
+
+        final Vector delegate = new DelegatingVector(parent);
+
+        final int size = parent.size();
+
+        assertEquals("Delegate size differs from expected.", size, delegate.size());
+
+        for (int idx = 0; idx < size; idx++)
+            assertDelegate(parent, delegate, idx);
+    }
+
+    /** */
+    private void assertDelegate(Vector parent, Vector delegate, int idx) {
+        assertValue(parent, delegate, idx);
+
+        parent.set(idx, parent.get(idx) + 1);
+
+        assertValue(parent, delegate, idx);
+
+        delegate.set(idx, delegate.get(idx) + 2);
+
+        assertValue(parent, delegate, idx);
+    }
+
+    /** */
+    private void assertValue(Vector parent, Vector delegate, int idx) {
+        assertEquals("Unexpected value at index " + idx, parent.get(idx), delegate.get(idx), 0d);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVectorConstructorTest.java
new file mode 100644
index 0000000..d62f35f
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOffHeapVectorConstructorTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.math.impls.vector;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class DenseLocalOffHeapVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new DenseLocalOffHeapVector(-1).size());
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void nullArrayTest() {
+        assertEquals("Null array.", IMPOSSIBLE_SIZE,
+            new DenseLocalOffHeapVector(null).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void zeroSizeTest() {
+        assertEquals("0 size.", IMPOSSIBLE_SIZE,
+            new DenseLocalOffHeapVector(new double[0]).size());
+    }
+
+    /** */
+    @Test
+    public void primitiveTest() {
+        assertEquals("1 size.", 1,
+            new DenseLocalOffHeapVector(new double[1]).size());
+
+        assertEquals("2 size.", 2,
+            new DenseLocalOffHeapVector(new double[2]).size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVectorConstructorTest.java
new file mode 100644
index 0000000..c10778e
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/DenseLocalOnHeapVectorConstructorTest.java
@@ -0,0 +1,163 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class DenseLocalOnHeapVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = org.apache.ignite.math.exceptions.UnsupportedOperationException.class)
+    public void mapInvalidArgsTest() {
+        assertEquals("Expect exception due to invalid args.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(new HashMap<String, Object>() {{
+                put("invalid", 99);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void mapMissingArgsTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("arr", new double[0]);
+            put("shallowCopyMissing", "whatever");
+        }};
+
+        assertEquals("Expect exception due to missing args.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(test).size());
+    }
+
+    /** */
+    @Test(expected = ClassCastException.class)
+    public void mapInvalidArrTypeTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("size", "whatever");
+        }};
+
+        assertEquals("Expect exception due to invalid arr type.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(test).size());
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void mapInvalidCopyTypeTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("arr", new double[0]);
+            put("shallowCopy", 0);
+        }};
+
+        assertEquals("Expect exception due to invalid copy type.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(test).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void mapNullTest() {
+        //noinspection ConstantConditions
+        assertEquals("Null map args.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector((Map<String, Object>)null).size());
+    }
+
+    /** */
+    @Test
+    public void mapTest() {
+        assertEquals("Size from args.", 99,
+            new DenseLocalOnHeapVector(new HashMap<String, Object>() {{
+                put("size", 99);
+            }}).size());
+
+        final double[] test = new double[99];
+
+        assertEquals("Size from array in args.", test.length,
+            new DenseLocalOnHeapVector(new HashMap<String, Object>() {{
+                put("arr", test);
+                put("copy", false);
+            }}).size());
+
+        assertEquals("Size from array in args, shallow copy.", test.length,
+            new DenseLocalOnHeapVector(new HashMap<String, Object>() {{
+                put("arr", test);
+                put("copy", true);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(-1).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullCopyTest() {
+        assertEquals("Null array to non-shallow copy.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(null, false).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullDefaultCopyTest() {
+        assertEquals("Null array default copy.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector((double[])null).size());
+    }
+
+    /** */
+    @Test(expected = NullPointerException.class)
+    public void defaultConstructorTest() {
+        assertEquals("Default constructor.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector().size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void nullArrShallowCopyTest() {
+        assertEquals("Null array shallow copy.", IMPOSSIBLE_SIZE,
+            new DenseLocalOnHeapVector(null, true).size());
+    }
+
+    /** */
+    @Test
+    public void primitiveTest() {
+        assertEquals("0 size shallow copy.", 0,
+            new DenseLocalOnHeapVector(new double[0], true).size());
+
+        assertEquals("0 size.", 0,
+            new DenseLocalOnHeapVector(new double[0], false).size());
+
+        assertEquals("1 size shallow copy.", 1,
+            new DenseLocalOnHeapVector(new double[1], true).size());
+
+        assertEquals("1 size.", 1,
+            new DenseLocalOnHeapVector(new double[1], false).size());
+
+        assertEquals("0 size default copy.", 0,
+            new DenseLocalOnHeapVector(new double[0]).size());
+
+        assertEquals("1 size default copy.", 1,
+            new DenseLocalOnHeapVector(new double[1]).size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/acd21fb8/modules/math/src/test/java/org/apache/ignite/math/impls/vector/FunctionVectorConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/math/src/test/java/org/apache/ignite/math/impls/vector/FunctionVectorConstructorTest.java b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/FunctionVectorConstructorTest.java
new file mode 100644
index 0000000..57c96d1
--- /dev/null
+++ b/modules/math/src/test/java/org/apache/ignite/math/impls/vector/FunctionVectorConstructorTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.math.impls.vector;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.IntToDoubleFunction;
+import org.apache.ignite.math.exceptions.UnsupportedOperationException;
+import org.apache.ignite.math.functions.IgniteFunction;
+import org.apache.ignite.math.functions.IntDoubleToVoidFunction;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** */
+public class FunctionVectorConstructorTest {
+    /** */
+    private static final int IMPOSSIBLE_SIZE = -1;
+
+    /** */
+    @Test(expected = org.apache.ignite.math.exceptions.UnsupportedOperationException.class)
+    public void mapInvalidArgsTest() {
+        assertEquals("Expect exception due to invalid args.", IMPOSSIBLE_SIZE,
+            new FunctionVector(new HashMap<String, Object>() {{
+                put("invalid", 99);
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = UnsupportedOperationException.class)
+    public void mapMissingArgsTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("size", 1);
+            put("paramMissing", "whatever");
+        }};
+
+        assertEquals("Expect exception due to missing args.",
+            -1, new FunctionVector(test).size());
+    }
+
+    /** */
+    @Test(expected = ClassCastException.class)
+    public void mapInvalidParamTypeTest() {
+        final Map<String, Object> test = new HashMap<String, Object>() {{
+            put("size", "whatever");
+
+            put("getFunc", (IntToDoubleFunction)i -> i);
+        }};
+
+        assertEquals("Expect exception due to invalid param type.", IMPOSSIBLE_SIZE,
+            new FunctionVector(test).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void mapNullTest() {
+        //noinspection ConstantConditions
+        assertEquals("Null map args.", IMPOSSIBLE_SIZE,
+            new FunctionVector(null).size());
+    }
+
+    /** */
+    @Test
+    public void mapTest() {
+        assertEquals("Size from args.", 99,
+            new FunctionVector(new HashMap<String, Object>() {{
+                put("size", 99);
+
+                put("getFunc", (IgniteFunction<Integer, Double>)i -> (double)i);
+            }}).size());
+
+        assertEquals("Size from args with setFunc.", 99,
+            new FunctionVector(new HashMap<String, Object>() {{
+                put("size", 99);
+
+                put("getFunc", (IgniteFunction<Integer, Double>)i -> (double)i);
+
+                put("setFunc", (IntDoubleToVoidFunction)(integer, aDouble) -> {
+                });
+            }}).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void negativeSizeTest() {
+        assertEquals("Negative size.", IMPOSSIBLE_SIZE,
+            new FunctionVector(-1, (i) -> (double)i).size());
+    }
+
+    /** */
+    @Test(expected = AssertionError.class)
+    public void zeroSizeTest() {
+        assertEquals("0 size.", IMPOSSIBLE_SIZE,
+            new FunctionVector(0, (i) -> (double)i).size());
+    }
+
+    /** */
+    @Test
+    public void primitiveTest() {
+        assertEquals("1 size.", 1,
+            new FunctionVector(1, (i) -> (double)i).size());
+
+        assertEquals("2 size.", 2,
+            new FunctionVector(2, (i) -> (double)i).size());
+    }
+}


[17/50] [abbrv] ignite git commit: IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0

Posted by sb...@apache.org.
IGNITE-4988 Cleanup and refactor VisorXxx tasks and DTO for ignite-2.0


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

Branch: refs/heads/ignite-1561-1
Commit: 9b61a76bd2f5f18e50081b2553e58bf36375b8ab
Parents: 12dfe9e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Apr 14 20:59:26 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Apr 14 20:59:26 2017 +0700

----------------------------------------------------------------------
 .../visor/query/VisorCancelQueriesTask.java     | 72 ---------------
 .../query/VisorCollectRunningQueriesTask.java   | 96 --------------------
 .../query/VisorQueryScanSubstringFilter.java    | 64 -------------
 3 files changed, 232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9b61a76b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
deleted file mode 100644
index a6f2d82..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
+++ /dev/null
@@ -1,72 +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.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorOneNodeTask;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task to cancel queries.
- */
-@GridInternal
-public class VisorCancelQueriesTask extends VisorOneNodeTask<Collection<Long>, Void> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCancelQueriesJob job(Collection<Long> arg) {
-        return new VisorCancelQueriesJob(arg, debug);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Void reduce0(List<ComputeJobResult> results) throws IgniteException {
-        return null;
-    }
-
-    /**
-     * Job to cancel queries on node.
-     */
-    private static class VisorCancelQueriesJob extends VisorJob<Collection<Long>, Void> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * Create job with specified argument.
-         *
-         * @param arg Job argument.
-         * @param debug Flag indicating whether debug information should be printed into node log.
-         */
-        protected VisorCancelQueriesJob(@Nullable Collection<Long> arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Void run(@Nullable Collection<Long> queries) throws IgniteException {
-            ignite.context().query().cancelQueries(queries);
-
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9b61a76b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
deleted file mode 100644
index 2b40e61..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
+++ /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.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
-import org.apache.ignite.internal.processors.task.GridInternal;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.visor.VisorJob;
-import org.apache.ignite.internal.visor.VisorMultiNodeTask;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task to collect currently running queries.
- */
-@GridInternal
-public class VisorCollectRunningQueriesTask extends VisorMultiNodeTask<Long, Map<UUID, Collection<VisorRunningQuery>>, Collection<VisorRunningQuery>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** {@inheritDoc} */
-    @Override protected VisorCollectRunningQueriesJob job(Long arg) {
-        return new VisorCollectRunningQueriesJob(arg, debug);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Map<UUID, Collection<VisorRunningQuery>> reduce0(List<ComputeJobResult> results) throws IgniteException {
-        Map<UUID, Collection<VisorRunningQuery>> map = new HashMap<>();
-
-        for (ComputeJobResult res : results)
-            if (res.getException() == null) {
-                Collection<VisorRunningQuery> queries = res.getData();
-
-                map.put(res.getNode().id(), queries);
-            }
-
-        return map;
-    }
-
-    /**
-     * Job to collect currently running queries from node.
-     */
-    private static class VisorCollectRunningQueriesJob extends VisorJob<Long, Collection<VisorRunningQuery>> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * Create job with specified argument.
-         *
-         * @param arg Job argument.
-         * @param debug Flag indicating whether debug information should be printed into node log.
-         */
-        protected VisorCollectRunningQueriesJob(@Nullable Long arg, boolean debug) {
-            super(arg, debug);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected Collection<VisorRunningQuery> run(@Nullable Long duration) throws IgniteException {
-            Collection<GridRunningQueryInfo> queries = ignite.context().query()
-                .runningQueries(duration != null ? duration : 0);
-
-            Collection<VisorRunningQuery> res = new ArrayList<>(queries.size());
-
-            long curTime = U.currentTimeMillis();
-
-            for (GridRunningQueryInfo qry : queries)
-                res.add(new VisorRunningQuery(qry.id(), qry.query(), qry.queryType(), qry.cache(),
-                    qry.startTime(), curTime - qry.startTime(),
-                    qry.cancelable(), qry.local()));
-
-            return res;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9b61a76b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
deleted file mode 100644
index 171698b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
+++ /dev/null
@@ -1,64 +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.
- */
-
-package org.apache.ignite.internal.visor.query;
-
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.lang.IgniteBiPredicate;
-
-/**
- * Filter scan results by specified substring in string presentation of key or value.
- */
-public class VisorQueryScanSubstringFilter implements IgniteBiPredicate<Object, Object> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Case sensitive flag. */
-    private final boolean caseSensitive;
-
-    /** String to search in string presentation of key or value. */
-    private final String ptrn;
-
-    /**
-     * Create filter instance.
-     *
-     * @param caseSensitive Case sensitive flag.
-     * @param ptrn String to search in string presentation of key or value.
-     */
-    public VisorQueryScanSubstringFilter(boolean caseSensitive, String ptrn) {
-        this.caseSensitive = caseSensitive;
-
-        this.ptrn = caseSensitive ? ptrn : ptrn.toUpperCase();
-    }
-
-    /**
-     * Check that key or value contains specified string.
-     *
-     * @param key Key object.
-     * @param val Value object.
-     * @return {@code true} when string presentation of key or value contain specified string.
-     */
-    @Override public boolean apply(Object key, Object val) {
-        String k = key instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)key) : key.toString();
-        String v = val instanceof BinaryObject ? VisorQueryUtils.binaryToString((BinaryObject)val) : val.toString();
-
-        if (caseSensitive)
-            return k.contains(ptrn) || v.contains(ptrn);
-
-        return k.toUpperCase().contains(ptrn) || v.toUpperCase().contains(ptrn);
-    }
-}