You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/07/31 08:10:37 UTC

[01/50] [abbrv] incubator-ignite git commit: #ignite-961: remove ignite-rest-http dependency from ignite-json module.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 ca1e9b31a -> cb4e59389


#ignite-961:  remove ignite-rest-http dependency from ignite-json module.


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

Branch: refs/heads/ignite-843
Commit: e051674f4f21406c947086eddf9e3126e9c2be8d
Parents: 8201b48
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 24 13:24:34 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 24 13:24:34 2015 +0300

----------------------------------------------------------------------
 modules/json/pom.xml | 6 ------
 1 file changed, 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e051674f/modules/json/pom.xml
----------------------------------------------------------------------
diff --git a/modules/json/pom.xml b/modules/json/pom.xml
index 88c300e..35863ac 100644
--- a/modules/json/pom.xml
+++ b/modules/json/pom.xml
@@ -65,12 +65,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-rest-http</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.11</version>


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

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


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

Branch: refs/heads/ignite-843
Commit: 58f4822b699ea3c398f8003cc71a9c0920747fde
Parents: 928c5e2 e4a7dc5
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 24 17:02:24 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 24 17:02:24 2015 +0300

----------------------------------------------------------------------
 examples/config/example-ignite.xml              |   2 +-
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  63 ++-
 .../apache/ignite/internal/IgniteKernal.java    |   4 +-
 .../GridClientConnectionManagerAdapter.java     |   2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |   2 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../discovery/GridDiscoveryManager.java         |   7 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  20 +-
 .../processors/task/GridTaskProcessor.java      |   3 +-
 .../ignite/internal/util/nio/GridNioServer.java |  28 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 519 ++++++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |  53 +-
 .../util/nio/ssl/GridNioSslHandler.java         |  79 ++-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  58 ++
 .../spi/IgniteSpiOperationTimeoutException.java |  43 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    | 102 ++++
 .../communication/tcp/TcpCommunicationSpi.java  | 294 +++++++++--
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  52 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 529 ++++++++++++-------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  11 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 169 ++++--
 .../tcp/internal/TcpDiscoveryNode.java          |  21 +
 .../TcpDiscoveryConnectionCheckMessage.java     |  64 +++
 .../apache/ignite/ssl/SslContextFactory.java    | 458 ++++++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 .../IgniteClientReconnectAbstractTest.java      |   4 +-
 .../IgniteTopologyPrintFormatSelfTest.java      |   6 +-
 .../internal/util/nio/GridNioSslSelfTest.java   |   2 +-
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../GridTcpCommunicationSpiAbstractTest.java    |   2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |   3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |  54 ++
 ...GridTcpCommunicationSpiRecoverySelfTest.java |  23 +-
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 ++
 ...unicationSpiTcpFailureDetectionSelfTest.java |  75 +++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |  46 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  36 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 205 +++++++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 116 ++--
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  | 402 ++++++++++++++
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 +
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteCacheFailoverTestSuite.java           |   4 +-
 .../IgniteSpiCommunicationSelfTestSuite.java    |   3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   5 +
 .../visor/commands/open/VisorOpenCommand.scala  |  17 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   3 +
 parent/pom.xml                                  |   2 +-
 55 files changed, 3393 insertions(+), 422 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/58f4822b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------


[15/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 34dbdcf34bca1d4d0291c9f4de814eaf0d0e5dcb
Parents: f965f6b e051674
Author: Andrey <an...@gridgain.com>
Authored: Mon Jul 27 10:53:27 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Jul 27 10:53:27 2015 +0700

----------------------------------------------------------------------
 modules/json/pom.xml | 6 ------
 1 file changed, 6 deletions(-)
----------------------------------------------------------------------



[31/50] [abbrv] incubator-ignite git commit: #ignite-961: merge

Posted by an...@apache.org.
#ignite-961:  merge


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

Branch: refs/heads/ignite-843
Commit: 216d4ff39be130015267fcf79abd2433644e0b3f
Parents: 63e6427
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 18:07:02 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 18:07:02 2015 +0300

----------------------------------------------------------------------
 .../processors/rest/handlers/query/QueryCommandHandler.java      | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/216d4ff3/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index d4e101a..35fbcef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -152,10 +152,6 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
 
                 res.setFieldsMetadata(convertMetadata(fieldsMeta));
 
-                List<GridQueryFieldMetadata> fieldsMeta = ((QueryCursorImpl<?>) qryCur).fieldsMeta();
-
-                res.setFieldsMetadata(convertMetadata(fieldsMeta));
-
                 return new GridRestResponse(res);
             }
             catch (Exception e) {


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

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

Conflicts:
	modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java


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

Branch: refs/heads/ignite-843
Commit: e4a7dc5239bf5581af28f5c37438498a17e5d2c6
Parents: 1bc9ad2 cff25e9
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 24 15:48:44 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 24 15:48:44 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  35 +-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  58 +++
 .../spi/IgniteSpiOperationTimeoutException.java |  43 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    | 102 ++++
 .../communication/tcp/TcpCommunicationSpi.java  | 122 ++++-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  52 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 509 +++++++++++--------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  11 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 135 +++--
 .../tcp/internal/TcpDiscoveryNode.java          |  21 +
 .../TcpDiscoveryConnectionCheckMessage.java     |  64 +++
 .../IgniteClientReconnectAbstractTest.java      |   4 +-
 .../GridTcpCommunicationSpiAbstractTest.java    |   2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |   3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |  54 ++
 ...GridTcpCommunicationSpiRecoverySelfTest.java |  23 +-
 ...unicationSpiTcpFailureDetectionSelfTest.java |  75 +++
 .../discovery/AbstractDiscoverySelfTest.java    |  23 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 205 ++++++++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 116 +++--
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  | 402 +++++++++++++++
 .../IgniteSpiCommunicationSelfTestSuite.java    |   3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   2 +
 24 files changed, 1749 insertions(+), 316 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4a7dc52/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 35911969,7be1dbc..f76025d
--- 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
@@@ -1964,15 -1971,25 +2007,25 @@@ public class TcpCommunicationSpi extend
              }
  
              try {
-                 safeHandshake(client, null, node.id(), connTimeout0, null);
 -                safeHandshake(client, null, node.id(), timeoutHelper.nextTimeoutChunk(connTimeout0));
++                safeHandshake(client, null, node.id(), timeoutHelper.nextTimeoutChunk(connTimeout0), null);
              }
-             catch (HandshakeTimeoutException e) {
+             catch (HandshakeTimeoutException | IgniteSpiOperationTimeoutException e) {
+                 client.forceClose();
+ 
+                 if (failureDetectionTimeoutEnabled() && (e instanceof HandshakeTimeoutException ||
+                     timeoutHelper.checkFailureTimeoutReached(e))) {
+                     log.debug("Handshake timed out (failure threshold reached) [failureDetectionTimeout=" +
+                         failureDetectionTimeout() + ", err=" + e.getMessage() + ", client=" + client + ']');
+ 
+                     throw e;
+                 }
+ 
+                 assert !failureDetectionTimeoutEnabled();
+ 
                  if (log.isDebugEnabled())
-                     log.debug("Handshake timedout (will retry with increased timeout) [timeout=" + connTimeout0 +
+                     log.debug("Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout0 +
                          ", err=" + e.getMessage() + ", client=" + client + ']');
  
-                 client.forceClose();
- 
                  if (attempt == reconCnt || connTimeout0 > maxConnTimeout) {
                      if (log.isDebugEnabled())
                          log.debug("Handshake timedout (will stop attempts to perform the handshake) " +
@@@ -2111,18 -2130,11 +2166,19 @@@
  
                      long rcvCnt = -1;
  
 +                    SSLEngine sslEngine = null;
 +
                      try {
-                         ch.socket().connect(addr, (int)connTimeout);
+                         ch.socket().connect(addr, (int)timeoutHelper.nextTimeoutChunk(connTimeout));
  
 +                        if (isSslEnabled()) {
 +                            sslEngine = ignite.configuration().getSslContextFactory().create().createSSLEngine();
 +
 +                            sslEngine.setUseClientMode(true);
 +                        }
 +
-                         rcvCnt = safeHandshake(ch, recoveryDesc, node.id(), connTimeout0, sslEngine);
+                         rcvCnt = safeHandshake(ch, recoveryDesc, node.id(),
 -                            timeoutHelper.nextTimeoutChunk(connTimeout0));
++                            timeoutHelper.nextTimeoutChunk(connTimeout0), sslEngine);
  
                          if (rcvCnt == -1)
                              return null;

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

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4a7dc52/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4a7dc52/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------


[34/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: c51381ec46785bf7a599c336001badcd70344bdf
Parents: 49bf1e2 216d4ff
Author: Andrey <an...@gridgain.com>
Authored: Tue Jul 28 11:02:22 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Tue Jul 28 11:02:22 2015 +0700

----------------------------------------------------------------------
 .../TcpDiscoveryIpFinderAbstractSelfTest.java   |  2 +-
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  | 18 ++++++
 ...pDiscoveryGoogleStorageIpFinderSelfTest.java | 29 ++++++++-
 modules/nodejs/src/main/js/cache.js             | 30 +++++++--
 .../ignite/internal/NodeJsSqlQuerySelfTest.java |  9 +++
 modules/nodejs/src/test/js/test-query.js        | 53 ++++++++++++++-
 modules/yardstick/config/benchmark.properties   |  6 +-
 .../yardstick/IgniteBenchmarkArguments.java     | 22 +++++++
 .../yardstick/cache/IgnitePutAllBenchmark.java  | 67 +++++++++++++++++++
 .../cache/IgnitePutAllTxBenchmark.java          | 68 ++++++++++++++++++++
 10 files changed, 296 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[27/50] [abbrv] incubator-ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite

Posted by an...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite


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

Branch: refs/heads/ignite-843
Commit: a12775621f85ea6e203761b116a06bf79ea12b13
Parents: 201e208 5304e6e
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 13:59:14 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 13:59:14 2015 +0300

----------------------------------------------------------------------
 modules/yardstick/config/benchmark.properties   |  6 +-
 .../yardstick/IgniteBenchmarkArguments.java     | 22 +++++++
 .../yardstick/cache/IgnitePutAllBenchmark.java  | 67 +++++++++++++++++++
 .../cache/IgnitePutAllTxBenchmark.java          | 68 ++++++++++++++++++++
 4 files changed, 162 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[13/50] [abbrv] incubator-ignite git commit: Added test for reproducing problems during simultaneously Ignite instances stopping and cache requests executing

Posted by an...@apache.org.
Added test for reproducing problems during simultaneously Ignite instances stopping and cache requests executing


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

Branch: refs/heads/ignite-843
Commit: 0341759c2ce8bc342521e7a2a50fe333f06f5a13
Parents: 58f4822
Author: agura <ag...@gridgain.com>
Authored: Fri Jul 24 20:27:03 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Jul 24 20:27:03 2015 +0300

----------------------------------------------------------------------
 .../CacheGetFutureHangsSelfTest.java            | 214 +++++++++++++++++++
 1 file changed, 214 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0341759c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
new file mode 100644
index 0000000..e2acb2e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Test for reproducing problems during simultaneously Ignite instances stopping and cache requests executing.
+ */
+public class CacheGetFutureHangsSelfTest extends GridCommonAbstractTest {
+    /** Grid count. */
+    private static final int GRID_CNT = 8;
+
+    /** Grids. */
+    private static Ignite[] grids;
+
+    /** Ids. */
+    private static String[] ids;
+
+    /** Flags. */
+    private static AtomicBoolean[] flags;
+
+    /** Futs. */
+    private static Collection<IgniteInternalFuture> futs;
+
+    /** Alive grids. */
+    private static Set<Integer> aliveGrids;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        OptimizedMarshaller marsh = new OptimizedMarshaller();
+        marsh.setRequireSerializable(false);
+
+        cfg.setMarshaller(marsh);
+
+        CacheConfiguration ccfg = defaultCacheConfiguration();
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+        ccfg.setBackups(1);
+        ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+        ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
+        ccfg.setNearConfiguration(null);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFailover() throws Exception {
+        int cnt = 10;
+
+        for (int i = 0; i < cnt; i++) {
+            try {
+                U.debug("*** Iteration " + (i + 1) + '/' + cnt);
+
+                init();
+
+                doTestFailover();
+            }
+            finally {
+                stopAllGrids();
+            }
+        }
+    }
+
+    /**
+     * Initializes test.
+     */
+    private void init() {
+        grids = new Ignite[GRID_CNT + 1];
+
+        ids = new String[GRID_CNT + 1];
+
+        aliveGrids = new HashSet<>();
+
+        flags = new AtomicBoolean[GRID_CNT + 1];
+
+        futs = new ArrayList<>();
+    }
+
+    /**
+     * Executes one test iteration.
+     */
+    private void doTestFailover() throws Exception {
+        try {
+            for (int i = 0; i < GRID_CNT + 1; i++) {
+                final IgniteEx grid = startGrid(i);
+
+                grids[i] = grid;
+
+                ids[i] = grid.localNode().id().toString();
+
+                aliveGrids.add(i);
+
+                flags[i] = new AtomicBoolean();
+            }
+
+            for (int i = 0; i < GRID_CNT + 1; i++) {
+                final int gridIdx = i;
+
+                futs.add(multithreadedAsync(new Runnable() {
+                    @Override public void run() {
+                        IgniteCache cache = grids[gridIdx].cache(null);
+
+                        while (!flags[gridIdx].get()) {
+                            int idx = ThreadLocalRandom.current().nextInt(GRID_CNT + 1);
+
+                            String id = ids[idx];
+
+                            if (id != null /*&& grids[gridIdx] != null*/) {
+                                //U.debug("!!! Grid containsKey start " + gridIdx);
+                                cache.containsKey(id);
+                                //U.debug("!!! Grid containsKey finished " + gridIdx);
+                            }
+
+                            try {
+                                Thread.sleep(ThreadLocalRandom.current().nextLong(50));
+                            }
+                            catch (InterruptedException e) {
+                                Thread.currentThread().interrupt();
+                            }
+                        }
+                    }
+                }, 1, "containsKey-thread-" + i));
+
+                futs.add(multithreadedAsync(new Runnable() {
+                    @Override public void run() {
+                        IgniteCache cache = grids[gridIdx].cache(null);
+
+                        while (!flags[gridIdx].get()) {
+                            int idx = ThreadLocalRandom.current().nextInt(GRID_CNT + 1);
+
+                            String id = ids[idx];
+
+                            if (id != null /*&& grids[gridIdx] != null*/) {
+                                //U.debug("!!! Grid put start " + gridIdx);
+                                cache.put(id, UUID.randomUUID());
+                                //U.debug("!!! Grid put finished " + gridIdx);
+                            }
+
+                            try {
+                                Thread.sleep(ThreadLocalRandom.current().nextLong(50));
+                            }
+                            catch (InterruptedException e) {
+                                Thread.currentThread().interrupt();
+                            }
+                        }
+                    }
+                }, 1, "put-thread-" + i));
+            }
+
+            while (aliveGrids.size() > 1) {
+                final int gridToKill = ThreadLocalRandom.current().nextInt(GRID_CNT) + 1;
+
+                if (gridToKill > 0 && grids[gridToKill] != null) {
+                    U.debug("!!! Trying to kill grid " + gridToKill);
+
+                    //synchronized (mons[gridToKill]) {
+                        U.debug("!!! Grid stop start " + gridToKill);
+
+                        grids[gridToKill].close();
+
+                        aliveGrids.remove(gridToKill);
+
+                        grids[gridToKill] = null;
+
+                        flags[gridToKill].set(true);
+
+                        U.debug("!!! Grid stop finished " + gridToKill);
+                    //}
+                }
+            }
+
+            Thread.sleep(ThreadLocalRandom.current().nextLong(100));
+        }
+        finally {
+            flags[0].set(true);
+
+            for (IgniteInternalFuture fut : futs)
+                fut.get();
+        }
+    }
+}


[50/50] [abbrv] incubator-ignite git commit: Merge branches 'ignite-1121' and 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-843

Posted by an...@apache.org.
Merge branches 'ignite-1121' and 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-843


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

Branch: refs/heads/ignite-843
Commit: cb4e59389bdf63040330d69e163a2d9c1396ecfa
Parents: ca1e9b3 f20f5c5
Author: Andrey <an...@gridgain.com>
Authored: Fri Jul 31 13:08:44 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri Jul 31 13:08:44 2015 +0700

----------------------------------------------------------------------
 DEVNOTES.txt                                    |    8 +
 RELEASE_NOTES.txt                               |   19 +
 assembly/LICENSE_FABRIC                         |  306 +++++
 assembly/LICENSE_HADOOP                         |  259 ++++
 assembly/NOTICE_FABRIC                          |   13 +
 assembly/NOTICE_HADOOP                          |   12 +
 assembly/dependencies-fabric.xml                |   13 +
 assembly/dependencies-hadoop.xml                |   12 +
 assembly/dependencies-visor-console.xml         |   20 +-
 assembly/release-base.xml                       |   15 +-
 assembly/release-fabric.xml                     |   12 +
 assembly/release-hadoop.xml                     |   12 +
 config/ignite-log4j2.xml                        |   81 ++
 config/ignite-log4j2.xml~                       |   65 +
 examples/config/example-ignite.xml              |    2 +-
 examples/config/js/example-query.xml            |   91 ++
 examples/pom.xml                                |   14 +-
 .../computegrid/ComputeTaskMapExample.java      |    2 +-
 .../examples/js/ExampleJsNodeStartup.java       |   36 +
 examples/src/main/js/cache-api-example.js       |   88 ++
 examples/src/main/js/cache-put-get-example.js   |   96 ++
 examples/src/main/js/cache-query-example.js     |  122 ++
 .../main/js/cache-sql-fields-query-example.js   |   92 ++
 examples/src/main/js/compute-run-example.js     |   79 ++
 examples/src/main/js/map-reduce-example.js      |   80 ++
 .../examples/ScalarCacheAffinityExample.scala   |    2 +-
 .../scalar/examples/ScalarCacheExample.scala    |    2 +-
 .../ScalarCachePopularNumbersExample.scala      |    2 +-
 .../examples/ScalarCacheQueryExample.scala      |    2 +-
 .../examples/ScalarSnowflakeSchemaExample.scala |    4 +-
 modules/aop/licenses/aspectj-epl-license.txt    |   69 -
 modules/aop/pom.xml                             |    2 +-
 modules/apache-license-gen/pom.xml              |   35 +
 .../src/main/resources/META-INF/licenses.txt.vm |   42 +
 modules/aws/pom.xml                             |    2 +-
 modules/clients/README.txt                      |   16 +
 modules/clients/pom.xml                         |    2 +-
 modules/clients/readme.md                       |   32 -
 modules/clients/readme.pdf                      |  Bin 47887 -> 0 bytes
 .../rest/AbstractRestProcessorSelfTest.java     |    1 +
 .../JettyRestProcessorAbstractSelfTest.java     | 1166 ++++++++++++++++-
 .../rest/protocols/tcp/MockNioSession.java      |   15 -
 modules/cloud/pom.xml                           |    2 +-
 modules/codegen/pom.xml                         |    2 +-
 modules/control-center-agent/README.txt         |   20 +
 modules/control-center-agent/pom.xml            |  125 ++
 .../control-center-agent/src/assembly/build.xml |   33 +
 modules/control-center-agent/src/bin/agent.bat  |   18 +
 modules/control-center-agent/src/bin/agent.sh   |   19 +
 .../java/org/apache/ignite/agent/Agent.java     |  141 ++
 .../apache/ignite/agent/AgentCommandLine.java   |  113 ++
 .../apache/ignite/agent/AgentConfiguration.java |  143 +++
 .../org/apache/ignite/agent/AgentLauncher.java  |  125 ++
 .../org/apache/ignite/agent/AgentSocket.java    |  146 +++
 .../ignite/agent/messages/AbstractMessage.java  |   25 +
 .../ignite/agent/messages/AuthMessage.java      |   73 ++
 .../ignite/agent/messages/AuthResult.java       |   57 +
 .../ignite/agent/messages/MessageFactory.java   |   76 ++
 .../ignite/agent/messages/RestRequest.java      |  127 ++
 .../ignite/agent/messages/RestResult.java       |   91 ++
 .../main/resources/default.config.properties    |   26 +
 .../src/main/resources/logging.properties       |   19 +
 modules/control-center-web/pom.xml              |   69 +
 .../src/main/js/agents/agent-manager.js         |  283 +++++
 .../src/main/js/agents/agent-server.js          |   90 ++
 modules/control-center-web/src/main/js/app.js   |    8 +-
 modules/control-center-web/src/main/js/bin/www  |   29 +-
 .../src/main/js/config/default.json             |   11 +-
 .../src/main/js/controllers/common-module.js    |   26 +-
 .../src/main/js/controllers/sql-controller.js   |  151 ++-
 modules/control-center-web/src/main/js/db.js    |   12 +
 .../src/main/js/keys/test.crt                   |   13 +
 .../src/main/js/keys/test.key                   |   18 +
 .../control-center-web/src/main/js/package.json |    3 +-
 .../src/main/js/routes/agent.js                 |   84 ++
 .../src/main/js/routes/notebooks.js             |  102 ++
 .../src/main/js/routes/sql.js                   |    4 +-
 .../src/main/js/views/includes/header.jade      |    7 +-
 .../src/main/js/views/sql/sql.jade              |   34 +-
 .../src/main/js/views/templates/layout.jade     |    2 +-
 .../src/test/js/routes/agent.js                 |   94 ++
 modules/core/licenses/jsr166-license.txt        |    3 +
 modules/core/licenses/snaptree-bsd-license.txt  |    2 +-
 modules/core/pom.xml                            |    9 +-
 .../java/org/apache/ignite/IgniteCache.java     |   17 +-
 .../IgniteClientDisconnectedException.java      |   61 +
 .../java/org/apache/ignite/IgniteCluster.java   |    8 +
 .../apache/ignite/IgniteSystemProperties.java   |    8 +
 .../org/apache/ignite/cache/CacheManager.java   |   13 +-
 .../apache/ignite/cache/CacheTypeMetadata.java  |   53 +-
 .../AffinityNodeAddressHashResolver.java        |    8 +-
 .../affinity/AffinityNodeHashResolver.java      |    5 +
 .../affinity/AffinityNodeIdHashResolver.java    |    6 +
 .../affinity/fair/FairAffinityFunction.java     |    5 +-
 .../rendezvous/RendezvousAffinityFunction.java  |   22 +-
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   |    2 +-
 .../ignite/compute/ComputeJobResultPolicy.java  |    3 +-
 .../configuration/CacheConfiguration.java       |   10 +-
 .../configuration/ConnectorConfiguration.java   |   32 +
 .../configuration/IgniteConfiguration.java      |   89 +-
 .../configuration/TransactionConfiguration.java |   23 +
 .../apache/ignite/internal/GridComponent.java   |   18 +
 .../ignite/internal/GridJobSiblingImpl.java     |    2 +-
 .../ignite/internal/GridKernalContext.java      |   19 +
 .../ignite/internal/GridKernalContextImpl.java  |   55 +-
 .../ignite/internal/GridKernalGateway.java      |   46 +-
 .../ignite/internal/GridKernalGatewayImpl.java  |   85 +-
 .../apache/ignite/internal/GridKernalState.java |    3 +
 .../ignite/internal/GridPluginComponent.java    |   11 +
 ...gniteClientDisconnectedCheckedException.java |   49 +
 .../ignite/internal/IgniteComponentType.java    |    8 +
 .../apache/ignite/internal/IgniteKernal.java    |  357 ++++--
 .../ignite/internal/IgniteNodeAttributes.java   |    3 +
 .../GridClientConnectionManagerAdapter.java     |    2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |    2 +-
 .../client/ssl/GridSslBasicContextFactory.java  |    3 +
 .../client/ssl/GridSslContextFactory.java       |    5 +-
 .../cluster/IgniteClusterAsyncImpl.java         |    5 +
 .../internal/cluster/IgniteClusterImpl.java     |   18 +
 .../internal/managers/GridManagerAdapter.java   |   19 +-
 .../deployment/GridDeploymentCommunication.java |    2 +-
 .../deployment/GridDeploymentManager.java       |   95 +-
 .../discovery/GridDiscoveryManager.java         |  216 +++-
 .../failover/GridFailoverContextImpl.java       |   28 +-
 .../managers/failover/GridFailoverManager.java  |   13 +-
 .../processors/GridProcessorAdapter.java        |   11 +
 .../affinity/GridAffinityAssignmentCache.java   |   26 +-
 .../cache/CacheEvictableEntryImpl.java          |    2 +-
 .../cache/CacheOsConflictResolutionManager.java |    6 +
 .../cache/DynamicCacheChangeBatch.java          |   17 +
 .../cache/DynamicCacheChangeRequest.java        |   39 +-
 .../processors/cache/GridCacheAdapter.java      |   42 +-
 .../cache/GridCacheAffinityManager.java         |   21 +-
 .../processors/cache/GridCacheAttributes.java   |   11 +-
 .../cache/GridCacheConcurrentMap.java           |   15 +-
 .../processors/cache/GridCacheContext.java      |   63 +-
 .../processors/cache/GridCacheEntryEx.java      |   32 +-
 .../cache/GridCacheEvictionManager.java         |   12 +-
 .../processors/cache/GridCacheGateway.java      |  120 +-
 .../processors/cache/GridCacheIoManager.java    |   16 +-
 .../processors/cache/GridCacheManager.java      |    6 +
 .../cache/GridCacheManagerAdapter.java          |    6 +
 .../processors/cache/GridCacheMapEntry.java     |  208 +--
 .../processors/cache/GridCacheMvccManager.java  |   57 +-
 .../GridCachePartitionExchangeManager.java      |  140 +-
 .../processors/cache/GridCachePreloader.java    |    5 +
 .../cache/GridCachePreloaderAdapter.java        |    5 +
 .../processors/cache/GridCacheProcessor.java    |  636 ++++++---
 .../cache/GridCacheSharedContext.java           |  120 +-
 .../cache/GridCacheSharedManager.java           |   11 +-
 .../cache/GridCacheSharedManagerAdapter.java    |   20 +-
 .../processors/cache/GridCacheUtils.java        |   27 +-
 .../processors/cache/IgniteCacheFutureImpl.java |   11 +
 .../processors/cache/IgniteCacheProxy.java      |  497 +++++---
 .../processors/cache/IgniteInternalCache.java   |    4 +-
 .../CacheDataStructuresManager.java             |   35 +
 .../distributed/GridCacheTxFinishSync.java      |   46 +
 .../distributed/dht/GridDhtCacheAdapter.java    |   14 +-
 .../distributed/dht/GridDhtCacheEntry.java      |    4 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |   24 +
 .../distributed/dht/GridDhtTopologyFuture.java  |   14 -
 .../distributed/dht/GridDhtTxFinishFuture.java  |   13 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   16 +-
 .../dht/GridPartitionedGetFuture.java           |   13 +-
 .../dht/atomic/GridDhtAtomicCache.java          |    6 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   31 +-
 .../GridDhtPartitionsExchangeFuture.java        |   71 +-
 .../dht/preloader/GridDhtPreloader.java         |   16 +-
 .../distributed/near/GridNearCacheAdapter.java  |    8 +
 .../distributed/near/GridNearGetFuture.java     |   17 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |    4 +-
 .../GridNearPessimisticTxPrepareFuture.java     |    2 +-
 .../near/GridNearTxFinishFuture.java            |   17 +-
 .../cache/dr/GridOsCacheDrManager.java          |    7 +-
 .../extras/GridCacheAttributesEntryExtras.java  |   37 +-
 .../GridCacheAttributesMvccEntryExtras.java     |   35 +-
 ...dCacheAttributesMvccObsoleteEntryExtras.java |   35 +-
 ...cheAttributesMvccObsoleteTtlEntryExtras.java |   35 +-
 .../GridCacheAttributesMvccTtlEntryExtras.java  |   35 +-
 .../GridCacheAttributesObsoleteEntryExtras.java |   36 +-
 ...idCacheAttributesObsoleteTtlEntryExtras.java |   36 +-
 .../GridCacheAttributesTtlEntryExtras.java      |   36 +-
 .../cache/extras/GridCacheEntryExtras.java      |   14 -
 .../extras/GridCacheEntryExtrasAdapter.java     |    8 -
 .../cache/extras/GridCacheMvccEntryExtras.java  |    8 -
 .../GridCacheMvccObsoleteEntryExtras.java       |    8 -
 .../GridCacheMvccObsoleteTtlEntryExtras.java    |    9 -
 .../extras/GridCacheMvccTtlEntryExtras.java     |    8 -
 .../extras/GridCacheObsoleteEntryExtras.java    |    8 -
 .../extras/GridCacheObsoleteTtlEntryExtras.java |    9 -
 .../cache/extras/GridCacheTtlEntryExtras.java   |    8 -
 .../cache/jta/CacheJtaManagerAdapter.java       |   17 +-
 .../cache/jta/CacheNoopJtaManager.java          |    2 +-
 .../query/GridCacheDistributedQueryManager.java |   22 +
 .../cache/query/GridCacheQueryAdapter.java      |   11 +-
 .../query/GridCacheQueryFutureAdapter.java      |    2 +-
 .../continuous/CacheContinuousQueryHandler.java |    9 +-
 .../store/GridCacheStoreManagerAdapter.java     |    2 +-
 .../cache/transactions/IgniteInternalTx.java    |   16 +-
 .../transactions/IgniteTransactionsImpl.java    |   59 +-
 .../cache/transactions/IgniteTxAdapter.java     |    6 +-
 .../cache/transactions/IgniteTxManager.java     |   28 +-
 .../transactions/TransactionProxyImpl.java      |    2 +-
 .../cache/version/GridCacheVersionManager.java  |    9 +-
 .../IgniteCacheObjectProcessorImpl.java         |   10 +
 .../clock/GridClockSyncProcessor.java           |    6 +-
 .../processors/closure/AffinityTask.java        |   35 +
 .../closure/GridClosureProcessor.java           |   63 +-
 .../processors/cluster/ClusterProcessor.java    |   11 +
 .../continuous/GridContinuousHandler.java       |    9 +-
 .../continuous/GridContinuousProcessor.java     |  127 +-
 .../datastreamer/DataStreamProcessor.java       |   27 +-
 .../datastreamer/DataStreamerImpl.java          |  112 +-
 .../datastreamer/DataStreamerUpdateJob.java     |   20 +-
 .../datastructures/DataStructuresProcessor.java |   72 +-
 .../datastructures/GridCacheAtomicLongImpl.java |   33 +-
 .../GridCacheAtomicReferenceImpl.java           |   34 +-
 .../GridCacheAtomicSequenceImpl.java            |   33 +-
 .../GridCacheAtomicStampedImpl.java             |   33 +-
 .../GridCacheCountDownLatchImpl.java            |   66 +-
 .../datastructures/GridCacheRemovable.java      |    6 +-
 .../datastructures/GridCacheSetImpl.java        |   15 +-
 .../datastructures/GridCacheSetProxy.java       |   47 +-
 .../processors/job/GridJobProcessor.java        |    2 +-
 .../internal/processors/job/GridJobWorker.java  |    2 +-
 .../json/IgniteJsonNoopProcessor.java           |   67 +
 .../processors/json/IgniteJsonProcessor.java    |   71 ++
 .../processors/query/GridQueryIndexing.java     |    7 +
 .../processors/query/GridQueryProcessor.java    |  245 +++-
 .../processors/rest/GridRestCommand.java        |   62 +-
 .../processors/rest/GridRestProcessor.java      |   59 +-
 .../handlers/cache/GridCacheCommandHandler.java |  373 +++++-
 .../query/CacheQueryFieldsMetaResult.java       |  133 ++
 .../rest/handlers/query/CacheQueryResult.java   |  120 ++
 .../handlers/query/QueryCommandHandler.java     |  298 +++++
 .../handlers/scripting/IgniteJsEmitResult.java  |   57 +
 .../IgniteScriptingCommandHandler.java          |  395 ++++++
 .../version/GridVersionCommandHandler.java      |   59 -
 .../version/GridVersionNameCommandHandler.java  |   67 +
 .../rest/protocols/tcp/GridTcpRestProtocol.java |   20 +-
 .../request/RestMapReduceScriptRequest.java     |   74 ++
 .../rest/request/RestRunScriptRequest.java      |   91 ++
 .../rest/request/RestSqlQueryRequest.java       |  125 ++
 .../scripting/IgniteScriptingConverter.java     |   47 +
 .../scripting/IgniteScriptingProcessor.java     |  264 ++++
 .../scripting/ScriptingClusterNode.java         |   42 +
 .../processors/scripting/ScriptingJSIgnite.java |   66 +
 .../processors/scripting/ScriptingJsCache.java  |  260 ++++
 .../service/GridServiceProcessor.java           |   45 +-
 .../processors/service/GridServiceProxy.java    |   13 +-
 .../processors/task/GridTaskProcessor.java      |   58 +-
 .../processors/task/GridTaskWorker.java         |   83 +-
 .../ignite/internal/util/GridJavaProcess.java   |   54 +-
 .../ignite/internal/util/IgniteUtils.java       |   63 +-
 .../util/future/GridFutureChainListener.java    |    4 -
 .../internal/util/future/IgniteFutureImpl.java  |   12 +-
 .../shmem/IpcSharedMemoryClientEndpoint.java    |    5 +-
 .../ignite/internal/util/lang/GridFunc.java     |    2 +
 .../util/lang/GridMetadataAwareAdapter.java     |  296 +++--
 .../ignite/internal/util/nio/GridNioServer.java |   37 +-
 .../util/nio/GridNioSessionMetaKey.java         |    5 +-
 .../util/nio/GridSelectorNioSessionImpl.java    |    8 +
 .../util/nio/ssl/BlockingSslHandler.java        |  519 ++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |   53 +-
 .../util/nio/ssl/GridNioSslHandler.java         |   79 +-
 .../visor/cache/VisorCacheConfiguration.java    |   11 -
 .../visor/cache/VisorCacheStopTask.java         |    2 +-
 .../plugin/security/SecurityPermission.java     |    7 +-
 .../plugin/security/SecuritySubjectType.java    |    3 +-
 .../java/org/apache/ignite/spi/IgniteSpi.java   |   15 +
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  109 +-
 .../spi/IgniteSpiOperationTimeoutException.java |   43 +
 .../spi/IgniteSpiOperationTimeoutHelper.java    |  102 ++
 .../communication/tcp/TcpCommunicationSpi.java  |  646 ++++++++--
 .../spi/discovery/DiscoverySpiDataExchange.java |    3 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  452 +++++--
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  754 +++++++----
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |   20 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  205 ++-
 .../tcp/internal/TcpDiscoveryNode.java          |   62 +-
 .../messages/TcpDiscoveryAbstractMessage.java   |    3 +
 .../messages/TcpDiscoveryClientAckResponse.java |   64 +
 .../TcpDiscoveryConnectionCheckMessage.java     |   64 +
 .../messages/TcpDiscoveryHandshakeResponse.java |   14 +
 .../ignite/spi/failover/FailoverContext.java    |   18 +
 .../spi/failover/always/AlwaysFailoverSpi.java  |   25 +
 .../spi/swapspace/file/FileSwapSpaceSpi.java    |    2 +-
 .../apache/ignite/ssl/SslContextFactory.java    |  458 +++++++
 .../org/apache/ignite/ssl/package-info.java     |   22 +
 .../META-INF/classnames-jdk.properties          |    3 +
 .../core/src/main/resources/ignite.properties   |    2 +-
 modules/core/src/test/config/log4j2-test.xml    |   57 +
 modules/core/src/test/config/log4j2-test.xml~   |   63 +
 .../src/test/config/log4j2-verbose-test.xml     |   48 +
 .../affinity/IgniteClientNodeAffinityTest.java  |   14 +-
 .../IgniteFairAffinityDynamicCacheSelfTest.java |    3 +-
 ...cheStoreSessionListenerAbstractSelfTest.java |  112 +-
 .../internal/GridUpdateNotifierSelfTest.java    |   15 +-
 .../IgniteClientReconnectAbstractTest.java      |  363 ++++++
 .../IgniteClientReconnectApiExceptionTest.java  |  846 ++++++++++++
 .../IgniteClientReconnectAtomicsTest.java       |  672 ++++++++++
 .../IgniteClientReconnectCacheTest.java         | 1202 ++++++++++++++++++
 .../IgniteClientReconnectCollectionsTest.java   |  443 +++++++
 .../IgniteClientReconnectComputeTest.java       |  192 +++
 ...eClientReconnectContinuousProcessorTest.java |  372 ++++++
 ...IgniteClientReconnectDiscoveryStateTest.java |  123 ++
 ...niteClientReconnectFailoverAbstractTest.java |  231 ++++
 .../IgniteClientReconnectFailoverTest.java      |  227 ++++
 .../IgniteClientReconnectServicesTest.java      |  260 ++++
 .../internal/IgniteClientReconnectStopTest.java |  106 ++
 .../IgniteClientReconnectStreamerTest.java      |  233 ++++
 .../IgniteSlowClientDetectionSelfTest.java      |    1 +
 .../GridDeploymentManagerStopSelfTest.java      |    7 +
 .../IgniteTopologyPrintFormatSelfTest.java      |    6 +-
 .../GridCacheTxLoadFromStoreOnLockSelfTest.java |   34 +-
 .../cache/CacheAffinityCallSelfTest.java        |  174 +++
 .../cache/CacheFutureExceptionSelfTest.java     |  161 ++-
 .../CacheMetricsForClusterGroupSelfTest.java    |   10 +-
 .../cache/CacheOffheapMapEntrySelfTest.java     |    7 +-
 .../cache/CacheStopAndDestroySelfTest.java      |  859 +++++++++++++
 ...eUsageMultinodeDynamicStartAbstractTest.java |    2 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  355 ++++--
 .../cache/GridCacheAbstractSelfTest.java        |   14 +-
 .../cache/GridCacheAffinityRoutingSelfTest.java |  157 ++-
 .../cache/GridCachePutAllFailoverSelfTest.java  |    3 +
 ...ProjectionForCachesOnDaemonNodeSelfTest.java |    2 +-
 .../IgniteCacheAbstractStopBusySelfTest.java    |    2 +-
 .../IgniteCacheConfigurationTemplateTest.java   |   26 +-
 .../cache/IgniteCacheDynamicStopSelfTest.java   |    6 +-
 .../cache/IgniteCacheNearLockValueSelfTest.java |    2 +
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  156 +--
 .../IgniteDynamicClientCacheStartSelfTest.java  |    5 +-
 .../IgniteTxExceptionAbstractSelfTest.java      |    1 +
 .../IgniteClientDataStructuresAbstractTest.java |  109 +-
 .../IgniteCountDownLatchAbstractSelfTest.java   |   12 +-
 .../CacheGetFutureHangsSelfTest.java            |  214 ++++
 .../GridCacheAbstractNodeRestartSelfTest.java   |   21 +-
 .../distributed/IgniteCache150ClientsTest.java  |    1 +
 ...teCacheClientNodePartitionsExchangeTest.java |   29 +-
 .../IgniteCacheClientReconnectTest.java         |  175 +++
 .../IgniteCacheServerNodeConcurrentStart.java   |   96 ++
 .../IgniteCacheSystemTransactionsSelfTest.java  |    2 +-
 ...NearDisabledOptimisticTxNodeRestartTest.java |   31 +
 .../IgniteCachePutRetryAbstractSelfTest.java    |   52 +-
 ...gniteCachePutRetryTransactionalSelfTest.java |   17 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    2 +-
 ...eAtomicNearOnlyMultiNodeFullApiSelfTest.java |    3 +
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |    5 +-
 .../near/GridCacheNearTxMultiNodeSelfTest.java  |   10 +-
 .../GridCachePartitionedFailoverSelfTest.java   |    5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |   52 +-
 ...ePartitionedOptimisticTxNodeRestartTest.java |   12 +-
 .../GridCacheReplicatedInvalidateSelfTest.java  |    3 +-
 ...acheAtomicReplicatedNodeRestartSelfTest.java |   14 +-
 .../cache/eviction/GridCacheMockEntry.java      |   12 +-
 ...CacheLocalOffHeapAndSwapMetricsSelfTest.java |    2 +-
 ...OnlyFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 ...AtomicClientOnlyMultiJvmFullApiSelfTest.java |   31 +
 ...tOnlyMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...pyOnReadDisabledMultiJvmFullApiSelfTest.java |   31 +
 ...omicFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 .../GridCacheAtomicMultiJvmFullApiSelfTest.java |   30 +
 ...tomicMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...bledFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 ...tomicNearEnabledMultiJvmFullApiSelfTest.java |   31 +
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |   31 +
 ...heAtomicNearOnlyMultiJvmFullApiSelfTest.java |   31 +
 ...rOnlyMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...cheAtomicOffHeapMultiJvmFullApiSelfTest.java |   31 +
 ...micOffHeapTieredMultiJvmFullApiSelfTest.java |   36 +
 ...rderFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |   31 +
 ...OrderMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...rityOrderOffHeapMultiJvmFullApiSelfTest.java |   31 +
 ...derOffHeapTieredMultiJvmFullApiSelfTest.java |   36 +
 ...OnlyFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 ...ridCacheNearOnlyMultiJvmFullApiSelfTest.java |   30 +
 ...rOnlyMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...pyOnReadDisabledMultiJvmFullApiSelfTest.java |   31 +
 ...onedFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 ...CachePartitionedMultiJvmFullApiSelfTest.java |   30 +
 ...ionedMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...micOffHeapTieredMultiJvmFullApiSelfTest.java |   36 +
 ...bledFairAffinityMultiJvmFullApiSelfTest.java |   31 +
 ...onedNearDisabledMultiJvmFullApiSelfTest.java |   31 +
 ...abledMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...rDisabledOffHeapMultiJvmFullApiSelfTest.java |   31 +
 ...ledOffHeapTieredMultiJvmFullApiSelfTest.java |   36 +
 ...rtitionedOffHeapMultiJvmFullApiSelfTest.java |   31 +
 ...nedOffHeapTieredMultiJvmFullApiSelfTest.java |   36 +
 ...ReplicatedAtomicMultiJvmFullApiSelfTest.java |   31 +
 ...rimaryWriteOrderMultiJvmFullApiSelfTest.java |   31 +
 ...dCacheReplicatedMultiJvmFullApiSelfTest.java |   30 +
 ...catedMultiJvmP2PDisabledFullApiSelfTest.java |   31 +
 ...plicatedNearOnlyMultiJvmFullApiSelfTest.java |   37 +
 ...eplicatedOffHeapMultiJvmFullApiSelfTest.java |   31 +
 ...tedOffHeapTieredMultiJvmFullApiSelfTest.java |   36 +
 .../DataStreamerMultinodeCreateCacheTest.java   |   14 +-
 .../internal/util/nio/GridNioSelfTest.java      |   88 +-
 .../internal/util/nio/GridNioSslSelfTest.java   |   16 +-
 .../nio/impl/GridNioFilterChainSelfTest.java    |   15 -
 .../GridMetadataAwareAdapterLoadSelfTest.java   |  135 ++
 .../lang/GridMetadataAwareAdapterSelfTest.java  |   58 +-
 .../loadtests/hashmap/GridCacheTestContext.java |    2 +-
 .../GridAbstractCommunicationSelfTest.java      |   13 +
 .../GridTcpCommunicationSpiAbstractTest.java    |    2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |    3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |   54 +
 ...GridTcpCommunicationSpiRecoverySelfTest.java |   23 +-
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |   38 +
 ...unicationSpiTcpFailureDetectionSelfTest.java |   75 ++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |   46 +
 .../discovery/AbstractDiscoverySelfTest.java    |   36 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java |  205 +++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      |  654 +++++++++-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |  142 ++-
 ...DiscoveryNodeConfigConsistentIdSelfTest.java |   76 ++
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |    1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  |  402 ++++++
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |   28 +
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |   42 +
 .../TcpDiscoveryIpFinderAbstractSelfTest.java   |    2 +-
 .../spi/failover/GridFailoverTestContext.java   |   10 +
 .../GridCommandLineTransformerSelfTest.java     |   12 +-
 .../ignite/testframework/GridTestUtils.java     |   20 +
 .../testframework/junits/GridAbstractTest.java  |  388 +++++-
 .../ignite/testframework/junits/IgniteMock.java |   13 +
 .../junits/common/GridCommonAbstractTest.java   |   50 +-
 .../junits/multijvm/AffinityProcessProxy.java   |  195 +++
 .../multijvm/IgniteCacheProcessProxy.java       |  602 +++++++++
 .../multijvm/IgniteClusterProcessProxy.java     |  325 +++++
 .../multijvm/IgniteEventsProcessProxy.java      |  148 +++
 .../junits/multijvm/IgniteNodeRunner.java       |  184 +++
 .../junits/multijvm/IgniteProcessProxy.java     |  571 +++++++++
 .../IgniteCacheFailoverTestSuite.java           |    4 +-
 .../IgniteCacheFailoverTestSuite2.java          |    4 +
 ...IgniteCacheFullApiMultiJvmSelfTestSuite.java |   89 ++
 .../testsuites/IgniteCacheRestartTestSuite.java |    5 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |    1 +
 .../testsuites/IgniteCacheTestSuite2.java       |    2 +-
 .../testsuites/IgniteCacheTestSuite4.java       |    4 +-
 .../testsuites/IgniteClientNodesTestSuite.java  |   42 +
 .../IgniteClientReconnectTestSuite.java         |   48 +
 .../IgniteSpiCommunicationSelfTestSuite.java    |    3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |    6 +
 modules/extdata/p2p/pom.xml                     |    2 +-
 .../CacheConfigurationP2PTestClient.java        |    4 +-
 .../extdata/uri/modules/uri-dependency/pom.xml  |    6 +-
 modules/extdata/uri/pom.xml                     |   26 +-
 modules/gce/pom.xml                             |    2 +-
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  |   18 +
 ...pDiscoveryGoogleStorageIpFinderSelfTest.java |   29 +-
 .../geospatial/licenses/jts-lgpl-license.txt    |  165 ---
 modules/geospatial/pom.xml                      |    2 +-
 modules/hadoop/docs/HADOOP_README.txt           |  122 ++
 modules/hadoop/docs/hadoop_readme.md            |  135 --
 modules/hadoop/docs/hadoop_readme.pdf           |  Bin 82219 -> 0 bytes
 modules/hadoop/pom.xml                          |    2 +-
 .../testsuites/IgniteHadoopTestSuite.java       |    2 +-
 .../licenses/hibernate-lgpl-2.1-license.txt     |  174 ---
 modules/hibernate/pom.xml                       |    2 +-
 .../HibernateTransactionalDataRegion.java       |   12 +-
 .../hibernate/HibernateL2CacheSelfTest.java     |    7 +-
 .../HibernateL2CacheTransactionalSelfTest.java  |    5 -
 modules/indexing/licenses/h2-epl-license.txt    |   69 -
 modules/indexing/pom.xml                        |    2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |    5 +
 .../processors/query/h2/sql/GridSqlAlias.java   |    4 +
 .../processors/query/h2/sql/GridSqlColumn.java  |    4 +
 .../processors/query/h2/sql/GridSqlConst.java   |    4 +
 .../processors/query/h2/sql/GridSqlElement.java |   40 +-
 .../query/h2/sql/GridSqlFunction.java           |    2 +
 .../processors/query/h2/sql/GridSqlJoin.java    |    4 +
 .../query/h2/sql/GridSqlOperation.java          |   21 +-
 .../query/h2/sql/GridSqlOperationType.java      |    2 +
 .../query/h2/sql/GridSqlParameter.java          |    4 +
 .../query/h2/sql/GridSqlPlaceholder.java        |    4 +
 .../processors/query/h2/sql/GridSqlQuery.java   |   25 +-
 .../query/h2/sql/GridSqlQueryParser.java        |   11 +-
 .../query/h2/sql/GridSqlQuerySplitter.java      |  405 +++---
 .../processors/query/h2/sql/GridSqlSelect.java  |   91 +-
 .../query/h2/sql/GridSqlSubquery.java           |    4 +
 .../processors/query/h2/sql/GridSqlTable.java   |    4 +
 .../processors/query/h2/sql/GridSqlType.java    |   10 +-
 .../processors/query/h2/sql/GridSqlUnion.java   |   11 -
 .../query/h2/twostep/GridMergeIndex.java        |   45 +-
 .../h2/twostep/GridReduceQueryExecutor.java     |   70 +-
 .../cache/GridCacheCrossCacheQuerySelfTest.java |   77 +-
 ...QueryOffheapEvictsMultiThreadedSelfTest.java |    5 +
 ...ClientReconnectCacheQueriesFailoverTest.java |  225 ++++
 .../cache/IgniteClientReconnectQueriesTest.java |  427 +++++++
 .../IgniteCacheQueryNodeRestartSelfTest.java    |    5 -
 ...dCacheAbstractReduceFieldsQuerySelfTest.java |    4 +
 .../IgniteCacheWithIndexingTestSuite.java       |    1 +
 modules/jcl/pom.xml                             |    2 +-
 modules/json/pom.xml                            |   82 ++
 .../processors/json/IgniteJsonArray.java        |  132 ++
 .../processors/json/IgniteJsonArrayBuilder.java |  130 ++
 .../processors/json/IgniteJsonGenerator.java    |  500 ++++++++
 .../processors/json/IgniteJsonLocation.java     |   60 +
 .../json/IgniteJsonMessageFactory.java          |   36 +
 .../processors/json/IgniteJsonNumber.java       |  116 ++
 .../processors/json/IgniteJsonObject.java       |  130 ++
 .../json/IgniteJsonObjectBuilder.java           |  141 ++
 .../json/IgniteJsonProcessorImpl.java           |  115 ++
 .../processors/json/IgniteJsonProvider.java     |  104 ++
 .../processors/json/IgniteJsonString.java       |   77 ++
 .../processors/json/JsonCacheObject.java        |  118 ++
 .../java/org/apache/ignite/json/IgniteJson.java |   36 +
 .../processors/json/IgniteJsonCacheTest.java    |  221 ++++
 modules/jta/licenses/jta-license.txt            |    2 +
 modules/jta/pom.xml                             |    2 +-
 .../apache/ignite/cache/jta/CacheTmLookup.java  |    3 +-
 .../processors/cache/jta/CacheJtaManager.java   |   72 +-
 .../cache/jta/GridCacheXAResource.java          |   16 +-
 .../processors/cache/GridCacheJtaSelfTest.java  |   52 +-
 .../GridTmLookupLifecycleAwareSelfTest.java     |   29 +-
 modules/kafka/licenses/apache-2.0.txt           |  202 +++
 modules/kafka/pom.xml                           |   13 +-
 modules/log4j/README.txt                        |    2 +-
 modules/log4j/pom.xml                           |    2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |    2 +-
 modules/log4j2/README.txt                       |   32 +
 modules/log4j2/licenses/apache-2.0.txt          |  202 +++
 modules/log4j2/pom.xml                          |   63 +
 modules/log4j2/pom.xml~                         |   45 +
 .../ignite/logger/log4j2/Log4J2Logger.java      |  486 +++++++
 .../ignite/logger/log4j2/Log4J2Logger.java~     |  542 ++++++++
 .../ignite/logger/log4j2/Log4j2FileAware.java   |   35 +
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |   33 +
 .../ignite/logger/log4j2/Log4jFileAware.java~   |   13 +
 .../ignite/logger/log4j2/package-info.java      |   22 +
 .../log4j2/GridLog4j2CorrectFileNameTest.java   |   95 ++
 .../log4j2/GridLog4j2CorrectFileNameTest.java~  |   95 ++
 .../log4j2/GridLog4j2InitializedTest.java       |   79 ++
 .../log4j2/GridLog4j2InitializedTest.java~      |   79 ++
 .../log4j2/GridLog4j2LoggingFileTest.java       |   72 ++
 .../log4j2/GridLog4j2LoggingFileTest.java~      |   74 ++
 .../logger/log4j2/Log4j2LoggerSelfTest.java     |  174 +++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java |  117 ++
 .../ignite/logger/log4j2/package-info.java      |   22 +
 .../testsuites/IgniteLog4j2TestSuite.java       |   38 +
 modules/mesos/licenses/jetty-epl-license.txt    |   69 -
 modules/mesos/pom.xml                           |    3 +-
 .../apache/ignite/mesos/ClusterProperties.java  |   14 +
 .../apache/ignite/mesos/IgniteScheduler.java    |   26 +-
 modules/nodejs/README.txt                       |   28 +
 modules/nodejs/pom.xml                          |   82 ++
 modules/nodejs/src/main/js/apache-ignite.js     |   26 +
 modules/nodejs/src/main/js/cache.js             |  518 ++++++++
 modules/nodejs/src/main/js/cluster-node.js      |   52 +
 modules/nodejs/src/main/js/compute.js           |  105 ++
 modules/nodejs/src/main/js/ignite.js            |  156 +++
 modules/nodejs/src/main/js/ignition.js          |  106 ++
 modules/nodejs/src/main/js/package.json         |   17 +
 modules/nodejs/src/main/js/server.js            |  253 ++++
 modules/nodejs/src/main/js/sql-fields-query.js  |  118 ++
 modules/nodejs/src/main/js/sql-query.js         |   51 +
 .../ignite/internal/NodeJsAbstractTest.java     |  163 +++
 .../ignite/internal/NodeJsCacheApiSelfTest.java |  220 ++++
 .../ignite/internal/NodeJsComputeSelfTest.java  |  198 +++
 .../ignite/internal/NodeJsIgniteSelfTest.java   |   68 +
 .../ignite/internal/NodeJsIgnitionSelfTest.java |   68 +
 .../internal/NodeJsSecretKeySelfTest.java       |   72 ++
 .../ignite/internal/NodeJsSqlQuerySelfTest.java |  222 ++++
 .../testsuites/IgniteNodeJsTestSuite.java       |   43 +
 modules/nodejs/src/test/js/rest-jetty.xml       |   71 ++
 modules/nodejs/src/test/js/test-cache-api.js    |  636 +++++++++
 modules/nodejs/src/test/js/test-compute.js      |  632 +++++++++
 modules/nodejs/src/test/js/test-ignite.js       |   91 ++
 modules/nodejs/src/test/js/test-ignition.js     |   66 +
 modules/nodejs/src/test/js/test-key.js          |   56 +
 modules/nodejs/src/test/js/test-query.js        |  237 ++++
 modules/nodejs/src/test/js/test-runner.js       |   46 +
 modules/nodejs/src/test/js/test-utils.js        |  172 +++
 modules/rest-http/pom.xml                       |   20 +-
 .../http/jetty/GridJettyJsonConfig.java         |    3 +
 .../http/jetty/GridJettyRestHandler.java        |  313 ++++-
 .../http/jetty/GridJettyRestProtocol.java       |    2 +-
 .../jetty/RestGlassFishScriptingConverter.java  |  155 +++
 .../scalar-2.10/licenses/scala-bsd-license.txt  |   18 -
 modules/scalar-2.10/pom.xml                     |    2 +-
 modules/scalar/licenses/scala-bsd-license.txt   |   18 -
 modules/scalar/pom.xml                          |    2 +-
 .../licenses/cron4j-lgpl-2.1-license.txt        |  174 ---
 modules/schedule/pom.xml                        |    2 +-
 modules/schema-import/pom.xml                   |    2 +-
 .../ignite/schema/ui/SchemaImportApp.java       |   36 +-
 modules/slf4j/licenses/sl4j-mit-license.txt     |   21 -
 modules/slf4j/pom.xml                           |    2 +-
 .../spark-2.10/licenses/scala-bsd-license.txt   |   18 -
 modules/spark-2.10/pom.xml                      |    2 +-
 modules/spark/licenses/scala-bsd-license.txt    |   18 -
 modules/spark/pom.xml                           |    2 +-
 .../org/apache/ignite/spark/IgniteContext.scala |   14 +
 modules/spring/pom.xml                          |    2 +-
 .../apache/ignite/cache/spring/SpringCache.java |    2 +-
 .../ignite/cache/spring/SpringCacheManager.java |   22 +-
 .../util/spring/IgniteSpringHelperImpl.java     |   10 +-
 .../IgniteExcludeInConfigurationTest.java       |    5 +-
 .../org/apache/ignite/spring/sprint-exclude.xml |   19 +
 modules/ssh/licenses/jcraft-revised-bsd.txt     |   28 -
 modules/ssh/pom.xml                             |    2 +-
 modules/tools/licenses/jodd-revised-bsd.txt     |   21 -
 modules/tools/pom.xml                           |    2 +-
 .../urideploy/licenses/jtidy-mit-license.txt    |   50 -
 modules/urideploy/pom.xml                       |    8 +-
 modules/visor-console-2.10/pom.xml              |    2 +-
 .../licenses/jline-bsd-license.txt              |   18 -
 .../licenses/scala-bsd-license.txt              |   18 -
 modules/visor-console/pom.xml                   |    2 +-
 .../commands/cache/VisorCacheCommand.scala      |    2 -
 .../visor/commands/open/VisorOpenCommand.scala  |   19 +-
 .../scala/org/apache/ignite/visor/visor.scala   |    3 +
 .../licenses/slf4j-mit-license.txt              |   21 -
 modules/visor-plugins/pom.xml                   |    2 +-
 modules/web/pom.xml                             |    8 +-
 modules/yardstick/README.md                     |   85 --
 modules/yardstick/README.txt                    |   93 ++
 .../config/benchmark-put-indexed-val.properties |   64 +
 modules/yardstick/config/benchmark.properties   |    6 +-
 modules/yardstick/config/ignite-base-config.xml |   23 +
 modules/yardstick/pom.xml                       |    2 +-
 .../yardstick/IgniteBenchmarkArguments.java     |   22 +
 .../yardstick/cache/IgnitePutAllBenchmark.java  |   67 +
 .../cache/IgnitePutAllTxBenchmark.java          |   68 +
 .../cache/IgnitePutIndexedValue1Benchmark.java  |   42 +
 .../cache/IgnitePutIndexedValue2Benchmark.java  |   42 +
 .../cache/IgnitePutIndexedValue8Benchmark.java  |   42 +
 .../ignite/yardstick/cache/model/Person1.java   |   55 +
 .../ignite/yardstick/cache/model/Person2.java   |   67 +
 .../ignite/yardstick/cache/model/Person8.java   |  109 ++
 modules/yarn/README.txt                         |   28 +
 modules/yarn/licenses/apache-2.0.txt            |  202 +++
 modules/yarn/pom.xml                            |  101 ++
 .../apache/ignite/yarn/ApplicationMaster.java   |  400 ++++++
 .../apache/ignite/yarn/ClusterProperties.java   |  432 +++++++
 .../org/apache/ignite/yarn/IgniteContainer.java |   84 ++
 .../org/apache/ignite/yarn/IgniteProvider.java  |  339 +++++
 .../apache/ignite/yarn/IgniteYarnClient.java    |  178 +++
 .../org/apache/ignite/yarn/package-info.java    |   22 +
 .../ignite/yarn/utils/IgniteYarnUtils.java      |   81 ++
 .../main/resources/ignite-default-config.xml    |   35 +
 .../org/apache/ignite/IgniteYarnTestSuite.java  |   38 +
 .../yarn/IgniteApplicationMasterSelfTest.java   |  532 ++++++++
 parent/pom.xml                                  |  100 +-
 pom.xml                                         |   38 +-
 647 files changed, 43578 insertions(+), 5370 deletions(-)
----------------------------------------------------------------------




[03/50] [abbrv] incubator-ignite git commit: Added byteOrder and directBuffer flag to GridNioSslHandler.

Posted by an...@apache.org.
Added byteOrder and directBuffer flag to GridNioSslHandler.


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

Branch: refs/heads/ignite-843
Commit: 5082d63a3fbdc1a4ba8da38bb5d10c27a629aebc
Parents: ccebd43
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 24 15:18:29 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 24 15:18:29 2015 +0300

----------------------------------------------------------------------
 .../GridClientConnectionManagerAdapter.java     |  2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |  2 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  3 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 37 ++++++++++-
 .../internal/util/nio/ssl/GridNioSslFilter.java | 49 ++++----------
 .../util/nio/ssl/GridNioSslHandler.java         | 69 ++++++++++++++++++--
 .../communication/tcp/TcpCommunicationSpi.java  |  3 +-
 .../internal/util/nio/GridNioSslSelfTest.java   |  2 +-
 8 files changed, 117 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
index 166eed5..e8d29b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnectionManagerAdapter.java
@@ -146,7 +146,7 @@ public abstract class GridClientConnectionManagerAdapter implements GridClientCo
                 GridNioFilter codecFilter = new GridNioCodecFilter(new GridTcpRestParser(routerClient), gridLog, false);
 
                 if (sslCtx != null) {
-                    GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, gridLog);
+                    GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, true, ByteOrder.nativeOrder(), gridLog);
 
                     sslFilter.directMode(false);
                     sslFilter.clientMode(true);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterImpl.java
index cd4c607..7b1cd8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterImpl.java
@@ -228,7 +228,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif
             GridNioFilter[] filters;
 
             if (sslCtx != null) {
-                GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, log);
+                GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, false, ByteOrder.nativeOrder(), log);
 
                 sslFilter.wantClientAuth(wantClientAuth);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
index c37c17d..689e050 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
@@ -215,7 +215,8 @@ public class GridTcpRestProtocol extends GridRestProtocolAdapter {
             GridNioFilter[] filters;
 
             if (sslCtx != null) {
-                GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, log);
+                GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx,
+                    cfg.isDirectBuffer(), ByteOrder.nativeOrder(), log);
 
                 sslFilter.directMode(false);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
index 9890efe..ee95308 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.util.nio.ssl;
 
 import org.apache.ignite.*;
-import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.nio.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 
@@ -30,7 +29,6 @@ import java.nio.channels.*;
 
 import static javax.net.ssl.SSLEngineResult.HandshakeStatus.*;
 import static javax.net.ssl.SSLEngineResult.Status.*;
-import static org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter.*;
 
 /**
  *
@@ -483,4 +481,39 @@ public class BlockingSslHandler {
             throw new IgniteCheckedException("Failed to write byte to socket.", e);
         }
     }
+
+    /**
+     * Expands the given byte buffer to the requested capacity.
+     *
+     * @param original Original byte buffer.
+     * @param cap Requested capacity.
+     * @return Expanded byte buffer.
+     */
+    private ByteBuffer expandBuffer(ByteBuffer original, int cap) {
+        ByteBuffer res = ByteBuffer.allocate(cap);
+
+        res.order(ByteOrder.nativeOrder());
+
+        original.flip();
+
+        res.put(original);
+
+        return res;
+    }
+
+    /**
+     * Copies the given byte buffer.
+     *
+     * @param original Byte buffer to copy.
+     * @return Copy of the original byte buffer.
+     */
+    private ByteBuffer copy(ByteBuffer original) {
+        ByteBuffer cp = ByteBuffer.allocate(original.remaining());
+
+        cp.put(original);
+
+        cp.flip();
+
+        return cp;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
index 596344b..c3cb084 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java
@@ -52,6 +52,12 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
     /** SSL context to use. */
     private SSLContext sslCtx;
 
+    /** Order. */
+    private ByteOrder order;
+
+    /** Allocate direct buffer or heap buffer. */
+    private boolean directBuf;
+
     /** Whether SSLEngine should use client mode. */
     private boolean clientMode;
 
@@ -62,13 +68,17 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
      * Creates SSL filter.
      *
      * @param sslCtx SSL context.
+     * @param directBuf Direct buffer flag.
+     * @param order Byte order.
      * @param log Logger to use.
      */
-    public GridNioSslFilter(SSLContext sslCtx, IgniteLogger log) {
+    public GridNioSslFilter(SSLContext sslCtx, boolean directBuf, ByteOrder order, IgniteLogger log) {
         super("SSL filter");
 
         this.log = log;
         this.sslCtx = sslCtx;
+        this.directBuf = directBuf;
+        this.order = order;
     }
 
     /**
@@ -151,7 +161,7 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
             engine.setEnabledProtocols(enabledProtos);
 
         try {
-            GridNioSslHandler hnd = new GridNioSslHandler(this, ses, engine, log);
+            GridNioSslHandler hnd = new GridNioSslHandler(this, ses, engine, directBuf, order, log);
 
             ses.addMeta(SSL_HANDLER.ordinal(), hnd);
 
@@ -384,39 +394,4 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
 
         return (ByteBuffer)msg;
     }
-
-    /**
-     * Expands the given byte buffer to the requested capacity.
-     *
-     * @param original Original byte buffer.
-     * @param cap Requested capacity.
-     * @return Expanded byte buffer.
-     */
-    public static ByteBuffer expandBuffer(ByteBuffer original, int cap) {
-        ByteBuffer res = ByteBuffer.allocate(cap);
-
-        res.order(ByteOrder.nativeOrder());
-
-        original.flip();
-
-        res.put(original);
-
-        return res;
-    }
-
-    /**
-     * Copies the given byte buffer.
-     *
-     * @param original Byte buffer to copy.
-     * @return Copy of the original byte buffer.
-     */
-    public static ByteBuffer copy(ByteBuffer original) {
-        ByteBuffer cp = ByteBuffer.allocate(original.remaining());
-
-        cp.put(original);
-
-        cp.flip();
-
-        return cp;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
index dc3d870..8c1ac5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/GridNioSslHandler.java
@@ -45,6 +45,12 @@ class GridNioSslHandler extends ReentrantLock {
     /** SSL engine. */
     private SSLEngine sslEngine;
 
+    /** Order. */
+    private ByteOrder order;
+
+    /** Allocate direct buffer or heap buffer. */
+    private boolean directBuf;
+
     /** Session of this handler. */
     private GridNioSession ses;
 
@@ -82,10 +88,16 @@ class GridNioSslHandler extends ReentrantLock {
      * @param ses Session for which this handler was created.
      * @param engine SSL engine instance for this handler.
      * @param log Logger to use.
+     * @param directBuf Direct buffer flag.
+     * @param order Byte order.
      * @throws SSLException If exception occurred when starting SSL handshake.
      */
-    GridNioSslHandler(GridNioSslFilter parent, GridNioSession ses, SSLEngine engine, IgniteLogger log)
-        throws SSLException {
+    GridNioSslHandler(GridNioSslFilter parent,
+        GridNioSession ses,
+        SSLEngine engine,
+        boolean directBuf,
+        ByteOrder order,
+        IgniteLogger log) throws SSLException {
         assert parent != null;
         assert ses != null;
         assert engine != null;
@@ -93,6 +105,8 @@ class GridNioSslHandler extends ReentrantLock {
 
         this.parent = parent;
         this.ses = ses;
+        this.order = order;
+        this.directBuf = directBuf;
         this.log = log;
 
         sslEngine = engine;
@@ -111,8 +125,13 @@ class GridNioSslHandler extends ReentrantLock {
         // Allocate a little bit more so SSL engine would not return buffer overflow status.
         int netBufSize = sslEngine.getSession().getPacketBufferSize() + 50;
 
-        outNetBuf = ByteBuffer.allocate(netBufSize);
-        inNetBuf = ByteBuffer.allocate(netBufSize);
+        outNetBuf = directBuf ? ByteBuffer.allocateDirect(netBufSize) : ByteBuffer.allocate(netBufSize);
+
+        outNetBuf.order(order);
+
+        inNetBuf = directBuf ? ByteBuffer.allocateDirect(netBufSize) : ByteBuffer.allocate(netBufSize);
+
+        inNetBuf.order(order);
 
         // Initially buffer is empty.
         outNetBuf.position(0);
@@ -120,9 +139,9 @@ class GridNioSslHandler extends ReentrantLock {
 
         int appBufSize = Math.max(sslEngine.getSession().getApplicationBufferSize() + 50, netBufSize * 2);
 
-        appBuf = ByteBuffer.allocate(appBufSize);
+        appBuf = directBuf ? ByteBuffer.allocateDirect(appBufSize) : ByteBuffer.allocate(appBufSize);
 
-        appBuf.order(ByteOrder.nativeOrder());
+        appBuf.order(order);
 
         if (log.isDebugEnabled())
             log.debug("Started SSL session [netBufSize=" + netBufSize + ", appBufSize=" + appBufSize + ']');
@@ -588,6 +607,44 @@ class GridNioSslHandler extends ReentrantLock {
     }
 
     /**
+     * Expands the given byte buffer to the requested capacity.
+     *
+     * @param original Original byte buffer.
+     * @param cap Requested capacity.
+     * @return Expanded byte buffer.
+     */
+    private ByteBuffer expandBuffer(ByteBuffer original, int cap) {
+        ByteBuffer res = directBuf ? ByteBuffer.allocateDirect(cap) : ByteBuffer.allocate(cap);
+
+        res.order(order);
+
+        original.flip();
+
+        res.put(original);
+
+        return res;
+    }
+
+    /**
+     * Copies the given byte buffer.
+     *
+     * @param original Byte buffer to copy.
+     * @return Copy of the original byte buffer.
+     */
+    private ByteBuffer copy(ByteBuffer original) {
+        ByteBuffer cp = directBuf ? ByteBuffer.allocateDirect(original.remaining()) :
+            ByteBuffer.allocate(original.remaining());
+
+        cp.order(order);
+
+        cp.put(original);
+
+        cp.flip();
+
+        return cp;
+    }
+
+    /**
      * Write request for cases while handshake is not finished yet.
      */
     private static class WriteRequest {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/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 a665a3a..a0acb5c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -1478,7 +1478,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                 if (isSslEnabled()) {
                     GridNioSslFilter sslFilter =
-                        new GridNioSslFilter(ignite.configuration().getSslContextFactory().create(), log);
+                        new GridNioSslFilter(ignite.configuration().getSslContextFactory().create(),
+                            true, ByteOrder.nativeOrder(), log);
 
                     sslFilter.directMode(true);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5082d63a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
index 930b5d1..ba22395 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
@@ -69,7 +69,7 @@ public class GridNioSslSelfTest extends GridNioSelfTest {
             .sendQueueLimit(0)
             .filters(
                 new GridNioCodecFilter(parser, log, false),
-                new GridNioSslFilter(sslCtx, log))
+                new GridNioSslFilter(sslCtx, true, ByteOrder.nativeOrder(), log))
             .build();
 
         srvr.start();


[28/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-843' into ignite-1121

Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-843' into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: aa3fc51cca5b11154b1f4312a29e2b3181553910
Parents: 3e8a935 ee6fa09
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Jul 27 14:14:21 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Jul 27 14:14:21 2015 +0300

----------------------------------------------------------------------
 modules/web-control-center/src/main/js/db.js    |  4 +--
 .../src/main/js/routes/caches.js                |  2 +-
 .../src/main/js/routes/clusters.js              |  2 +-
 .../src/main/js/routes/generator/xml.js         | 29 +++++++++++++++++++-
 .../src/main/js/routes/metadata.js              |  2 +-
 5 files changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[43/50] [abbrv] incubator-ignite git commit: #ignite-gg-10610: Security hole if DataStreamer is used for populating the cache

Posted by an...@apache.org.
#ignite-gg-10610: Security hole if DataStreamer is used for populating the cache


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

Branch: refs/heads/ignite-843
Commit: 5288b2d8b882bbb86d69e1019821d51803685861
Parents: a127756
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 29 15:27:31 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 29 15:27:31 2015 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          | 22 ++++++++++++++++++++
 .../datastreamer/DataStreamerUpdateJob.java     | 20 +++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5288b2d8/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index 605f478..5fae676 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.security.*;
 import org.apache.ignite.stream.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
@@ -413,6 +414,8 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
     @Override public IgniteFuture<?> addData(Collection<? extends Map.Entry<K, V>> entries) {
         A.notEmpty(entries, "entries");
 
+        checkSecurityPermission(SecurityPermission.CACHE_PUT);
+
         enterBusy();
 
         try {
@@ -520,6 +523,11 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
     @Override public IgniteFuture<?> addData(K key, V val) {
         A.notNull(key, "key");
 
+        if (val == null)
+            checkSecurityPermission(SecurityPermission.CACHE_REMOVE);
+        else
+            checkSecurityPermission(SecurityPermission.CACHE_PUT);
+
         KeyCacheObject key0 = cacheObjProc.toCacheKeyObject(cacheObjCtx, key, true);
         CacheObject val0 = cacheObjProc.toCacheObject(cacheObjCtx, val, true);
 
@@ -980,6 +988,20 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
     }
 
     /**
+     * Check permissions for streaming.
+     *
+     * @param perm Security permission.
+     * @throws org.apache.ignite.plugin.security.SecurityException If permissions are not enough for streaming.
+     */
+    private void checkSecurityPermission(SecurityPermission perm)
+        throws org.apache.ignite.plugin.security.SecurityException{
+        if (!ctx.security().enabled())
+            return;
+
+        ctx.security().authorize(cacheName, perm, null);
+    }
+
+    /**
      *
      */
     private class Buffer {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5288b2d8/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
index 21ba3ac..9e0703a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.plugin.security.*;
 import org.apache.ignite.stream.*;
 import org.jetbrains.annotations.*;
 
@@ -106,8 +107,13 @@ class DataStreamerUpdateJob implements GridPlainCallable<Object> {
 
                 CacheObject val = e.getValue();
 
-                if (val != null)
+                if (val != null) {
+                    checkSecurityPermission(SecurityPermission.CACHE_PUT);
+
                     val.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
+                }
+                else
+                    checkSecurityPermission(SecurityPermission.CACHE_REMOVE);
             }
 
             if (unwrapEntries()) {
@@ -139,4 +145,16 @@ class DataStreamerUpdateJob implements GridPlainCallable<Object> {
     private boolean unwrapEntries() {
         return !(rcvr instanceof DataStreamerCacheUpdaters.InternalUpdater);
     }
+
+    /**
+     * @param perm Security permission.
+     * @throws org.apache.ignite.plugin.security.SecurityException If permission is not enough.
+     */
+    private void checkSecurityPermission(SecurityPermission perm)
+        throws org.apache.ignite.plugin.security.SecurityException {
+        if (!ctx.security().enabled())
+            return;
+
+        ctx.security().authorize(cacheName, perm, null);
+    }
 }


[24/50] [abbrv] incubator-ignite git commit: #ignite-961: add metadata test for nodejs.

Posted by an...@apache.org.
#ignite-961:  add metadata test for nodejs.


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

Branch: refs/heads/ignite-843
Commit: 70a8b2f9002057b9f70bf328a201f7c33d5350a4
Parents: 9289dab
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 13:23:24 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 13:23:24 2015 +0300

----------------------------------------------------------------------
 modules/nodejs/src/main/js/cache.js             | 30 +++++++++--
 .../ignite/internal/NodeJsSqlQuerySelfTest.java |  9 ++++
 modules/nodejs/src/test/js/test-query.js        | 53 +++++++++++++++++++-
 3 files changed, 87 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70a8b2f9/modules/nodejs/src/main/js/cache.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js
index a232558..1600eaa 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -269,7 +269,7 @@ Cache.prototype.size = function(callback) {
  * @returns {QueryCursor} Cursor for current query.
  */
 Cache.prototype.query = function(qry) {
-    return new QueryCursor(this, qry, true, null);
+    return new QueryCursor(this, qry, true, null, null);
 }
 
 Cache.prototype.__createPromise = function(cmd) {
@@ -302,12 +302,14 @@ Cache.prototype._createCommand = function(name) {
  * @param {SqlQuery|SqlFieldsQuery} qry Sql query
  * @param {boolean} init True if query is not started
  * @param {Object[]} res Current page result
+ * @param fieldsMeta Fields metadata.
  */
-QueryCursor = function(cache, qry, init, res) {
+QueryCursor = function(cache, qry, init, res, fieldsMeta) {
     this._qry = qry;
     this._cache = cache;
     this._init = init;
     this._res = res;
+    this._fieldsMeta = fieldsMeta;
 }
 
 /**
@@ -342,6 +344,10 @@ QueryCursor.prototype.getAll = function() {
             else {
                 cursor._res = res;
 
+                if (cursor._fieldsMeta === null) {
+                    cursor._fieldsMeta = res["fieldsMetadata"];
+                }
+
                 fullRes = fullRes.concat(res["items"]);
 
                 if (res["last"]) {
@@ -372,20 +378,36 @@ QueryCursor.prototype.nextPage = function() {
     var server = this._cache._server;
     var qry = this._qry;
     var cache = this._cache;
+    var fieldsMeta = this._fieldsMeta;
 
     return new Promise(function(resolve, reject) {
        server.runCommand(cmd, function(err, res) {
            if(err !== null) {
-               reject(err);
+                reject(err);
            }
            else {
-               resolve(new QueryCursor(cache, qry, false, res));
+                if (fieldsMeta !== null) {
+                    resolve(new QueryCursor(cache, qry, false, res, fieldsMeta));
+                }
+                else {
+                    resolve(new QueryCursor(cache, qry, false, res, res["fieldsMetadata"]))
+                }
            }
        });
     });
 }
 
 /**
+ * Gets query fields metadata
+ *
+ * @this{QueryCursor}
+ * @returns {Object[]} Query fields metadata.
+ */
+QueryCursor.prototype.fieldsMetadata = function() {
+    return this._fieldsMeta;
+}
+
+/**
  * Gets collections of the query page results.
  *
  * @this{QueryCursor}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70a8b2f9/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
index 2e4289e..22d7ad4 100644
--- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
+++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
@@ -65,6 +65,15 @@ public class NodeJsSqlQuerySelfTest extends NodeJsAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testSqlFieldsMeta() throws Exception {
+        initCache();
+
+        runJsScript("testSqlFieldsMeta");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testCloseQuery() throws Exception {
         initCache();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/70a8b2f9/modules/nodejs/src/test/js/test-query.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-query.js b/modules/nodejs/src/test/js/test-query.js
index dcbb310..3d55886 100644
--- a/modules/nodejs/src/test/js/test-query.js
+++ b/modules/nodejs/src/test/js/test-query.js
@@ -124,6 +124,8 @@ testSqlFieldsGetAllQuery = function() {
     TestUtils.startIgniteNode().then(function(ignite) {
         var qry = new SqlFieldsQuery("select concat(firstName, ' ', lastName) from Person");
 
+        var cursor = ignite.cache("person").query(qry);
+
         function onQuery(fullRes) {
             assert(fullRes.length === 4, "Result length is not correct" +
                 "[expected=1, val = " + fullRes.length + "]");
@@ -135,10 +137,14 @@ testSqlFieldsGetAllQuery = function() {
 
             console.log("Result: " + JSON.stringify(fullRes));
 
+            var meta = cursor.fieldsMetadata();
+
+            assert(meta[0]["fieldName"] !== null, "Incorrect fields meta.")
+
             return ignite.cache("person").get("key");
         }
 
-        ignite.cache("person").query(qry).getAll().then(onQuery).then(function(){
+        cursor.getAll().then(onQuery).then(function(){
             TestUtils.testDone();
         })
     }).catch(function(err) {
@@ -146,6 +152,51 @@ testSqlFieldsGetAllQuery = function() {
     });
 }
 
+testSqlFieldsMeta = function() {
+    TestUtils.startIgniteNode().then(function(ignite) {
+        var qry = new SqlFieldsQuery("select firstName, lastName from Person");
+
+        var fullRes = [];
+
+        function onQuery(cursor) {
+            var page = cursor.page();
+
+            fullRes = fullRes.concat(page);
+
+            var meta = cursor.fieldsMetadata();
+
+            console.log("Fields meta: " + JSON.stringify(meta))
+            assert(meta.length === 2, "Incorrect fields meta length [exp=2, val=" + meta.length + "]");
+
+            assert(meta[0]["fieldName"] === "FIRSTNAME", "Incorrect fields meta " +
+                "[exp=FIRSTNAME, val=" + meta[0]["fieldName"] + "]");
+            assert(meta[0]["fieldTypeName"] === "java.lang.String", "Incorrect fields meta " +
+                "[exp=java.lang.String, val=" + meta[0]["fieldTypeName"] + "]");
+            assert(meta[0]["schemaName"] === "person", "Incorrect fields meta " +
+                "[exp=person, val=" + meta[0]["schemaName"] + "]");
+            assert(meta[0]["typeName"] === "PERSON", "Incorrect fields meta " +
+                "[exp=PERSON, val=" + meta[0]["typeName"] + "]");
+
+            if (cursor.isFinished()) {
+                assert(fullRes.length === 4, "Result length is not correct" +
+                    "[expected=1, val = " + fullRes.length + "]");
+
+                console.log("Result: " + JSON.stringify(fullRes));
+
+                TestUtils.testDone();
+
+                return;
+            }
+
+            cursor.nextPage().then(onQuery);
+        }
+
+        ignite.cache("person").query(qry).nextPage().then(onQuery);
+    }).catch(function(err) {
+        assert(err === null, err);
+    });
+}
+
 testSqlQueryWithParams = function() {
     TestUtils.startIgniteNode().then(function(ignite) {
         var qry = new SqlQuery("salary > ? and salary <= ?");


[49/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: f20f5c5b6c126d11245ad026c4431e6ed80ae1f4
Parents: a13453f a3c533c
Author: Andrey <an...@gridgain.com>
Authored: Fri Jul 31 09:46:49 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri Jul 31 09:46:49 2015 +0700

----------------------------------------------------------------------
 .../control-center-web/src/main/js/DEVNOTES.txt |   8 +-
 .../main/js/controllers/caches-controller.js    |   2 +
 .../main/js/controllers/clusters-controller.js  |   2 +
 .../src/main/js/controllers/common-module.js    |  18 +-
 .../main/js/controllers/metadata-controller.js  |   2 +
 .../src/main/js/controllers/models/caches.json  |  19 +-
 .../main/js/controllers/models/metadata.json    |  12 +-
 .../main/js/controllers/summary-controller.js   |   2 +-
 .../src/main/js/routes/generator/common.js      |  31 +-
 .../src/main/js/routes/generator/docker.js      |  70 +-
 .../src/main/js/routes/generator/java.js        | 670 +++++++++++--------
 .../src/main/js/routes/generator/xml.js         |  98 +--
 .../src/main/js/routes/summary.js               |  19 +-
 .../src/main/js/views/configuration/caches.jade |   2 +-
 .../src/main/js/views/includes/controls.jade    | 105 +--
 15 files changed, 591 insertions(+), 469 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f20f5c5b/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------


[23/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 0ff3504e64166a5b29397ebd6b7161220b112ef6
Parents: fcfda9a 9289dab
Author: Andrey <an...@gridgain.com>
Authored: Mon Jul 27 16:49:36 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Jul 27 16:49:36 2015 +0700

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   5 +
 assembly/release-base.xml                       |   5 +
 config/ignite-log4j2.xml                        |  81 +++
 config/ignite-log4j2.xml~                       |  65 +++
 examples/config/example-ignite.xml              |   2 +-
 modules/clients/README.txt                      |  16 +
 modules/clients/readme.md                       |  32 --
 modules/clients/readme.pdf                      | Bin 47887 -> 0 bytes
 .../JettyRestProcessorAbstractSelfTest.java     |  39 +-
 .../rest/protocols/tcp/MockNioSession.java      |  15 -
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  63 ++-
 .../apache/ignite/internal/IgniteKernal.java    |  49 +-
 .../GridClientConnectionManagerAdapter.java     |   2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |   2 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../discovery/GridDiscoveryManager.java         |   7 +-
 .../cache/CacheEvictableEntryImpl.java          |   2 +-
 .../processors/cache/GridCacheAdapter.java      |  13 +-
 .../processors/cache/GridCacheEntryEx.java      |  32 +-
 .../cache/GridCacheEvictionManager.java         |  12 +-
 .../processors/cache/GridCacheMapEntry.java     | 208 +------
 .../processors/cache/GridCacheUtils.java        |  18 +-
 .../extras/GridCacheAttributesEntryExtras.java  |  37 +-
 .../GridCacheAttributesMvccEntryExtras.java     |  35 +-
 ...dCacheAttributesMvccObsoleteEntryExtras.java |  35 +-
 ...cheAttributesMvccObsoleteTtlEntryExtras.java |  35 +-
 .../GridCacheAttributesMvccTtlEntryExtras.java  |  35 +-
 .../GridCacheAttributesObsoleteEntryExtras.java |  36 +-
 ...idCacheAttributesObsoleteTtlEntryExtras.java |  36 +-
 .../GridCacheAttributesTtlEntryExtras.java      |  36 +-
 .../cache/extras/GridCacheEntryExtras.java      |  14 -
 .../extras/GridCacheEntryExtrasAdapter.java     |   8 -
 .../cache/extras/GridCacheMvccEntryExtras.java  |   8 -
 .../GridCacheMvccObsoleteEntryExtras.java       |   8 -
 .../GridCacheMvccObsoleteTtlEntryExtras.java    |   9 -
 .../extras/GridCacheMvccTtlEntryExtras.java     |   8 -
 .../extras/GridCacheObsoleteEntryExtras.java    |   8 -
 .../extras/GridCacheObsoleteTtlEntryExtras.java |   9 -
 .../cache/extras/GridCacheTtlEntryExtras.java   |   8 -
 .../store/GridCacheStoreManagerAdapter.java     |   2 +-
 .../cache/transactions/IgniteInternalTx.java    |  16 +-
 .../cache/transactions/IgniteTxAdapter.java     |   6 +-
 .../processors/rest/GridRestProcessor.java      |   8 +
 .../query/CacheQueryFieldsMetaResult.java       | 133 +++++
 .../rest/handlers/query/CacheQueryResult.java   |  19 +
 .../handlers/query/QueryCommandHandler.java     |  21 +
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  20 +-
 .../processors/task/GridTaskProcessor.java      |   3 +-
 .../util/lang/GridMetadataAwareAdapter.java     | 296 +++++-----
 .../ignite/internal/util/nio/GridNioServer.java |  28 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 519 ++++++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |  53 +-
 .../util/nio/ssl/GridNioSslHandler.java         |  79 ++-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  58 ++
 .../spi/IgniteSpiOperationTimeoutException.java |  43 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    | 102 ++++
 .../communication/tcp/TcpCommunicationSpi.java  | 294 ++++++++--
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  52 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 529 +++++++++++-------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  11 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 169 ++++--
 .../tcp/internal/TcpDiscoveryNode.java          |  21 +
 .../TcpDiscoveryConnectionCheckMessage.java     |  64 +++
 .../apache/ignite/ssl/SslContextFactory.java    | 458 ++++++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 modules/core/src/test/config/log4j2-test.xml    |  57 ++
 modules/core/src/test/config/log4j2-test.xml~   |  63 +++
 .../src/test/config/log4j2-verbose-test.xml     |  48 ++
 .../IgniteClientReconnectAbstractTest.java      |   4 +-
 .../IgniteTopologyPrintFormatSelfTest.java      |   6 +-
 .../CacheGetFutureHangsSelfTest.java            | 214 ++++++++
 .../cache/eviction/GridCacheMockEntry.java      |  12 +-
 .../internal/util/nio/GridNioSslSelfTest.java   |   2 +-
 .../nio/impl/GridNioFilterChainSelfTest.java    |  15 -
 .../GridMetadataAwareAdapterLoadSelfTest.java   | 135 +++++
 .../lang/GridMetadataAwareAdapterSelfTest.java  |  58 +-
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../GridTcpCommunicationSpiAbstractTest.java    |   2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |   3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |  54 ++
 ...GridTcpCommunicationSpiRecoverySelfTest.java |  23 +-
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 ++
 ...unicationSpiTcpFailureDetectionSelfTest.java |  75 +++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |  46 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  36 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 205 +++++++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 116 ++--
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  | 402 ++++++++++++++
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 +
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteCacheFailoverTestSuite.java           |   4 +-
 .../IgniteSpiCommunicationSelfTestSuite.java    |   3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   5 +
 modules/hadoop/docs/HADOOP_README.txt           | 122 +++++
 modules/hadoop/docs/hadoop_readme.md            | 135 -----
 modules/hadoop/docs/hadoop_readme.pdf           | Bin 82219 -> 0 bytes
 modules/log4j/README.txt                        |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   2 +-
 modules/log4j2/README.txt                       |  32 ++
 modules/log4j2/licenses/apache-2.0.txt          | 202 +++++++
 modules/log4j2/pom.xml                          |  63 +++
 modules/log4j2/pom.xml~                         |  45 ++
 .../ignite/logger/log4j2/Log4J2Logger.java      | 486 +++++++++++++++++
 .../ignite/logger/log4j2/Log4J2Logger.java~     | 542 +++++++++++++++++++
 .../ignite/logger/log4j2/Log4j2FileAware.java   |  35 ++
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |  33 ++
 .../ignite/logger/log4j2/Log4jFileAware.java~   |  13 +
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../log4j2/GridLog4j2CorrectFileNameTest.java   |  95 ++++
 .../log4j2/GridLog4j2CorrectFileNameTest.java~  |  95 ++++
 .../log4j2/GridLog4j2InitializedTest.java       |  79 +++
 .../log4j2/GridLog4j2InitializedTest.java~      |  79 +++
 .../log4j2/GridLog4j2LoggingFileTest.java       |  72 +++
 .../log4j2/GridLog4j2LoggingFileTest.java~      |  74 +++
 .../logger/log4j2/Log4j2LoggerSelfTest.java     | 174 ++++++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 117 ++++
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../testsuites/IgniteLog4j2TestSuite.java       |  38 ++
 .../visor/commands/open/VisorOpenCommand.scala  |  17 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   3 +
 modules/yardstick/README.md                     |  85 ---
 modules/yardstick/README.txt                    |  93 ++++
 parent/pom.xml                                  |   4 +-
 pom.xml                                         |   1 +
 131 files changed, 7137 insertions(+), 1494 deletions(-)
----------------------------------------------------------------------



[37/50] [abbrv] incubator-ignite git commit: IGNITE-1121 Add copyrights.

Posted by an...@apache.org.
IGNITE-1121 Add copyrights.


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

Branch: refs/heads/ignite-843
Commit: 666d44caac5f8bfff36c25d8fb35144337b813f0
Parents: a4be95f
Author: sevdokimov <se...@gridgain.com>
Authored: Tue Jul 28 18:50:39 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue Jul 28 18:50:39 2015 +0300

----------------------------------------------------------------------
 .../src/main/resources/default.config.properties     | 15 +++++++++++++++
 .../src/main/resources/logging.properties            | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/666d44ca/modules/control-center-agent/src/main/resources/default.config.properties
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/resources/default.config.properties b/modules/control-center-agent/src/main/resources/default.config.properties
index e7064b7..631e811 100644
--- a/modules/control-center-agent/src/main/resources/default.config.properties
+++ b/modules/control-center-agent/src/main/resources/default.config.properties
@@ -1,3 +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.
+
 # Ignite Control Center web-socket server URI.
 serverURI=wss://localhost:3001
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/666d44ca/modules/control-center-agent/src/main/resources/logging.properties
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/resources/logging.properties b/modules/control-center-agent/src/main/resources/logging.properties
index f63c832..ea397c1 100644
--- a/modules/control-center-agent/src/main/resources/logging.properties
+++ b/modules/control-center-agent/src/main/resources/logging.properties
@@ -1,3 +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.
+
 handlers =java.util.logging.ConsoleHandler
 .level = INFO
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


[41/50] [abbrv] incubator-ignite git commit: # ignite-1121 Add install npm and node.js through maven.

Posted by an...@apache.org.
# ignite-1121 Add install npm and node.js through maven.


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

Branch: refs/heads/ignite-843
Commit: 89220b19a3de2e48633b8248d94a055a640e5be0
Parents: 94bb0d9
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 29 13:43:54 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 29 13:43:54 2015 +0700

----------------------------------------------------------------------
 modules/control-center-web/pom.xml | 69 +++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/89220b19/modules/control-center-web/pom.xml
----------------------------------------------------------------------
diff --git a/modules/control-center-web/pom.xml b/modules/control-center-web/pom.xml
new file mode 100644
index 0000000..eb71764
--- /dev/null
+++ b/modules/control-center-web/pom.xml
@@ -0,0 +1,69 @@
+<?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>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-control-center-web</artifactId>
+    <version>1.4.1-SNAPSHOT</version>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>com.github.eirslett</groupId>
+                <artifactId>frontend-maven-plugin</artifactId>
+                <version>0.0.23</version>
+
+                <configuration>
+                    <workingDirectory>src/main/js</workingDirectory>
+                </configuration>
+
+                <executions>
+                    <execution>
+                        <id>install node and npm</id>
+                        <goals>
+                            <goal>install-node-and-npm</goal>
+                        </goals>
+                        <configuration>
+                            <nodeVersion>v0.12.7</nodeVersion>
+                            <npmVersion>2.13.2</npmVersion>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>npm install</id>
+                        <goals>
+                            <goal>npm</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file


[29/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-961' into ignite-1121

Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-961' into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: d5925e688b118a401247722b787c4ba40853e6b7
Parents: aa3fc51 70a8b2f
Author: sevdokimov <se...@gridgain.com>
Authored: Mon Jul 27 15:26:53 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Mon Jul 27 15:26:53 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   5 +
 assembly/release-base.xml                       |   5 +
 config/ignite-log4j2.xml                        |  81 +++
 config/ignite-log4j2.xml~                       |  65 ++
 examples/config/example-ignite.xml              |   2 +-
 .../ignite/examples/ExampleNodeStartup.java     |   2 +-
 .../examples/js/ExampleJsNodeStartup.java       |   2 +-
 examples/src/main/js/cache-query-example.js     |  24 +-
 .../main/js/cache-sql-fields-query-example.js   |  95 +--
 modules/apache-license-gen/pom.xml              |  13 -
 modules/clients/README.txt                      |  16 +
 modules/clients/readme.md                       |  32 -
 modules/clients/readme.pdf                      | Bin 47887 -> 0 bytes
 .../JettyRestProcessorAbstractSelfTest.java     | 715 +++++++++++--------
 .../rest/protocols/tcp/MockNioSession.java      |  15 -
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../java/org/apache/ignite/IgniteCache.java     |   3 +-
 .../apache/ignite/IgniteSystemProperties.java   |   8 +
 .../AffinityNodeAddressHashResolver.java        |   8 +-
 .../affinity/AffinityNodeHashResolver.java      |   5 +
 .../affinity/AffinityNodeIdHashResolver.java    |   6 +
 .../rendezvous/RendezvousAffinityFunction.java  |  22 +-
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   |   2 +-
 .../configuration/CacheConfiguration.java       |   4 +-
 .../configuration/ConnectorConfiguration.java   |  32 +
 .../configuration/IgniteConfiguration.java      |  89 ++-
 .../apache/ignite/internal/IgniteKernal.java    |  94 ++-
 .../ignite/internal/IgniteNodeAttributes.java   |   3 +
 .../GridClientConnectionManagerAdapter.java     |   2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |   2 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../discovery/GridDiscoveryManager.java         |   7 +-
 .../cache/CacheEvictableEntryImpl.java          |   2 +-
 .../processors/cache/GridCacheAdapter.java      |  15 +-
 .../processors/cache/GridCacheAttributes.java   |   8 +-
 .../processors/cache/GridCacheEntryEx.java      |  32 +-
 .../cache/GridCacheEvictionManager.java         |  12 +-
 .../processors/cache/GridCacheMapEntry.java     | 208 +-----
 .../processors/cache/GridCacheMvccManager.java  |  14 +
 .../processors/cache/GridCacheProcessor.java    | 113 +--
 .../processors/cache/GridCacheUtils.java        |  18 +-
 .../processors/cache/IgniteCacheProxy.java      |   2 +-
 .../processors/cache/IgniteInternalCache.java   |   4 +-
 .../distributed/dht/GridDhtTxFinishFuture.java  |  13 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |  16 +-
 .../GridDhtPartitionsExchangeFuture.java        |  10 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   4 +-
 .../GridNearPessimisticTxPrepareFuture.java     |   2 +-
 .../near/GridNearTxFinishFuture.java            |  17 +-
 .../extras/GridCacheAttributesEntryExtras.java  |  37 +-
 .../GridCacheAttributesMvccEntryExtras.java     |  35 +-
 ...dCacheAttributesMvccObsoleteEntryExtras.java |  35 +-
 ...cheAttributesMvccObsoleteTtlEntryExtras.java |  35 +-
 .../GridCacheAttributesMvccTtlEntryExtras.java  |  35 +-
 .../GridCacheAttributesObsoleteEntryExtras.java |  36 +-
 ...idCacheAttributesObsoleteTtlEntryExtras.java |  36 +-
 .../GridCacheAttributesTtlEntryExtras.java      |  36 +-
 .../cache/extras/GridCacheEntryExtras.java      |  14 -
 .../extras/GridCacheEntryExtrasAdapter.java     |   8 -
 .../cache/extras/GridCacheMvccEntryExtras.java  |   8 -
 .../GridCacheMvccObsoleteEntryExtras.java       |   8 -
 .../GridCacheMvccObsoleteTtlEntryExtras.java    |   9 -
 .../extras/GridCacheMvccTtlEntryExtras.java     |   8 -
 .../extras/GridCacheObsoleteEntryExtras.java    |   8 -
 .../extras/GridCacheObsoleteTtlEntryExtras.java |   9 -
 .../cache/extras/GridCacheTtlEntryExtras.java   |   8 -
 .../store/GridCacheStoreManagerAdapter.java     |   2 +-
 .../cache/transactions/IgniteInternalTx.java    |  16 +-
 .../cache/transactions/IgniteTxAdapter.java     |   6 +-
 .../cache/transactions/IgniteTxManager.java     |   5 +-
 .../processors/query/GridQueryProcessor.java    |   2 +-
 .../processors/rest/GridRestCommand.java        |  28 +-
 .../processors/rest/GridRestProcessor.java      |  26 +
 .../handlers/cache/GridCacheCommandHandler.java |  70 +-
 .../query/CacheQueryFieldsMetaResult.java       | 133 ++++
 .../rest/handlers/query/CacheQueryResult.java   |  19 +
 .../handlers/query/QueryCommandHandler.java     | 105 +--
 .../IgniteScriptingCommandHandler.java          |   5 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  20 +-
 .../scripting/IgniteScriptingConverter.java     |  15 +-
 .../scripting/IgniteScriptingProcessor.java     |  13 +-
 .../processors/scripting/ScriptingJsCache.java  |  15 +-
 .../processors/task/GridTaskProcessor.java      |   3 +-
 .../ignite/internal/util/IgniteUtils.java       |  31 +-
 .../util/lang/GridMetadataAwareAdapter.java     | 296 ++++----
 .../ignite/internal/util/nio/GridNioServer.java |  37 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/GridSelectorNioSessionImpl.java    |   8 +
 .../util/nio/ssl/BlockingSslHandler.java        | 519 ++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |  53 +-
 .../util/nio/ssl/GridNioSslHandler.java         |  79 +-
 .../org/apache/ignite/json/JSONCacheObject.java |  95 ---
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  58 ++
 .../spi/IgniteSpiOperationTimeoutException.java |  43 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    | 102 +++
 .../communication/tcp/TcpCommunicationSpi.java  | 294 ++++++--
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  52 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 587 +++++++++------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  11 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 172 ++++-
 .../tcp/internal/TcpDiscoveryNode.java          |  39 +-
 .../TcpDiscoveryConnectionCheckMessage.java     |  64 ++
 .../apache/ignite/ssl/SslContextFactory.java    | 458 ++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 modules/core/src/test/config/log4j2-test.xml    |  57 ++
 modules/core/src/test/config/log4j2-test.xml~   |  63 ++
 .../src/test/config/log4j2-verbose-test.xml     |  48 ++
 .../IgniteClientReconnectAbstractTest.java      |   4 +-
 .../IgniteClientReconnectFailoverTest.java      |   6 +
 .../IgniteTopologyPrintFormatSelfTest.java      |   6 +-
 .../cache/CacheAffinityCallSelfTest.java        |  10 +-
 .../cache/GridCachePutAllFailoverSelfTest.java  |   3 +
 .../CacheGetFutureHangsSelfTest.java            | 214 ++++++
 .../GridCacheAbstractNodeRestartSelfTest.java   |   9 +
 ...NearDisabledOptimisticTxNodeRestartTest.java |  31 +
 .../IgniteCachePutRetryAbstractSelfTest.java    |  52 +-
 ...gniteCachePutRetryTransactionalSelfTest.java |  17 +-
 .../GridCachePartitionedFailoverSelfTest.java   |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |   4 +-
 ...ePartitionedOptimisticTxNodeRestartTest.java |  12 +-
 .../cache/eviction/GridCacheMockEntry.java      |  12 +-
 .../internal/util/nio/GridNioSelfTest.java      |  88 ++-
 .../internal/util/nio/GridNioSslSelfTest.java   |  16 +-
 .../nio/impl/GridNioFilterChainSelfTest.java    |  15 -
 .../GridMetadataAwareAdapterLoadSelfTest.java   | 135 ++++
 .../lang/GridMetadataAwareAdapterSelfTest.java  |  58 +-
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../GridTcpCommunicationSpiAbstractTest.java    |   2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |   3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |  54 ++
 ...GridTcpCommunicationSpiRecoverySelfTest.java |  23 +-
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 +
 ...unicationSpiTcpFailureDetectionSelfTest.java |  75 ++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |  46 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  36 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 205 ++++++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 116 ++-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   2 +
 ...DiscoveryNodeConfigConsistentIdSelfTest.java |  76 ++
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  | 402 +++++++++++
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 +
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../testframework/junits/GridAbstractTest.java  |   3 +-
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteCacheFailoverTestSuite.java           |   4 +-
 .../IgniteCacheFailoverTestSuite2.java          |   4 +
 .../testsuites/IgniteCacheRestartTestSuite.java |   5 +-
 .../IgniteSpiCommunicationSelfTestSuite.java    |   3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   6 +
 modules/hadoop/docs/HADOOP_README.txt           | 122 ++++
 modules/hadoop/docs/hadoop_readme.md            | 135 ----
 modules/hadoop/docs/hadoop_readme.pdf           | Bin 82219 -> 0 bytes
 .../processors/query/h2/sql/GridSqlAlias.java   |   4 +
 .../processors/query/h2/sql/GridSqlColumn.java  |   4 +
 .../processors/query/h2/sql/GridSqlConst.java   |   4 +
 .../processors/query/h2/sql/GridSqlElement.java |  40 +-
 .../query/h2/sql/GridSqlFunction.java           |   2 +
 .../processors/query/h2/sql/GridSqlJoin.java    |   4 +
 .../query/h2/sql/GridSqlOperation.java          |  21 +-
 .../query/h2/sql/GridSqlOperationType.java      |   2 +
 .../query/h2/sql/GridSqlParameter.java          |   4 +
 .../query/h2/sql/GridSqlPlaceholder.java        |   4 +
 .../processors/query/h2/sql/GridSqlQuery.java   |  25 +-
 .../query/h2/sql/GridSqlQueryParser.java        |  11 +-
 .../query/h2/sql/GridSqlQuerySplitter.java      | 405 +++++++----
 .../processors/query/h2/sql/GridSqlSelect.java  |  91 +--
 .../query/h2/sql/GridSqlSubquery.java           |   4 +
 .../processors/query/h2/sql/GridSqlTable.java   |   4 +
 .../processors/query/h2/sql/GridSqlType.java    |  10 +-
 .../processors/query/h2/sql/GridSqlUnion.java   |  11 -
 .../cache/GridCacheCrossCacheQuerySelfTest.java |  77 +-
 ...QueryOffheapEvictsMultiThreadedSelfTest.java |   5 +
 .../IgniteCacheQueryNodeRestartSelfTest.java    |   5 -
 modules/json/pom.xml                            |   6 -
 .../processors/json/IgniteJsonObject.java       |  13 +
 .../processors/json/JsonCacheObject.java        |  15 +
 .../processors/json/IgniteJsonCacheTest.java    |  25 +
 modules/log4j/README.txt                        |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   2 +-
 modules/log4j2/README.txt                       |  32 +
 modules/log4j2/licenses/apache-2.0.txt          | 202 ++++++
 modules/log4j2/pom.xml                          |  63 ++
 modules/log4j2/pom.xml~                         |  45 ++
 .../ignite/logger/log4j2/Log4J2Logger.java      | 486 +++++++++++++
 .../ignite/logger/log4j2/Log4J2Logger.java~     | 542 ++++++++++++++
 .../ignite/logger/log4j2/Log4j2FileAware.java   |  35 +
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |  33 +
 .../ignite/logger/log4j2/Log4jFileAware.java~   |  13 +
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../log4j2/GridLog4j2CorrectFileNameTest.java   |  95 +++
 .../log4j2/GridLog4j2CorrectFileNameTest.java~  |  95 +++
 .../log4j2/GridLog4j2InitializedTest.java       |  79 ++
 .../log4j2/GridLog4j2InitializedTest.java~      |  79 ++
 .../log4j2/GridLog4j2LoggingFileTest.java       |  72 ++
 .../log4j2/GridLog4j2LoggingFileTest.java~      |  74 ++
 .../logger/log4j2/Log4j2LoggerSelfTest.java     | 174 +++++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 117 +++
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../testsuites/IgniteLog4j2TestSuite.java       |  38 +
 modules/nodejs/src/main/js/cache.js             |  56 +-
 modules/nodejs/src/main/js/ignite.js            |   4 +-
 modules/nodejs/src/main/js/server.js            |   2 +-
 modules/nodejs/src/main/js/sql-fields-query.js  |   2 +-
 .../ignite/internal/NodeJsCacheApiSelfTest.java |   7 -
 .../ignite/internal/NodeJsSqlQuerySelfTest.java |  12 +-
 modules/nodejs/src/test/js/test-cache-api.js    |  21 -
 modules/nodejs/src/test/js/test-compute.js      |   6 +-
 modules/nodejs/src/test/js/test-query.js        |  53 +-
 modules/rest-http/pom.xml                       |   6 +
 .../http/jetty/GridJettyRestHandler.java        |  40 +-
 .../jetty/RestGlassFishScriptingConverter.java  |  99 ++-
 .../org/apache/ignite/spark/IgniteContext.scala |  14 +
 .../visor/commands/open/VisorOpenCommand.scala  |  17 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   3 +
 modules/yardstick/README.md                     |  85 ---
 modules/yardstick/README.txt                    |  93 +++
 parent/pom.xml                                  |   4 +-
 pom.xml                                         |  13 +-
 221 files changed, 8957 insertions(+), 2772 deletions(-)
----------------------------------------------------------------------



[38/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121

Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 301ac429889526b33bacfc00a3ba2117560f518e
Parents: c51381e 666d44c
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 29 08:43:24 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 29 08:43:24 2015 +0700

----------------------------------------------------------------------
 modules/control-center-agent/README.txt         | 20 +++++++++++++++
 .../java/org/apache/ignite/agent/Agent.java     | 12 ++++-----
 .../org/apache/ignite/agent/AgentLauncher.java  |  4 +--
 .../src/main/resources/config.properties        |  2 --
 .../main/resources/default.config.properties    | 26 ++++++++++++++++++++
 .../src/main/resources/logging.properties       | 15 +++++++++++
 6 files changed, 69 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[48/50] [abbrv] incubator-ignite git commit: Merge branches 'ignite-1121' and 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branches 'ignite-1121' and 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: a13453f5d2d6b35f3b276f8cfb89ea6cda561834
Parents: e24f3b7 6961060
Author: Andrey <an...@gridgain.com>
Authored: Fri Jul 31 09:46:17 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri Jul 31 09:46:17 2015 +0700

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          | 22 ++++++++++++++++++++
 .../datastreamer/DataStreamerUpdateJob.java     | 20 +++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[18/50] [abbrv] incubator-ignite git commit: #ignite-961: add new rest commands.

Posted by an...@apache.org.
#ignite-961:  add new rest commands.


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

Branch: refs/heads/ignite-843
Commit: 9bfc1842a20c6dc2f55f133a997608dd1b5f803a
Parents: 0341759
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 10:36:46 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 10:36:46 2015 +0300

----------------------------------------------------------------------
 .../rest/AbstractRestProcessorSelfTest.java     |   1 +
 .../JettyRestProcessorAbstractSelfTest.java     | 616 ++++++++++++++++++-
 .../apache/ignite/internal/IgniteKernal.java    |  42 +-
 .../processors/cache/GridCacheAdapter.java      |   2 +-
 .../processors/rest/GridRestCommand.java        |  53 +-
 .../processors/rest/GridRestProcessor.java      |  32 +
 .../handlers/cache/GridCacheCommandHandler.java | 373 ++++++++++-
 .../rest/handlers/query/CacheQueryResult.java   | 101 +++
 .../handlers/query/QueryCommandHandler.java     | 271 ++++++++
 .../version/GridVersionCommandHandler.java      |  14 +-
 .../rest/request/RestSqlQueryRequest.java       | 125 ++++
 .../http/jetty/GridJettyRestHandler.java        |  85 ++-
 12 files changed, 1639 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
index 4f1969f..8310b0f 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
@@ -84,6 +84,7 @@ abstract class AbstractRestProcessorSelfTest extends GridCommonAbstractTest {
         CacheConfiguration ccfg = defaultCacheConfiguration();
 
         ccfg.setStatisticsEnabled(true);
+        ccfg.setIndexedTypes(String.class, String.class);
 
         cfg.setCacheConfiguration(ccfg);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/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 d5a3cc1..160046c 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
@@ -17,12 +17,20 @@
 
 package org.apache.ignite.internal.processors.rest;
 
+import net.sf.json.*;
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.rest.handlers.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.testframework.*;
 
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import java.util.concurrent.*;
 import java.util.regex.*;
 
 import static org.apache.ignite.IgniteSystemProperties.*;
@@ -31,7 +39,7 @@ import static org.apache.ignite.IgniteSystemProperties.*;
  * Tests for Jetty REST protocol.
  */
 @SuppressWarnings("unchecked")
-abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorSelfTest {
+public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorSelfTest {
     /** Grid count. */
     private static final int GRID_CNT = 3;
 
@@ -40,6 +48,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
         System.setProperty(IGNITE_JETTY_PORT, Integer.toString(restPort()));
 
         super.beforeTestsStarted();
+
+        initCache();
     }
 
     /** {@inheritDoc} */
@@ -50,6 +60,11 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        grid(0).cache(null).removeAll();
+    }
+
+    /** {@inheritDoc} */
     @Override protected int gridCount() {
         return GRID_CNT;
     }
@@ -65,7 +80,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @return Returned content.
      * @throws Exception If failed.
      */
-    private String content(Map<String, String> params) throws Exception {
+    protected String content(Map<String, String> params) throws Exception {
         String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?";
 
         for (Map.Entry<String, String> e : params.entrySet())
@@ -115,6 +130,18 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     }
 
     /**
+     * @param err Error.
+     * @return Regex pattern for JSON.
+     */
+    private String errorPattern(String err) {
+        return "\\{" +
+            "\\\"error\\\":\\\"" + err + "\\\"\\," +
+            "\\\"response\\\":null\\," +
+            "\\\"sessionToken\\\":\\\"\\\"," +
+            "\\\"successStatus\\\":" + 1 + "\\}";
+    }
+
+    /**
      * @param res Response.
      * @param success Success flag.
      * @return Regex pattern for JSON.
@@ -144,6 +171,19 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @param success Success flag.
      * @return Regex pattern for JSON.
      */
+    private String cacheBulkPattern(int res, boolean success) {
+        return "\\{\\\"affinityNodeId\\\":\\\"\\\"\\," +
+            "\\\"error\\\":\\\"\\\"\\," +
+            "\\\"response\\\":" + res + "\\," +
+            "\\\"sessionToken\\\":\\\"\\\"," +
+            "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}";
+    }
+
+    /**
+     * @param res Response.
+     * @param success Success flag.
+     * @return Regex pattern for JSON.
+     */
     private String cachePattern(boolean res, boolean success) {
         return "\\{\\\"affinityNodeId\\\":\\\"\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}\\\"\\," +
             "\\\"error\\\":\\\"\\\"\\," +
@@ -208,7 +248,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     public void testGet() throws Exception {
         jcache().put("getKey", "getVal");
 
-        String ret = content(F.asMap("cmd", "get", "key", "getKey"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "getKey"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -221,11 +261,64 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     /**
      * @throws Exception If failed.
      */
+    public void testCacheSize() throws Exception {
+        jcache().removeAll();
+
+        jcache().put("getKey", "getVal");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_SIZE.key()));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        info("Size command result: " + ret);
+
+        jsonEquals(ret, cacheBulkPattern(1, true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIgniteName() throws Exception {
+        String ret = content(F.asMap("cmd", GridRestCommand.NAME.key()));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        info("Name command result: " + ret);
+
+        jsonEquals(ret, stringPattern(getTestGridName(0), true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetOrCreateCache() throws Exception {
+        String ret = content(F.asMap("cmd", GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        info("Name command result: " + ret);
+
+        grid(0).cache("testCache").put("1", "1");
+
+        ret = content(F.asMap("cmd", GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        assertNull(grid(0).cache("testCache"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testGetAll() throws Exception {
         jcache().put("getKey1", "getVal1");
         jcache().put("getKey2", "getVal2");
 
-        String ret = content(F.asMap("cmd", "getall", "k1", "getKey1", "k2", "getKey2"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -235,14 +328,192 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
         jsonEquals(ret,
             // getKey[12] is used since the order is not determined.
             cacheBulkPattern("\\{\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\,\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\}",
-            true));
+                true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIncorrectPut() throws Exception {
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+        jsonEquals(ret, errorPattern("Failed to find mandatory parameter in request: val"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContainsKey() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern(true, true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContainesKeys() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(null).put("key1", "val1");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
+            "k1", "key0", "k2", "key1"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cacheBulkPattern(true, true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetAndPut() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern("val0", true));
+
+        assertEquals("val1", grid(0).cache(null).get("key0"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetAndPutIfAbsent() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
+            "key", "key0", "val", "val1"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern("val0", true));
+
+        assertEquals("val0", grid(0).cache(null).get("key0"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutIfAbsent2() throws Exception {
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
+            "key", "key0", "val", "val1"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern(true, true));
+
+        assertEquals("val1", grid(0).cache(null).get("key0"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRemoveValue() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+            "key", "key0", "val", "val1"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern(false, true));
+
+        assertEquals("val0", grid(0).cache(null).get("key0"));
+
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+            "key", "key0", "val", "val0"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern(true, true));
+
+        assertNull(grid(0).cache(null).get("key0"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetAndRemove() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
+            "key", "key0"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern("val0", true));
+
+        assertNull(grid(0).cache(null).get("key0"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReplaceValue() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+            "key", "key0", "val", "val1", "val2", "val2"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern(false, true));
+
+        assertEquals("val0", grid(0).cache(null).get("key0"));
+
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+            "key", "key0", "val", "val1", "val2", "val0"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern(true, true));
+
+        assertEquals("val1", grid(0).cache(null).get("key0"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetAndReplace() throws Exception {
+        grid(0).cache(null).put("key0", "val0");
+
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
+            "key", "key0", "val", "val1"));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        jsonEquals(ret, cachePattern("val0", true));
+
+        assertEquals("val1", grid(0).cache(null).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPut() throws Exception {
-        String ret = content(F.asMap("cmd", "put", "key", "putKey", "val", "putVal"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
+            "key", "putKey", "val", "putVal"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -258,7 +529,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testPutWithExpiration() throws Exception {
-        String ret = content(F.asMap("cmd", "put", "key", "putKey", "val", "putVal", "exp", "2000"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
+            "key", "putKey", "val", "putVal", "exp", "2000"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -278,7 +550,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     public void testAdd() throws Exception {
         jcache().put("addKey1", "addVal1");
 
-        String ret = content(F.asMap("cmd", "add", "key", "addKey2", "val", "addVal2"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
+            "key", "addKey2", "val", "addVal2"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -293,7 +566,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testAddWithExpiration() throws Exception {
-        String ret = content(F.asMap("cmd", "add", "key", "addKey", "val", "addVal", "exp", "2000"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
+            "key", "addKey", "val", "addVal", "exp", "2000"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -311,7 +585,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testPutAll() throws Exception {
-        String ret = content(F.asMap("cmd", "putall", "k1", "putKey1", "k2", "putKey2",
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_ALL.key(),
+            "k1", "putKey1", "k2", "putKey2",
             "v1", "putVal1", "v2", "putVal2"));
 
         assertNotNull(ret);
@@ -333,7 +608,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals("rmvVal", jcache().localPeek("rmvKey", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "rmv", "key", "rmvKey"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE.key(),
+            "key", "rmvKey"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -359,7 +635,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
         assertEquals("rmvVal3", jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP));
         assertEquals("rmvVal4", jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "rmvall", "k1", "rmvKey1", "k2", "rmvKey2"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key(),
+            "k1", "rmvKey1", "k2", "rmvKey2"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -397,7 +674,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals("casOldVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val2", "casOldVal", "val1", "casNewVal"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+            "key", "casKey", "val2", "casOldVal", "val1", "casNewVal"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -419,7 +697,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals("repOldVal", jcache().localPeek("repKey", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "rep", "key", "repKey", "val", "repVal"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
+            "key", "repKey", "val", "repVal"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -439,7 +718,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals("replaceVal", jcache().get("replaceKey"));
 
-        String ret = content(F.asMap("cmd", "rep", "key", "replaceKey", "val", "replaceValNew", "exp", "2000"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
+            "key", "replaceKey", "val", "replaceValNew", "exp", "2000"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -460,7 +740,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     public void testAppend() throws Exception {
         jcache().put("appendKey", "appendVal");
 
-        String ret = content(F.asMap("cmd", "append", "key", "appendKey", "val", "_suffix"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_APPEND.key(),
+            "key", "appendKey", "val", "_suffix"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -476,7 +757,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     public void testPrepend() throws Exception {
         jcache().put("prependKey", "prependVal");
 
-        String ret = content(F.asMap("cmd", "prepend", "key", "prependKey", "val", "prefix_"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PREPEND.key(),
+            "key", "prependKey", "val", "prefix_"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -490,7 +772,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testIncrement() throws Exception {
-        String ret = content(F.asMap("cmd", "incr", "key", "incrKey", "init", "2", "delta", "3"));
+        String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(),
+            "key", "incrKey", "init", "2", "delta", "3"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -499,7 +782,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get());
 
-        ret = content(F.asMap("cmd", "incr", "key", "incrKey", "delta", "10"));
+        ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -513,7 +796,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testDecrement() throws Exception {
-        String ret = content(F.asMap("cmd", "decr", "key", "decrKey", "init", "15", "delta", "10"));
+        String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
+            "key", "decrKey", "init", "15", "delta", "10"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -522,7 +806,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get());
 
-        ret = content(F.asMap("cmd", "decr", "key", "decrKey", "delta", "3"));
+        ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
+            "key", "decrKey", "delta", "3"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -540,7 +825,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals("casOldVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val2", "casOldVal"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+            "key", "casKey", "val2", "casOldVal"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -558,7 +844,8 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
     public void testPutIfAbsent() throws Exception {
         assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val1", "casNewVal"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+            "key", "casKey", "val1", "casNewVal"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -578,7 +865,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         assertEquals("casVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP));
 
-        String ret = content(F.asMap("cmd", "cas", "key", "casKey"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -594,7 +881,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testMetrics() throws Exception {
-        String ret = content(F.asMap("cmd", "cache"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METRICS.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -608,7 +895,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testTopology() throws Exception {
-        String ret = content(F.asMap("cmd", "top", "attr", "false", "mtr", "false"));
+        String ret = content(F.asMap("cmd", GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -622,7 +909,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testNode() throws Exception {
-        String ret = content(F.asMap("cmd", "node", "attr", "true", "mtr", "true", "id",
+        String ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id",
             grid(0).localNode().id().toString()));
 
         assertNotNull(ret);
@@ -632,7 +919,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         jsonEquals(ret, pattern("\\{.+\\}", true));
 
-        ret = content(F.asMap("cmd", "node", "attr", "false", "mtr", "false", "ip", LOC_HOST));
+        ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -641,7 +928,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         jsonEquals(ret, pattern("\\{.+\\}", true));
 
-        ret = content(F.asMap("cmd", "node", "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
+        ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
             UUID.randomUUID().toString()));
 
         assertNotNull(ret);
@@ -660,7 +947,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
      * @throws Exception If failed.
      */
     public void testExe() throws Exception {
-        String ret = content(F.asMap("cmd", "exe"));
+        String ret = content(F.asMap("cmd", GridRestCommand.EXE.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -670,7 +957,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
         jsonEquals(ret, pattern("null", false));
 
         // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server.
-        ret = content(F.asMap("cmd", "exe", "name", "UNKNOWN_TASK"));
+        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -682,7 +969,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
         grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader());
         grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader());
 
-        ret = content(F.asMap("cmd", "exe", "name", TestTask1.class.getName()));
+        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -691,7 +978,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         jsonEquals(ret, pattern("\\{.+\\}", true));
 
-        ret = content(F.asMap("cmd", "exe", "name", TestTask2.class.getName()));
+        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -700,7 +987,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
 
         jsonEquals(ret, pattern("\\{.+" + TestTask2.RES + ".+\\}", true));
 
-        ret = content(F.asMap("cmd", "res"));
+        ret = content(F.asMap("cmd", GridRestCommand.RESULT.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -722,5 +1009,266 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS
         jsonEquals(ret, stringPattern(".+", true));
     }
 
+    /**
+     * @throws Exception If failed.
+     */
+    public void testQueryArgs() throws Exception {
+        String qry = "salary > ? and salary <= ?";
+
+        Map<String, String> params = new HashMap<>();
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
+        params.put("type", "Person");
+        params.put("psz", "10");
+        params.put("cacheName", "person");
+        params.put("qry", URLEncoder.encode(qry));
+        params.put("arg1", "1000");
+        params.put("arg2", "2000");
+
+        String ret = content(params);
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        JSONObject json = JSONObject.fromObject(ret);
+
+        List items = (List)((Map)json.get("response")).get("items");
+
+        assertEquals(2, items.size());
+
+        assertFalse(queryCursorFound());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testQuery() throws Exception {
+        grid(0).cache(null).put("1", "1");
+        grid(0).cache(null).put("2", "2");
+        grid(0).cache(null).put("3", "3");
+
+        Map<String, String> params = new HashMap<>();
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
+        params.put("type", "String");
+        params.put("psz", "1");
+        params.put("qry", URLEncoder.encode("select * from String"));
+
+        String ret = content(params);
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        JSONObject json = JSONObject.fromObject(ret);
+
+        Integer qryId = (Integer)((Map)json.get("response")).get("queryId");
+
+        assertNotNull(qryId);
+
+        ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+            "psz", "1", "qryId", String.valueOf(qryId)));
+
+        json = JSONObject.fromObject(ret);
+
+        Integer qryId0 = (Integer)((Map)json.get("response")).get("queryId");
+
+        Boolean last = (Boolean)((Map)json.get("response")).get("last");
+
+        assertEquals(qryId0, qryId);
+        assertFalse(last);
+
+        ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+            "psz", "1", "qryId", String.valueOf(qryId)));
+
+        json = JSONObject.fromObject(ret);
+
+        qryId0 = (Integer)((Map)json.get("response")).get("queryId");
+
+        last = (Boolean)((Map)json.get("response")).get("last");
+
+        assertEquals(qryId0, qryId);
+        assertTrue(last);
+
+        assertFalse(queryCursorFound());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSqlFieldsQuery() throws Exception {
+        String qry = "select concat(firstName, ' ', lastName) from Person";
+
+        Map<String, String> params = new HashMap<>();
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
+        params.put("psz", "10");
+        params.put("cacheName", "person");
+        params.put("qry", URLEncoder.encode(qry));
+
+        String ret = content(params);
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        JSONObject json = JSONObject.fromObject(ret);
+
+        List items = (List)((Map)json.get("response")).get("items");
+
+        assertEquals(4, items.size());
+
+        assertFalse(queryCursorFound());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testQueryClose() throws Exception {
+        String qry = "salary > ? and salary <= ?";
+
+        Map<String, String> params = new HashMap<>();
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
+        params.put("type", "Person");
+        params.put("psz", "1");
+        params.put("cacheName", "person");
+        params.put("qry", URLEncoder.encode(qry));
+        params.put("arg1", "1000");
+        params.put("arg2", "2000");
+
+        String ret = content(params);
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        JSONObject json = JSONObject.fromObject(ret);
+
+        List items = (List)((Map)json.get("response")).get("items");
+
+        assertEquals(1, items.size());
+
+        assertTrue(queryCursorFound());
+
+        Integer qryId = (Integer)((Map)json.get("response")).get("queryId");
+
+        assertNotNull(qryId);
+
+        ret = content(F.asMap("cmd", GridRestCommand.CLOSE_SQL_QUERY.key(),
+            "cacheName", "person", "qryId", String.valueOf(qryId)));
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        assertFalse(queryCursorFound());
+    }
+
     protected abstract String signature() throws Exception;
+
+    /**
+     * @return True if any query cursor is available.
+     */
+    private boolean queryCursorFound() {
+        boolean found = false;
+
+        for (int i = 0; i < GRID_CNT; ++i) {
+            Map<GridRestCommand, GridRestCommandHandler> handlers =
+                GridTestUtils.getFieldValue(grid(i).context().rest(), "handlers");
+
+            GridRestCommandHandler qryHnd = handlers.get(GridRestCommand.CLOSE_SQL_QUERY);
+
+            ConcurrentHashMap<Long, Iterator> its = GridTestUtils.getFieldValue(qryHnd, "qryCurs");
+
+            found |= its.size() != 0;
+        }
+
+        return found;
+    }
+
+    /**
+     * Init cache.
+     */
+    private void initCache() {
+        CacheConfiguration<Integer, Person> personCacheCfg = new CacheConfiguration<>("person");
+        personCacheCfg.setIndexedTypes(Integer.class, Person.class);
+
+        IgniteCache<Integer, Person> personCache = grid(0).getOrCreateCache(personCacheCfg);
+
+        personCache.clear();
+
+        Person p1 = new Person("John", "Doe", 2000);
+        Person p2 = new Person("Jane", "Doe", 1000);
+        Person p3 = new Person("John", "Smith", 1000);
+        Person p4 = new Person("Jane", "Smith", 2000);
+
+        personCache.put(p1.getId(), p1);
+        personCache.put(p2.getId(), p2);
+        personCache.put(p3.getId(), p3);
+        personCache.put(p4.getId(), p4);
+
+        SqlQuery<Integer, Person> qry = new SqlQuery<>(Person.class, "salary > ? and salary <= ?");
+
+        qry.setArgs(1000, 2000);
+
+        assertEquals(2, personCache.query(qry).getAll().size());
+    }
+
+    /**
+     * Person class.
+     */
+    public static class Person implements Serializable {
+        /** Person id. */
+        private static int PERSON_ID = 0;
+
+        /** Person ID (indexed). */
+        @QuerySqlField(index = true)
+        private Integer id;
+
+        /** First name (not-indexed). */
+        @QuerySqlField
+        private String firstName;
+
+        /** Last name (not indexed). */
+        @QuerySqlField
+        private String lastName;
+
+        /** Salary (indexed). */
+        @QuerySqlField(index = true)
+        private double salary;
+
+        /**
+         * @param firstName First name.
+         * @param lastName Last name.
+         * @param salary Salary.
+         */
+        Person(String firstName, String lastName, double salary) {
+            id = PERSON_ID++;
+
+            this.firstName = firstName;
+            this.lastName = lastName;
+            this.salary = salary;
+        }
+
+        /**
+         * @return First name.
+         */
+        public String getFirstName() {
+            return firstName;
+        }
+
+        /**
+         * @return Last name.
+         */
+        public String getLastName() {
+            return lastName;
+        }
+        /**
+         * @return Salary.
+         */
+        public double getSalary() {
+
+            return salary;
+        }
+
+        /**
+         * @return Id.
+         */
+        public Integer getId() {
+            return id;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/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 daa9204..2d8e88f 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
@@ -2448,22 +2448,28 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public void destroyCache(String cacheName) {
-        guard();
-
-        IgniteInternalFuture<?> stopFut;
+        IgniteInternalFuture stopFut = destroyCacheAsync(cacheName);
 
         try {
-            stopFut = ctx.cache().dynamicDestroyCache(cacheName);
+            stopFut.get();
         }
-        finally {
-            unguard();
+        catch (IgniteCheckedException e) {
+            throw CU.convertToCacheException(e);
         }
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Ignite future.
+     */
+    public IgniteInternalFuture<?> destroyCacheAsync(String cacheName) {
+        guard();
 
         try {
-            stopFut.get();
+            return ctx.cache().dynamicDestroyCache(cacheName);
         }
-        catch (IgniteCheckedException e) {
-            throw CU.convertToCacheException(e);
+        finally {
+            unguard();
         }
     }
 
@@ -2485,6 +2491,24 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         }
     }
 
+    /**
+     * @param cacheName Cache name.
+     * @return Future that will be completed when cache is deployed.
+     */
+    public IgniteInternalFuture<?> getOrCreateCacheAsync(String cacheName) {
+        guard();
+
+        try {
+            if (ctx.cache().cache(cacheName) == null)
+                return ctx.cache().getOrCreateFromTemplate(cacheName);
+
+            return new GridFinishedFuture<>();
+        }
+        finally {
+            unguard();
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public <K, V> void addCacheConfiguration(CacheConfiguration<K, V> cacheCfg) {
         A.notNull(cacheCfg, "cacheCfg");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 2e5fe8c..94bcc93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -2279,7 +2279,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
      * @return Put future.
      */
     public IgniteInternalFuture<Boolean> putAsync(K key, V val,
-                                                  @Nullable CacheEntryPredicate... filter) {
+        @Nullable CacheEntryPredicate... filter) {
         final boolean statsEnabled = ctx.config().isStatisticsEnabled();
 
         final long start = statsEnabled ? System.nanoTime() : 0L;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
index 62732f0..76a33b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
@@ -33,12 +33,27 @@ public enum GridRestCommand {
     /** Get cached value. */
     CACHE_GET("get"),
 
+    /** Contains cached value. */
+    CACHE_CONTAINS_KEY("conkey"),
+
+    /** Contains cached values. */
+    CACHE_CONTAINS_KEYS("conkeys"),
+
     /** Get several cached values. */
     CACHE_GET_ALL("getall"),
 
+    /** Store value in cache and return previous value. */
+    CACHE_GET_AND_PUT("getput"),
+
+    /** Store value in cache and return previous value. */
+    CACHE_GET_AND_PUT_IF_ABSENT("getputifabs"),
+
     /** Store value in cache. */
     CACHE_PUT("put"),
 
+    /** Store value in cache. */
+    CACHE_PUT_IF_ABSENT("putifabs"),
+
     /** Store value in cache if it doesn't exist. */
     CACHE_ADD("add"),
 
@@ -48,12 +63,24 @@ public enum GridRestCommand {
     /** Remove value from cache. */
     CACHE_REMOVE("rmv"),
 
+    /** Remove value from cache. */
+    CACHE_REMOVE_VALUE("rmvval"),
+
+    /** Remove value from cache. */
+    CACHE_GET_AND_REMOVE("getrmv"),
+
     /** Remove several values from cache. */
     CACHE_REMOVE_ALL("rmvall"),
 
     /** Replace cache value only if there is currently a mapping for it. */
     CACHE_REPLACE("rep"),
 
+    /** Replace cache value only if there is currently a mapping for it. */
+    CACHE_REPLACE_VALUE("repval"),
+
+    /** Replace cache value only if there is currently a mapping for it. */
+    CACHE_GET_AND_REPLACE("getrep"),
+
     /** Compare and set. */
     CACHE_CAS("cas"),
 
@@ -66,6 +93,9 @@ public enum GridRestCommand {
     /** Cache metrics. */
     CACHE_METRICS("cache"),
 
+    /** Cache size. */
+    CACHE_SIZE("size"),
+
     /** Increment. */
     ATOMIC_INCREMENT("incr"),
 
@@ -87,6 +117,9 @@ public enum GridRestCommand {
     /** Version. */
     VERSION("version"),
 
+    /** Name. */
+    NAME("name"),
+
     /** Log. */
     LOG("log"),
 
@@ -94,7 +127,25 @@ public enum GridRestCommand {
     NOOP("noop"),
 
     /** Quit. */
-    QUIT("quit");
+    QUIT("quit"),
+
+    /** Get or create cache. */
+    GET_OR_CREATE_CACHE("getorcreate"),
+
+    /** Stops dynamically started cache. */
+    DESTROY_CACHE("destcache"),
+
+    /** Execute sql query. */
+    EXECUTE_SQL_QUERY("qryexe"),
+
+    /** Execute sql fields query. */
+    EXECUTE_SQL_FIELDS_QUERY("qryfldexe"),
+
+    /** Fetch query results. */
+    FETCH_SQL_QUERY("qryfetch"),
+
+    /** Close query. */
+    CLOSE_SQL_QUERY("qrycls");
 
     /** Enum values. */
     private static final GridRestCommand[] VALS = values();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 2d1d802..bb796d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.rest.client.message.*;
 import org.apache.ignite.internal.processors.rest.handlers.*;
 import org.apache.ignite.internal.processors.rest.handlers.cache.*;
 import org.apache.ignite.internal.processors.rest.handlers.datastructures.*;
+import org.apache.ignite.internal.processors.rest.handlers.query.*;
 import org.apache.ignite.internal.processors.rest.handlers.task.*;
 import org.apache.ignite.internal.processors.rest.handlers.top.*;
 import org.apache.ignite.internal.processors.rest.handlers.version.*;
@@ -254,6 +255,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
             addHandler(new GridTopologyCommandHandler(ctx));
             addHandler(new GridVersionCommandHandler(ctx));
             addHandler(new DataStructuresCommandHandler(ctx));
+            addHandler(new QueryCommandHandler(ctx));
 
             // Start protocols.
             startTcpProtocol();
@@ -384,6 +386,8 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
         if (interceptor != null && res.getResponse() != null) {
             switch (req.command()) {
+                case CACHE_CONTAINS_KEYS:
+                case CACHE_CONTAINS_KEY:
                 case CACHE_GET:
                 case CACHE_GET_ALL:
                 case CACHE_PUT:
@@ -527,12 +531,23 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
         switch (req.command()) {
             case CACHE_GET:
+            case CACHE_CONTAINS_KEY:
+            case CACHE_CONTAINS_KEYS:
             case CACHE_GET_ALL:
                 perm = SecurityPermission.CACHE_READ;
                 name = ((GridRestCacheRequest)req).cacheName();
 
                 break;
 
+            case EXECUTE_SQL_QUERY:
+            case EXECUTE_SQL_FIELDS_QUERY:
+            case CLOSE_SQL_QUERY:
+            case FETCH_SQL_QUERY:
+                perm = SecurityPermission.CACHE_READ;
+                name = ((RestSqlQueryRequest)req).cacheName();
+
+                break;
+
             case CACHE_PUT:
             case CACHE_ADD:
             case CACHE_PUT_ALL:
@@ -540,6 +555,11 @@ public class GridRestProcessor extends GridProcessorAdapter {
             case CACHE_CAS:
             case CACHE_APPEND:
             case CACHE_PREPEND:
+            case CACHE_GET_AND_PUT:
+            case CACHE_GET_AND_REPLACE:
+            case CACHE_GET_AND_PUT_IF_ABSENT:
+            case CACHE_PUT_IF_ABSENT:
+            case CACHE_REPLACE_VALUE:
                 perm = SecurityPermission.CACHE_PUT;
                 name = ((GridRestCacheRequest)req).cacheName();
 
@@ -547,6 +567,8 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
             case CACHE_REMOVE:
             case CACHE_REMOVE_ALL:
+            case CACHE_GET_AND_REMOVE:
+            case CACHE_REMOVE_VALUE:
                 perm = SecurityPermission.CACHE_REMOVE;
                 name = ((GridRestCacheRequest)req).cacheName();
 
@@ -559,7 +581,15 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
                 break;
 
+            case GET_OR_CREATE_CACHE:
+            case DESTROY_CACHE:
+                perm = SecurityPermission.ADMIN_CACHE;
+                name = ((GridRestCacheRequest)req).cacheName();
+
+                break;
+
             case CACHE_METRICS:
+            case CACHE_SIZE:
             case TOPOLOGY:
             case NODE:
             case VERSION:
@@ -567,6 +597,8 @@ public class GridRestProcessor extends GridProcessorAdapter {
             case QUIT:
             case ATOMIC_INCREMENT:
             case ATOMIC_DECREMENT:
+            case NAME:
+            case LOG:
                 break;
 
             default:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index 1f24023..64f595d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -53,26 +53,46 @@ import static org.apache.ignite.transactions.TransactionIsolation.*;
 public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
     /** Supported commands. */
     private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(
+        DESTROY_CACHE,
+        GET_OR_CREATE_CACHE,
+        CACHE_CONTAINS_KEYS,
+        CACHE_CONTAINS_KEY,
         CACHE_GET,
+        CACHE_GET_AND_PUT,
+        CACHE_GET_AND_REPLACE,
+        CACHE_GET_AND_PUT_IF_ABSENT,
+        CACHE_PUT_IF_ABSENT,
         CACHE_GET_ALL,
         CACHE_PUT,
         CACHE_ADD,
         CACHE_PUT_ALL,
         CACHE_REMOVE,
+        CACHE_REMOVE_VALUE,
+        CACHE_REPLACE_VALUE,
+        CACHE_GET_AND_REMOVE,
         CACHE_REMOVE_ALL,
         CACHE_REPLACE,
         CACHE_CAS,
         CACHE_APPEND,
         CACHE_PREPEND,
-        CACHE_METRICS
+        CACHE_METRICS,
+        CACHE_SIZE
     );
 
     /** Requests with required parameter {@code key}. */
     private static final EnumSet<GridRestCommand> KEY_REQUIRED_REQUESTS = EnumSet.of(
+        CACHE_CONTAINS_KEY,
         CACHE_GET,
+        CACHE_GET_AND_PUT,
+        CACHE_GET_AND_REPLACE,
+        CACHE_GET_AND_PUT_IF_ABSENT,
+        CACHE_PUT_IF_ABSENT,
         CACHE_PUT,
         CACHE_ADD,
         CACHE_REMOVE,
+        CACHE_REMOVE_VALUE,
+        CACHE_REPLACE_VALUE,
+        CACHE_GET_AND_REMOVE,
         CACHE_REPLACE,
         ATOMIC_INCREMENT,
         ATOMIC_DECREMENT,
@@ -137,6 +157,44 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
             IgniteInternalFuture<GridRestResponse> fut;
 
             switch (cmd) {
+                case DESTROY_CACHE: {
+                    fut = ((IgniteKernal)ctx.grid()).destroyCacheAsync(cacheName).chain(
+                        new CX1<IgniteInternalFuture<?>, GridRestResponse>() {
+                            @Override public GridRestResponse applyx(IgniteInternalFuture<?> f)
+                                throws IgniteCheckedException {
+                                return new GridRestResponse(f.get());
+                            }
+                        });
+
+                    break;
+                }
+
+                case GET_OR_CREATE_CACHE: {
+                    fut = ((IgniteKernal)ctx.grid()).getOrCreateCacheAsync(cacheName).chain(
+                        new CX1<IgniteInternalFuture<?>, GridRestResponse>() {
+                            @Override public GridRestResponse applyx(IgniteInternalFuture<?> f)
+                                throws IgniteCheckedException {
+                                return new GridRestResponse(f.get());
+                            }
+                        });
+
+                    break;
+                }
+
+                case CACHE_CONTAINS_KEYS: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new ContainsKeysCommand(getKeys(req0)));
+
+                    break;
+                }
+
+                case CACHE_CONTAINS_KEY: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new ContainsKeyCommand(key));
+
+                    break;
+                }
+
                 case CACHE_GET: {
                     fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
                         new GetCommand(key));
@@ -144,48 +202,51 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
                     break;
                 }
 
-                case CACHE_GET_ALL: {
-                    Set<Object> keys = req0.values().keySet();
+                case CACHE_GET_AND_PUT: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new GetAndPutCommand(key, getValue(req0)));
 
-                    if (F.isEmpty(keys))
-                        throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("keys"));
+                    break;
+                }
 
-                    // HashSet wrapping for correct serialization
-                    HashSet<Object> keys0 = new HashSet<>();
+                case CACHE_GET_AND_REPLACE: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new GetAndReplaceCommand(key, getValue(req0)));
 
-                    for (Object getKey : keys) {
-                        if (getKey == null)
-                            throw new IgniteCheckedException("Failing getAll operation (null keys are not allowed).");
+                    break;
+                }
 
-                        keys0.add(getKey);
-                    }
+                case CACHE_GET_AND_PUT_IF_ABSENT: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new GetAndPutIfAbsentCommand(key, getValue(req0)));
+
+                    break;
+                }
 
+                case CACHE_PUT_IF_ABSENT: {
                     fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
-                        new GetAllCommand(keys0));
+                        new PutIfAbsentCommand(key, getValue(req0)));
 
                     break;
                 }
 
-                case CACHE_PUT: {
-                    final Object val = req0.value();
+                case CACHE_GET_ALL: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new GetAllCommand(getKeys(req0)));
 
-                    if (val == null)
-                        throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val"));
+                    break;
+                }
 
+                case CACHE_PUT: {
                     fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key, new
-                        PutCommand(key, ttl, val));
+                        PutCommand(key, ttl, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_ADD: {
-                    final Object val = req0.value();
-
-                    if (val == null)
-                        throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val"));
-
                     fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
-                        new AddCommand(key, ttl, val));
+                        new AddCommand(key, ttl, getValue(req0)));
 
                     break;
                 }
@@ -220,6 +281,27 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
                     break;
                 }
 
+                case CACHE_REMOVE_VALUE: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new RemoveValueCommand(key, getValue(req0)));
+
+                    break;
+                }
+
+                case CACHE_REPLACE_VALUE: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new ReplaceValueCommand(key, getValue(req0), req0.value2()));
+
+                    break;
+                }
+
+                case CACHE_GET_AND_REMOVE: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key,
+                        new GetAndRemoveCommand(key));
+
+                    break;
+                }
+
                 case CACHE_REMOVE_ALL: {
                     Map<Object, Object> map = req0.values();
 
@@ -274,6 +356,12 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
                     break;
                 }
 
+                case CACHE_SIZE: {
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName, key, new SizeCommand());
+
+                    break;
+                }
+
                 default:
                     throw new IllegalArgumentException("Invalid command for cache handler: " + req);
             }
@@ -297,6 +385,44 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
     }
 
     /**
+     * @param req Request.
+     * @return Request keys.
+     * @throws IgniteCheckedException If incorrect keys are presented.
+     */
+    private Set<Object> getKeys(GridRestCacheRequest req) throws IgniteCheckedException {
+        Set<Object> keys = req.values().keySet();
+
+        if (F.isEmpty(keys))
+            throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("keys"));
+
+        // HashSet wrapping for correct serialization
+        HashSet<Object> keys0 = new HashSet<>();
+
+        for (Object getKey : keys) {
+            if (getKey == null)
+                throw new IgniteCheckedException("Failing operation (null keys are not allowed).");
+
+            keys0.add(getKey);
+        }
+
+        return keys0;
+    }
+
+    /**
+     * @param req Request.
+     * @return Request value.
+     * @throws IgniteCheckedException If incorrect keys are presented.
+     */
+    private Object getValue(GridRestCacheRequest req) throws IgniteCheckedException {
+        final Object val = req.value();
+
+        if (val == null)
+            throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val"));
+
+        return val;
+    }
+
+    /**
      * Executes command on flagged cache projection. Checks {@code destId} to find
      * if command could be performed locally or routed to a remote node.
      *
@@ -702,6 +828,48 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
     }
 
     /** */
+    private static class ContainsKeyCommand extends CacheProjectionCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private final Object key;
+
+        /**
+         * @param key Key.
+         */
+        ContainsKeyCommand(Object key) {
+            this.key = key;
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.containsKeyAsync(key);
+        }
+    }
+
+    /** */
+    private static class ContainsKeysCommand extends CacheProjectionCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private final Collection<Object> keys;
+
+        /**
+         * @param keys Keys.
+         */
+        ContainsKeysCommand(Collection<Object> keys) {
+            this.keys = keys;
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.containsKeysAsync(keys);
+        }
+    }
+
+    /** */
     private static class GetCommand extends CacheProjectionCommand {
         /** */
         private static final long serialVersionUID = 0L;
@@ -723,6 +891,113 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
     }
 
     /** */
+    private static class GetAndPutCommand extends CacheProjectionCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Key. */
+        protected final Object key;
+
+        /** Value.*/
+        protected final Object val;
+
+        /**
+         * @param key Key.
+         * @param val Value.
+         */
+        GetAndPutCommand(Object key, Object val) {
+            this.key = key;
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.getAndPutAsync(key, val);
+        }
+    }
+
+    /** */
+    private static class GetAndReplaceCommand extends GetAndPutCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param key Key.
+         * @param val Value.
+         */
+        GetAndReplaceCommand(Object key, Object val) {
+            super(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.getAndReplaceAsync(key, val);
+        }
+    }
+
+    /** */
+    private static class ReplaceValueCommand extends GetAndReplaceCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private final Object oldVal;
+
+        /**
+         * @param key Key.
+         * @param val Value.
+         * @param oldVal Old value.
+         */
+        ReplaceValueCommand(Object key, Object val, Object oldVal) {
+            super(key, val);
+            this.oldVal = oldVal;
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.replaceAsync(key, oldVal, val);
+        }
+    }
+
+    /** */
+    private static class GetAndPutIfAbsentCommand extends GetAndPutCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param key Key.
+         * @param val Value.
+         */
+        GetAndPutIfAbsentCommand(Object key, Object val) {
+            super(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.getAndPutIfAbsentAsync(key, val);
+        }
+    }
+
+    /** */
+    private static class PutIfAbsentCommand extends GetAndPutCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param key Key.
+         * @param val Value.
+         */
+        PutIfAbsentCommand(Object key, Object val) {
+            super(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.putIfAbsentAsync(key, val);
+        }
+    }
+
+    /** */
     private static class GetAllCommand extends CacheProjectionCommand {
         /** */
         private static final long serialVersionUID = 0L;
@@ -770,7 +1045,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
         private static final long serialVersionUID = 0L;
 
         /** */
-        private final Object key;
+        protected final Object key;
 
         /**
          * @param key Key.
@@ -786,6 +1061,43 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
     }
 
     /** */
+    private static class RemoveValueCommand extends GetAndPutCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param key Key.
+         * @param val Value.
+         */
+        RemoveValueCommand(Object key, Object val) {
+            super(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.removeAsync(key, val);
+        }
+    }
+
+    /** */
+    private static class GetAndRemoveCommand extends RemoveCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param key Key.
+         */
+        GetAndRemoveCommand(Object key) {
+            super(key);
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.getAndRemoveAsync(key);
+        }
+    }
+
+    /** */
     private static class RemoveAllCommand extends CacheProjectionCommand {
         /** */
         private static final long serialVersionUID = 0L;
@@ -1025,4 +1337,15 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
             );
         }
     }
+
+    /** */
+    private static class SizeCommand extends CacheCommand {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** {@inheritDoc} */
+        @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
+            return c.sizeAsync(new CachePeekMode[]{CachePeekMode.PRIMARY});
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
new file mode 100644
index 0000000..3e49576
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.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.processors.rest.handlers.query;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Client query result.
+ */
+public class CacheQueryResult implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Query ID. */
+    private long qryId;
+
+    /** Result items. */
+    private Collection<?> items;
+
+    /** Last flag. */
+    private boolean last;
+
+    /**
+     * @return Query ID.
+     */
+    public long getQueryId() {
+        return qryId;
+    }
+
+    /**
+     * @param qryId Query ID.
+     */
+    public void setQueryId(long qryId) {
+        this.qryId = qryId;
+    }
+
+    /**
+     * @return Items.
+     */
+    public Collection<?> getItems() {
+        return items;
+    }
+
+    /**
+     * @param items Items.
+     */
+    public void setItems(Collection<?> items) {
+        this.items = items;
+    }
+
+    /**
+     * @return Last flag.
+     */
+    public boolean getLast() {
+        return last;
+    }
+
+    /**
+     * @param last Last flag.
+     */
+    public void setLast(boolean last) {
+        this.last = last;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheQueryResult.class, this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeBoolean(last);
+        out.writeLong(qryId);
+        U.writeCollection(out, items);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        last = in.readBoolean();
+        qryId = in.readLong();
+        items = U.readCollection(in);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
new file mode 100644
index 0000000..defca37
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.rest.handlers.query;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.rest.*;
+import org.apache.ignite.internal.processors.rest.handlers.*;
+import org.apache.ignite.internal.processors.rest.request.*;
+import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.internal.processors.rest.GridRestCommand.*;
+
+/**
+ * Query command handler.
+ */
+public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
+    /** Supported commands. */
+    private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(EXECUTE_SQL_QUERY,
+        EXECUTE_SQL_FIELDS_QUERY,
+        FETCH_SQL_QUERY,
+        CLOSE_SQL_QUERY);
+
+    /** Query ID sequence. */
+    private static final AtomicLong qryIdGen = new AtomicLong();
+
+    /** Current queries cursors. */
+    private final ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs = new ConcurrentHashMap<>();
+
+    /**
+     * @param ctx Context.
+     */
+    public QueryCommandHandler(GridKernalContext ctx) {
+        super(ctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<GridRestCommand> supportedCommands() {
+        return SUPPORTED_COMMANDS;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest req) {
+        assert req != null;
+
+        assert SUPPORTED_COMMANDS.contains(req.command());
+        assert req instanceof RestSqlQueryRequest : "Invalid type of query request.";
+
+        switch (req.command()) {
+            case EXECUTE_SQL_QUERY:
+            case EXECUTE_SQL_FIELDS_QUERY: {
+                return ctx.closure().callLocalSafe(
+                    new ExecuteQueryCallable(ctx, (RestSqlQueryRequest)req, qryCurs), false);
+            }
+
+            case FETCH_SQL_QUERY: {
+                return ctx.closure().callLocalSafe(
+                    new FetchQueryCallable((RestSqlQueryRequest)req, qryCurs), false);
+            }
+
+            case CLOSE_SQL_QUERY: {
+                return ctx.closure().callLocalSafe(
+                    new CloseQueryCallable((RestSqlQueryRequest)req, qryCurs), false);
+            }
+        }
+
+        return new GridFinishedFuture<>();
+    }
+
+    /**
+     * Execute query callable.
+     */
+    private static class ExecuteQueryCallable implements Callable<GridRestResponse> {
+        /** Kernal context. */
+        private GridKernalContext ctx;
+
+        /** Execute query request. */
+        private RestSqlQueryRequest req;
+
+        /** Queries cursors. */
+        private ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs;
+
+        /**
+         * @param ctx Kernal context.
+         * @param req Execute query request.
+         * @param qryCurs Queries cursors.
+         */
+        public ExecuteQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req,
+            ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs) {
+            this.ctx = ctx;
+            this.req = req;
+            this.qryCurs = qryCurs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridRestResponse call() throws Exception {
+            long qryId = qryIdGen.getAndIncrement();
+
+            try {
+                Query qry;
+
+                if (req.typeName() != null) {
+                    qry = new SqlQuery(req.typeName(), req.sqlQuery());
+
+                    ((SqlQuery)qry).setArgs(req.arguments());
+                }
+                else {
+                    qry = new SqlFieldsQuery(req.sqlQuery());
+
+                    ((SqlFieldsQuery)qry).setArgs(req.arguments());
+                }
+
+                IgniteCache<Object, Object> cache = ctx.grid().cache(req.cacheName());
+
+                if (cache == null)
+                    return new GridRestResponse(GridRestResponse.STATUS_FAILED,
+                        "No cache with name [cacheName=" + req.cacheName() + "]");
+
+                QueryCursor qryCur = cache.query(qry);
+
+                Iterator cur = qryCur.iterator();
+
+                qryCurs.put(qryId, new IgniteBiTuple<>(qryCur, cur));
+
+                CacheQueryResult res = createQueryResult(qryCurs, cur, req, qryId);
+
+                return new GridRestResponse(res);
+            }
+            catch (Exception e) {
+                qryCurs.remove(qryId);
+
+                return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
+            }
+        }
+    }
+
+    /**
+     * Close query callable.
+     */
+    private static class CloseQueryCallable implements Callable<GridRestResponse> {
+        /** Execute query request. */
+        private RestSqlQueryRequest req;
+
+        /** Queries cursors. */
+        private final ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs;
+
+        /**
+         * @param req Execute query request.
+         * @param qryCurs Queries cursors.
+         */
+        public CloseQueryCallable(RestSqlQueryRequest req,
+            ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs) {
+            this.req = req;
+            this.qryCurs = qryCurs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridRestResponse call() throws Exception {
+            try {
+                QueryCursor cur = qryCurs.get(req.queryId()).get1();
+
+                if (cur == null)
+                    return new GridRestResponse(GridRestResponse.STATUS_FAILED,
+                        "Cannot find query [qryId=" + req.queryId() + "]");
+
+                cur.close();
+
+                qryCurs.remove(req.queryId());
+
+                return new GridRestResponse(true);
+            }
+            catch (Exception e) {
+                qryCurs.remove(req.queryId());
+
+                return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
+            }
+        }
+    }
+
+    /**
+     * Fetch query callable.
+     */
+    private static class FetchQueryCallable implements Callable<GridRestResponse> {
+        /** Execute query request. */
+        private RestSqlQueryRequest req;
+
+        /** Queries cursors. */
+        private final ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs;
+
+        /**
+         * @param req Execute query request.
+         * @param qryCurs Queries cursors.
+         */
+        public FetchQueryCallable(RestSqlQueryRequest req,
+            ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs) {
+            this.req = req;
+            this.qryCurs = qryCurs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridRestResponse call() throws Exception {
+            try {
+                Iterator cur = qryCurs.get(req.queryId()).get2();
+
+                if (cur == null)
+                    return new GridRestResponse(GridRestResponse.STATUS_FAILED,
+                        "Cannot find query [qryId=" + req.queryId() + "]");
+
+                CacheQueryResult res = createQueryResult(qryCurs, cur, req, req.queryId());
+
+                return new GridRestResponse(res);
+            }
+            catch (Exception e) {
+                qryCurs.remove(req.queryId());
+
+                return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
+            }
+        }
+    }
+
+    /**
+     * @param qryCurs Query cursors.
+     * @param cur Current cursor.
+     * @param req Sql request.
+     * @param qryId Query id.
+     * @return Query result with items.
+     */
+    private static CacheQueryResult createQueryResult(
+        ConcurrentHashMap<Long, IgniteBiTuple<QueryCursor, Iterator>> qryCurs,
+        Iterator cur, RestSqlQueryRequest req, Long qryId) {
+        CacheQueryResult res = new CacheQueryResult();
+
+        List<Object> items = new ArrayList<>();
+
+        for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i)
+            items.add(cur.next());
+
+        res.setItems(items);
+
+        res.setLast(!cur.hasNext());
+
+        res.setQueryId(qryId);
+
+        if (!cur.hasNext())
+            qryCurs.remove(qryId);
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java
index 2bfb704..bf09d30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java
@@ -30,11 +30,11 @@ import static org.apache.ignite.internal.IgniteVersionUtils.*;
 import static org.apache.ignite.internal.processors.rest.GridRestCommand.*;
 
 /**
- * Handler for {@link GridRestCommand#VERSION} command.
+ * Handler for {@link GridRestCommand#VERSION} and {@link GridRestCommand#NAME} command.
  */
 public class GridVersionCommandHandler extends GridRestCommandHandlerAdapter {
     /** Supported commands. */
-    private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(VERSION);
+    private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(VERSION, NAME);
 
     /**
      * @param ctx Context.
@@ -54,6 +54,14 @@ public class GridVersionCommandHandler extends GridRestCommandHandlerAdapter {
 
         assert SUPPORTED_COMMANDS.contains(req.command());
 
-        return new GridFinishedFuture<>(new GridRestResponse(VER_STR));
+        switch (req.command()){
+            case VERSION:
+                return new GridFinishedFuture<>(new GridRestResponse(VER_STR));
+
+            case NAME:
+                return new GridFinishedFuture<>(new GridRestResponse(ctx.gridName()));
+        }
+
+        return new GridFinishedFuture<>();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
new file mode 100644
index 0000000..5ba3a50
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.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.processors.rest.request;
+
+/**
+ * Sql query request.
+ */
+public class RestSqlQueryRequest extends GridRestRequest {
+    /** Sql query. */
+    private String sqlQry;
+
+    /** Sql query arguments. */
+    private Object[] args;
+
+    /** Page size. */
+    private Integer pageSize;
+
+    /** Cache name. */
+    private String cacheName;
+
+    /** Query id. */
+    private Long qryId;
+
+    /** Query type name. */
+    private String typeName;
+
+    /**
+     * @param sqlQry Sql query.
+     */
+    public void sqlQuery(String sqlQry) {
+        this.sqlQry = sqlQry;
+    }
+
+    /**
+     * @return Sql query.
+     */
+    public String sqlQuery() {
+        return sqlQry;
+    }
+
+    /**
+     * @param args Sql query arguments.
+     */
+    public void arguments(Object[] args) {
+        this.args = args;
+    }
+
+    /**
+     * @return Sql query arguments.
+     */
+    public Object[] arguments() {
+        return args;
+    }
+
+    /**
+     * @param pageSize Page size.
+     */
+    public void pageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    /**
+     * @return Page size.
+     */
+    public int pageSize() {
+        return pageSize;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     */
+    public void cacheName(String cacheName) {
+        this.cacheName = cacheName;
+    }
+
+    /**
+     * @return Cache name.
+     */
+    public String cacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @param id Query id.
+     */
+    public void queryId(Long id) {
+        this.qryId = id;
+    }
+
+    /**
+     * @return Query id.
+     */
+    public Long queryId() {
+        return qryId;
+    }
+
+    /**
+     * @param typeName Query type name.
+     */
+    public void typeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    /**
+     * @return Query type name.
+     */
+    public String typeName() {
+        return typeName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9bfc1842/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index fac9818..bf0f2c8 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -323,11 +323,21 @@ public class GridJettyRestHandler extends AbstractHandler {
      * @throws IgniteCheckedException If creation failed.
      */
     @Nullable private GridRestRequest createRequest(GridRestCommand cmd,
-        Map<String, Object> params,
-        ServletRequest req) throws IgniteCheckedException {
+        Map<String, Object> params, HttpServletRequest req) throws IgniteCheckedException {
         GridRestRequest restReq;
 
         switch (cmd) {
+            case GET_OR_CREATE_CACHE:
+            case DESTROY_CACHE: {
+                GridRestCacheRequest restReq0 = new GridRestCacheRequest();
+
+                restReq0.cacheName((String)params.get("cacheName"));
+
+                restReq = restReq0;
+
+                break;
+            }
+
             case ATOMIC_DECREMENT:
             case ATOMIC_INCREMENT: {
                 DataStructuresRequest restReq0 = new DataStructuresRequest();
@@ -341,15 +351,25 @@ public class GridJettyRestHandler extends AbstractHandler {
                 break;
             }
 
+            case CACHE_CONTAINS_KEY:
+            case CACHE_CONTAINS_KEYS:
             case CACHE_GET:
             case CACHE_GET_ALL:
+            case CACHE_GET_AND_PUT:
+            case CACHE_GET_AND_REPLACE:
+            case CACHE_PUT_IF_ABSENT:
+            case CACHE_GET_AND_PUT_IF_ABSENT:
             case CACHE_PUT:
             case CACHE_PUT_ALL:
             case CACHE_REMOVE:
+            case CACHE_REMOVE_VALUE:
+            case CACHE_REPLACE_VALUE:
+            case CACHE_GET_AND_REMOVE:
             case CACHE_REMOVE_ALL:
             case CACHE_ADD:
             case CACHE_CAS:
             case CACHE_METRICS:
+            case CACHE_SIZE:
             case CACHE_REPLACE:
             case CACHE_APPEND:
             case CACHE_PREPEND: {
@@ -370,7 +390,8 @@ public class GridJettyRestHandler extends AbstractHandler {
                 restReq0.cacheFlags(intValue("cacheFlags", params, 0));
                 restReq0.ttl(longValue("exp", params, null));
 
-                if (cmd == CACHE_GET_ALL || cmd == CACHE_PUT_ALL || cmd == CACHE_REMOVE_ALL) {
+                if (cmd == CACHE_GET_ALL || cmd == CACHE_PUT_ALL || cmd == CACHE_REMOVE_ALL ||
+                    cmd == CACHE_CONTAINS_KEYS) {
                     List<Object> keys = values("k", params);
                     List<Object> vals = values("v", params);
 
@@ -441,12 +462,70 @@ public class GridJettyRestHandler extends AbstractHandler {
                 break;
             }
 
+            case NAME:
             case VERSION: {
                 restReq = new GridRestRequest();
 
                 break;
             }
 
+            case EXECUTE_SQL_QUERY:
+            case EXECUTE_SQL_FIELDS_QUERY: {
+                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+
+                restReq0.sqlQuery((String) params.get("qry"));
+
+                restReq0.arguments(values("arg", params).toArray());
+
+                restReq0.typeName((String) params.get("type"));
+
+                String psz = (String) params.get("psz");
+
+                if (psz != null)
+                    restReq0.pageSize(Integer.parseInt(psz));
+
+                restReq0.cacheName((String)params.get("cacheName"));
+
+                restReq = restReq0;
+
+                break;
+            }
+
+            case FETCH_SQL_QUERY: {
+                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+
+                String qryId = (String) params.get("qryId");
+
+                if (qryId != null)
+                    restReq0.queryId(Long.parseLong(qryId));
+
+                String psz = (String) params.get("psz");
+
+                if (psz != null)
+                    restReq0.pageSize(Integer.parseInt(psz));
+
+                restReq0.cacheName((String)params.get("cacheName"));
+
+                restReq = restReq0;
+
+                break;
+            }
+
+            case CLOSE_SQL_QUERY: {
+                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+
+                String qryId = (String) params.get("qryId");
+
+                if (qryId != null)
+                    restReq0.queryId(Long.parseLong(qryId));
+
+                restReq0.cacheName((String)params.get("cacheName"));
+
+                restReq = restReq0;
+
+                break;
+            }
+
             default:
                 throw new IgniteCheckedException("Invalid command: " + cmd);
         }



[33/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 49bf1e26706f7b5451c7b40ec5f9059bfd00d016
Parents: f58d813 ce7ab19
Author: Andrey <an...@gridgain.com>
Authored: Tue Jul 28 10:56:53 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Tue Jul 28 10:56:53 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |   1 +
 .../src/main/js/controllers/common-module.js    |   5 +-
 .../main/js/controllers/metadata-controller.js  |  63 +++++-----
 .../main/js/controllers/models/metadata.json    |   4 +-
 modules/web-control-center/src/main/js/db.js    |  20 +++-
 .../web-control-center/src/main/js/package.json |   1 +
 .../src/main/js/routes/generator/common.js      |  16 +++
 .../src/main/js/routes/generator/xml.js         | 114 +++++++++++++++++--
 .../src/main/js/routes/summary.js               |   2 +-
 .../src/main/js/views/configuration/caches.jade |   2 +-
 .../main/js/views/configuration/clusters.jade   |   2 +-
 .../main/js/views/configuration/metadata.jade   |   8 +-
 .../main/js/views/configuration/summary.jade    |  27 +++--
 .../src/main/js/views/includes/controls.jade    |  44 ++++---
 .../src/main/js/views/login.jade                |   4 +-
 .../src/main/js/views/settings/admin.jade       |   2 +-
 .../src/main/js/views/settings/profile.jade     |   2 +-
 .../src/main/js/views/sql/sql.jade              |   2 +-
 .../src/main/js/views/templates/confirm.jade    |   6 +-
 .../src/main/js/views/templates/copy.jade       |   8 +-
 .../src/main/js/views/templates/tab.jade        |   2 +-
 21 files changed, 237 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/49bf1e26/modules/web-control-center/src/main/js/package.json
----------------------------------------------------------------------


[46/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121

Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 6ecf62636f60d54b1143d27b715afa2b20de9278
Parents: 6b62175 1ff248c
Author: Andrey <an...@gridgain.com>
Authored: Fri Jul 31 08:50:55 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri Jul 31 08:50:55 2015 +0700

----------------------------------------------------------------------
 modules/control-center-agent/src/bin/agent.bat | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------



[22/50] [abbrv] incubator-ignite git commit: #ignite-961: add metadata test

Posted by an...@apache.org.
#ignite-961:  add metadata test


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

Branch: refs/heads/ignite-843
Commit: 9289dab01be73abba37a308015ed0e91f923464f
Parents: a0f4af9
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 12:43:03 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 12:43:03 2015 +0300

----------------------------------------------------------------------
 .../processors/rest/JettyRestProcessorAbstractSelfTest.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9289dab0/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 c6363be..5f3d15e 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
@@ -1421,6 +1421,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals(2, meta.size());
 
+        JSONObject o = (JSONObject)meta.get(0);
+
+        assertEquals("FIRSTNAME", o.get("fieldName"));
+        assertEquals("java.lang.String", o.get("fieldTypeName"));
+        assertEquals("person", o.get("schemaName"));
+        assertEquals("PERSON", o.get("typeName"));
 
         assertFalse(queryCursorFound());
     }


[39/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: f621c3ef7d7569aa1c9e4a2109c05aafb0bd6cf0
Parents: 301ac42 2e4daaa
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 29 08:50:20 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 29 08:50:20 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |  1 +
 .../main/js/controllers/clusters-controller.js  |  1 +
 .../src/main/js/controllers/common-module.js    | 59 ++++++++++++
 .../main/js/controllers/metadata-controller.js  |  5 +-
 .../src/main/js/controllers/models/caches.json  |  7 +-
 .../main/js/controllers/models/clusters.json    | 20 ++--
 .../main/js/controllers/models/metadata.json    | 14 ++-
 modules/web-control-center/src/main/js/db.js    |  2 +-
 .../src/main/js/routes/generator/common.js      | 11 ++-
 .../src/main/js/routes/generator/xml.js         | 93 +++++++++++++------
 .../src/main/js/views/configuration/caches.jade |  4 +-
 .../main/js/views/configuration/clusters.jade   |  4 +-
 .../main/js/views/configuration/metadata.jade   |  4 +-
 .../main/js/views/configuration/summary.jade    |  2 +-
 .../src/main/js/views/includes/controls.jade    | 96 ++++++++++----------
 .../src/main/js/views/login.jade                | 14 +--
 .../src/main/js/views/settings/profile.jade     |  4 +-
 .../src/main/js/views/templates/layout.jade     |  2 +-
 .../src/main/js/views/templates/select.jade     |  8 +-
 .../src/main/js/views/templates/tab.jade        |  8 +-
 20 files changed, 237 insertions(+), 122 deletions(-)
----------------------------------------------------------------------



[06/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-1.3.3' into master.

Posted by an...@apache.org.
Merge branch 'ignite-1.3.3' into master.

Conflicts:
	examples/pom.xml
	modules/aop/pom.xml
	modules/apache-license-gen/pom.xml
	modules/aws/pom.xml
	modules/clients/pom.xml
	modules/cloud/pom.xml
	modules/codegen/pom.xml
	modules/core/pom.xml
	modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
	modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
	modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
	modules/core/src/main/resources/ignite.properties
	modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
	modules/extdata/p2p/pom.xml
	modules/extdata/uri/modules/uri-dependency/pom.xml
	modules/extdata/uri/pom.xml
	modules/gce/pom.xml
	modules/geospatial/pom.xml
	modules/hadoop/pom.xml
	modules/hibernate/pom.xml
	modules/indexing/pom.xml
	modules/jcl/pom.xml
	modules/jta/pom.xml
	modules/kafka/pom.xml
	modules/log4j/pom.xml
	modules/mesos/pom.xml
	modules/rest-http/pom.xml
	modules/scalar-2.10/pom.xml
	modules/scalar/pom.xml
	modules/schedule/pom.xml
	modules/schema-import/pom.xml
	modules/slf4j/pom.xml
	modules/spark-2.10/pom.xml
	modules/spark/pom.xml
	modules/spring/pom.xml
	modules/ssh/pom.xml
	modules/tools/pom.xml
	modules/urideploy/pom.xml
	modules/visor-console-2.10/pom.xml
	modules/visor-console/pom.xml
	modules/visor-plugins/pom.xml
	modules/web/pom.xml
	modules/yardstick/pom.xml
	modules/yarn/pom.xml
	pom.xml


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

Branch: refs/heads/ignite-843
Commit: 1bc9ad2e80dd2ab04b745c9cbc661362d9a45723
Parents: ae148f1 5082d63
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 24 15:46:02 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 24 15:46:02 2015 +0300

----------------------------------------------------------------------
 examples/config/example-ignite.xml              |   2 +-
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  28 +
 .../apache/ignite/internal/IgniteKernal.java    |   4 +-
 .../GridClientConnectionManagerAdapter.java     |   2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |   2 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../discovery/GridDiscoveryManager.java         |   7 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  20 +-
 .../processors/task/GridTaskProcessor.java      |   3 +-
 .../ignite/internal/util/nio/GridNioServer.java |  28 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 519 +++++++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |  53 +-
 .../util/nio/ssl/GridNioSslHandler.java         |  79 ++-
 .../communication/tcp/TcpCommunicationSpi.java  | 176 ++++++-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  20 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  34 +-
 .../apache/ignite/ssl/SslContextFactory.java    | 458 ++++++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 .../IgniteTopologyPrintFormatSelfTest.java      |   6 +-
 .../internal/util/nio/GridNioSslSelfTest.java   |   2 +-
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 ++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |  46 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  13 +
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 +
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteCacheFailoverTestSuite.java           |   4 +-
 .../IgniteSpiDiscoverySelfTestSuite.java        |   3 +
 .../visor/commands/open/VisorOpenCommand.scala  |  17 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   3 +
 parent/pom.xml                                  |   2 +-
 37 files changed, 1646 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 823ddcd,54ef2ba..aa9bfac
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@@ -59,7 -60,7 +60,8 @@@ import javax.cache.expiry.*
  import javax.cache.integration.*;
  import javax.cache.processor.*;
  import javax.management.*;
 +import java.io.*;
+ import javax.net.ssl.*;
  import java.lang.management.*;
  import java.util.*;
  
@@@ -401,9 -402,9 +403,12 @@@ public class IgniteConfiguration 
      /** Cache store session listeners. */
      private Factory<CacheStoreSessionListener>[] storeSesLsnrs;
  
 +    /** Consistent globally unique node ID which survives node restarts. */
 +    private Serializable consistentId;
 +
+     /** SSL connection factory. */
+     private Factory<SSLContext> sslCtxFactory;
+ 
      /**
       * Creates valid grid configuration with all default values.
       */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 068d374,fac6f6d..a7363af
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@@ -1094,14 -1027,13 +1094,13 @@@ public class GridDiscoveryManager exten
       * @param heap Heap size.
       * @return Topology snapshot message.
       */
 -    private String topologySnapshotMessage(int serverNodesNum, int clientNodesNum, int totalCpus, double heap) {
 +    private String topologySnapshotMessage(int srvNodesNum, int clientNodesNum, int totalCpus, double heap) {
          return PREFIX + " [" +
              (discoOrdered ? "ver=" + topSnap.get().topVer.topologyVersion() + ", " : "") +
-             "server nodes=" + srvNodesNum +
-             ", client nodes=" + clientNodesNum +
 -            "servers=" + serverNodesNum +
++            "servers=" + srvNodesNum +
+             ", clients=" + clientNodesNum +
              ", CPUs=" + totalCpus +
-             ", heap=" + heap + "GB" +
-             ']';
+             ", heap=" + heap + "GB]";
      }
  
      /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index e9fd696,a0acb5c..35911969
--- 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
@@@ -2261,10 -2285,16 +2341,16 @@@ public class TcpCommunicationSpi extend
                      else if (log.isDebugEnabled())
                          log.debug("Received remote node ID: " + rmtNodeId0);
  
-                     ch.write(ByteBuffer.wrap(U.IGNITE_HEADER));
+                     if (isSslEnabled() ) {
+                         assert sslHnd != null;
+ 
+                         ch.write(sslHnd.encrypt(ByteBuffer.wrap(U.IGNITE_HEADER)));
+                     }
+                     else
+                         ch.write(ByteBuffer.wrap(U.IGNITE_HEADER));
  
                      if (recovery != null) {
 -                        HandshakeMessage msg = new HandshakeMessage(getLocalNodeId(),
 +                        HandshakeMessage msg = new HandshakeMessage(getLocalNode().id(),
                              recovery.incrementConnectCount(),
                              recovery.receivedCount());
  
@@@ -2281,11 -2311,24 +2367,23 @@@
  
                          buf.flip();
  
-                         ch.write(buf);
+                         if (isSslEnabled()) {
+                             assert sslHnd != null;
+ 
+                             ch.write(sslHnd.encrypt(buf));
+                         }
+                         else
+                             ch.write(buf);
                      }
-                     else
-                         ch.write(ByteBuffer.wrap(nodeIdMessage().nodeIdBytesWithType));
+                     else {
+                         if (isSslEnabled()) {
+                             assert sslHnd != null;
  
 -                            ch.write(sslHnd.encrypt(ByteBuffer.wrap(nodeIdMsg.nodeIdBytesWithType)));
++                            ch.write(sslHnd.encrypt(ByteBuffer.wrap(nodeIdMessage().nodeIdBytesWithType)));
+                         }
+                         else
 -                            ch.write(ByteBuffer.wrap(nodeIdMsg.nodeIdBytesWithType));
++                            ch.write(ByteBuffer.wrap(nodeIdMessage().nodeIdBytesWithType));
+                     }
 -
                      if (recovery != null) {
                          if (log.isDebugEnabled())
                              log.debug("Waiting for handshake [rmtNode=" + rmtNodeId + ']');

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
index 73f5ba5,ba22395..9ae0928
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSslSelfTest.java
@@@ -72,7 -69,12 +72,7 @@@ public class GridNioSslSelfTest extend
              .sendQueueLimit(0)
              .filters(
                  new GridNioCodecFilter(parser, log, false),
-                 new GridNioSslFilter(sslCtx, log));
 -                new GridNioSslFilter(sslCtx, true, ByteOrder.nativeOrder(), log))
 -            .build();
 -
 -        srvr.start();
 -
 -        return srvr;
++                new GridNioSslFilter(sslCtx, true, ByteOrder.nativeOrder(), log));
      }
  
      /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1bc9ad2e/parent/pom.xml
----------------------------------------------------------------------


[45/50] [abbrv] incubator-ignite git commit: # IGNITE-1121 Add *.bat file (cherry picked from commit a40aaf6)

Posted by an...@apache.org.
# IGNITE-1121 Add *.bat file
(cherry picked from commit a40aaf6)


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

Branch: refs/heads/ignite-843
Commit: 1ff248cfd71d74e72580a43bc114217f0dae1e48
Parents: 666d44c
Author: sevdokimov <se...@jetbrains.com>
Authored: Thu Jul 30 23:12:13 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Thu Jul 30 23:15:57 2015 +0300

----------------------------------------------------------------------
 modules/control-center-agent/src/bin/agent.bat | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ff248cf/modules/control-center-agent/src/bin/agent.bat
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/bin/agent.bat b/modules/control-center-agent/src/bin/agent.bat
new file mode 100755
index 0000000..74b8299
--- /dev/null
+++ b/modules/control-center-agent/src/bin/agent.bat
@@ -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.
+::
+
+java -jar agent-${version}.jar %*


[11/50] [abbrv] incubator-ignite git commit: # ignite-788: review

Posted by an...@apache.org.
# ignite-788: review


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

Branch: refs/heads/ignite-843
Commit: 928c5e2cc0a154ff81357135ab191ea2a648ac98
Parents: 6894a87
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 24 17:00:42 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 24 17:00:42 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   5 +
 assembly/release-base.xml                       |   5 +
 config/ignite-log4j2.xml                        | 114 ++--
 .../apache/ignite/internal/IgniteKernal.java    |  40 +-
 modules/core/src/test/config/log4j2-test.xml    |  88 ++-
 .../src/test/config/log4j2-verbose-test.xml     |  48 ++
 modules/log4j/README.txt                        |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   2 +-
 modules/log4j2/README.txt                       |   2 +-
 modules/log4j2/pom.xml                          |  30 +-
 .../ignite/logger/log4j2/Log4J2Logger.java      | 626 +++++++++----------
 .../ignite/logger/log4j2/package-info.java      |   1 -
 .../logger/log4j2/Log4j2LoggerSelfTest.java     | 174 ++++++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 117 ++++
 .../testsuites/IgniteLog4j2TestSuite.java       |  13 +-
 15 files changed, 784 insertions(+), 483 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 73ea48b..ce180c7 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,11 @@
 Apache Ignite Release Notes
 ===========================
 
+Apache Ignite In-Memory Data Fabric 1.4
+---------------------------------------
+* Added support for log4j2.
+
+
 Apache Ignite In-Memory Data Fabric 1.3
 ---------------------------------------
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/assembly/release-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-base.xml b/assembly/release-base.xml
index 4137566..c95966a 100644
--- a/assembly/release-base.xml
+++ b/assembly/release-base.xml
@@ -43,6 +43,11 @@
         </file>
 
         <file>
+            <source>config/ignite-log4j2.xml</source>
+            <outputDirectory>/config</outputDirectory>
+        </file>
+
+        <file>
             <source>config/java.util.logging.properties</source>
             <outputDirectory>/config</outputDirectory>
         </file>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
index 3c4af7a..c9c349e 100644
--- a/config/ignite-log4j2.xml
+++ b/config/ignite-log4j2.xml
@@ -7,59 +7,75 @@
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
+
        http://www.apache.org/licenses/LICENSE-2.0
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-  Configuration file for apache ignite 2 
-  -->
-<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
-    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-<Configuration status="debug" strict="true" name="XMLConfigTest"
-               packages="org.apache.ignite.logger.log4j2">
-  <Filter type="ThresholdFilter" level="TRACE"/>
-  <Appenders>
-    <Appender type="Console" name="CONSOLE_ERR">
-    </Appender>
-	<Routing name="Routing">	
-	   <Routes pattern="$${ctx:ROUTINGKEY}">
-	   <Route key="$${ctx:ROUTINGKEY}">
-		  <RollingFile name="Rolling-default" fileName="work/log/ignite.log"
-					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
-			<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
-			</PatternLayout>
-			<Policies>
-			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-			  <SizeBasedTriggeringPolicy size="10 MB" />
-			</Policies>
-		  </RollingFile>
-		</Route>
-	   <Route>
-		<RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
-					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
-		<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
-		</PatternLayout>
-		<Policies>
-		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-		  <SizeBasedTriggeringPolicy size="10 MB" />
-		</Policies>
-		  </RollingFile>
-		</Route>
-		  </Routes>
-		</Routing>
-	</Appenders>
-  <Loggers>
-    <Logger name="org.springframework" level="warn"/>
-    <Logger name="rg.eclipse.jetty" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
-    <Logger name="com.amazonaws" level="warn"/>
-    <Root level="TRACE">
-    	<AppenderRef ref="Routing"/>
-   </Root>
-  </Loggers>
+-->
+
+<Configuration>
+    <Appenders>
+        <Console name="CONSOLE" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+            <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
+        </Console>
+
+        <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+        </Console>
+
+        <Routing name="FILE">
+            <Routes pattern="$${sys:nodeId}">
+                <Route>
+                    <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
+                                 filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+                        <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+                        <Policies>
+                            <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+                            <SizeBasedTriggeringPolicy size="10 MB" />
+                        </Policies>
+                    </RollingFile>
+                </Route>
+            </Routes>
+        </Routing>
+    </Appenders>
+
+    <Loggers>
+        <!--
+        <Logger name="org.apache.ignite" level=DEBUG/>
+        -->
+
+        <!--
+            Uncomment to disable courtesy notices, such as SPI configuration
+            consistency warnings.
+        -->
+        <!--
+        <Logger name="org.apache.ignite.CourtesyConfigNotice" level=OFF/>
+        -->
+
+        <Logger name="org.springframework" level="WARN"/>
+        <Logger name="org.eclipse.jetty" level="WARN"/>
+
+        <!--
+        Avoid warnings about failed bind attempt when multiple nodes running on the same host.
+        -->
+        <Logger name="org.eclipse.jetty.util.log" level="ERROR"/>
+        <Logger name="org.eclipse.jetty.util.component" level="ERROR"/>
+
+        <Logger name="com.amazonaws" level="WARN"/>
+
+        <Root level="INFO">
+            <!-- Uncomment to enable logging to console. -->
+            <!--
+            <AppenderRef ref="CONSOLE" level="DEBUG"/>
+            -->
+
+            <AppenderRef ref="CONSOLE_ERR" level="ERROR"/>
+            <AppenderRef ref="FILE" level="DEBUG"/>
+        </Root>
+    </Loggers>
 </Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/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 3f340d1..99c86ca 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
@@ -1487,13 +1487,25 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     private void ackAsciiLogo() {
         assert log != null;
 
-        String fileName = log.fileName();
-
         if (System.getProperty(IGNITE_NO_ASCII) == null) {
             String ver = "ver. " + ACK_VER_STR;
 
             // Big thanks to: http://patorjk.com/software/taag
             // Font name "Small Slant"
+            if (log.isInfoEnabled()) {
+                log.info(NL + NL +
+                        ">>>    __________  ________________  " + NL +
+                        ">>>   /  _/ ___/ |/ /  _/_  __/ __/  " + NL +
+                        ">>>  _/ // (7 7    // /  / / / _/    " + NL +
+                        ">>> /___/\\___/_/|_/___/ /_/ /___/   " + NL +
+                        ">>> " + NL +
+                        ">>> " + ver + NL +
+                        ">>> " + COPYRIGHT + NL +
+                        ">>> " + NL +
+                        ">>> Ignite documentation: " + "http://" + SITE + NL
+                );
+            }
+
             if (log.isQuiet()) {
                 U.quiet(false,
                     "   __________  ________________ ",
@@ -1508,27 +1520,15 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                     "",
                     "Quiet mode.");
 
+                String fileName = log.fileName();
+
                 if (fileName != null)
-                    U.quiet(false, "  ^-- Logging to file '" +  fileName + '\'');
+                    U.quiet(false, "  ^-- Logging to file '" + fileName + '\'');
 
                 U.quiet(false,
                     "  ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or \"-v\" to ignite.{sh|bat}",
                     "");
             }
-
-            if (log.isInfoEnabled()) {
-                log.info(NL + NL +
-                        ">>>    __________  ________________  " + NL +
-                        ">>>   /  _/ ___/ |/ /  _/_  __/ __/  " + NL +
-                        ">>>  _/ // (7 7    // /  / / / _/    " + NL +
-                        ">>> /___/\\___/_/|_/___/ /_/ /___/   " + NL +
-                        ">>> " + NL +
-                        ">>> " + ver + NL +
-                        ">>> " + COPYRIGHT + NL +
-                        ">>> " + NL +
-                        ">>> Ignite documentation: " + "http://" + SITE + NL
-                );
-            }
         }
     }
 
@@ -2730,8 +2730,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Nullable @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String name,
         @Nullable T initVal,
         @Nullable S initStamp,
-        boolean create)
-    {
+        boolean create) {
         guard();
 
         try {
@@ -2749,8 +2748,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Nullable @Override public IgniteCountDownLatch countDownLatch(String name,
         int cnt,
         boolean autoDel,
-        boolean create)
-    {
+        boolean create) {
         guard();
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/core/src/test/config/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml b/modules/core/src/test/config/log4j2-test.xml
index fcfae43..30599cc 100644
--- a/modules/core/src/test/config/log4j2-test.xml
+++ b/modules/core/src/test/config/log4j2-test.xml
@@ -1,4 +1,5 @@
 <?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
@@ -6,58 +7,51 @@
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
+
        http://www.apache.org/licenses/LICENSE-2.0
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
-    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-<Configuration status="debug" strict="true" name="XMLConfigTest"
-               packages="org.apache.ignite.logger.log4j2">
-  <Filter type="ThresholdFilter" level="TRACE"/>
-  <Appenders>
-    <Appender type="Console" name="CONSOLE_ERR">
-    </Appender>
-	<Routing name="Routing">	
-	   <Routes pattern="$${ctx:ROUTINGKEY}">
-	   <Route key="$${ctx:ROUTINGKEY}">
-		  <RollingFile name="Rolling-default" fileName="work/log/ignite.log"
-					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
-			<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
-			</PatternLayout>
-			<Policies>
-			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-			  <SizeBasedTriggeringPolicy size="10 MB" />
-			</Policies>
-		  </RollingFile>
-		</Route>
-	   <Route>
-		  <RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
-					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
-		<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
-		</PatternLayout>
-		<Policies>
-		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-		  <SizeBasedTriggeringPolicy size="10 MB" />
-		</Policies>
-		  </RollingFile>
-		</Route>
-		  </Routes>
-		</Routing>
-	</Appenders>
-  <Loggers>
-    <Logger name="org.springframework" level="warn"/>
-    <Logger name="rg.eclipse.jetty" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
-    <Logger name="com.amazonaws" level="warn"/>
-    <Root level="TRACE">
-    	<AppenderRef ref="Routing"/>
-   </Root>
-  </Loggers>
+
+<Configuration>
+    <Appenders>
+        <Console name="CONSOLE" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+            <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
+        </Console>
+
+        <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+        </Console>
+
+        <Routing name="FILE">
+            <Routes pattern="$${sys:nodeId}">
+                <Route>
+                    <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
+                                 filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+                        <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+                        <Policies>
+                            <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+                            <SizeBasedTriggeringPolicy size="10 MB" />
+                        </Policies>
+                    </RollingFile>
+                </Route>
+            </Routes>
+        </Routing>
+    </Appenders>
+
+    <Loggers>
+        <Logger name="org" level="INFO"/>
+        <Logger name="org.eclipse.jetty" level="INFO"/>
+
+        <Root level="INFO">
+            <AppenderRef ref="CONSOLE" level="DEBUG"/>
+            <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
+            <AppenderRef ref="FILE" level="DEBUG"/>
+        </Root>
+    </Loggers>
 </Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/core/src/test/config/log4j2-verbose-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-verbose-test.xml b/modules/core/src/test/config/log4j2-verbose-test.xml
new file mode 100644
index 0000000..b870dc8
--- /dev/null
+++ b/modules/core/src/test/config/log4j2-verbose-test.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+
+<Configuration>
+    <Appenders>
+        <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+        </Console>
+
+        <Routing name="FILE">
+            <Routes pattern="$${sys:nodeId}">
+                <Route>
+                    <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
+                                 filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+                        <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+                        <Policies>
+                            <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+                            <SizeBasedTriggeringPolicy size="10 MB" />
+                        </Policies>
+                    </RollingFile>
+                </Route>
+            </Routes>
+        </Routing>
+    </Appenders>
+
+    <Loggers>
+        <Root level="INFO">
+            <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
+            <AppenderRef ref="FILE" level="DEBUG"/>
+        </Root>
+    </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j/README.txt
----------------------------------------------------------------------
diff --git a/modules/log4j/README.txt b/modules/log4j/README.txt
index 9ca3c55..4bd1b4b 100644
--- a/modules/log4j/README.txt
+++ b/modules/log4j/README.txt
@@ -1,7 +1,7 @@
 Apache Ignite Log4J Module
 --------------------------
 
-Apache Ignite Log4J module provides GridLogger implementation based on Apache Log4J.
+Apache Ignite Log4J module provides IgniteLogger implementation based on Apache Log4J.
 
 To enable Log4J module when starting a standalone node, move 'optional/ignite-log4j' folder to
 'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
index 333b1da..e3828ab 100644
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
@@ -42,7 +42,7 @@ import static org.apache.ignite.IgniteSystemProperties.*;
  * Here is a typical example of configuring log4j logger in Ignite configuration file:
  * <pre name="code" class="xml">
  *      &lt;property name="gridLogger"&gt;
- *          &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4jLogger"&gt;
+ *          &lt;bean class="org.apache.ignite.logger.log4j.Log4JLogger"&gt;
  *              &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/&gt;
  *          &lt;/bean>
  *      &lt;/property&gt;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/README.txt
----------------------------------------------------------------------
diff --git a/modules/log4j2/README.txt b/modules/log4j2/README.txt
index 2bf9e79..47d01d2 100644
--- a/modules/log4j2/README.txt
+++ b/modules/log4j2/README.txt
@@ -1,7 +1,7 @@
 Apache Ignite Log4J2 Module
 --------------------------
 
-Apache Ignite Log4J2 module provides GridLogger implementation based on Apache Log4J2.
+Apache Ignite Log4J2 module provides IgniteLogger implementation based on Apache Log4J2.
 
 To enable Log4J2 module when starting a standalone node, move 'optional/ignite-log4j2' folder to
 'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
index f25a31b..58dc05e 100644
--- a/modules/log4j2/pom.xml
+++ b/modules/log4j2/pom.xml
@@ -1,4 +1,5 @@
 <?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
@@ -15,35 +16,30 @@
   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>
         <groupId>org.apache.ignite</groupId>
         <artifactId>ignite-parent</artifactId>
         <version>1</version>
         <relativePath>../../parent</relativePath>
     </parent>
+
     <artifactId>ignite-log4j2</artifactId>
-    <version>1.0.6-SNAPSHOT</version>
+    <version>1.4.1-SNAPSHOT</version>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-          <dependency>
-           <groupId>org.apache.logging.log4j</groupId>
-           <artifactId>log4j-api</artifactId>
-           <version>2.3</version>
-         </dependency>
-         <dependency>
-           <groupId>org.apache.logging.log4j</groupId>
-           <artifactId>log4j-core</artifactId>
-           <version>2.3</version>
-         </dependency>
+
         <dependency>
             <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-core</artifactId>
@@ -51,5 +47,17 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>2.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>2.3</version>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index 15ef44d..19f43e6 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -17,86 +17,64 @@
 
 package org.apache.ignite.logger.log4j2;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.util.GridConcurrentHashSet;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.C1;
-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.lang.IgniteClosure;
-import org.apache.ignite.logger.LoggerNodeIdAware;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.appender.ConsoleAppender;
-import org.apache.logging.log4j.core.appender.FileAppender;
-import org.apache.logging.log4j.core.appender.RollingFileAppender;
-import org.apache.logging.log4j.core.config.AppenderRef;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.Configurator;
-import org.apache.logging.log4j.core.config.LoggerConfig;
-import org.apache.logging.log4j.core.layout.PatternLayout;
-import org.jetbrains.annotations.Nullable;
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.logger.*;
+import org.apache.logging.log4j.*;
+import org.apache.logging.log4j.core.*;
+import org.apache.logging.log4j.core.Logger;
+import org.apache.logging.log4j.core.appender.*;
+import org.apache.logging.log4j.core.appender.routing.*;
+import org.apache.logging.log4j.core.config.*;
+import org.apache.logging.log4j.core.layout.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.nio.charset.*;
+import java.util.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
 
 /**
- * Log4j2-based implementation for logging. This logger should be used by
- * loaders that have prefer <a target=_new
- * href="http://logging.apache.org/log4j/2.x/">log4j2</a>-based logging.
+ * Log4j2-based implementation for logging. This logger should be used
+ * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/2.x/index.html">log4j2</a>-based logging.
  * <p>
- * Here is a typical example of configuring log4j logger in Ignite configuration
- * file:
- * 
+ * Here is a typical example of configuring log4j2 logger in Ignite configuration file:
  * <pre name="code" class="xml">
  *      &lt;property name="gridLogger"&gt;
- *          &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4J2Logger"&gt;
+ *          &lt;bean class="org.apache.ignite.logger.log4j2.Log4J2Logger"&gt;
  *              &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j2.xml"/&gt;
  *          &lt;/bean>
  *      &lt;/property&gt;
  * </pre>
- * 
  * and from your code:
- * 
  * <pre name="code" class="java">
  *      IgniteConfiguration cfg = new IgniteConfiguration();
  *      ...
- *      URL xml = U.resolveIgniteUrl("config/custom-log4j.xml");
+ *      URL xml = U.resolveIgniteUrl("config/custom-log4j2.xml");
  *      IgniteLogger log = new Log4J2Logger(xml);
  *      ...
  *      cfg.setGridLogger(log);
  * </pre>
  *
- * Please take a look at <a target=_new
- * href="http://logging.apache.org/log4j/2.x/">Apache Log4j 2.7</a> for
- * additional information.
+ * Please take a look at <a target=_new href="http://logging.apache.org/log4j/2.x/index.html">Apache Log4j 2</a>
+ * for additional information.
  * <p>
- * It's recommended to use Ignite logger injection instead of
- * using/instantiating logger apacin your task/job code. See
- * {@link org.apache.ignite.resources.LoggerResource} annotation about logger
+ * It's recommended to use Ignite logger injection instead of using/instantiating
+ * logger in your task/job code. See {@link org.apache.ignite.resources.LoggerResource} annotation about logger
  * injection.
- * 
- * Porting for the Log4j2
- * 
- * @author Gianfranco Murador
  */
-public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
-        Log4j2FileAware {
-
-    /** custom message */
-    private static String LOG_MESSAGE = ">>> Local Node [ID: ";
+public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
+    /** */
+    private static final String NODE_ID = "nodeId";
 
-    /** Appenders. */
-    private static Collection<FileAppender> fileAppenders = new GridConcurrentHashSet<>();
+    /** */
+    private static final String CONSOLE_APPENDER = "autoConfiguredIgniteConsoleAppender";
 
     /** */
     private static volatile boolean inited;
@@ -109,104 +87,55 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
 
     /** Logger implementation. */
     @GridToStringExclude
+    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private Logger impl;
 
-    /** Path to configuration file. */
-    private final String path;
+    /** Auto added at verbose mode console logger (nullable). */
+    @GridToStringExclude
+    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
+    private Logger consoleLog;
 
     /** Quiet flag. */
     private final boolean quiet;
 
     /** Node ID. */
-    private UUID nodeId;
-
-    /**
-     * Creates new logger and automatically detects if root logger already has
-     * appenders configured. If it does not, the root logger will be configured
-     * with default appender (analogous to calling
-     * {@link #Log4J2Logger(boolean) Log4J2Logger(boolean)} with parameter
-     * {@code true}, otherwise, existing appenders will be used (analogous to
-     * calling {@link #Log4J2Logger(boolean) Log4J2Logger(boolean)} with
-     * parameter
-     */
-    public Log4J2Logger() {
-        this(!isConfigured());
-    }
+    private volatile UUID nodeId;
 
     /**
      * Creates new logger with given implementation.
-     * 
+     *
      * @param impl Log4j implementation to use.
+     * @param consoleLog Cosole logger (optional).
      */
-    public Log4J2Logger(final Logger impl) {
+    private Log4J2Logger(final Logger impl, @Nullable final Logger consoleLog) {
         assert impl != null;
-
-        path = null;
-
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
-                return impl;
-            }
-        });
+        this.impl = impl;
+        this.consoleLog = consoleLog;
 
         quiet = quiet0;
     }
 
     /**
-     * Creates new logger. If initialize parameter is {@code true} the Log4j
-     * logger will be initialized with default console appender and {@code INFO}
-     * log level.
-     *
-     * @param init If {@code true}, then a default console appender with
-     *            following pattern layout will be created: {@code %d ABSOLUTE}
-     *            %-5p [%c{1}] %m%n}. If {@code false}, then no implicit
-     *            initialization will take place, and {@code Log4j} should be
-     *            configured prior to calling this constructor.
-     */
-    public Log4J2Logger(boolean init) {
-        impl = LogManager.getRootLogger();
-
-        if (init) {
-            // Implementation has already been inited, passing NULL.
-            addConsoleAppenderIfNeeded(Level.INFO, null);
-            quiet = quiet0;
-        } else
-            quiet = true;
-        path = null;
-    }
-
-    /**
-     * Creates new logger with given configuration {@code cfgFile}.
+     * Creates new logger with given configuration {@code path}.
      *
-     * @param cfgFile Log4j configuration XML file.
+     * @param path Path to log4j configuration XML file.
      * @throws IgniteCheckedException Thrown in case logger can't be created.
      */
-    public Log4J2Logger(File cfgFile) throws IgniteCheckedException {
+    public Log4J2Logger(String path) throws IgniteCheckedException {
+        if (path == null)
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
 
-        final String uri;
+        final URL cfgUrl = U.resolveIgniteUrl(path);
 
-        if (cfgFile == null)
-            throw new IgniteCheckedException(
-                    "Configuration XML file for Log4j must be specified.");
+        if (cfgUrl == null)
+            throw new IgniteCheckedException("Log4j configuration path was not found: " + path);
 
-        if (!cfgFile.exists() || cfgFile.isDirectory())
-            throw new IgniteCheckedException(
-                    "Log4j configuration path was not found or is a directory: "
-                            + cfgFile);
-        try {
-            uri = cfgFile.toURI().toURL().toString();
-        } catch (MalformedURLException e) {
-            throw new IgniteCheckedException(e.toString());
-        }
-        path = cfgFile.getAbsolutePath();
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
-                if (init) {
-                    Configurator.initialize("Log4J2Logger", uri);
-                }
-                return LogManager.getRootLogger();
+        addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    Configurator.initialize(LogManager.ROOT_LOGGER_NAME, cfgUrl.toString());
+
+                return (Logger)LogManager.getRootLogger();
             }
         });
 
@@ -214,31 +143,26 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
     }
 
     /**
-     * Creates new logger with given configuration {@code path}.
-     * @param path Path to log4j configuration XML file.
+     * Creates new logger with given configuration {@code cfgFile}.
+     *
+     * @param cfgFile Log4j configuration XML file.
      * @throws IgniteCheckedException Thrown in case logger can't be created.
      */
-    public Log4J2Logger(String path) throws IgniteCheckedException {
-        if (path == null)
-            throw new IgniteCheckedException(
-                    "Configuration XML file for Log4j must be specified.");
-
-        this.path = path;
+    public Log4J2Logger(File cfgFile) throws IgniteCheckedException {
+        if (cfgFile == null)
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
 
-        final URL cfgUrl = U.resolveIgniteUrl(path);
+        if (!cfgFile.exists() || cfgFile.isDirectory())
+            throw new IgniteCheckedException("Log4j2 configuration path was not found or is a directory: " + cfgFile);
 
-        if (cfgUrl == null)
-            throw new IgniteCheckedException(
-                    "Log4j configuration path was not found: " + path);
+        final String path = cfgFile.getAbsolutePath();
 
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
+        addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    Configurator.initialize(LogManager.ROOT_LOGGER_NAME, path);
 
-                if (init) {
-                    Configurator.initialize("Log4J2Logger", cfgUrl.toString());
-                }
-                return LogManager.getRootLogger();
+                return (Logger)LogManager.getRootLogger();
             }
         });
 
@@ -253,16 +177,14 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
      */
     public Log4J2Logger(final URL cfgUrl) throws IgniteCheckedException {
         if (cfgUrl == null)
-            throw new IgniteCheckedException(
-                    "Configuration XML file for Log4j must be specified.");
-        path = null;
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
-                if (init) {
-                    Configurator.initialize("Log4J2Logger", cfgUrl.toString());
-                }
-                return LogManager.getRootLogger();
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
+
+        addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    Configurator.initialize(LogManager.ROOT_LOGGER_NAME, cfgUrl.toString());
+
+                return (Logger)LogManager.getRootLogger();
             }
         });
 
@@ -270,102 +192,124 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
     }
 
     /**
-     * Checks if Log4j is already configured within this VM or not
-     * 
-     * @return {@code True} if log4j was already configured, {@code false}
-     *         otherwise.
-     */
-    public static boolean isConfigured() {
-        return !(LogManager.getLogger("Log4J2Logger") != null);
-    }
-
-    /**
      * Sets level for internal log4j implementation.
      *
      * @param level Log level to set.
      */
     public void setLevel(Level level) {
-        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+        LoggerContext ctx = (LoggerContext)LogManager.getContext(false);
+
         Configuration conf = ctx.getConfiguration();
-        conf.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(level);
+
+        conf.getLoggerConfig(impl.getName()).setLevel(level);
+
         ctx.updateLoggers(conf);
     }
 
     /** {@inheritDoc} */
-    @Nullable
-    @Override
-    public String fileName() {
-        org.apache.logging.log4j.core.Logger loggerImpl = (org.apache.logging.log4j.core.Logger) impl;
-        Collection<Appender> appenders = loggerImpl.getAppenders().values();
-        for (Appender a : appenders) {
-            if (a instanceof FileAppender) {
-                return ((FileAppender) a).getFileName();
-            }
-            if (a instanceof RollingFileAppender) {
-                return ((RollingFileAppender) a).getFileName();
+    @Nullable @Override public String fileName() {
+        for (Logger log = impl; log != null; log = log.getParent()) {
+            for (Appender a : log.getAppenders().values()) {
+                if (a instanceof FileAppender)
+                    return ((FileAppender)a).getFileName();
+
+                if (a instanceof RollingFileAppender)
+                    return ((RollingFileAppender)a).getFileName();
+
+                if (a instanceof RoutingAppender) {
+                    try {
+                        RoutingAppender routing = (RoutingAppender)a;
+
+                        Field appsFiled = routing.getClass().getDeclaredField("appenders");
+
+                        appsFiled.setAccessible(true);
+
+                        Map<String, AppenderControl> appenders = (Map<String, AppenderControl>)appsFiled.get(routing);
+
+                        for (AppenderControl control : appenders.values()) {
+                            Appender innerApp = control.getAppender();
+
+                            if (innerApp instanceof FileAppender)
+                                return ((FileAppender)innerApp).getFileName();
+
+                            if (innerApp instanceof RollingFileAppender)
+                                return ((RollingFileAppender)innerApp).getFileName();
+                        }
+                    }
+                    catch (IllegalAccessException | NoSuchFieldException e) {
+                        error("Faild to get file name. Looks like the implementation of log4j 2 was changed.", e);
+                    }
+                }
             }
         }
+
         return null;
     }
 
     /**
      * Adds console appender when needed with some default logging settings.
      *
-     * @param logLevel Optional log level.
-     * @param implInitC Optional log implementation init closure.
+     * @param initLogClo Optional log implementation init closure.
      */
-    private void addConsoleAppenderIfNeeded(@Nullable Level logLevel,
-            @Nullable IgniteClosure<Boolean, Logger> implInitC) {
+    private void addConsoleAppenderIfNeeded(@Nullable IgniteClosure<Boolean, Logger> initLogClo) {
         if (inited) {
-            if (implInitC != null)
-                // Do not init.
-                impl = implInitC.apply(false);
+            // Do not init.
+            impl = initLogClo.apply(false);
 
             return;
         }
+
         synchronized (mux) {
             if (inited) {
-                if (implInitC != null)
-                    // Do not init.
-                    impl = implInitC.apply(false);
+                // Do not init.
+                impl = initLogClo.apply(false);
 
                 return;
             }
 
-            if (implInitC != null)
-                // Init logger impl.
-                impl = implInitC.apply(true);
-
-            // use the local quite instead of this
-            boolean quiet = isQuiet();
-
-            // here added a console logger if not exists, programmatically
-            // the implementations is more easy with new API
-            // Log4j2 has always a console logger by default
-            Logger clog = LogManager.getLogger("CONSOLE");
-            if (clog == null) {
-
-                ConsoleAppender console = ConsoleAppender.createAppender(
-                        PatternLayout.createDefaultLayout(), null, "CONSOLE",
-                        "console", null, null);
-                final LoggerContext ctx = (LoggerContext) new org.apache.logging.log4j.core.LoggerContext(
-                        "console");
-
-                final Configuration config = ((org.apache.logging.log4j.core.LoggerContext) ctx)
-                        .getConfiguration();
-                config.addAppender(console);
-                AppenderRef ref = AppenderRef.createAppenderRef("console",
-                        logLevel, null);
-                AppenderRef[] refs = new AppenderRef[] { ref };
-                LoggerConfig loggerConfig = LoggerConfig.createLogger("false",
-                        logLevel, "org.apache.logging.log4j", "true", refs,
-                        null, config, null);
-                loggerConfig.addAppender(console, null, null);
-
-                config.addLogger("org.apache.logging.log4j", loggerConfig);
-                ((org.apache.logging.log4j.core.LoggerContext) ctx)
-                        .updateLoggers();
+            // Init logger impl.
+            impl = initLogClo.apply(true);
+
+            boolean quiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
+
+            boolean consoleAppenderFound = false;
+            Logger rootLogger = null;
+
+            for (Logger log = impl; log != null; ) {
+                if (!consoleAppenderFound) {
+                    for (Appender appender : log.getAppenders().values()) {
+                        if (appender instanceof ConsoleAppender) {
+                            if ("CONSOLE_ERR".equals(appender.getName()))
+                                continue;
+
+                            consoleAppenderFound = true;
+
+                            break;
+                        }
+                    }
+                }
+
+                if (log.getParent() == null) {
+                    rootLogger = log;
+
+                    break;
+                }
+                else
+                    log = log.getParent();
+            }
+
+            if (consoleAppenderFound && quiet)
+                // User configured console appender, but log is quiet.
+                quiet = false;
 
+            if (!consoleAppenderFound && !quiet &&
+                Boolean.valueOf(System.getProperty(IGNITE_CONSOLE_APPENDER, "true"))) {
+                // Console appender not found => we've looked through all categories up to root.
+                assert rootLogger != null;
+
+                // User launched ignite in verbose mode and did not add console appender with INFO level
+                // to configuration and did not set IGNITE_CONSOLE_APPENDER to false.
+                consoleLog = createConsoleLogger();
             }
 
             quiet0 = quiet;
@@ -374,171 +318,169 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
     }
 
     /**
-     * With the new Log4j2 API when can choose the filename in the ThreadContext
-     * instead of do some hack to setup the file in according to the nodeid. So
-     * this method is deprecated
+     * Creates console appender with some reasonable default logging settings.
+     *
+     * @return Logger with auto configured console appender.
      */
-    @Override
-    @Deprecated
-    public void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-        for (FileAppender a : fileAppenders) {
+    public static Logger createConsoleLogger() {
+        LoggerContext ctx = (LoggerContext)LogManager.getContext(true);
 
-        }
+        Configuration cfg = ctx.getConfiguration();
+
+        PatternLayout layout = PatternLayout.createLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n", null, null,
+            Charset.defaultCharset(), false, false, null, null);
+
+        final Appender consoleApp = ConsoleAppender.createAppender(layout, null, null, CONSOLE_APPENDER, null, null);
+        consoleApp.start();
+
+        AppenderRef ref = AppenderRef.createAppenderRef(CONSOLE_APPENDER, Level.TRACE, null);
+
+        AppenderRef[] refs = {ref};
+
+        LoggerConfig logCfg = LoggerConfig.createLogger("false", Level.INFO, LogManager.ROOT_LOGGER_NAME, "",
+            refs, null, null, null);
+
+        logCfg.addAppender(consoleApp, null, null);
+        cfg.addAppender(consoleApp);
+
+        cfg.addLogger(LogManager.ROOT_LOGGER_NAME, logCfg);
+
+        ctx.updateLoggers(cfg);
+
+        return (Logger)LogManager.getContext().getLogger(LogManager.ROOT_LOGGER_NAME);
     }
 
-    /**
-     * Adds file appender.
-     *
-     * @param a Appender.
-     */
-    public static void addAppender(FileAppender a) {
-        A.notNull(a, "a");
-        fileAppenders.add(a);
+    /** {@inheritDoc} */
+    @Override public void setNodeId(UUID nodeId) {
+        A.notNull(nodeId, "nodeId");
+
+        this.nodeId = nodeId;
+
+        // Set nodeId as system variable to be used at configuration.
+        System.setProperty(NODE_ID, U.id8(nodeId));
+
+        ((LoggerContext)LogManager.getContext(false)).reconfigure();
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID getNodeId() {
+        return nodeId;
     }
 
     /**
-     * Removes file appender.
+     * Gets {@link IgniteLogger} wrapper around log4j logger for the given
+     * category. If category is {@code null}, then root logger is returned. If
+     * category is an instance of {@link Class} then {@code (Class)ctgr).getName()}
+     * is used as category name.
      *
-     * @param a Appender.
+     * @param ctgr {@inheritDoc}
+     * @return {@link IgniteLogger} wrapper around log4j logger.
      */
-    public static void removeAppender(FileAppender a) {
-        A.notNull(a, "a");
-        fileAppenders.remove(a);
+    @Override public Log4J2Logger getLogger(Object ctgr) {
+        if (ctgr == null)
+            return new Log4J2Logger((Logger)LogManager.getRootLogger(),
+                consoleLog == null ? null : (Logger)LogManager.getContext().getLogger(""));
+
+        if (ctgr instanceof Class) {
+            String name = ((Class<?>)ctgr).getName();
+
+            return new Log4J2Logger((Logger)LogManager.getLogger(name),
+                consoleLog == null ? null : (Logger)LogManager.getContext().getLogger(name));
+        }
+
+        String name = ctgr.toString();
+
+        return new Log4J2Logger((Logger)LogManager.getLogger(name),
+            consoleLog == null ? null : (Logger)LogManager.getContext().getLogger(name));
     }
 
     /** {@inheritDoc} */
-    @Override
-    public UUID getNodeId() {
-        return nodeId;
+    @Override public void trace(String msg) {
+        if (!isTraceEnabled())
+            warning("Logging at TRACE level without checking if TRACE level is enabled: " + msg);
+
+        impl.trace(msg);
+
+        if (consoleLog != null)
+            consoleLog.trace(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void setNodeId(UUID nodeid) {
-        A.notNull(nodeid, "nodeId");
-        String uid = U.id8(nodeid);
-
-        // set up the new thread context
-        ThreadContext.put("nodeidmsg", LOG_MESSAGE + uid + "]");
-        ThreadContext.put("ROUTINGKEY", uid);
-
-        ((org.apache.logging.log4j.core.LoggerContext) LogManager
-                .getContext(false)).reconfigure();
-        this.nodeId = nodeid;
+    @Override public void debug(String msg) {
+        if (!isDebugEnabled())
+            warning("Logging at DEBUG level without checking if DEBUG level is enabled: " + msg);
+
+        impl.debug(msg);
+
+        if (consoleLog != null)
+            consoleLog.debug(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void debug(String msg) {
-        if (!impl.isDebugEnabled())
-            warning("Logging at DEBUG level without checking if DEBUG level is enabled: "
-                    + msg);
-        impl.debug(msg);
+    @Override public void info(String msg) {
+        if (!isInfoEnabled())
+            warning("Logging at INFO level without checking if INFO level is enabled: " + msg);
+
+        impl.info(msg);
+
+        if (consoleLog != null)
+            consoleLog.info(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void warning(String msg) {
+    @Override public void warning(String msg) {
         impl.warn(msg);
+
+        if (consoleLog != null)
+            consoleLog.warn(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void warning(String msg, @Nullable Throwable e) {
+    @Override public void warning(String msg, @Nullable Throwable e) {
         impl.warn(msg, e);
+
+        if (consoleLog != null)
+            consoleLog.warn(msg, e);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void error(String msg) {
+    @Override public void error(String msg) {
         impl.error(msg);
-    }
 
-    /** {@inheritDoc} */
-    @Override
-    public void error(String msg, @Nullable Throwable e) {
-        impl.error(msg, e);
+        if (consoleLog != null)
+            consoleLog.error(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void info(String msg) {
-        if (!impl.isInfoEnabled())
-            warning("Logging at INFO level without checking if INFO level is enabled: "
-                    + msg);
+    @Override public void error(String msg, @Nullable Throwable e) {
+        impl.error(msg, e);
 
-        impl.info(msg);
+        if (consoleLog != null)
+            consoleLog.error(msg, e);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isTraceEnabled() {
-        return impl.isTraceEnabled();
+    @Override public boolean isTraceEnabled() {
+        return impl.isTraceEnabled() || (consoleLog != null && consoleLog.isTraceEnabled());
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isDebugEnabled() {
-        return impl.isDebugEnabled();
+    @Override public boolean isDebugEnabled() {
+        return impl.isDebugEnabled() || (consoleLog != null && consoleLog.isDebugEnabled());
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isInfoEnabled() {
-        return impl.isInfoEnabled();
+    @Override public boolean isInfoEnabled() {
+        return impl.isInfoEnabled() || (consoleLog != null && consoleLog.isInfoEnabled());
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isQuiet() {
-        return !isInfoEnabled() && !isDebugEnabled();
+    @Override public boolean isQuiet() {
+        return quiet;
     }
 
     /** {@inheritDoc} */
-    @Override
-    public String toString() {
+    @Override public String toString() {
         return S.toString(Log4J2Logger.class, this);
     }
-
-    /**
-     * Gets files for all registered file appenders.
-     *
-     * @return List of files.
-     */
-    public static Collection<String> logFiles() {
-        Collection<String> res = new ArrayList<String>(fileAppenders.size());
-        for (FileAppender a : fileAppenders)
-            res.add(a.getFileName());
-        return res;
-    }
-
-    /**
-     * Gets {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger
-     * for the given category. If category is {@code null}, then root logger is
-     * returned. If category is an instance of {@link Class} then
-     * {@code (Class)ctgr).getName()} is used as category name.
-     *
-     * @param ctgr {@inheritDoc}
-     * @return {@link org.apache.ignite.IgniteLogger} wrapper around log4j
-     *         logger.
-     */
-    @Override
-    public Log4J2Logger getLogger(Object ctgr) {
-        return new Log4J2Logger(
-                ctgr == null ? LogManager.getRootLogger()
-                        : ctgr instanceof Class ? LogManager
-                                .getLogger(((Class<?>) ctgr).getName())
-                                : LogManager.getLogger(ctgr.toString()));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void trace(String msg) {
-        if (!impl.isTraceEnabled())
-            warning("Logging at TRACE level without checking if TRACE level is enabled: "
-                    + msg);
-        impl.trace(msg);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
index 642cf8c..4e18f97 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
@@ -20,4 +20,3 @@
  * Contains <b>default</b> Log4j2 implementation for logging.
  */
 package org.apache.ignite.logger.log4j2;
-

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java
new file mode 100644
index 0000000..ac10a64
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.logger.log4j2;
+
+import junit.framework.*;
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.logger.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid Log4j2 SPI test.
+ */
+public class Log4j2LoggerSelfTest extends TestCase {
+    /** */
+    private static final String LOG_PATH_TEST = "modules/core/src/test/config/log4j2-test.xml";
+
+    /** */
+    private static final String LOG_PATH_MAIN = "config/ignite-log4j2.xml";
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFileConstructor() throws Exception {
+        File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_TEST);
+
+        assert xml != null;
+        assert xml.exists();
+
+        IgniteLogger log = new Log4J2Logger(xml).getLogger(getClass());
+
+        ((LoggerNodeIdAware)log).setNodeId(UUID.randomUUID());
+
+        checkLog(log);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testUrlConstructor() throws Exception {
+        File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_TEST);
+
+        assert xml != null;
+        assert xml.exists();
+
+        IgniteLogger log = new Log4J2Logger(xml.toURI().toURL()).getLogger(getClass());
+
+        ((LoggerNodeIdAware)log).setNodeId(UUID.randomUUID());
+
+        checkLog(log);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPathConstructor() throws Exception {
+        IgniteLogger log = new Log4J2Logger(LOG_PATH_TEST).getLogger(getClass());
+
+        ((LoggerNodeIdAware)log).setNodeId(UUID.randomUUID());
+
+        checkLog(log);
+    }
+
+    /**
+     * Tests log4j logging SPI.
+     */
+    private void checkLog(IgniteLogger log) {
+        assert !log.isDebugEnabled();
+        assert log.isInfoEnabled();
+
+        log.debug("This is 'debug' message.");
+        log.info("This is 'info' message.");
+        log.warning("This is 'warning' message.");
+        log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
+        log.error("This is 'error' message.");
+        log.error("This is 'error' message.", new Exception("It's a test error exception"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSystemNodeId() throws Exception {
+        UUID id = UUID.randomUUID();
+
+        new Log4J2Logger(LOG_PATH_TEST).setNodeId(id);
+
+        assertEquals(U.id8(id), System.getProperty("nodeId"));
+    }
+
+    /**
+     * Tests correct behaviour in case 2 local nodes are started.
+     *
+     * @throws Exception If error occurs.
+     */
+    public void testLogFilesTwoNodes() throws Exception {
+        checkOneNode(0);
+        checkOneNode(1);
+    }
+
+    /**
+     * Starts the local node and checks for presence of log file.
+     * Also checks that this is really a log of a started node.
+     *
+     * @param id Test-local node ID.
+     * @throws Exception If error occurred.
+     */
+    private void checkOneNode(int id) throws Exception {
+        String id8;
+        File logFile;
+
+        try (Ignite ignite = G.start(getConfiguration("grid" + id, LOG_PATH_MAIN))) {
+            id8 = U.id8(ignite.cluster().localNode().id());
+
+            String logPath = "work/log/ignite-" + id8 + ".log";
+
+            logFile = U.resolveIgnitePath(logPath);
+            assertNotNull("Failed to resolve path: " + logPath, logFile);
+            assertTrue("Log file does not exist: " + logFile, logFile.exists());
+
+            assertEquals(logFile.getAbsolutePath(), ignite.log().fileName());
+        }
+
+        String logContent = U.readFileToString(logFile.getAbsolutePath(), "UTF-8");
+
+        assertTrue("Log file does not contain it's node ID: " + logFile,
+            logContent.contains(">>> Local node [ID="+ id8.toUpperCase()));
+
+    }
+
+    /**
+     * Creates grid configuration.
+     *
+     * @param gridName Grid name.
+     * @param logPath Logger configuration path.
+     * @return Grid configuration.
+     * @throws Exception If error occurred.
+     */
+    private static IgniteConfiguration getConfiguration(String gridName, String logPath)
+        throws Exception {
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {{
+            setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
+        }});
+
+        return new IgniteConfiguration()
+            .setGridName(gridName)
+            .setGridLogger(new Log4J2Logger(logPath))
+            .setConnectorConfiguration(null)
+            .setDiscoverySpi(disco);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java
new file mode 100644
index 0000000..f4f2356
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.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.logger.log4j2;
+
+import junit.framework.*;
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.logging.log4j.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid Log4j2 SPI test.
+ */
+public class Log4j2LoggerVerboseModeSelfTest extends TestCase {
+    /** */
+    public static final String LOG_PATH_VERBOSE_TEST = "modules/core/src/test/config/log4j2-verbose-test.xml";
+
+    /**
+     * Test does not work after another tests. Can be run from IDE as separate test.
+     *
+     * @throws Exception If failed.
+     */
+    public void testVerboseMode() throws Exception {
+        final PrintStream backupSysOut = System.out;
+        final PrintStream backupSysErr = System.err;
+
+        final ByteArrayOutputStream testOut = new ByteArrayOutputStream();
+        final ByteArrayOutputStream testErr = new ByteArrayOutputStream();
+
+        try {
+            System.setOut(new PrintStream(testOut));
+            System.setErr(new PrintStream(testErr));
+
+            System.setProperty("IGNITE_QUIET", "false");
+
+            try (Ignite ignite = G.start(getConfiguration("verboseLogGrid", LOG_PATH_VERBOSE_TEST))) {
+                String testMsg = "******* Hello Tester! ******* ";
+
+                ignite.log().error(testMsg + Level.ERROR);
+                ignite.log().warning(testMsg + Level.WARN);
+                ignite.log().info(testMsg + Level.INFO);
+                ignite.log().debug(testMsg + Level.DEBUG);
+                ignite.log().trace(testMsg + Level.TRACE);
+
+                String consoleOut = testOut.toString();
+                String consoleErr = testErr.toString();
+
+                assertTrue(consoleOut.contains(testMsg + Level.INFO));
+                assertTrue(consoleOut.contains(testMsg + Level.DEBUG));
+                assertTrue(consoleOut.contains(testMsg + Level.TRACE));
+                assertTrue(consoleOut.contains(testMsg + Level.ERROR));
+                assertTrue(consoleOut.contains(testMsg + Level.WARN));
+
+                assertTrue(consoleErr.contains(testMsg + Level.ERROR));
+                assertTrue(consoleErr.contains(testMsg + Level.WARN));
+                assertTrue(!consoleErr.contains(testMsg + Level.INFO));
+                assertTrue(consoleErr.contains(testMsg + Level.DEBUG));
+                assertTrue(consoleErr.contains(testMsg + Level.TRACE));
+            }
+        }
+        finally {
+            System.setProperty("IGNITE_QUIET", "true");
+
+            System.setOut(backupSysOut);
+            System.setErr(backupSysErr);
+
+            System.out.println("**************** Out Console content ***************");
+            System.out.println(testOut.toString());
+
+            System.err.println("**************** Err Console content ***************");
+            System.err.println(testErr.toString());
+        }
+    }
+
+    /**
+     * Creates grid configuration.
+     *
+     * @param gridName Grid name.
+     * @param logPath Logger configuration path.
+     * @return Grid configuration.
+     * @throws Exception If error occurred.
+     */
+    private static IgniteConfiguration getConfiguration(String gridName, String logPath)
+        throws Exception {
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {{
+            setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
+        }});
+
+        return new IgniteConfiguration()
+            .setGridName(gridName)
+            .setGridLogger(new Log4J2Logger(logPath))
+            .setConnectorConfiguration(null)
+            .setDiscoverySpi(disco);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
index d025332..85a98c2 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
@@ -17,11 +17,8 @@
 
 package org.apache.ignite.testsuites;
 
-import org.apache.ignite.logger.log4j2.GridLog4j2CorrectFileNameTest;
-import org.apache.ignite.logger.log4j2.GridLog4j2InitializedTest;
-import org.apache.ignite.logger.log4j2.GridLog4j2LoggingFileTest;
-
-import junit.framework.TestSuite;
+import junit.framework.*;
+import org.apache.ignite.logger.log4j2.*;
 
 /**
  * Log4j2 logging tests.
@@ -34,10 +31,8 @@ public class IgniteLog4j2TestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Log4j2 Logging Test Suite");
 
-        suite.addTest(new TestSuite(GridLog4j2InitializedTest.class));
-        suite.addTest(new TestSuite(GridLog4j2CorrectFileNameTest.class));
-        suite.addTest(new TestSuite(GridLog4j2LoggingFileTest.class));
+        suite.addTest(new TestSuite(Log4j2LoggerSelfTest.class));
+
         return suite;
     }
-
 }


[17/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-961' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: fcfda9ae7ffdd955a60ce7d57121095e9c0c93fb
Parents: 34dbdcf 4475be8
Author: Andrey <an...@gridgain.com>
Authored: Mon Jul 27 14:20:00 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Jul 27 14:20:00 2015 +0700

----------------------------------------------------------------------
 modules/nodejs/src/main/js/sql-fields-query.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[44/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-961

Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-961


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

Branch: refs/heads/ignite-843
Commit: 6961060ce64f41697e2a1bfaa921908f05ea0b61
Parents: 216d4ff 5288b2d
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 29 18:09:28 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 29 18:09:28 2015 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          | 22 ++++++++++++++++++++
 .../datastreamer/DataStreamerUpdateJob.java     | 20 +++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[09/50] [abbrv] incubator-ignite git commit: # ignite-788

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java~
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java~ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java~
new file mode 100644
index 0000000..4f372ed
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.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.logger.log4j2;
+
+import java.net.URL;
+import java.util.UUID;
+import junit.framework.TestCase;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.logger.log4j2.Log4J2Logger;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Log4j initialized test.
+ */
+@GridCommonTest(group = "Logger")
+public class GridLog4j2InitializedTest extends TestCase {
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Override
+    protected void setUp() throws Exception {
+  
+    }
+
+    /** */
+    public void testLogInitialize() {
+
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        cfg.setGridName("grid" + 1);
+        cfg.setNodeId(new UUID(1, 1));
+        cfg.setIgniteHome("/home/glutters/Documenti/apache-ignite/ignite-master/incubator-ignite/");
+       
+        URL xml = U.resolveIgniteUrl("config/ignite-log4j2.xml");
+        IgniteLogger log;
+        try {
+
+            log = new Log4J2Logger(xml);
+            // log.isQuiet();
+            cfg.setGridLogger(log);
+        } catch (IgniteCheckedException e) {
+            e.printStackTrace();
+            return;
+        }
+
+        assert log.isInfoEnabled() == true;
+
+        if (log.isDebugEnabled())
+            log.debug("This is 'debug' message.");
+
+        log.info("This is 'info' message.");
+        log.warning("This is 'warning' message.");
+        log.warning("This is 'warning' message.", new Exception(
+                "It's a test warning exception"));
+        log.error("This is 'error' message.");
+
+        assert log.getLogger(GridLog4j2InitializedTest.class.getName()) instanceof Log4J2Logger;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java
new file mode 100644
index 0000000..4f5b5fd
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.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.logger.log4j2;
+
+import java.io.File;
+import java.util.UUID;
+
+import junit.framework.TestCase;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.logger.LoggerNodeIdAware;
+import org.apache.ignite.logger.log4j2.Log4J2Logger;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.junit.Test;
+
+/**
+ * Grid Log4j SPI test.
+ */
+public class GridLog4j2LoggingFileTest extends TestCase {
+    /** */
+    private IgniteLogger log;
+
+    /** {@inheritDoc} */
+    @Override
+    protected void setUp() throws Exception {
+        
+
+        File xml = GridTestUtils
+                .resolveIgnitePath("modules/core/src/test/config/log4j2-test.xml");
+
+        assert xml != null;
+        assert xml.exists() == true;
+
+        log = new Log4J2Logger(xml).getLogger(getClass());
+        ((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
+
+    }
+
+    /**
+     * Tests log4j logging SPI.
+     */
+    @Test
+    public void testLog() {
+        assert log.isDebugEnabled() == true;
+        assert log.isInfoEnabled() == true;
+
+        log.debug("This is 'debug' message.");
+        log.info("This is 'info' message.");
+        log.warning("This is 'warning' message.");
+        log.warning("This is 'warning' message.", new Exception(
+                "It's a test warning exception"));
+        log.error("This is 'error' message.");
+        log.error("This is 'error' message.", new Exception(
+                "It's a test error exception"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java~
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java~ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java~
new file mode 100644
index 0000000..c414bdf
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2LoggingFileTest.java~
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.logger.log4j2;
+
+import java.io.File;
+import java.util.UUID;
+
+import junit.framework.TestCase;
+
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.logger.LoggerNodeIdAware;
+import org.apache.ignite.logger.log4j2.Log4J2Logger;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.junit.Test;
+
+/**
+ * Grid Log4j SPI test.
+ */
+public class GridLog4j2LoggingFileTest extends TestCase {
+    /** */
+    private IgniteLogger log;
+
+    /** {@inheritDoc} */
+    @Override
+    protected void setUp() throws Exception {
+        
+        System.setProperty("IGNITE_HOME",
+                "/home/glutters/Documenti/apache-ignite/commit-patch-788/incubator-ignite");
+
+        File xml = GridTestUtils
+                .resolveIgnitePath("modules/core/src/test/config/log4j2-test.xml");
+
+        assert xml != null;
+        assert xml.exists() == true;
+
+        log = new Log4J2Logger(xml).getLogger(getClass());
+        ((LoggerNodeIdAware) log).setNodeId(UUID.randomUUID());
+
+    }
+
+    /**
+     * Tests log4j logging SPI.
+     */
+    @Test
+    public void testLog() {
+        assert log.isDebugEnabled() == true;
+        assert log.isInfoEnabled() == true;
+
+        log.debug("This is 'debug' message.");
+        log.info("This is 'info' message.");
+        log.warning("This is 'warning' message.");
+        log.warning("This is 'warning' message.", new Exception(
+                "It's a test warning exception"));
+        log.error("This is 'error' message.");
+        log.error("This is 'error' message.", new Exception(
+                "It's a test error exception"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/package-info.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/package-info.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/package-info.java
new file mode 100644
index 0000000..523478f
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/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 internal tests or test related classes and interfaces.
+ */
+package org.apache.ignite.logger.log4j2;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
new file mode 100644
index 0000000..d025332
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.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.testsuites;
+
+import org.apache.ignite.logger.log4j2.GridLog4j2CorrectFileNameTest;
+import org.apache.ignite.logger.log4j2.GridLog4j2InitializedTest;
+import org.apache.ignite.logger.log4j2.GridLog4j2LoggingFileTest;
+
+import junit.framework.TestSuite;
+
+/**
+ * Log4j2 logging tests.
+ */
+public class IgniteLog4j2TestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Log4j2 Logging Test Suite");
+
+        suite.addTest(new TestSuite(GridLog4j2InitializedTest.class));
+        suite.addTest(new TestSuite(GridLog4j2CorrectFileNameTest.class));
+        suite.addTest(new TestSuite(GridLog4j2LoggingFileTest.class));
+        return suite;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2ae259c..4d53d96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,7 @@
         <module>modules/jta</module>
         <module>modules/aws</module>
         <module>modules/log4j</module>
+        <module>modules/log4j2</module>
         <module>modules/slf4j</module>
         <module>modules/jcl</module>
         <module>modules/codegen</module>


[05/50] [abbrv] incubator-ignite git commit: master: back merge from ignite-752

Posted by an...@apache.org.
master: back merge from ignite-752


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

Branch: refs/heads/ignite-843
Commit: cff25e91ac16fb11f3790690ec28d39a729519d9
Parents: ae148f1
Author: dmagda <ma...@gmail.com>
Authored: Fri Jul 24 15:32:51 2015 +0300
Committer: dmagda <ma...@gmail.com>
Committed: Fri Jul 24 15:32:51 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  35 +-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  58 +++
 .../spi/IgniteSpiOperationTimeoutException.java |  43 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    | 102 ++++
 .../communication/tcp/TcpCommunicationSpi.java  | 122 ++++-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  52 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 509 +++++++++++--------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  11 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 135 +++--
 .../tcp/internal/TcpDiscoveryNode.java          |  21 +
 .../TcpDiscoveryConnectionCheckMessage.java     |  64 +++
 .../IgniteClientReconnectAbstractTest.java      |   4 +-
 .../GridTcpCommunicationSpiAbstractTest.java    |   2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |   3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |  54 ++
 ...GridTcpCommunicationSpiRecoverySelfTest.java |  23 +-
 ...unicationSpiTcpFailureDetectionSelfTest.java |  75 +++
 .../discovery/AbstractDiscoverySelfTest.java    |  23 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 205 ++++++++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 116 +++--
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  | 402 +++++++++++++++
 .../IgniteSpiCommunicationSelfTestSuite.java    |   3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   2 +
 24 files changed, 1749 insertions(+), 316 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/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 823ddcd..aac1754 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
@@ -190,6 +190,11 @@ public class IgniteConfiguration {
     /** Default value for cache sanity check enabled flag. */
     public static final boolean DFLT_CACHE_SANITY_CHECK_ENABLED = true;
 
+    /** Default failure detection timeout in millis. */
+    @SuppressWarnings("UnnecessaryBoxing")
+//    public static final Long DFLT_FAILURE_DETECTION_TIMEOUT = new Long(10_000);
+    public static final Long DFLT_FAILURE_DETECTION_TIMEOUT = new Long(10_000);
+
     /** Optional grid name. */
     private String gridName;
 
@@ -367,6 +372,9 @@ public class IgniteConfiguration {
     /** Port number range for time server. */
     private int timeSrvPortRange = DFLT_TIME_SERVER_PORT_RANGE;
 
+    /** Failure detection timeout. */
+    private Long failureDetectionTimeout = DFLT_FAILURE_DETECTION_TIMEOUT;
+
     /** Property names to include into node attributes. */
     private String[] includeProps;
 
@@ -449,7 +457,7 @@ public class IgniteConfiguration {
         consistentId = cfg.getConsistentId();
         deployMode = cfg.getDeploymentMode();
         discoStartupDelay = cfg.getDiscoveryStartupDelay();
-        pubPoolSize = cfg.getPublicThreadPoolSize();
+        failureDetectionTimeout = cfg.getFailureDetectionTimeout();
         ggHome = cfg.getIgniteHome();
         ggWork = cfg.getWorkDirectory();
         gridName = cfg.getGridName();
@@ -479,6 +487,7 @@ public class IgniteConfiguration {
         p2pMissedCacheSize = cfg.getPeerClassLoadingMissedResourcesCacheSize();
         p2pPoolSize = cfg.getPeerClassLoadingThreadPoolSize();
         pluginCfgs = cfg.getPluginConfigurations();
+        pubPoolSize = cfg.getPublicThreadPoolSize();
         segChkFreq = cfg.getSegmentCheckFrequency();
         segPlc = cfg.getSegmentationPolicy();
         segResolveAttempts = cfg.getSegmentationResolveAttempts();
@@ -1655,6 +1664,30 @@ public class IgniteConfiguration {
     }
 
     /**
+     * Returns failure detection timeout used by {@link TcpDiscoverySpi} and {@link TcpCommunicationSpi}.
+     * <p>
+     * Default is {@link #DFLT_FAILURE_DETECTION_TIMEOUT}.
+     *
+     * @see #setFailureDetectionTimeout(long)
+     * @return Failure detection timeout in milliseconds.
+     */
+    public Long getFailureDetectionTimeout() {
+        return failureDetectionTimeout;
+    }
+
+    /**
+     * Sets failure detection timeout to use in {@link TcpDiscoverySpi} and {@link TcpCommunicationSpi}.
+     * <p>
+     * Failure detection timeout is used to determine how long the communication or discovery SPIs should wait before
+     * considering a remote connection failed.
+     *
+     * @param failureDetectionTimeout Failure detection timeout in milliseconds.
+     */
+    public void setFailureDetectionTimeout(long failureDetectionTimeout) {
+        this.failureDetectionTimeout = failureDetectionTimeout;
+    }
+
+    /**
      * Should return fully configured load balancing SPI implementation. If not provided,
      * {@link RoundRobinLoadBalancingSpi} will be used.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 2f3def9..f809d82 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -19,6 +19,7 @@ package org.apache.ignite.spi;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.managers.communication.*;
@@ -74,6 +75,15 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
     /** Local node. */
     private ClusterNode locNode;
 
+    /** Failure detection timeout usage switch. */
+    private boolean failureDetectionTimeoutEnabled = true;
+
+    /**
+     *  Failure detection timeout. Initialized with the value of
+     *  {@link IgniteConfiguration#getFailureDetectionTimeout()}.
+     */
+    private long failureDetectionTimeout;
+
     /**
      * Creates new adapter and initializes it from the current (this) class.
      * SPI name will be initialized to the simple name of the class
@@ -583,6 +593,54 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
     }
 
     /**
+     * Initiates and checks failure detection timeout value.
+     */
+    protected void initFailureDetectionTimeout() {
+        if (failureDetectionTimeoutEnabled) {
+            failureDetectionTimeout = ignite.configuration().getFailureDetectionTimeout();
+
+            if (failureDetectionTimeout <= 0)
+                throw new IgniteSpiException("Invalid failure detection timeout value: " + failureDetectionTimeout);
+            else if (failureDetectionTimeout <= 10)
+                // Because U.currentTimeInMillis() is updated once in 10 milliseconds.
+                log.warning("Failure detection timeout is too low, it may lead to unpredictable behaviour " +
+                    "[failureDetectionTimeout=" + failureDetectionTimeout + ']');
+        }
+        // Intentionally compare references using '!=' below
+        else if (ignite.configuration().getFailureDetectionTimeout() !=
+                IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT)
+            log.warning("Failure detection timeout will be ignored (one of SPI parameters has been set explicitly)");
+
+    }
+
+    /**
+     * Enables or disables failure detection timeout.
+     *
+     * @param enabled {@code true} if enable, {@code false} otherwise.
+     */
+    public void failureDetectionTimeoutEnabled(boolean enabled) {
+        failureDetectionTimeoutEnabled = enabled;
+    }
+
+    /**
+     * Checks whether failure detection timeout is enabled for this {@link IgniteSpi}.
+     *
+     * @return {@code true} if enabled, {@code false} otherwise.
+     */
+    public boolean failureDetectionTimeoutEnabled() {
+        return failureDetectionTimeoutEnabled;
+    }
+
+    /**
+     * Returns failure detection timeout set to use for network related operations.
+     *
+     * @return failure detection timeout in milliseconds or {@code 0} if the timeout is disabled.
+     */
+    public long failureDetectionTimeout() {
+        return failureDetectionTimeout;
+    }
+
+    /**
      * Temporarily SPI context.
      */
     private class GridDummySpiContext implements IgniteSpiContext {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
new file mode 100644
index 0000000..0e34cf2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.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.spi;
+
+import org.apache.ignite.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.configuration.*;
+
+/**
+ * Kind of exception that is used when failure detection timeout is enabled for {@link TcpDiscoverySpi} or
+ * {@link TcpCommunicationSpi}.
+ *
+ * For more information refer to {@link IgniteConfiguration#setFailureDetectionTimeout(long)} and
+ * {@link IgniteSpiOperationTimeoutHelper}.
+ */
+public class IgniteSpiOperationTimeoutException extends IgniteCheckedException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Constructor.
+     * @param msg Error message.
+     */
+    public IgniteSpiOperationTimeoutException(String msg) {
+        super(msg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
new file mode 100644
index 0000000..f7d8daa
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.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.spi;
+
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.net.*;
+
+/**
+ * Object that incorporates logic that determines a timeout value for the next network related operation and checks
+ * whether a failure detection timeout is reached or not.
+ *
+ * A new instance of the class should be created for every complex network based operations that usually consists of
+ * request and response parts.
+ */
+public class IgniteSpiOperationTimeoutHelper {
+    /** */
+    private long lastOperStartTs;
+
+    /** */
+    private long timeout;
+
+    /** */
+    private final boolean failureDetectionTimeoutEnabled;
+
+    /** */
+    private final long failureDetectionTimeout;
+
+    /**
+     * Constructor.
+     *
+     * @param adapter SPI adapter.
+     */
+    public IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter) {
+        failureDetectionTimeoutEnabled = adapter.failureDetectionTimeoutEnabled();
+        failureDetectionTimeout = adapter.failureDetectionTimeout();
+    }
+
+    /**
+     * Returns a timeout value to use for the next network operation.
+     *
+     * If failure detection timeout is enabled then the returned value is a portion of time left since the last time
+     * this method is called. If the timeout is disabled then {@code dfltTimeout} is returned.
+     *
+     * @param dfltTimeout Timeout to use if failure detection timeout is disabled.
+     * @return Timeout in milliseconds.
+     * @throws IgniteSpiOperationTimeoutException If failure detection timeout is reached for an operation that uses
+     * this {@code IgniteSpiOperationTimeoutController}.
+     */
+    public long nextTimeoutChunk(long dfltTimeout) throws IgniteSpiOperationTimeoutException {
+        if (!failureDetectionTimeoutEnabled)
+            return dfltTimeout;
+
+        if (lastOperStartTs == 0) {
+            timeout = failureDetectionTimeout;
+            lastOperStartTs = U.currentTimeMillis();
+        }
+        else {
+            long curTs = U.currentTimeMillis();
+
+            timeout = timeout - (curTs - lastOperStartTs);
+
+            lastOperStartTs = curTs;
+
+            if (timeout <= 0)
+                throw new IgniteSpiOperationTimeoutException("Network operation timed out. Increase " +
+                    "'failureDetectionTimeout' configuration property [failureDetectionTimeout="
+                    + failureDetectionTimeout + ']');
+        }
+
+        return timeout;
+    }
+
+    /**
+     * Checks whether the given {@link Exception} is generated because failure detection timeout has been reached.
+     *
+     * @param e Exception.
+     * @return {@code true} if failure detection timeout is reached, {@code false} otherwise.
+     */
+    public boolean checkFailureTimeoutReached(Exception e) {
+        if (!failureDetectionTimeoutEnabled)
+            return false;
+
+        return e instanceof IgniteSpiOperationTimeoutException || e instanceof SocketTimeoutException ||
+            X.hasCause(e, IgniteSpiOperationTimeoutException.class, SocketException.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/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 e9fd696..7be1dbc 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -73,7 +73,21 @@ import static org.apache.ignite.events.EventType.*;
  * {@link #DFLT_IDLE_CONN_TIMEOUT} period and then are closed. Use
  * {@link #setIdleConnectionTimeout(long)} configuration parameter to configure
  * you own idle connection timeout.
+ * <h1 class="header">Failure Detection</h1>
+ * Configuration defaults (see Configuration section below and
+ * {@link IgniteConfiguration#getFailureDetectionTimeout()}) for details) are chosen to make possible for
+ * communication SPI work reliably on most of hardware and virtual deployments, but this has made failure detection
+ * time worse.
  * <p>
+ * If it's needed to tune failure detection then it's highly recommended to do this using
+ * {@link IgniteConfiguration#setFailureDetectionTimeout(long)}. This failure timeout automatically controls the
+ * following parameters: {@link #getConnectTimeout()}, {@link #getMaxConnectTimeout()},
+ * {@link #getReconnectCount()}. If any of those parameters is set explicitly, then the failure timeout setting will be
+ * ignored.
+ * <p>
+ * If it's required to perform advanced settings of failure detection and
+ * {@link IgniteConfiguration#getFailureDetectionTimeout()} is unsuitable then various {@code TcpCommunicationSpi}
+ * configuration parameters may be used.
  * <h1 class="header">Configuration</h1>
  * <h2 class="header">Mandatory</h2>
  * This SPI has no mandatory configuration parameters.
@@ -991,12 +1005,16 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * {@code 0} is interpreted as infinite timeout.
      * <p>
      * If not provided, default value is {@link #DFLT_CONN_TIMEOUT}.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param connTimeout Connect timeout.
      */
     @IgniteSpiConfiguration(optional = true)
     public void setConnectTimeout(long connTimeout) {
         this.connTimeout = connTimeout;
+
+        failureDetectionTimeoutEnabled(false);
     }
 
     /** {@inheritDoc} */
@@ -1013,12 +1031,16 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * {@code 0} is interpreted as infinite timeout.
      * <p>
      * If not provided, default value is {@link #DFLT_MAX_CONN_TIMEOUT}.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param maxConnTimeout Maximum connect timeout.
      */
     @IgniteSpiConfiguration(optional = true)
     public void setMaxConnectTimeout(long maxConnTimeout) {
         this.maxConnTimeout = maxConnTimeout;
+
+        failureDetectionTimeoutEnabled(false);
     }
 
     /** {@inheritDoc} */
@@ -1031,12 +1053,16 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * with remote nodes.
      * <p>
      * If not provided, default value is {@link #DFLT_RECONNECT_CNT}.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param reconCnt Maximum number of reconnection attempts.
      */
     @IgniteSpiConfiguration(optional = true)
     public void setReconnectCount(int reconCnt) {
         this.reconCnt = reconCnt;
+
+        failureDetectionTimeoutEnabled(false);
     }
 
     /** {@inheritDoc} */
@@ -1264,6 +1290,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
     /** {@inheritDoc} */
     @Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
+        initFailureDetectionTimeout();
+
         assertParameter(locPort > 1023, "locPort > 1023");
         assertParameter(locPort <= 0xffff, "locPort < 0xffff");
         assertParameter(locPortRange >= 0, "locPortRange >= 0");
@@ -1272,10 +1300,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         assertParameter(sockSndBuf >= 0, "sockSndBuf >= 0");
         assertParameter(msgQueueLimit >= 0, "msgQueueLimit >= 0");
         assertParameter(shmemPort > 0 || shmemPort == -1, "shmemPort > 0 || shmemPort == -1");
-        assertParameter(reconCnt > 0, "reconnectCnt > 0");
         assertParameter(selectorsCnt > 0, "selectorsCnt > 0");
-        assertParameter(connTimeout >= 0, "connTimeout >= 0");
-        assertParameter(maxConnTimeout >= connTimeout, "maxConnTimeout >= connTimeout");
+
+        if (!failureDetectionTimeoutEnabled()) {
+            assertParameter(reconCnt > 0, "reconnectCnt > 0");
+            assertParameter(connTimeout >= 0, "connTimeout >= 0");
+            assertParameter(maxConnTimeout >= connTimeout, "maxConnTimeout >= connTimeout");
+        }
+
         assertParameter(sockWriteTimeout >= 0, "sockWriteTimeout >= 0");
         assertParameter(ackSndThreshold > 0, "ackSndThreshold > 0");
         assertParameter(unackedMsgsBufSize >= 0, "unackedMsgsBufSize >= 0");
@@ -1351,9 +1383,15 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
             log.debug(configInfo("sockRcvBuf", sockRcvBuf));
             log.debug(configInfo("shmemPort", shmemPort));
             log.debug(configInfo("msgQueueLimit", msgQueueLimit));
-            log.debug(configInfo("connTimeout", connTimeout));
-            log.debug(configInfo("maxConnTimeout", maxConnTimeout));
-            log.debug(configInfo("reconCnt", reconCnt));
+
+            if (failureDetectionTimeoutEnabled()) {
+                log.debug(configInfo("connTimeout", connTimeout));
+                log.debug(configInfo("maxConnTimeout", maxConnTimeout));
+                log.debug(configInfo("reconCnt", reconCnt));
+            }
+            else
+                log.debug(configInfo("failureDetectionTimeout", failureDetectionTimeout()));
+
             log.debug(configInfo("sockWriteTimeout", sockWriteTimeout));
             log.debug(configInfo("ackSndThreshold", ackSndThreshold));
             log.debug(configInfo("unackedMsgsBufSize", unackedMsgsBufSize));
@@ -1906,17 +1944,22 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
         long connTimeout0 = connTimeout;
 
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this);
+
         while (true) {
             GridCommunicationClient client;
 
             try {
                 client = new GridShmemCommunicationClient(metricsLsnr,
                     port,
-                    connTimeout,
+                    timeoutHelper.nextTimeoutChunk(connTimeout),
                     log,
                     getSpiContext().messageFormatter());
             }
             catch (IgniteCheckedException e) {
+                if (timeoutHelper.checkFailureTimeoutReached(e))
+                    throw e;
+
                 // Reconnect for the second time, if connection is not established.
                 if (connectAttempts < 2 && X.hasCause(e, ConnectException.class)) {
                     connectAttempts++;
@@ -1928,15 +1971,25 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
             }
 
             try {
-                safeHandshake(client, null, node.id(), connTimeout0);
+                safeHandshake(client, null, node.id(), timeoutHelper.nextTimeoutChunk(connTimeout0));
             }
-            catch (HandshakeTimeoutException e) {
+            catch (HandshakeTimeoutException | IgniteSpiOperationTimeoutException e) {
+                client.forceClose();
+
+                if (failureDetectionTimeoutEnabled() && (e instanceof HandshakeTimeoutException ||
+                    timeoutHelper.checkFailureTimeoutReached(e))) {
+                    log.debug("Handshake timed out (failure threshold reached) [failureDetectionTimeout=" +
+                        failureDetectionTimeout() + ", err=" + e.getMessage() + ", client=" + client + ']');
+
+                    throw e;
+                }
+
+                assert !failureDetectionTimeoutEnabled();
+
                 if (log.isDebugEnabled())
-                    log.debug("Handshake timedout (will retry with increased timeout) [timeout=" + connTimeout0 +
+                    log.debug("Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout0 +
                         ", err=" + e.getMessage() + ", client=" + client + ']');
 
-                client.forceClose();
-
                 if (attempt == reconCnt || connTimeout0 > maxConnTimeout) {
                     if (log.isDebugEnabled())
                         log.debug("Handshake timedout (will stop attempts to perform the handshake) " +
@@ -2050,6 +2103,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
             int attempt = 1;
 
+            IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this);
+
             while (!conn) { // Reconnection on handshake timeout.
                 try {
                     SocketChannel ch = SocketChannel.open();
@@ -2076,9 +2131,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     long rcvCnt = -1;
 
                     try {
-                        ch.socket().connect(addr, (int)connTimeout);
+                        ch.socket().connect(addr, (int)timeoutHelper.nextTimeoutChunk(connTimeout));
 
-                        rcvCnt = safeHandshake(ch, recoveryDesc, node.id(), connTimeout0);
+                        rcvCnt = safeHandshake(ch, recoveryDesc, node.id(),
+                            timeoutHelper.nextTimeoutChunk(connTimeout0));
 
                         if (rcvCnt == -1)
                             return null;
@@ -2112,19 +2168,43 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         }
                     }
                 }
-                catch (HandshakeTimeoutException e) {
+                catch (HandshakeTimeoutException | IgniteSpiOperationTimeoutException e) {
                     if (client != null) {
                         client.forceClose();
 
                         client = null;
                     }
 
+                    if (failureDetectionTimeoutEnabled() && (e instanceof HandshakeTimeoutException ||
+                        timeoutHelper.checkFailureTimeoutReached(e))) {
+
+                        String msg = "Handshake timed out (failure detection timeout is reached) " +
+                            "[failureDetectionTimeout=" + failureDetectionTimeout() + ", addr=" + addr + ']';
+
+                        onException(msg, e);
+
+                        if (log.isDebugEnabled())
+                            log.debug(msg);
+
+                        if (errs == null)
+                            errs = new IgniteCheckedException("Failed to connect to node (is node still alive?). " +
+                                "Make sure that each GridComputeTask and GridCacheTransaction has a timeout set " +
+                                "in order to prevent parties from waiting forever in case of network issues " +
+                                "[nodeId=" + node.id() + ", addrs=" + addrs + ']');
+
+                        errs.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + addr, e));
+
+                        break;
+                    }
+
+                    assert !failureDetectionTimeoutEnabled();
+
                     onException("Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout0 +
                         ", addr=" + addr + ']', e);
 
                     if (log.isDebugEnabled())
                         log.debug(
-                            "Handshake timedout (will retry with increased timeout) [timeout=" + connTimeout0 +
+                            "Handshake timed out (will retry with increased timeout) [timeout=" + connTimeout0 +
                                 ", addr=" + addr + ", err=" + e + ']');
 
                     if (attempt == reconCnt || connTimeout0 > maxConnTimeout) {
@@ -2164,7 +2244,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     if (log.isDebugEnabled())
                         log.debug("Client creation failed [addr=" + addr + ", err=" + e + ']');
 
-                    if (X.hasCause(e, SocketTimeoutException.class))
+                    boolean failureDetThrReached = timeoutHelper.checkFailureTimeoutReached(e);
+
+                    if (failureDetThrReached)
+                        LT.warn(log, null, "Connect timed out (consider increasing 'failureDetectionTimeout' " +
+                            "configuration property) [addr=" + addr + ", failureDetectionTimeout=" +
+                            failureDetectionTimeout() + ']');
+                    else if (X.hasCause(e, SocketTimeoutException.class))
                         LT.warn(log, null, "Connect timed out (consider increasing 'connTimeout' " +
                             "configuration property) [addr=" + addr + ", connTimeout=" + connTimeout + ']');
 
@@ -2177,7 +2263,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     errs.addSuppressed(new IgniteCheckedException("Failed to connect to address: " + addr, e));
 
                     // Reconnect for the second time, if connection is not established.
-                    if (connectAttempts < 2 &&
+                    if (!failureDetThrReached && connectAttempts < 2 &&
                         (e instanceof ConnectException || X.hasCause(e, ConnectException.class))) {
                         connectAttempts++;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 572ba2c..12b10b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -480,13 +480,17 @@ class ClientImpl extends TcpDiscoveryImpl {
 
         Collection<Throwable> errs = null;
 
-        long ackTimeout0 = spi.ackTimeout;
+        long ackTimeout0 = spi.getAckTimeout();
+
+        int reconCnt = 0;
 
         int connectAttempts = 1;
 
         UUID locNodeId = getLocalNodeId();
 
-        for (int i = 0; i < spi.reconCnt; i++) {
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+
+        while (true) {
             boolean openSock = false;
 
             Socket sock = null;
@@ -494,7 +498,7 @@ class ClientImpl extends TcpDiscoveryImpl {
             try {
                 long tstamp = U.currentTimeMillis();
 
-                sock = spi.openSocket(addr);
+                sock = spi.openSocket(addr, timeoutHelper);
 
                 openSock = true;
 
@@ -502,7 +506,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                 req.client(true);
 
-                spi.writeToSocket(sock, req);
+                spi.writeToSocket(sock, req, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
 
                 TcpDiscoveryHandshakeResponse res = spi.readMessage(sock, null, ackTimeout0);
 
@@ -532,7 +536,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                 msg.client(true);
 
-                spi.writeToSocket(sock, msg);
+                spi.writeToSocket(sock, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
 
                 spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
 
@@ -540,7 +544,8 @@ class ClientImpl extends TcpDiscoveryImpl {
                     log.debug("Message has been sent to address [msg=" + msg + ", addr=" + addr +
                         ", rmtNodeId=" + rmtNodeId + ']');
 
-                return new T3<>(sock, spi.readReceipt(sock, ackTimeout0), res.clientAck());
+                return new T3<>(sock, spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0)),
+                    res.clientAck());
             }
             catch (IOException | IgniteCheckedException e) {
                 U.closeQuiet(sock);
@@ -555,6 +560,12 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                 errs.add(e);
 
+                if (timeoutHelper.checkFailureTimeoutReached(e))
+                    break;
+
+                if (!spi.failureDetectionTimeoutEnabled() && ++reconCnt == spi.getReconnectCount())
+                    break;
+
                 if (!openSock) {
                     // Reconnect for the second time, if connection is not established.
                     if (connectAttempts < 2) {
@@ -566,7 +577,8 @@ class ClientImpl extends TcpDiscoveryImpl {
                     break; // Don't retry if we can not establish connection.
                 }
 
-                if (e instanceof SocketTimeoutException || X.hasCause(e, SocketTimeoutException.class)) {
+                if (!spi.failureDetectionTimeoutEnabled() && (e instanceof SocketTimeoutException ||
+                    X.hasCause(e, SocketTimeoutException.class))) {
                     ackTimeout0 *= 2;
 
                     if (!checkAckTimeout(ackTimeout0))
@@ -868,6 +880,9 @@ class ClientImpl extends TcpDiscoveryImpl {
         private final Queue<TcpDiscoveryAbstractMessage> queue = new ArrayDeque<>();
 
         /** */
+        private final long socketTimeout;
+
+        /** */
         private TcpDiscoveryAbstractMessage unackedMsg;
 
         /**
@@ -875,6 +890,9 @@ class ClientImpl extends TcpDiscoveryImpl {
          */
         protected SocketWriter() {
             super(spi.ignite().name(), "tcp-client-disco-sock-writer", log);
+
+            socketTimeout = spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() :
+                spi.getSocketTimeout();
         }
 
         /**
@@ -968,12 +986,13 @@ class ClientImpl extends TcpDiscoveryImpl {
                         }
                     }
 
-                    spi.writeToSocket(sock, msg);
+                    spi.writeToSocket(sock, msg, socketTimeout);
 
                     msg = null;
 
                     if (ack) {
-                        long waitEnd = U.currentTimeMillis() + spi.ackTimeout;
+                        long waitEnd = U.currentTimeMillis() + (spi.failureDetectionTimeoutEnabled() ?
+                            spi.failureDetectionTimeout() : spi.getAckTimeout());
 
                         TcpDiscoveryAbstractMessage unacked;
 
@@ -989,7 +1008,10 @@ class ClientImpl extends TcpDiscoveryImpl {
                         if (unacked != null) {
                             if (log.isDebugEnabled())
                                 log.debug("Failed to get acknowledge for message, will try to reconnect " +
-                                "[msg=" + unacked + ", timeout=" + spi.ackTimeout + ']');
+                                "[msg=" + unacked +
+                                (spi.failureDetectionTimeoutEnabled() ?
+                                ", failureDetectionTimeout=" + spi.failureDetectionTimeout() :
+                                ", timeout=" + spi.getAckTimeout()) + ']');
 
                             throw new IOException("Failed to get acknowledge for message: " + unacked);
                         }
@@ -1068,11 +1090,11 @@ class ClientImpl extends TcpDiscoveryImpl {
                         if (join) {
                             joinError(new IgniteSpiException("Join process timed out, connection failed and " +
                                 "failed to reconnect (consider increasing 'joinTimeout' configuration property) " +
-                                "[networkTimeout=" + spi.joinTimeout + ", sock=" + sock + ']'));
+                                "[joinTimeout=" + spi.joinTimeout + ", sock=" + sock + ']'));
                         }
                         else
-                            U.error(log, "Failed to reconnect to cluster (consider increasing 'networkTimeout' " +
-                                "configuration property) [networkTimeout=" + spi.netTimeout + ", sock=" + sock + ']');
+                            U.error(log, "Failed to reconnect to cluster (consider increasing 'networkTimeout'" +
+                                " configuration  property) [networkTimeout=" + spi.netTimeout + ", sock=" + sock + ']');
 
                         return;
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index dc343eb..b4f89ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -80,14 +80,6 @@ class ServerImpl extends TcpDiscoveryImpl {
     /** Client message workers. */
     protected ConcurrentMap<UUID, ClientMessageWorker> clientMsgWorkers = new ConcurrentHashMap8<>();
 
-    /** Metrics sender. */
-    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-    private HeartbeatsSender hbsSnd;
-
-    /** Status checker. */
-    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-    private CheckStatusSender chkStatusSnd;
-
     /** IP finder cleaner. */
     @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private IpFinderCleaner ipFinderCleaner;
@@ -229,12 +221,6 @@ class ServerImpl extends TcpDiscoveryImpl {
 
         spi.stats.onJoinFinished();
 
-        hbsSnd = new HeartbeatsSender();
-        hbsSnd.start();
-
-        chkStatusSnd = new CheckStatusSender();
-        chkStatusSnd.start();
-
         if (spi.ipFinder.isShared()) {
             ipFinderCleaner = new IpFinderCleaner();
             ipFinderCleaner.start();
@@ -278,10 +264,10 @@ class ServerImpl extends TcpDiscoveryImpl {
             msgWorker.addMessage(new TcpDiscoveryNodeLeftMessage(locNode.id()));
 
             synchronized (mux) {
-                long threshold = U.currentTimeMillis() + spi.netTimeout;
-
                 long timeout = spi.netTimeout;
 
+                long threshold = U.currentTimeMillis() + timeout;
+
                 while (spiState != LEFT && timeout > 0) {
                     try {
                         mux.wait(timeout);
@@ -319,12 +305,6 @@ class ServerImpl extends TcpDiscoveryImpl {
         U.interrupt(tmp);
         U.joinThreads(tmp, log);
 
-        U.interrupt(hbsSnd);
-        U.join(hbsSnd, log);
-
-        U.interrupt(chkStatusSnd);
-        U.join(chkStatusSnd, log);
-
         U.interrupt(ipFinderCleaner);
         U.join(ipFinderCleaner, log);
 
@@ -482,6 +462,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
         UUID locNodeId = getLocalNodeId();
 
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+
         if (F.contains(spi.locNodeAddrs, addr)) {
             if (clientNodeId == null)
                 return F.t(getLocalNodeId(), false);
@@ -494,7 +476,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             boolean clientPingRes;
 
             try {
-                clientPingRes = clientWorker.ping();
+                clientPingRes = clientWorker.ping(timeoutHelper);
             }
             catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
@@ -517,18 +499,26 @@ class ServerImpl extends TcpDiscoveryImpl {
             try {
                 Socket sock = null;
 
-                for (int i = 0; i < spi.reconCnt; i++) {
+                int reconCnt = 0;
+
+                boolean openedSock = false;
+
+                while (true) {
                     try {
                         if (addr.isUnresolved())
                             addr = new InetSocketAddress(InetAddress.getByName(addr.getHostName()), addr.getPort());
 
                         long tstamp = U.currentTimeMillis();
 
-                        sock = spi.openSocket(addr);
+                        sock = spi.openSocket(addr, timeoutHelper);
 
-                        spi.writeToSocket(sock, new TcpDiscoveryPingRequest(locNodeId, clientNodeId));
+                        openedSock = true;
 
-                        TcpDiscoveryPingResponse res = spi.readMessage(sock, null, spi.netTimeout);
+                        spi.writeToSocket(sock, new TcpDiscoveryPingRequest(locNodeId, clientNodeId),
+                            timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
+
+                        TcpDiscoveryPingResponse res = spi.readMessage(sock, null, timeoutHelper.nextTimeoutChunk(
+                            spi.getAckTimeout()));
 
                         if (locNodeId.equals(res.creatorNodeId())) {
                             if (log.isDebugEnabled())
@@ -550,6 +540,16 @@ class ServerImpl extends TcpDiscoveryImpl {
                             errs = new ArrayList<>();
 
                         errs.add(e);
+
+                        reconCnt++;
+
+                        if (!openedSock && reconCnt == 2)
+                            break;
+
+                        if (timeoutHelper.checkFailureTimeoutReached(e))
+                            break;
+                        else if (!spi.failureDetectionTimeoutEnabled() && reconCnt == spi.getReconnectCount())
+                            break;
                     }
                     finally {
                         U.closeQuiet(sock);
@@ -607,6 +607,12 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
     }
 
+    /** {@inheritDoc} */
+    @Override protected void onDataReceived() {
+        if (spi.failureDetectionTimeoutEnabled() && locNode != null)
+            locNode.lastDataReceivedTime(U.currentTimeMillis());
+    }
+
     /**
      * Tries to join this node to topology.
      *
@@ -678,10 +684,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                 log.debug("Join request message has been sent (waiting for coordinator response).");
 
             synchronized (mux) {
-                long threshold = U.currentTimeMillis() + spi.netTimeout;
-
                 long timeout = spi.netTimeout;
 
+                long threshold = U.currentTimeMillis() + timeout;
+
                 while (spiState == CONNECTING && timeout > 0) {
                     try {
                         mux.wait(timeout);
@@ -883,15 +889,19 @@ class ServerImpl extends TcpDiscoveryImpl {
 
         Collection<Throwable> errs = null;
 
-        long ackTimeout0 = spi.ackTimeout;
+        long ackTimeout0 = spi.getAckTimeout();
 
         int connectAttempts = 1;
 
-        boolean joinReqSent = false;
+        boolean joinReqSent;
 
         UUID locNodeId = getLocalNodeId();
 
-        for (int i = 0; i < spi.reconCnt; i++) {
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+
+        int reconCnt = 0;
+
+        while (true){
             // Need to set to false on each new iteration,
             // since remote node may leave in the middle of the first iteration.
             joinReqSent = false;
@@ -903,14 +913,16 @@ class ServerImpl extends TcpDiscoveryImpl {
             try {
                 long tstamp = U.currentTimeMillis();
 
-                sock = spi.openSocket(addr);
+                sock = spi.openSocket(addr, timeoutHelper);
 
                 openSock = true;
 
                 // Handshake.
-                spi.writeToSocket(sock, new TcpDiscoveryHandshakeRequest(locNodeId));
+                spi.writeToSocket(sock, new TcpDiscoveryHandshakeRequest(locNodeId), timeoutHelper.nextTimeoutChunk(
+                    spi.getSocketTimeout()));
 
-                TcpDiscoveryHandshakeResponse res = spi.readMessage(sock, null, ackTimeout0);
+                TcpDiscoveryHandshakeResponse res = spi.readMessage(sock, null, timeoutHelper.nextTimeoutChunk(
+                    ackTimeout0));
 
                 if (locNodeId.equals(res.creatorNodeId())) {
                     if (log.isDebugEnabled())
@@ -924,7 +936,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 // Send message.
                 tstamp = U.currentTimeMillis();
 
-                spi.writeToSocket(sock, msg);
+                spi.writeToSocket(sock, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
 
                 spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
 
@@ -941,7 +953,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 // E.g. due to class not found issue.
                 joinReqSent = msg instanceof TcpDiscoveryJoinRequestMessage;
 
-                return spi.readReceipt(sock, ackTimeout0);
+                return spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
             }
             catch (ClassCastException e) {
                 // This issue is rarely reproducible on AmazonEC2, but never
@@ -967,6 +979,12 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 errs.add(e);
 
+                if (timeoutHelper.checkFailureTimeoutReached(e))
+                    break;
+
+                if (!spi.failureDetectionTimeoutEnabled() && ++reconCnt == spi.getReconnectCount())
+                    break;
+
                 if (!openSock) {
                     // Reconnect for the second time, if connection is not established.
                     if (connectAttempts < 2) {
@@ -978,7 +996,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                     break; // Don't retry if we can not establish connection.
                 }
 
-                if (e instanceof SocketTimeoutException || X.hasCause(e, SocketTimeoutException.class)) {
+                if (!spi.failureDetectionTimeoutEnabled() && (e instanceof SocketTimeoutException ||
+                    X.hasCause(e, SocketTimeoutException.class))) {
                     ackTimeout0 *= 2;
 
                     if (!checkAckTimeout(ackTimeout0))
@@ -1256,12 +1275,6 @@ class ServerImpl extends TcpDiscoveryImpl {
         U.interrupt(tcpSrvr);
         U.join(tcpSrvr, log);
 
-        U.interrupt(hbsSnd);
-        U.join(hbsSnd, log);
-
-        U.interrupt(chkStatusSnd);
-        U.join(chkStatusSnd, log);
-
         U.interrupt(ipFinderCleaner);
         U.join(ipFinderCleaner, log);
 
@@ -1350,8 +1363,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             b.append("Internal threads: ").append(U.nl());
 
             b.append("    Message worker: ").append(threadStatus(msgWorker)).append(U.nl());
-            b.append("    Check status sender: ").append(threadStatus(chkStatusSnd)).append(U.nl());
-            b.append("    HB sender: ").append(threadStatus(hbsSnd)).append(U.nl());
+
             b.append("    IP finder cleaner: ").append(threadStatus(ipFinderCleaner)).append(U.nl());
             b.append("    Stats printer: ").append(threadStatus(statsPrinter)).append(U.nl());
 
@@ -1398,7 +1410,8 @@ class ServerImpl extends TcpDiscoveryImpl {
     private boolean recordable(TcpDiscoveryAbstractMessage msg) {
         return !(msg instanceof TcpDiscoveryHeartbeatMessage) &&
             !(msg instanceof TcpDiscoveryStatusCheckMessage) &&
-            !(msg instanceof TcpDiscoveryDiscardMessage);
+            !(msg instanceof TcpDiscoveryDiscardMessage) &&
+            !(msg instanceof TcpDiscoveryConnectionCheckMessage);
     }
 
     /**
@@ -1434,112 +1447,6 @@ class ServerImpl extends TcpDiscoveryImpl {
     }
 
     /**
-     * Thread that sends heartbeats.
-     */
-    private class HeartbeatsSender extends IgniteSpiThread {
-        /**
-         * Constructor.
-         */
-        private HeartbeatsSender() {
-            super(spi.ignite().name(), "tcp-disco-hb-sender", log);
-
-            setPriority(spi.threadPri);
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("BusyWait")
-        @Override protected void body() throws InterruptedException {
-            while (!isLocalNodeCoordinator())
-                Thread.sleep(1000);
-
-            if (log.isDebugEnabled())
-                log.debug("Heartbeats sender has been started.");
-
-            UUID nodeId = getConfiguredNodeId();
-
-            while (!isInterrupted()) {
-                if (spiStateCopy() != CONNECTED) {
-                    if (log.isDebugEnabled())
-                        log.debug("Stopping heartbeats sender (SPI is not connected to topology).");
-
-                    return;
-                }
-
-                TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(nodeId);
-
-                msg.verify(getLocalNodeId());
-
-                msgWorker.addMessage(msg);
-
-                Thread.sleep(spi.hbFreq);
-            }
-        }
-    }
-
-    /**
-     * Thread that sends status check messages to next node if local node has not
-     * been receiving heartbeats ({@link TcpDiscoveryHeartbeatMessage})
-     * for {@link TcpDiscoverySpi#getMaxMissedHeartbeats()} *
-     * {@link TcpDiscoverySpi#getHeartbeatFrequency()}.
-     */
-    private class CheckStatusSender extends IgniteSpiThread {
-        /**
-         * Constructor.
-         */
-        private CheckStatusSender() {
-            super(spi.ignite().name(), "tcp-disco-status-check-sender", log);
-
-            setPriority(spi.threadPri);
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings("BusyWait")
-        @Override protected void body() throws InterruptedException {
-            if (log.isDebugEnabled())
-                log.debug("Status check sender has been started.");
-
-            // Only 1 heartbeat missing is acceptable. Add 50 ms to avoid false alarm.
-            long checkTimeout = (long)spi.maxMissedHbs * spi.hbFreq + 50;
-
-            long lastSent = 0;
-
-            while (!isInterrupted()) {
-                // 1. Determine timeout.
-                if (lastSent < locNode.lastUpdateTime())
-                    lastSent = locNode.lastUpdateTime();
-
-                long timeout = (lastSent + checkTimeout) - U.currentTimeMillis();
-
-                if (timeout > 0)
-                    Thread.sleep(timeout);
-
-                // 2. Check if SPI is still connected.
-                if (spiStateCopy() != CONNECTED) {
-                    if (log.isDebugEnabled())
-                        log.debug("Stopping status check sender (SPI is not connected to topology).");
-
-                    return;
-                }
-
-                // 3. Was there an update?
-                if (locNode.lastUpdateTime() > lastSent || !ring.hasRemoteNodes()) {
-                    if (log.isDebugEnabled())
-                        log.debug("Skipping status check send " +
-                            "[locNodeLastUpdate=" + U.format(locNode.lastUpdateTime()) +
-                            ", hasRmts=" + ring.hasRemoteNodes() + ']');
-
-                    continue;
-                }
-
-                // 4. Send status check message.
-                lastSent = U.currentTimeMillis();
-
-                msgWorker.addMessage(new TcpDiscoveryStatusCheckMessage(locNode, null));
-            }
-        }
-    }
-
-    /**
      * Thread that cleans IP finder and keeps it in the correct state, unregistering
      * addresses of the nodes that has left the topology.
      * <p>
@@ -1861,10 +1768,49 @@ class ServerImpl extends TcpDiscoveryImpl {
         /** Socket. */
         private Socket sock;
 
+        /** Last time status message has been sent. */
+        private long lastTimeStatusMsgSent;
+
+        /** Incoming heartbeats check frequency. */
+        private long hbCheckFreq = (long)spi.maxMissedHbs * spi.hbFreq + 50;
+
+        /** Last time heartbeat message has been sent. */
+        private long lastTimeHbMsgSent;
+
+        /** Time when the last status message has been sent. */
+        private long lastTimeConnCheckMsgSent;
+
+        /** Flag that keeps info on whether the threshold is reached or not. */
+        private boolean failureThresholdReached;
+
+        /** Connection check frequency. */
+        private long connCheckFreq;
+
         /**
          */
         protected RingMessageWorker() {
-            super("tcp-disco-msg-worker");
+            super("tcp-disco-msg-worker", 10);
+
+            initConnectionCheckFrequency();
+        }
+
+        /**
+         * Initializes connection check frequency. Used only when failure detection timeout is enabled.
+         */
+        private void initConnectionCheckFrequency() {
+            if (spi.failureDetectionTimeoutEnabled()) {
+                for (int i = 3; i > 0; i--) {
+                    connCheckFreq = spi.failureDetectionTimeout() / i;
+
+                    if (connCheckFreq > 0)
+                        break;
+                }
+
+                assert connCheckFreq > 0;
+
+                if (log.isDebugEnabled())
+                    log.debug("Connection check frequency is calculated: " + connCheckFreq);
+            }
         }
 
         /**
@@ -1921,9 +1867,25 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (spi.ensured(msg))
                 msgHist.add(msg);
 
+            if (msg.senderNodeId() != null && !msg.senderNodeId().equals(getLocalNodeId()))
+                // Reset the flag.
+                failureThresholdReached = false;
+
             spi.stats.onMessageProcessingFinished(msg);
         }
 
+        /** {@inheritDoc} */
+        @Override protected void noMessageLoop() {
+            if (locNode == null)
+                return;
+
+            checkConnection();
+
+            sendHeartbeatMessage();
+
+            checkHeartbeatsReceiving();
+        }
+
         /**
          * Sends message across the ring.
          *
@@ -1990,7 +1952,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                         if (debugMode)
                             debugLog("No next node in topology.");
 
-                        if (ring.hasRemoteNodes()) {
+                        if (ring.hasRemoteNodes() && !(msg instanceof TcpDiscoveryConnectionCheckMessage) &&
+                            !(msg instanceof TcpDiscoveryStatusCheckMessage && msg.creatorNodeId().equals(locNodeId))) {
                             msg.senderNodeId(locNodeId);
 
                             addMessage(msg);
@@ -2027,7 +1990,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 List<InetSocketAddress> locNodeAddrs = U.arrayList(locNode.socketAddresses());
 
                 addr: for (InetSocketAddress addr : spi.getNodeAddresses(next, sameHost)) {
-                    long ackTimeout0 = spi.ackTimeout;
+                    long ackTimeout0 = spi.getAckTimeout();
 
                     if (locNodeAddrs.contains(addr)){
                         if (log.isDebugEnabled())
@@ -2037,8 +2000,15 @@ class ServerImpl extends TcpDiscoveryImpl {
                         continue;
                     }
 
-                    for (int i = 0; i < spi.reconCnt; i++) {
+                    int reconCnt = 0;
+
+                    IgniteSpiOperationTimeoutHelper timeoutHelper = null;
+
+                    while (true) {
                         if (sock == null) {
+                            if (timeoutHelper == null)
+                                timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+
                             nextNodeExists = false;
 
                             boolean success = false;
@@ -2049,14 +2019,16 @@ class ServerImpl extends TcpDiscoveryImpl {
                             try {
                                 long tstamp = U.currentTimeMillis();
 
-                                sock = spi.openSocket(addr);
+                                sock = spi.openSocket(addr, timeoutHelper);
 
                                 openSock = true;
 
                                 // Handshake.
-                                writeToSocket(sock, new TcpDiscoveryHandshakeRequest(locNodeId));
+                                writeToSocket(sock, new TcpDiscoveryHandshakeRequest(locNodeId),
+                                    timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
 
-                                TcpDiscoveryHandshakeResponse res = spi.readMessage(sock, null, ackTimeout0);
+                                TcpDiscoveryHandshakeResponse res = spi.readMessage(sock, null,
+                                    timeoutHelper.nextTimeoutChunk(ackTimeout0));
 
                                 if (locNodeId.equals(res.creatorNodeId())) {
                                     if (log.isDebugEnabled())
@@ -2140,8 +2112,13 @@ class ServerImpl extends TcpDiscoveryImpl {
                                 if (!openSock)
                                     break; // Don't retry if we can not establish connection.
 
-                                if (e instanceof SocketTimeoutException ||
-                                    X.hasCause(e, SocketTimeoutException.class)) {
+                                if (!spi.failureDetectionTimeoutEnabled() && ++reconCnt == spi.getReconnectCount())
+                                    break;
+
+                                if (timeoutHelper.checkFailureTimeoutReached(e))
+                                    break;
+                                else if (!spi.failureDetectionTimeoutEnabled() && (e instanceof
+                                    SocketTimeoutException || X.hasCause(e, SocketTimeoutException.class))) {
                                     ackTimeout0 *= 2;
 
                                     if (!checkAckTimeout(ackTimeout0))
@@ -2156,9 +2133,13 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                                     sock = null;
                                 }
-                                else
+                                else {
                                     // Next node exists and accepts incoming messages.
                                     nextNodeExists = true;
+                                    // Resetting timeout control object to let the code below to use a new one
+                                    // for the next bunch of operations.
+                                    timeoutHelper = null;
+                                }
                             }
                         }
 
@@ -2195,8 +2176,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                                     prepareNodeAddedMessage(pendingMsg, next.id(), pendingMsgs.msgs,
                                         pendingMsgs.discardId);
 
+                                    if (timeoutHelper == null)
+                                        timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+
                                     try {
-                                        writeToSocket(sock, pendingMsg);
+                                        writeToSocket(sock, pendingMsg, timeoutHelper.nextTimeoutChunk(
+                                            spi.getSocketTimeout()));
                                     }
                                     finally {
                                         clearNodeAddedMessage(pendingMsg);
@@ -2204,7 +2189,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                                     spi.stats.onMessageSent(pendingMsg, U.currentTimeMillis() - tstamp);
 
-                                    int res = spi.readReceipt(sock, ackTimeout0);
+                                    int res = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
 
                                     if (log.isDebugEnabled())
                                         log.debug("Pending message has been sent to next node [msg=" + msg.id() +
@@ -2215,19 +2200,34 @@ class ServerImpl extends TcpDiscoveryImpl {
                                         debugLog("Pending message has been sent to next node [msg=" + msg.id() +
                                             ", pendingMsgId=" + pendingMsg + ", next=" + next.id() +
                                             ", res=" + res + ']');
+
+                                    // Resetting timeout control object to create a new one for the next bunch of
+                                    // operations.
+                                    timeoutHelper = null;
                                 }
                             }
 
-                            prepareNodeAddedMessage(msg, next.id(), pendingMsgs.msgs, pendingMsgs.discardId);
+                            if (msg instanceof TcpDiscoveryConnectionCheckMessage) {
+                                if (!next.version().greaterThanEqual(TcpDiscoverySpi.FAILURE_DETECTION_MAJOR_VER,
+                                    TcpDiscoverySpi.FAILURE_DETECTION_MINOR_VER,
+                                    TcpDiscoverySpi.FAILURE_DETECTION_MAINT_VER))
+                                    // Preserve backward compatibility with nodes of older versions.
+                                    msg = new TcpDiscoveryStatusCheckMessage(locNode, null);
+                            }
+                            else
+                                prepareNodeAddedMessage(msg, next.id(), pendingMsgs.msgs, pendingMsgs.discardId);
 
                             try {
                                 long tstamp = U.currentTimeMillis();
 
-                                writeToSocket(sock, msg);
+                                if (timeoutHelper == null)
+                                    timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+
+                                writeToSocket(sock, msg, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
 
                                 spi.stats.onMessageSent(msg, U.currentTimeMillis() - tstamp);
 
-                                int res = spi.readReceipt(sock, ackTimeout0);
+                                int res = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
 
                                 if (log.isDebugEnabled())
                                     log.debug("Message has been sent to next node [msg=" + msg +
@@ -2262,11 +2262,19 @@ class ServerImpl extends TcpDiscoveryImpl {
                             onException("Failed to send message to next node [next=" + next.id() + ", msg=" + msg + ']',
                                 e);
 
-                            if (e instanceof SocketTimeoutException || X.hasCause(e, SocketTimeoutException.class)) {
-                                ackTimeout0 *= 2;
+                            if (timeoutHelper.checkFailureTimeoutReached(e))
+                                break;
 
-                                if (!checkAckTimeout(ackTimeout0))
+                            if (!spi.failureDetectionTimeoutEnabled()) {
+                                if (++reconCnt == spi.getReconnectCount())
                                     break;
+                                else if (e instanceof SocketTimeoutException ||
+                                    X.hasCause(e, SocketTimeoutException.class)) {
+                                    ackTimeout0 *= 2;
+
+                                    if (!checkAckTimeout(ackTimeout0))
+                                        break;
+                                }
                             }
                         }
                         finally {
@@ -2279,7 +2287,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                                 if (log.isDebugEnabled())
                                     log.debug("Message has not been sent [next=" + next.id() + ", msg=" + msg +
-                                        ", i=" + i + ']');
+                                        (!spi.failureDetectionTimeoutEnabled() ? ", i=" + reconCnt : "") + ']');
                             }
                         }
                     } // Try to reconnect.
@@ -3342,7 +3350,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                 }
                 else if (leftNode.equals(next) && sock != null) {
                     try {
-                        writeToSocket(sock, msg);
+                        writeToSocket(sock, msg, spi.failureDetectionTimeoutEnabled() ?
+                            spi.failureDetectionTimeout() : spi.getSocketTimeout());
 
                         if (log.isDebugEnabled())
                             log.debug("Sent verified node left message to leaving node: " + msg);
@@ -3991,6 +4000,77 @@ class ServerImpl extends TcpDiscoveryImpl {
                 }
             }
         }
+
+        /**
+         * Sends heartbeat message if needed.
+         */
+        private void sendHeartbeatMessage() {
+            if (!isLocalNodeCoordinator())
+                return;
+
+            long elapsed = (lastTimeHbMsgSent + spi.hbFreq) - U.currentTimeMillis();
+
+            if (elapsed > 0)
+                return;
+
+            TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(getConfiguredNodeId());
+
+            msg.verify(getLocalNodeId());
+
+            msgWorker.addMessage(msg);
+
+            lastTimeHbMsgSent = U.currentTimeMillis();
+        }
+
+        /**
+         * Check the last time a heartbeat message received. If the time is bigger than {@code hbCheckTimeout} than
+         * {@link TcpDiscoveryStatusCheckMessage} is sent accros the ring.
+         */
+        private void checkHeartbeatsReceiving() {
+            if (lastTimeStatusMsgSent < locNode.lastUpdateTime())
+                lastTimeStatusMsgSent = locNode.lastUpdateTime();
+
+            long elapsed = (lastTimeStatusMsgSent + hbCheckFreq) - U.currentTimeMillis();
+
+            if (elapsed > 0)
+                return;
+
+            msgWorker.addMessage(new TcpDiscoveryStatusCheckMessage(locNode, null));
+
+            lastTimeStatusMsgSent = U.currentTimeMillis();
+        }
+
+        /**
+         * Check connection aliveness status.
+         */
+        private void checkConnection() {
+            if (!spi.failureDetectionTimeoutEnabled())
+                return;
+
+            if (!failureThresholdReached && U.currentTimeMillis() - locNode.lastDataReceivedTime()
+                >= spi.failureDetectionTimeout() && ring.hasRemoteNodes() && spiStateCopy() == CONNECTED) {
+
+                log.info("Local node seems to be disconnected from topology (failure detection timeout " +
+                    "is reached): [failureDetectionTimeout=" + spi.failureDetectionTimeout() +
+                    ", connCheckFreq=" + connCheckFreq + ']');
+
+                failureThresholdReached = true;
+
+                // Reset sent time deliberately to force sending connection check message.
+                lastTimeConnCheckMsgSent = 0;
+            }
+
+            long elapsed = (lastTimeConnCheckMsgSent + connCheckFreq) - U.currentTimeMillis();
+
+            if (elapsed > 0)
+                return;
+
+            if (ring.hasRemoteNodes()) {
+                sendMessageAcrossRing(new TcpDiscoveryConnectionCheckMessage(locNode));
+
+                lastTimeConnCheckMsgSent = U.currentTimeMillis();
+            }
+        }
     }
 
     /**
@@ -4186,14 +4266,17 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                             TcpDiscoveryPingResponse res = new TcpDiscoveryPingResponse(locNodeId);
 
+                            IgniteSpiOperationTimeoutHelper timeoutHelper =
+                                new IgniteSpiOperationTimeoutHelper(spi);
+
                             if (req.clientNodeId() != null) {
                                 ClientMessageWorker clientWorker = clientMsgWorkers.get(req.clientNodeId());
 
                                 if (clientWorker != null)
-                                    res.clientExists(clientWorker.ping());
+                                    res.clientExists(clientWorker.ping(timeoutHelper));
                             }
 
-                            spi.writeToSocket(sock, res);
+                            spi.writeToSocket(sock, res, timeoutHelper.nextTimeoutChunk(spi.getSocketTimeout()));
                         }
                         else if (log.isDebugEnabled())
                             log.debug("Ignore ping request, node is stopping.");
@@ -4214,7 +4297,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (req.client())
                         res.clientAck(true);
 
-                    spi.writeToSocket(sock, res);
+                    spi.writeToSocket(sock, res, spi.failureDetectionTimeoutEnabled() ?
+                        spi.failureDetectionTimeout() : spi.getSocketTimeout());
 
                     // It can happen if a remote node is stopped and it has a loopback address in the list of addresses,
                     // the local node sends a handshake request message on the loopback address, so we get here.
@@ -4323,6 +4407,9 @@ class ServerImpl extends TcpDiscoveryImpl {
                     return;
                 }
 
+                long socketTimeout = spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() :
+                    spi.getSocketTimeout();
+
                 while (!isInterrupted()) {
                     try {
                         TcpDiscoveryAbstractMessage msg = spi.marsh.unmarshal(in, U.gridClassLoader());
@@ -4337,7 +4424,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                         if (debugMode && recordable(msg))
                             debugLog("Message has been received: " + msg);
 
-                        if (msg instanceof TcpDiscoveryJoinRequestMessage) {
+                        if (msg instanceof TcpDiscoveryConnectionCheckMessage) {
+                            spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+
+                            continue;
+                        }
+                        else if (msg instanceof TcpDiscoveryJoinRequestMessage) {
                             TcpDiscoveryJoinRequestMessage req = (TcpDiscoveryJoinRequestMessage)msg;
 
                             if (!req.responded()) {
@@ -4355,7 +4447,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                                 TcpDiscoverySpiState state = spiStateCopy();
 
                                 if (state == CONNECTED) {
-                                    spi.writeToSocket(msg, sock, RES_OK);
+                                    spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
 
                                     if (clientMsgWrk.getState() == State.NEW)
                                         clientMsgWrk.start();
@@ -4365,7 +4457,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                                     continue;
                                 }
                                 else {
-                                    spi.writeToSocket(msg, sock, RES_CONTINUE_JOIN);
+                                    spi.writeToSocket(msg, sock, RES_CONTINUE_JOIN, socketTimeout);
 
                                     break;
                                 }
@@ -4373,7 +4465,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         }
                         else if (msg instanceof TcpDiscoveryDuplicateIdMessage) {
                             // Send receipt back.
-                            spi.writeToSocket(msg, sock, RES_OK);
+                            spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
 
                             boolean ignored = false;
 
@@ -4402,7 +4494,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         }
                         else if (msg instanceof TcpDiscoveryAuthFailedMessage) {
                             // Send receipt back.
-                            spi.writeToSocket(msg, sock, RES_OK);
+                            spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
 
                             boolean ignored = false;
 
@@ -4431,7 +4523,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         }
                         else if (msg instanceof TcpDiscoveryCheckFailedMessage) {
                             // Send receipt back.
-                            spi.writeToSocket(msg, sock, RES_OK);
+                            spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
 
                             boolean ignored = false;
 
@@ -4460,7 +4552,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         }
                         else if (msg instanceof TcpDiscoveryLoopbackProblemMessage) {
                             // Send receipt back.
-                            spi.writeToSocket(msg, sock, RES_OK);
+                            spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
 
                             boolean ignored = false;
 
@@ -4509,7 +4601,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             clientMsgWrk.addMessage(ack);
                         }
                         else
-                            spi.writeToSocket(msg, sock, RES_OK);
+                            spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
                     }
                     catch (IgniteCheckedException e) {
                         if (log.isDebugEnabled())
@@ -4610,8 +4702,11 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             TcpDiscoverySpiState state = spiStateCopy();
 
+            long socketTimeout = spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() :
+                spi.getSocketTimeout();
+
             if (state == CONNECTED) {
-                spi.writeToSocket(msg, sock, RES_OK);
+                spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
 
                 if (log.isDebugEnabled())
                     log.debug("Responded to join request message [msg=" + msg + ", res=" + RES_OK + ']');
@@ -4648,7 +4743,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     // Local node is stopping. Remote node should try next one.
                     res = RES_CONTINUE_JOIN;
 
-                spi.writeToSocket(msg, sock, res);
+                spi.writeToSocket(msg, sock, res, socketTimeout);
 
                 if (log.isDebugEnabled())
                     log.debug("Responded to join request message [msg=" + msg + ", res=" + res + ']');
@@ -4741,7 +4836,7 @@ class ServerImpl extends TcpDiscoveryImpl {
          * @param clientNodeId Node ID.
          */
         protected ClientMessageWorker(Socket sock, UUID clientNodeId) {
-            super("tcp-disco-client-message-worker");
+            super("tcp-disco-client-message-worker", 2000);
 
             this.sock = sock;
             this.clientNodeId = clientNodeId;
@@ -4791,7 +4886,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                             log.debug("Sending message ack to client [sock=" + sock + ", locNodeId="
                                 + getLocalNodeId() + ", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
 
-                        writeToSocket(sock, msg);
+                        writeToSocket(sock, msg, spi.failureDetectionTimeoutEnabled() ?
+                            spi.failureDetectionTimeout() : spi.getSocketTimeout());
                     }
                 }
                 else {
@@ -4802,7 +4898,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         prepareNodeAddedMessage(msg, clientNodeId, null, null);
 
-                        writeToSocket(sock, msg);
+                        writeToSocket(sock, msg, spi.failureDetectionTimeoutEnabled() ?
+                            spi.failureDetectionTimeout() : spi.getSocketTimeout());
                     }
                     finally {
                         clearNodeAddedMessage(msg);
@@ -4836,10 +4933,11 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
+         * @param timeoutHelper Timeout controller.
          * @return Ping result.
          * @throws InterruptedException If interrupted.
          */
-        public boolean ping() throws InterruptedException {
+        public boolean ping(IgniteSpiOperationTimeoutHelper timeoutHelper) throws InterruptedException {
             if (spi.isNodeStopping0())
                 return false;
 
@@ -4865,7 +4963,8 @@ class ServerImpl extends TcpDiscoveryImpl {
             }
 
             try {
-                return fut.get(spi.ackTimeout, TimeUnit.MILLISECONDS);
+                return fut.get(timeoutHelper.nextTimeoutChunk(spi.getAckTimeout()),
+                    TimeUnit.MILLISECONDS);
             }
             catch (IgniteInterruptedCheckedException ignored) {
                 throw new InterruptedException();
@@ -4904,12 +5003,18 @@ class ServerImpl extends TcpDiscoveryImpl {
         /** Backed interrupted flag. */
         private volatile boolean interrupted;
 
+        /** Polling timeout. */
+        private final long pollingTimeout;
+
         /**
          * @param name Thread name.
+         * @param pollingTimeout Messages polling timeout.
          */
-        protected MessageWorkerAdapter(String name) {
+        protected MessageWorkerAdapter(String name, long pollingTimeout) {
             super(spi.ignite().name(), name, log);
 
+            this.pollingTimeout = pollingTimeout;
+
             setPriority(spi.threadPri);
         }
 
@@ -4919,12 +5024,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                 log.debug("Message worker started [locNodeId=" + getConfiguredNodeId() + ']');
 
             while (!isInterrupted()) {
-                TcpDiscoveryAbstractMessage msg = queue.poll(2000, TimeUnit.MILLISECONDS);
+                TcpDiscoveryAbstractMessage msg = queue.poll(pollingTimeout, TimeUnit.MILLISECONDS);
 
                 if (msg == null)
-                    continue;
-
-                processMessage(msg);
+                    noMessageLoop();
+                else
+                    processMessage(msg);
             }
         }
 
@@ -4968,16 +5073,24 @@ class ServerImpl extends TcpDiscoveryImpl {
         protected abstract void processMessage(TcpDiscoveryAbstractMessage msg);
 
         /**
+         * Called when there is no message to process giving ability to perform other activity.
+         */
+        protected void noMessageLoop() {
+            // No-op.
+        }
+
+        /**
          * @param sock Socket.
          * @param msg Message.
+         * @param timeout Socket timeout.
          * @throws IOException If IO failed.
          * @throws IgniteCheckedException If marshalling failed.
          */
-        protected final void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg)
+        protected final void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout)
             throws IOException, IgniteCheckedException {
             bout.reset();
 
-            spi.writeToSocket(sock, msg, bout);
+            spi.writeToSocket(sock, msg, bout, timeout);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
index c271b7c..4dacf45 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
@@ -131,6 +131,13 @@ abstract class TcpDiscoveryImpl {
     }
 
     /**
+     * Called when a chunk of data is received from a remote node.
+     */
+    protected void onDataReceived() {
+        // No-op
+    }
+
+    /**
      * @param log Logger.
      */
     public abstract void dumpDebugInfo(IgniteLogger log);
@@ -273,10 +280,10 @@ abstract class TcpDiscoveryImpl {
      * maximum acknowledgement timeout, {@code false} otherwise.
      */
     protected boolean checkAckTimeout(long ackTimeout) {
-        if (ackTimeout > spi.maxAckTimeout) {
+        if (ackTimeout > spi.getMaxAckTimeout()) {
             LT.warn(log, null, "Acknowledgement timeout is greater than maximum acknowledgement timeout " +
                 "(consider increasing 'maxAckTimeout' configuration property) " +
-                "[ackTimeout=" + ackTimeout + ", maxAckTimeout=" + spi.maxAckTimeout + ']');
+                "[ackTimeout=" + ackTimeout + ", maxAckTimeout=" + spi.getMaxAckTimeout() + ']');
 
             return false;
         }


[16/50] [abbrv] incubator-ignite git commit: # ignite-961 Typo.

Posted by an...@apache.org.
# ignite-961 Typo.


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

Branch: refs/heads/ignite-843
Commit: 4475be8a9f48c9e286202df75f03eb91207881ab
Parents: e051674
Author: Andrey <an...@gridgain.com>
Authored: Mon Jul 27 14:15:21 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Jul 27 14:15:21 2015 +0700

----------------------------------------------------------------------
 modules/nodejs/src/main/js/sql-fields-query.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4475be8a/modules/nodejs/src/main/js/sql-fields-query.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/sql-fields-query.js b/modules/nodejs/src/main/js/sql-fields-query.js
index 13c6df8..edc9f4c 100644
--- a/modules/nodejs/src/main/js/sql-fields-query.js
+++ b/modules/nodejs/src/main/js/sql-fields-query.js
@@ -72,7 +72,7 @@ SqlFieldsQuery.prototype.page = function(res) {
  * @param {int} pageSz Page size.
  */
 SqlFieldsQuery.prototype.setPageSize = function(pageSz) {
-    this._pageSize = pageSz;
+    this._pageSz = pageSz;
 }
 
 /**


[14/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121

Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121

# Conflicts:
#	modules/web-control-center/src/main/js/package.json


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

Branch: refs/heads/ignite-843
Commit: f965f6bf7c3c2d7d410c544047bea0d363f3f69f
Parents: 126185f 3e8a935
Author: Andrey <an...@gridgain.com>
Authored: Mon Jul 27 08:45:37 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Jul 27 08:45:37 2015 +0700

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/agent/Agent.java  |  5 ++---
 .../org/apache/ignite/agent/AgentCommandLine.java |  2 +-
 .../apache/ignite/agent/messages/AuthMessage.java |  8 ++++----
 .../apache/ignite/agent/messages/AuthResult.java  |  6 +++---
 .../apache/ignite/agent/messages/RestRequest.java |  2 +-
 .../apache/ignite/agent/messages/RestResult.java  |  4 ++--
 .../src/main/js/controllers/caches-controller.js  | 14 ++++++++++++++
 .../main/js/controllers/clusters-controller.js    |  6 ++----
 .../src/main/js/controllers/models/caches.json    | 14 ++++++++++++++
 .../src/main/js/controllers/models/metadata.json  |  8 +++++++-
 modules/web-control-center/src/main/js/db.js      |  2 ++
 .../src/main/js/routes/caches.js                  | 18 ++++++++++++++----
 .../src/main/js/views/includes/controls.jade      |  4 ++--
 13 files changed, 68 insertions(+), 25 deletions(-)
----------------------------------------------------------------------



[32/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121

Posted by an...@apache.org.
Merge remote-tracking branch 'origin/ignite-1121' into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: f58d813307d12e6173b11ca7133a151e146f2745
Parents: 0ff3504 aa3fc51
Author: Andrey <an...@gridgain.com>
Authored: Tue Jul 28 10:54:19 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Tue Jul 28 10:54:19 2015 +0700

----------------------------------------------------------------------
 modules/web-control-center/src/main/js/db.js    |  4 +--
 .../src/main/js/routes/caches.js                |  2 +-
 .../src/main/js/routes/clusters.js              |  2 +-
 .../src/main/js/routes/generator/xml.js         | 29 +++++++++++++++++++-
 .../src/main/js/routes/metadata.js              |  2 +-
 5 files changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[08/50] [abbrv] incubator-ignite git commit: Merge ignite-843 -> ignite-1121

Posted by an...@apache.org.
Merge ignite-843 -> ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 3e8a935d83e0c4eed589fe490835d0518dd82cc6
Parents: 8e050e9 8f30428
Author: sevdokimov <se...@gridgain.com>
Authored: Fri Jul 24 16:45:12 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jul 24 16:45:12 2015 +0300

----------------------------------------------------------------------
 modules/web-control-center/src/main/js/app.js   |   10 +-
 .../main/js/controllers/caches-controller.js    |   14 +
 .../main/js/controllers/clusters-controller.js  |    6 +-
 .../main/js/controllers/metadata-controller.js  |   67 +-
 .../src/main/js/controllers/models/caches.json  |   22 +-
 .../main/js/controllers/models/clusters.json    |    8 +-
 .../main/js/controllers/models/metadata.json    |   42 +-
 .../src/main/js/controllers/models/summary.json |    2 +-
 modules/web-control-center/src/main/js/db.js    |    2 +
 .../web-control-center/src/main/js/package.json |    2 +-
 .../src/main/js/public/stylesheets/style.less   | 1214 -----------------
 .../src/main/js/public/stylesheets/style.scss   | 1270 ++++++++++++++++++
 .../src/main/js/routes/caches.js                |   18 +-
 .../src/main/js/views/configuration/caches.jade |    4 +-
 .../main/js/views/configuration/clusters.jade   |    4 +-
 .../main/js/views/configuration/metadata.jade   |    6 +-
 .../main/js/views/configuration/summary.jade    |   11 +-
 .../src/main/js/views/includes/controls.jade    |   98 +-
 .../src/main/js/views/sql/sql.jade              |   13 +-
 19 files changed, 1482 insertions(+), 1331 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8a935d/modules/web-control-center/src/main/js/app.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8a935d/modules/web-control-center/src/main/js/package.json
----------------------------------------------------------------------


[47/50] [abbrv] incubator-ignite git commit: # ignite-1121 Sql tab

Posted by an...@apache.org.
# ignite-1121 Sql tab


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

Branch: refs/heads/ignite-843
Commit: e24f3b74bdf6a3bb5171717537fb834532e4f0b3
Parents: 6ecf626
Author: Andrey <an...@gridgain.com>
Authored: Fri Jul 31 09:29:28 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Fri Jul 31 09:29:28 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/agents/agent-manager.js         | 283 +++++++++++++++++++
 .../src/main/js/agents/agent-server.js          |  90 ++++++
 modules/control-center-web/src/main/js/app.js   |   8 +-
 .../src/main/js/controllers/common-module.js    |  26 +-
 .../src/main/js/controllers/sql-controller.js   |  22 +-
 modules/control-center-web/src/main/js/db.js    |  12 +
 .../src/main/js/keys/test.crt                   |  13 +
 .../src/main/js/keys/test.key                   |  18 ++
 .../src/main/js/routes/agent.js                 |  84 ++++++
 .../src/main/js/routes/notebooks.js             | 102 +++++++
 .../src/main/js/routes/sql.js                   |   4 +-
 .../src/main/js/views/includes/header.jade      |   7 +-
 .../src/main/js/views/sql/sql.jade              |   3 +-
 .../src/test/js/routes/agent.js                 |  94 ++++++
 modules/nodejs/src/main/js/cluster-node.js      |  23 +-
 modules/nodejs/src/main/js/ignite.js            |   5 +-
 .../http/jetty/GridJettyJsonConfig.java         |   3 +
 .../src/main/js/agents/agent-manager.js         | 283 -------------------
 .../src/main/js/agents/agent-server.js          |  90 ------
 .../src/main/js/keys/test.crt                   |  13 -
 .../src/main/js/keys/test.key                   |  18 --
 .../src/main/js/routes/agent.js                 |  84 ------
 .../src/test/js/routes/agent.js                 |  94 ------
 23 files changed, 778 insertions(+), 601 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/agents/agent-manager.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/agents/agent-manager.js b/modules/control-center-web/src/main/js/agents/agent-manager.js
new file mode 100644
index 0000000..10d3a56
--- /dev/null
+++ b/modules/control-center-web/src/main/js/agents/agent-manager.js
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var WebSocketServer = require('ws').Server;
+
+var apacheIgnite = require('apache-ignite');
+
+var db = require('../db');
+
+var AgentServer = require('./agent-server').AgentServer;
+
+/**
+ * @constructor
+ */
+function AgentManager(srv) {
+    this._clients = {};
+
+    this._server = srv;
+
+    this._wss = new WebSocketServer({ server: this._server });
+
+    var self = this;
+
+    this._wss.on('connection', function(ws) {
+        var client = new Client(ws, self);
+    });
+}
+
+/**
+ * @param userId
+ * @param {Client} client
+ */
+AgentManager.prototype._removeClient = function(userId, client) {
+    var connections = this._clients[userId];
+
+    if (connections) {
+        removeFromArray(connections, client);
+
+        if (connections.length == 0)
+            delete this._clients[userId];
+    }
+};
+
+/**
+ * @param userId
+ * @param {Client} client
+ */
+AgentManager.prototype._addClient = function(userId, client) {
+    var existingConnections = this._clients[userId];
+
+    if (!existingConnections) {
+        existingConnections = [];
+
+        this._clients[userId] = existingConnections;
+    }
+
+    existingConnections.push(client);
+};
+
+/**
+ * @param userId
+ * @return {Client}
+ */
+AgentManager.prototype.findClient = function(userId) {
+    var clientsList = this._clients[userId];
+
+    if (!clientsList)
+        return null;
+
+    return clientsList[0];
+};
+
+/**
+ * For tests only!!!
+ * @return {Client}
+ */
+AgentManager.prototype.getOneClient = function() {
+    for (var userId in this._clients) {
+        if (this._clients.hasOwnProperty(userId)) {
+            var m = this._clients[userId];
+
+            if (m.length > 0)
+                return m[0];
+        }
+    }
+
+    return null;
+};
+
+
+/**
+ * @constructor
+ * @param {AgentManager} manager
+ * @param {WebSocket} ws
+ */
+function Client(ws, manager) {
+    var self = this;
+
+    this._manager = manager;
+    this._ws = ws;
+
+    ws.on('close', function() {
+        if (self.user) {
+            self._manager._removeClient(self.user._id, self);
+        }
+    });
+
+    ws.on('message', function (msg) {
+        self._handleMessage(JSON.parse(msg))
+    });
+
+    this._restCounter = 0;
+
+    this._cbMap = {};
+}
+
+/**
+ * @param {String|Object} msg
+ * @param {Function} cb
+ */
+Client.prototype.sendMessage = function(msg, cb) {
+    if (typeof msg == 'object') {
+        msg = JSON.stringify(msg);
+    }
+
+    this._ws.send(msg, cb);
+};
+
+/**
+ * @param {String} path
+ * @param {Object} params
+ * @param {Function} cb
+ * @param {String} method
+ * @param {String} body
+ * @param {Object} headers
+ */
+Client.prototype.invokeRest = function(path, params, cb, method, body, headers) {
+    var self = this;
+
+    if (typeof(params) != 'object')
+        throw "'params' argument must be an object";
+
+    if (typeof(cb) != 'function')
+        throw "callback must be a function";
+
+    if (body && typeof(body) != 'string')
+        throw "body must be a string";
+
+    if (headers && typeof(headers) != 'object')
+        throw "headers must be an object";
+
+    if (!method)
+        method = 'GET';
+    else
+        method = method.toUpperCase();
+
+    if (method != 'GET' && method != 'POST')
+        throw "Unknown HTTP method: " + method;
+
+    var reqId = this._restCounter++;
+
+    this._cbMap[reqId] = cb;
+
+    this.sendMessage({
+        id: reqId,
+        type: 'RestRequest',
+        method: method,
+        params: params,
+        path: path,
+        body: body,
+        headers: headers
+    }, function(err) {
+        if (err) {
+            delete self._cbMap[reqId];
+
+            cb(err)
+        }
+    })
+};
+
+/**
+ * @param {Object} msg
+ */
+Client.prototype._handleMessage = function(msg) {
+    var self = this;
+
+    switch (msg.type) {
+        case 'AuthMessage':
+            var account = db.Account.findByUsername(msg.login, function(err, account) {
+                if (err) {
+                    ws.send("{type: 'AuthResult', success: false}");
+                }
+                else {
+                    account.authenticate(msg.password, function(err, user, res) {
+                        if (!user) {
+                            self._ws.send(JSON.stringify({type: 'AuthResult', success: false, message: res.message}));
+                        }
+                        else {
+                            self._ws.send("{type: 'AuthResult', success: true}");
+
+                            self._user = account;
+
+                            self._manager._addClient(account._id, self);
+
+                            self._ignite = new apacheIgnite.Ignite(new AgentServer(self));
+                        }
+                    });
+                }
+            });
+
+            break;
+
+        case 'RestResult':
+            var cb = this._cbMap[msg.requestId];
+
+            if (!cb)
+                break;
+
+            delete this._cbMap[msg.requestId];
+
+            if (!msg.executed) {
+                cb(msg.message)
+            }
+            else {
+                cb(null, msg.code, msg.message)
+            }
+
+            break;
+
+        default:
+            this._ws.close()
+    }
+};
+
+/**
+ * @return {Ignite}
+ */
+Client.prototype.ignite = function() {
+    return this._ignite;
+};
+
+function removeFromArray(arr, val) {
+    var idx;
+
+    while ((idx = arr.indexOf(val)) !== -1) {
+        arr.splice(idx, 1);
+    }
+}
+
+exports.AgentManager = AgentManager;
+
+/**
+ * @type {AgentManager}
+ */
+var manager = null;
+
+exports.createManager = function(srv) {
+    if (manager)
+        throw "Agent manager already cleared!";
+
+    manager = new AgentManager(srv);
+};
+
+/**
+ * @return {AgentManager}
+ */
+exports.getAgentManager = function() {
+    return manager;
+};

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/agents/agent-server.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/agents/agent-server.js b/modules/control-center-web/src/main/js/agents/agent-server.js
new file mode 100644
index 0000000..31dee5a
--- /dev/null
+++ b/modules/control-center-web/src/main/js/agents/agent-server.js
@@ -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.
+ */
+
+/**
+ * Creates an instance of server for Ignite
+ *
+ * @constructor
+ * @this {AgentServer}
+ * @param {Client} client connected client
+ */
+function AgentServer(client) {
+    this._client = client;
+}
+
+/**
+ * Run http request
+ *
+ * @this {AgentServer}
+ * @param {Command} cmd Command
+ * @param {callback} callback on finish
+ */
+AgentServer.prototype.runCommand = function(cmd, callback) {
+    var params = {cmd: cmd.name()};
+
+    for (var p of cmd._params) {
+        params[p.key] = p.value;
+    }
+
+    var body = undefined;
+
+    var headers = undefined;
+
+    if (cmd._isPost()) {
+        body = cmd.postData();
+
+        headers = {'Content-Length': body.length, 'JSONObject': 'application/json'};
+    }
+
+    this._client.invokeRest("ignite", params, function(error, code, message) {
+        if (error) {
+            callback(error);
+            return
+        }
+
+        if (code !== 200) {
+            if (code === 401) {
+                callback.call(null, "Authentication failed. Status code 401.");
+            }
+            else {
+                callback.call(null, "Request failed. Status code " + code);
+            }
+
+            return;
+        }
+
+        var igniteResponse;
+
+        try {
+            igniteResponse = JSON.parse(message);
+        }
+        catch (e) {
+            callback.call(null, e, null);
+
+            return;
+        }
+
+        if (igniteResponse.successStatus) {
+            callback.call(null, igniteResponse.error, null)
+        }
+        else {
+            callback.call(null, null, igniteResponse.response);
+        }
+    }, cmd._method(), body, headers);
+};
+
+exports.AgentServer = AgentServer;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/app.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app.js b/modules/control-center-web/src/main/js/app.js
index 930c798..7741822 100644
--- a/modules/control-center-web/src/main/js/app.js
+++ b/modules/control-center-web/src/main/js/app.js
@@ -26,6 +26,7 @@ var session = require('express-session');
 var mongoStore = require('connect-mongo')(session);
 
 var publicRoutes = require('./routes/public');
+var notebooksRoutes = require('./routes/notebooks');
 var clustersRouter = require('./routes/clusters');
 var cachesRouter = require('./routes/caches');
 var metadataRouter = require('./routes/metadata');
@@ -123,8 +124,11 @@ app.use('/configuration/clusters', clustersRouter);
 app.use('/configuration/caches', cachesRouter);
 app.use('/configuration/metadata', metadataRouter);
 app.use('/configuration/summary', summary);
-app.use('/sql', sqlRouter);
-app.use('/agent', agentRouter);
+
+app.use('/notebooks', mustAuthenticated, notebooksRoutes);
+app.use('/sql', mustAuthenticated, sqlRouter);
+
+app.use('/agent', mustAuthenticated, agentRouter);
 
 // Catch 404 and forward to error handler.
 app.use(function (req, res, next) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index df2ff19..8d3efed 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -481,4 +481,28 @@ controlCenterModule.controller('auth', [
                     $alert({placement: 'top', container: '#errors-container', title: $scope.errorMessage(data)});
                 });
         };
-    }]);
\ No newline at end of file
+    }]);
+
+// Navigation bar controller.
+controlCenterModule.controller('notebooks', ['$scope', '$http','$common', function ($scope, $http, $common) {
+    $scope.notebooks = [];
+
+    // When landing on the page, get clusters and show them.
+    $http.post('/notebooks/list')
+        .success(function (data) {
+            $scope.notebooks = data;
+
+            if ($scope.notebooks.length > 0) {
+                $scope.notebookDropdown = [
+                    { text: 'Create new notebook', href: '/notebooks/new', target: '_self' },
+                    { divider: true }
+                ];
+
+                for (notebook of $scope.notebooks)
+                    $scope.notebookDropdown.push({text: notebook.name, href: '/sql/' + notebook._id, target: '_self'});
+            }
+        })
+        .error(function (errMsg) {
+            $common.showError(errMsg);
+        });
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js
index b4b4335..1e67a08 100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@ -15,7 +15,11 @@
  * limitations under the License.
  */
 
-controlCenterModule.controller('sqlController', ['$scope', '$http', '$common', function ($scope, $http, $common) {
+controlCenterModule.controller('sqlController', ['$scope', '$controller', '$http', '$common',
+    function ($scope, $controller, $http, $common) {
+    // Initialize the super class and extend it.
+    angular.extend(this, $controller('notebooks', {$scope: $scope}));
+
     $scope.joinTip = $common.joinTip;
 
     $scope.pageSizes = [50, 100, 200, 400, 800, 1000];
@@ -26,6 +30,22 @@ controlCenterModule.controller('sqlController', ['$scope', '$http', '$common', f
         {value: 'LOCAL', label: 'LOCAL'}
     ];
 
+    var loadNotebook = function() {
+        $http.post('/notebooks/get', {nodeId: $scope.nodeId})
+            .success(function (notebook) {
+                $scope.notebook = notebook;
+            })
+            .error(function (errMsg) {
+                $common.showError(errMsg);
+            });
+    };
+
+    loadNotebook();
+
+    $scope.addParagraph = function(notebook) {
+        notebook.paragraphs.push({});
+    };
+
     $scope.tabs = [];
 
     $scope.addTab = function() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/db.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/db.js b/modules/control-center-web/src/main/js/db.js
index 5232e24..401beff 100644
--- a/modules/control-center-web/src/main/js/db.js
+++ b/modules/control-center-web/src/main/js/db.js
@@ -355,6 +355,18 @@ var PersistenceSchema = new Schema({
 // Define persistence model.
 exports.Persistence = mongoose.model('Persistence', PersistenceSchema);
 
+// Define persistence schema.
+var NotebookSchema = new Schema({
+    space: {type: ObjectId, ref: 'Space'},
+    name: String,
+    paragraph: [{
+        query: String
+    }]
+});
+
+// Define persistence model.
+exports.Notebook = mongoose.model('Notebook', NotebookSchema);
+
 exports.upsert = function (model, data, cb) {
     if (data._id) {
         var id = data._id;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/keys/test.crt
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/keys/test.crt b/modules/control-center-web/src/main/js/keys/test.crt
new file mode 100644
index 0000000..50c6d5c
--- /dev/null
+++ b/modules/control-center-web/src/main/js/keys/test.crt
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE-----
+MIIB6zCCAVQCCQDcAphbU6UcLjANBgkqhkiG9w0BAQsFADA6MRIwEAYDVQQDDAls
+b2NhbGhvc3QxJDAiBgkqhkiG9w0BCQEWFXNldmRva2ltb3ZAYXBhY2hlLm9yZzAe
+Fw0xNTA3MTQxMzAyNTNaFw0xODA2MjMxMzAyNTNaMDoxEjAQBgNVBAMMCWxvY2Fs
+aG9zdDEkMCIGCSqGSIb3DQEJARYVc2V2ZG9raW1vdkBhcGFjaGUub3JnMIGfMA0G
+CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDP/zpJrdHqCj6lPpeFF6LQtzKef6UiyBBo
+rbuOtCCgW8KMJJciluBWk2126qLt9smBN4jBpSNU3pq0r9gBMUTd/LSe7aY4D5ED
+Pjp7XsypNVKeHaHbFi7KhfHy0LYxsWiNPmmHJv4dtYOp+pGK25rkXNfyJxxjgxN6
+wo34+MnZIQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAFk9XEjcdyihws+fVmdGGUFo
+bVxI9YGH6agiNbU3WNF4B4VRzcPPW8z2mEo7eF9kgYmq/YzH4T8tgi/qkL/u8eZV
+Wmi9bg6RThLN6/hj3wVoOFKykbDQ05FFdhIJXN5UOjPmxYM97EKqg6J0W2HAb8SG
++UekPnmAo/2HTKsLykH8
+-----END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/keys/test.key
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/keys/test.key b/modules/control-center-web/src/main/js/keys/test.key
new file mode 100644
index 0000000..1b395c0
--- /dev/null
+++ b/modules/control-center-web/src/main/js/keys/test.key
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,6798185330CE2EE2
+
+sOwkmD8rvjx11l09V26dJhLhl+SyPIhyeZ3TqHXrYCATKoXlzidT+uPu1jVYtrwr
+nBLA6TrIDYRrBNlEsqGZ0cSvWTIczzVW1xZKHEJo5q2vUT/W8u/Q1QQtS3P3GeKF
+dEzx496rpZqwwVw59GNbuIwyYoVvQf3iEXzfhplGmLPELYIplDFOLgNuXQyXSGx6
+rwKsCxXMLsDyrA6DCz0Odf08p2HvWk/s5Ne3DFcQlqRNtIrBVGD2O0/Fp8ZZ2I4E
+Yn2OIIWJff3HanOjLOWKdN8YAn5UleNmlEUdIHeS5qaQ68mabOxLkSef9qglV+sd
+FHTtUq0cG6t6nhxZBziexha6v1yl/xABAHHhNPOfak+HthWxRD4N9f1yFYAeTmkn
+4kwBWoSUe12XRf2pGNqhEUKN/KhDmWk85wI55i/Cu2XmNoiBFlS9BXrRYU8uVCJw
+KlxjKTDWl1opCyvxTDxJnMkt44ZT445LRePKVueGIIKSUIXNQypOE+C1I0CL0N2W
+Ts3m9nthquvLeMx92k7b8yW69BER5uac3SIlGCOJObQXsHgyk8wYiyd/zLKfjctG
+PXieaW81UKjp+GqWpvWPz3VqnKwoyUWeVOOTviurli6kYOrHuySTMqMb6hxJctw9
+grAQTT0UPiAKWcM7InLzZnRjco+v9QLLEokjVngXPba16K/CItFY16xuGlaFLW7Y
+XTc67AkL8b76HBZelMjmCsqjvSoULhuMFwTOvUMm/mSM8rMoi9asrJRLQHRMWCST
+/6RENPLzPlOMnNLBujpBbn8V3/aYzEZsHMI+6S3d27WYlTJIqpabSA==
+-----END RSA PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/agent.js b/modules/control-center-web/src/main/js/routes/agent.js
new file mode 100644
index 0000000..4646c28
--- /dev/null
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -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.
+ */
+
+var router = require('express').Router();
+var agentManager = require('../agents/agent-manager');
+
+var apacheIgnite = require('apache-ignite');
+var SqlFieldsQuery = apacheIgnite.SqlFieldsQuery;
+
+/* GET summary page. */
+router.post('/topology', function(req, res) {
+    var client = agentManager.getAgentManager().getOneClient();
+
+    if (!client)
+        return res.status(500).send("Client not found");
+
+    client.ignite().cluster().then(function (clusters) {
+        res.json(clusters.map(function (cluster) {
+            var caches = Object.keys(cluster._caches).map(function(key) {
+                return {"name" : key, "mode" : cluster._caches[key] }
+            });
+
+            return { nodeId: cluster._nodeId, caches: caches };
+        }));
+    }, function (err) {
+        res.send(err);
+    });
+});
+
+/* GET summary page. */
+router.post('/query', function(req, res) {
+    var client = agentManager.getAgentManager().getOneClient();
+
+    if (!client)
+        return res.status(500).send("Client not found");
+
+    // Create sql query.
+    var qry = new SqlFieldsQuery(req.body.query);
+
+    // Set page size for query.
+    qry.setPageSize(req.body.pageSize);
+
+    // Get query cursor.
+    client.ignite().cache(req.body.cacheName).query(qry).nextPage().then(function (cursor) {
+        res.json({meta: cursor.fieldsMetadata(), rows: cursor.page(), queryId: cursor.queryId()});
+    }, function (err) {
+        res.status(500).send(err);
+    });
+});
+
+/* GET summary page. */
+router.post('/next_page', function(req, res) {
+    var client = agentManager.getAgentManager().getOneClient();
+
+    if (!client)
+        return res.status(500).send("Client not found");
+
+    var cache = client.ignite().cache(req.body.cacheName);
+
+    var cmd = cache._createCommand("qryfetch").addParam("qryId", req.body.queryId).
+        addParam("psz", req.body.pageSize);
+
+    cache.__createPromise(cmd).then(function (page) {
+        res.json({rows: page["items"], last: page === null || page["last"]});
+    }, function (err) {
+        res.status(500).send(err);
+    });
+});
+
+module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/routes/notebooks.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/notebooks.js b/modules/control-center-web/src/main/js/routes/notebooks.js
new file mode 100644
index 0000000..5b7ac8e
--- /dev/null
+++ b/modules/control-center-web/src/main/js/routes/notebooks.js
@@ -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.
+ *
+ */
+
+var router = require('express').Router();
+var db = require('../db');
+
+/**
+ * Get notebooks names accessed for user account.
+ *
+ * @param req Request.
+ * @param res Response.
+ */
+router.post('/list', function (req, res) {
+    var user_id = req.currentUserId();
+
+    // Get owned space and all accessed space.
+    db.Space.find({$or: [{owner: user_id}, {usedBy: {$elemMatch: {account: user_id}}}]}, function (err, spaces) {
+        if (err)
+            return res.status(500).send(err.message);
+
+        var space_ids = spaces.map(function (value) {
+            return value._id;
+        });
+
+        // Get all metadata for spaces.
+        db.Notebook.find({space: {$in: space_ids}}).select('_id name').sort('name').exec(function (err, notebooks) {
+            if (err)
+                return res.status(500).send(err.message);
+
+            res.json(notebooks);
+        });
+    });
+});
+
+/**
+ * Get notebook accessed for user account.
+ *
+ * @param req Request.
+ * @param res Response.
+ */
+router.post('/get', function (req, res) {
+    var user_id = req.currentUserId();
+
+    // Get owned space and all accessed space.
+    db.Space.find({$or: [{owner: user_id}, {usedBy: {$elemMatch: {account: user_id}}}]}, function (err, spaces) {
+        if (err)
+            return res.status(500).send(err.message);
+
+        var space_ids = spaces.map(function (value) {
+            return value._id;
+        });
+
+        // Get all metadata for spaces.
+        db.Notebook.findOne({$or : [{space: {$in: space_ids}}, {_id: req.body.noteId}]}).exec(function (err, notebook) {
+            if (err)
+                return res.status(500).send(err.message);
+
+            res.json(notebook);
+        });
+    });
+});
+
+/**
+ * Create new notebook for user account.
+ *
+ * @param req Request.
+ * @param res Response.
+ */
+router.get('/new', function (req, res) {
+    var user_id = req.currentUserId();
+
+    // Get owned space and all accessed space.
+    db.Space.findOne({owner: user_id}, function (err, space) {
+        if (err)
+            return res.status(500).send(err.message);
+
+        (new db.Notebook({space: space.id, name: 'Notebook', paragraph: []})).save(function (err, notebook) {
+            if (err)
+                return res.status(500).send(err.message);
+
+            return res.redirect('/sql/' + notebook._id);
+        });
+    });
+});
+
+module.exports = router;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/routes/sql.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/sql.js b/modules/control-center-web/src/main/js/routes/sql.js
index ce4565d..d11be69 100644
--- a/modules/control-center-web/src/main/js/routes/sql.js
+++ b/modules/control-center-web/src/main/js/routes/sql.js
@@ -17,8 +17,8 @@
 
 var router = require('express').Router();
 var db = require('../db');
-router.get('/', function(req, res) {
-    res.render('sql/sql');
+router.get('/:noteId', function (req, res) {
+    res.render('sql/sql', {noteId: req.params.noteId});
 });
 
 module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/views/includes/header.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/includes/header.jade b/modules/control-center-web/src/main/js/views/includes/header.jade
index bfd5275..49ea592 100644
--- a/modules/control-center-web/src/main/js/views/includes/header.jade
+++ b/modules/control-center-web/src/main/js/views/includes/header.jade
@@ -29,11 +29,14 @@ header.header(id='header')
             ul.nav.navbar-nav(ng-controller='activeLink' ng-show='user')
                 +header-item('/configuration', '/configuration/clusters', 'Configuration')
                 //+header-item('/monitoring', '/monitoring', 'Monitoring')
-                +header-item('/sql', '/sql', 'SQL')
+                li(ng-controller='notebooks')
+                    a.dropdown-toggle(ng-hide='notebooks.length == 0' data-toggle='dropdown' bs-dropdown='notebookDropdown' data-placement='bottom-right') SQL
+                        span.caret
+                    a(ng-hide='notebooks.length > 0' ng-class='{active: isActive("/sql")}' href='/notebooks/new') SQL
                 //+header-item('/deploy', '/deploy', 'Deploy')
             ul.nav.navbar-nav.pull-right
                 li(ng-if='user')
-                    a.dropdown-toggle(data-toggle='dropdown' bs-dropdown='userDropdown' data-placement='bottom-right') {{user.username}}
+                    a.dropdown-toggle(data-toggle='dropdown' bs-dropdown='userDropdown' data-placement='bottom-right' data-ng-bind='::user.username')
                         span.caret
                 li.nav-login(ng-if='!user')
                     a(ng-click='login()' href='#') Log In
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/main/js/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/sql.jade b/modules/control-center-web/src/main/js/views/sql/sql.jade
index 2ce6958..53e6639 100644
--- a/modules/control-center-web/src/main/js/views/sql/sql.jade
+++ b/modules/control-center-web/src/main/js/views/sql/sql.jade
@@ -11,6 +11,7 @@
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
+
 extends ../templates/layout
 
 append scripts
@@ -27,7 +28,7 @@ block container
                 .docs-header
                     h1 Connect to Ignite and Execute SQL Queries
                     hr
-                .docs-body(ng-controller='sqlController')
+                .docs-body(ng-controller='sqlController' ng-init='noteId = #{JSON.stringify(noteId)};')
                     - var tab = 'tabs[tabs.activeIdx]'
 
                     .block-callout-parent.block-callout-border.margin-bottom-dflt

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/control-center-web/src/test/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/test/js/routes/agent.js b/modules/control-center-web/src/test/js/routes/agent.js
new file mode 100644
index 0000000..c8bfd82
--- /dev/null
+++ b/modules/control-center-web/src/test/js/routes/agent.js
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var request = require('supertest'),
+    should = require('should'),
+    app = require('../../app'),
+    fs = require('fs'),
+    https = require('https'),
+    config = require('../../helpers/configuration-loader.js'),
+    agentManager = require('../../agents/agent-manager');
+
+/**
+ * Create HTTP server.
+ */
+/**
+ * Start agent server.
+ */
+var agentServer = https.createServer({
+    key: fs.readFileSync(config.get('monitor:server:key')),
+    cert: fs.readFileSync(config.get('monitor:server:cert')),
+    passphrase: config.get('monitor:server:keyPassphrase')
+});
+
+agentServer.listen(config.get('monitor:server:port'));
+
+agentManager.createManager(agentServer);
+
+describe('request from agent', function() {
+    var agent = request.agent(app);
+
+    before(function (done) {
+        this.timeout(10000);
+
+        agent
+            .post('/login')
+            .send({email: 'anovikov@gridgain.com', password: 'extHB2aXgb'})
+            .expect(302)
+            .end(function (err) {
+                if (err)
+                    throw err;
+
+                setTimeout(done, 5000);
+            });
+    });
+
+    it('should return topology snapshot', function(done){
+        agent
+            .post('/agent/topology')
+            .send({})
+            .end(function(err, nodes) {
+                if (err) {
+                    console.log(err.response.text);
+
+                    throw err;
+                }
+
+                console.log(nodes);
+
+                done();
+            });
+    });
+
+    //it('should query result', function(done){
+    //    agent
+    //        .post('/agent/query')
+    //        .send({
+    //            username: 'nva',
+    //            password: 'nva.141',
+    //            host: 'localhost',
+    //            port: '5432',
+    //            dbName: 'ggmonitor'
+    //        })
+    //        .end(function(err, res) {
+    //            if (err)
+    //                throw err;
+    //
+    //            done();
+    //        });
+    //});
+});

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/nodejs/src/main/js/cluster-node.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cluster-node.js b/modules/nodejs/src/main/js/cluster-node.js
index 940f123..7ef4fb3 100644
--- a/modules/nodejs/src/main/js/cluster-node.js
+++ b/modules/nodejs/src/main/js/cluster-node.js
@@ -15,15 +15,17 @@
  * limitations under the License.
  */
 
- /**
-  * @constructor
-  * @this{ClusterNode}
-  * @param {string} nodeId Node id
-  * @param {Object.<string,string>} attr Node Attributes
-  */
-function ClusterNode(nodeId, attr) {
+/**
+ * @constructor
+ * @this{ClusterNode}
+ * @param {string} nodeId Node id
+ * @param {Object.<string,string>} attr Node Attributes
+ * @param {Object.<string,string>} caches Node caches name, mode
+ */
+function ClusterNode(nodeId, attr, caches) {
     this._nodeId = nodeId;
     this._attr = attr;
+    this._caches = caches;
 }
 
 /**
@@ -40,4 +42,11 @@ ClusterNode.prototype.attributes = function() {
     return this._attr;
 }
 
+/**
+ * @returns {Object.<string,string>} Node caches name, mode
+ */
+ClusterNode.prototype.caches = function() {
+    return this._caches;
+}
+
 exports.ClusterNode = ClusterNode
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/nodejs/src/main/js/ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/ignite.js b/modules/nodejs/src/main/js/ignite.js
index 5b68c23..47facc0 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -129,9 +129,8 @@ Ignite.prototype.cluster = function() {
                 else {
                     var nodes = [];
 
-                    for (var node of res) {
-                        nodes.push(new ClusterNode(node.nodeId, node.attributes));
-                    }
+                    for (var node of res)
+                        nodes.push(new ClusterNode(node.nodeId, node.attributes, node.caches));
 
                     resolve(nodes);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
index e36da80..ad6ee22 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java
@@ -39,6 +39,9 @@ public class GridJettyJsonConfig extends JsonConfig {
     private static class ToStringJsonProcessor implements JsonValueProcessor {
         /** {@inheritDoc} */
         @Override public Object processArrayValue(Object val, JsonConfig jsonCfg) {
+            if (val != null && val.getClass() == UUID.class)
+                return val.toString();
+
             throw new UnsupportedOperationException("Serialize array to string is not supported: " + val);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/web-control-center/src/main/js/agents/agent-manager.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/agents/agent-manager.js b/modules/web-control-center/src/main/js/agents/agent-manager.js
deleted file mode 100644
index 10d3a56..0000000
--- a/modules/web-control-center/src/main/js/agents/agent-manager.js
+++ /dev/null
@@ -1,283 +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.
- */
-
-var WebSocketServer = require('ws').Server;
-
-var apacheIgnite = require('apache-ignite');
-
-var db = require('../db');
-
-var AgentServer = require('./agent-server').AgentServer;
-
-/**
- * @constructor
- */
-function AgentManager(srv) {
-    this._clients = {};
-
-    this._server = srv;
-
-    this._wss = new WebSocketServer({ server: this._server });
-
-    var self = this;
-
-    this._wss.on('connection', function(ws) {
-        var client = new Client(ws, self);
-    });
-}
-
-/**
- * @param userId
- * @param {Client} client
- */
-AgentManager.prototype._removeClient = function(userId, client) {
-    var connections = this._clients[userId];
-
-    if (connections) {
-        removeFromArray(connections, client);
-
-        if (connections.length == 0)
-            delete this._clients[userId];
-    }
-};
-
-/**
- * @param userId
- * @param {Client} client
- */
-AgentManager.prototype._addClient = function(userId, client) {
-    var existingConnections = this._clients[userId];
-
-    if (!existingConnections) {
-        existingConnections = [];
-
-        this._clients[userId] = existingConnections;
-    }
-
-    existingConnections.push(client);
-};
-
-/**
- * @param userId
- * @return {Client}
- */
-AgentManager.prototype.findClient = function(userId) {
-    var clientsList = this._clients[userId];
-
-    if (!clientsList)
-        return null;
-
-    return clientsList[0];
-};
-
-/**
- * For tests only!!!
- * @return {Client}
- */
-AgentManager.prototype.getOneClient = function() {
-    for (var userId in this._clients) {
-        if (this._clients.hasOwnProperty(userId)) {
-            var m = this._clients[userId];
-
-            if (m.length > 0)
-                return m[0];
-        }
-    }
-
-    return null;
-};
-
-
-/**
- * @constructor
- * @param {AgentManager} manager
- * @param {WebSocket} ws
- */
-function Client(ws, manager) {
-    var self = this;
-
-    this._manager = manager;
-    this._ws = ws;
-
-    ws.on('close', function() {
-        if (self.user) {
-            self._manager._removeClient(self.user._id, self);
-        }
-    });
-
-    ws.on('message', function (msg) {
-        self._handleMessage(JSON.parse(msg))
-    });
-
-    this._restCounter = 0;
-
-    this._cbMap = {};
-}
-
-/**
- * @param {String|Object} msg
- * @param {Function} cb
- */
-Client.prototype.sendMessage = function(msg, cb) {
-    if (typeof msg == 'object') {
-        msg = JSON.stringify(msg);
-    }
-
-    this._ws.send(msg, cb);
-};
-
-/**
- * @param {String} path
- * @param {Object} params
- * @param {Function} cb
- * @param {String} method
- * @param {String} body
- * @param {Object} headers
- */
-Client.prototype.invokeRest = function(path, params, cb, method, body, headers) {
-    var self = this;
-
-    if (typeof(params) != 'object')
-        throw "'params' argument must be an object";
-
-    if (typeof(cb) != 'function')
-        throw "callback must be a function";
-
-    if (body && typeof(body) != 'string')
-        throw "body must be a string";
-
-    if (headers && typeof(headers) != 'object')
-        throw "headers must be an object";
-
-    if (!method)
-        method = 'GET';
-    else
-        method = method.toUpperCase();
-
-    if (method != 'GET' && method != 'POST')
-        throw "Unknown HTTP method: " + method;
-
-    var reqId = this._restCounter++;
-
-    this._cbMap[reqId] = cb;
-
-    this.sendMessage({
-        id: reqId,
-        type: 'RestRequest',
-        method: method,
-        params: params,
-        path: path,
-        body: body,
-        headers: headers
-    }, function(err) {
-        if (err) {
-            delete self._cbMap[reqId];
-
-            cb(err)
-        }
-    })
-};
-
-/**
- * @param {Object} msg
- */
-Client.prototype._handleMessage = function(msg) {
-    var self = this;
-
-    switch (msg.type) {
-        case 'AuthMessage':
-            var account = db.Account.findByUsername(msg.login, function(err, account) {
-                if (err) {
-                    ws.send("{type: 'AuthResult', success: false}");
-                }
-                else {
-                    account.authenticate(msg.password, function(err, user, res) {
-                        if (!user) {
-                            self._ws.send(JSON.stringify({type: 'AuthResult', success: false, message: res.message}));
-                        }
-                        else {
-                            self._ws.send("{type: 'AuthResult', success: true}");
-
-                            self._user = account;
-
-                            self._manager._addClient(account._id, self);
-
-                            self._ignite = new apacheIgnite.Ignite(new AgentServer(self));
-                        }
-                    });
-                }
-            });
-
-            break;
-
-        case 'RestResult':
-            var cb = this._cbMap[msg.requestId];
-
-            if (!cb)
-                break;
-
-            delete this._cbMap[msg.requestId];
-
-            if (!msg.executed) {
-                cb(msg.message)
-            }
-            else {
-                cb(null, msg.code, msg.message)
-            }
-
-            break;
-
-        default:
-            this._ws.close()
-    }
-};
-
-/**
- * @return {Ignite}
- */
-Client.prototype.ignite = function() {
-    return this._ignite;
-};
-
-function removeFromArray(arr, val) {
-    var idx;
-
-    while ((idx = arr.indexOf(val)) !== -1) {
-        arr.splice(idx, 1);
-    }
-}
-
-exports.AgentManager = AgentManager;
-
-/**
- * @type {AgentManager}
- */
-var manager = null;
-
-exports.createManager = function(srv) {
-    if (manager)
-        throw "Agent manager already cleared!";
-
-    manager = new AgentManager(srv);
-};
-
-/**
- * @return {AgentManager}
- */
-exports.getAgentManager = function() {
-    return manager;
-};

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/web-control-center/src/main/js/agents/agent-server.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/agents/agent-server.js b/modules/web-control-center/src/main/js/agents/agent-server.js
deleted file mode 100644
index 31dee5a..0000000
--- a/modules/web-control-center/src/main/js/agents/agent-server.js
+++ /dev/null
@@ -1,90 +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.
- */
-
-/**
- * Creates an instance of server for Ignite
- *
- * @constructor
- * @this {AgentServer}
- * @param {Client} client connected client
- */
-function AgentServer(client) {
-    this._client = client;
-}
-
-/**
- * Run http request
- *
- * @this {AgentServer}
- * @param {Command} cmd Command
- * @param {callback} callback on finish
- */
-AgentServer.prototype.runCommand = function(cmd, callback) {
-    var params = {cmd: cmd.name()};
-
-    for (var p of cmd._params) {
-        params[p.key] = p.value;
-    }
-
-    var body = undefined;
-
-    var headers = undefined;
-
-    if (cmd._isPost()) {
-        body = cmd.postData();
-
-        headers = {'Content-Length': body.length, 'JSONObject': 'application/json'};
-    }
-
-    this._client.invokeRest("ignite", params, function(error, code, message) {
-        if (error) {
-            callback(error);
-            return
-        }
-
-        if (code !== 200) {
-            if (code === 401) {
-                callback.call(null, "Authentication failed. Status code 401.");
-            }
-            else {
-                callback.call(null, "Request failed. Status code " + code);
-            }
-
-            return;
-        }
-
-        var igniteResponse;
-
-        try {
-            igniteResponse = JSON.parse(message);
-        }
-        catch (e) {
-            callback.call(null, e, null);
-
-            return;
-        }
-
-        if (igniteResponse.successStatus) {
-            callback.call(null, igniteResponse.error, null)
-        }
-        else {
-            callback.call(null, null, igniteResponse.response);
-        }
-    }, cmd._method(), body, headers);
-};
-
-exports.AgentServer = AgentServer;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/web-control-center/src/main/js/keys/test.crt
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/keys/test.crt b/modules/web-control-center/src/main/js/keys/test.crt
deleted file mode 100644
index 50c6d5c..0000000
--- a/modules/web-control-center/src/main/js/keys/test.crt
+++ /dev/null
@@ -1,13 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIB6zCCAVQCCQDcAphbU6UcLjANBgkqhkiG9w0BAQsFADA6MRIwEAYDVQQDDAls
-b2NhbGhvc3QxJDAiBgkqhkiG9w0BCQEWFXNldmRva2ltb3ZAYXBhY2hlLm9yZzAe
-Fw0xNTA3MTQxMzAyNTNaFw0xODA2MjMxMzAyNTNaMDoxEjAQBgNVBAMMCWxvY2Fs
-aG9zdDEkMCIGCSqGSIb3DQEJARYVc2V2ZG9raW1vdkBhcGFjaGUub3JnMIGfMA0G
-CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDP/zpJrdHqCj6lPpeFF6LQtzKef6UiyBBo
-rbuOtCCgW8KMJJciluBWk2126qLt9smBN4jBpSNU3pq0r9gBMUTd/LSe7aY4D5ED
-Pjp7XsypNVKeHaHbFi7KhfHy0LYxsWiNPmmHJv4dtYOp+pGK25rkXNfyJxxjgxN6
-wo34+MnZIQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAFk9XEjcdyihws+fVmdGGUFo
-bVxI9YGH6agiNbU3WNF4B4VRzcPPW8z2mEo7eF9kgYmq/YzH4T8tgi/qkL/u8eZV
-Wmi9bg6RThLN6/hj3wVoOFKykbDQ05FFdhIJXN5UOjPmxYM97EKqg6J0W2HAb8SG
-+UekPnmAo/2HTKsLykH8
------END CERTIFICATE-----

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/web-control-center/src/main/js/keys/test.key
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/keys/test.key b/modules/web-control-center/src/main/js/keys/test.key
deleted file mode 100644
index 1b395c0..0000000
--- a/modules/web-control-center/src/main/js/keys/test.key
+++ /dev/null
@@ -1,18 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,6798185330CE2EE2
-
-sOwkmD8rvjx11l09V26dJhLhl+SyPIhyeZ3TqHXrYCATKoXlzidT+uPu1jVYtrwr
-nBLA6TrIDYRrBNlEsqGZ0cSvWTIczzVW1xZKHEJo5q2vUT/W8u/Q1QQtS3P3GeKF
-dEzx496rpZqwwVw59GNbuIwyYoVvQf3iEXzfhplGmLPELYIplDFOLgNuXQyXSGx6
-rwKsCxXMLsDyrA6DCz0Odf08p2HvWk/s5Ne3DFcQlqRNtIrBVGD2O0/Fp8ZZ2I4E
-Yn2OIIWJff3HanOjLOWKdN8YAn5UleNmlEUdIHeS5qaQ68mabOxLkSef9qglV+sd
-FHTtUq0cG6t6nhxZBziexha6v1yl/xABAHHhNPOfak+HthWxRD4N9f1yFYAeTmkn
-4kwBWoSUe12XRf2pGNqhEUKN/KhDmWk85wI55i/Cu2XmNoiBFlS9BXrRYU8uVCJw
-KlxjKTDWl1opCyvxTDxJnMkt44ZT445LRePKVueGIIKSUIXNQypOE+C1I0CL0N2W
-Ts3m9nthquvLeMx92k7b8yW69BER5uac3SIlGCOJObQXsHgyk8wYiyd/zLKfjctG
-PXieaW81UKjp+GqWpvWPz3VqnKwoyUWeVOOTviurli6kYOrHuySTMqMb6hxJctw9
-grAQTT0UPiAKWcM7InLzZnRjco+v9QLLEokjVngXPba16K/CItFY16xuGlaFLW7Y
-XTc67AkL8b76HBZelMjmCsqjvSoULhuMFwTOvUMm/mSM8rMoi9asrJRLQHRMWCST
-/6RENPLzPlOMnNLBujpBbn8V3/aYzEZsHMI+6S3d27WYlTJIqpabSA==
------END RSA PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/web-control-center/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/routes/agent.js b/modules/web-control-center/src/main/js/routes/agent.js
deleted file mode 100644
index 4646c28..0000000
--- a/modules/web-control-center/src/main/js/routes/agent.js
+++ /dev/null
@@ -1,84 +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.
- */
-
-var router = require('express').Router();
-var agentManager = require('../agents/agent-manager');
-
-var apacheIgnite = require('apache-ignite');
-var SqlFieldsQuery = apacheIgnite.SqlFieldsQuery;
-
-/* GET summary page. */
-router.post('/topology', function(req, res) {
-    var client = agentManager.getAgentManager().getOneClient();
-
-    if (!client)
-        return res.status(500).send("Client not found");
-
-    client.ignite().cluster().then(function (clusters) {
-        res.json(clusters.map(function (cluster) {
-            var caches = Object.keys(cluster._caches).map(function(key) {
-                return {"name" : key, "mode" : cluster._caches[key] }
-            });
-
-            return { nodeId: cluster._nodeId, caches: caches };
-        }));
-    }, function (err) {
-        res.send(err);
-    });
-});
-
-/* GET summary page. */
-router.post('/query', function(req, res) {
-    var client = agentManager.getAgentManager().getOneClient();
-
-    if (!client)
-        return res.status(500).send("Client not found");
-
-    // Create sql query.
-    var qry = new SqlFieldsQuery(req.body.query);
-
-    // Set page size for query.
-    qry.setPageSize(req.body.pageSize);
-
-    // Get query cursor.
-    client.ignite().cache(req.body.cacheName).query(qry).nextPage().then(function (cursor) {
-        res.json({meta: cursor.fieldsMetadata(), rows: cursor.page(), queryId: cursor.queryId()});
-    }, function (err) {
-        res.status(500).send(err);
-    });
-});
-
-/* GET summary page. */
-router.post('/next_page', function(req, res) {
-    var client = agentManager.getAgentManager().getOneClient();
-
-    if (!client)
-        return res.status(500).send("Client not found");
-
-    var cache = client.ignite().cache(req.body.cacheName);
-
-    var cmd = cache._createCommand("qryfetch").addParam("qryId", req.body.queryId).
-        addParam("psz", req.body.pageSize);
-
-    cache.__createPromise(cmd).then(function (page) {
-        res.json({rows: page["items"], last: page === null || page["last"]});
-    }, function (err) {
-        res.status(500).send(err);
-    });
-});
-
-module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e24f3b74/modules/web-control-center/src/test/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/test/js/routes/agent.js b/modules/web-control-center/src/test/js/routes/agent.js
deleted file mode 100644
index 6a7fa2c..0000000
--- a/modules/web-control-center/src/test/js/routes/agent.js
+++ /dev/null
@@ -1,94 +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.
- */
-
-var request = require('supertest'),
-    should = require('should'),
-    app = require('../../app'),
-    fs = require('fs'),
-    https = require('https'),
-    config = require('../../helpers/configuration-loader.js'),
-    agentManager = require('../../agents/agent-manager');
-
-/**
- * Create HTTP server.
- */
-/**
- * Start agent server.
- */
-var agentServer = https.createServer({
-    key: fs.readFileSync(config.get('monitor:server:key')),
-    cert: fs.readFileSync(config.get('monitor:server:cert')),
-    passphrase: config.get('monitor:server:keyPassphrase')
-});
-
-agentServer.listen(config.get('monitor:server:port'));
-
-agentManager.createManager(agentServer);
-
-describe('request from agent', function() {
-    var agent = request.agent(app);
-
-    before(function (done) {
-        this.timeout(10000);
-
-        agent
-            .post('/login')
-            .send({email: 'anovikov@gridgain.com', password: 'extHB2aXgb'})
-            .expect(302)
-            .end(function (err) {
-                if (err)
-                    throw err;
-
-                setTimeout(done, 5000);
-            });
-    });
-
-    it('should return topology snapshot', function(done){
-        agent
-            .post('/agent/topology')
-            .send({})
-            .end(function(err, nodes) {
-                if (err) {
-                    console.log(err.response.text);
-
-                    throw err;
-                }
-
-                console.log(nodes);
-
-                done();
-            });
-    });
-
-    //it('should query result', function(done){
-    //    agent
-    //        .post('/agent/query')
-    //        .send({
-    //            username: 'nva',
-    //            password: 'nva.141',
-    //            host: 'localhost',
-    //            port: '5432',
-    //            dbName: 'ggmonitor'
-    //        })
-    //        .end(function(err, res) {
-    //            if (err)
-    //                throw err;
-    //
-    //            done();
-    //        });
-    //});
-});
\ No newline at end of file


[02/50] [abbrv] incubator-ignite git commit: # IGNITE-1121 fix warnings.

Posted by an...@apache.org.
# IGNITE-1121 fix warnings.


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

Branch: refs/heads/ignite-843
Commit: 8e050e9fa4ab1556ea853d7d7cdb6078bdd2c09f
Parents: ea15083
Author: sevdokimov <se...@gridgain.com>
Authored: Fri Jul 24 13:57:29 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jul 24 13:57:29 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/agent/Agent.java         | 5 ++---
 .../main/java/org/apache/ignite/agent/AgentCommandLine.java  | 2 +-
 .../java/org/apache/ignite/agent/messages/AuthMessage.java   | 8 ++++----
 .../java/org/apache/ignite/agent/messages/AuthResult.java    | 6 +++---
 .../java/org/apache/ignite/agent/messages/RestRequest.java   | 2 +-
 .../java/org/apache/ignite/agent/messages/RestResult.java    | 4 ++--
 6 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e050e9f/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
index d34854d..ca2ff51 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
@@ -24,7 +24,6 @@ import org.apache.http.client.methods.*;
 import org.apache.http.client.utils.*;
 import org.apache.http.entity.*;
 import org.apache.http.impl.client.*;
-import org.apache.http.message.*;
 import org.apache.ignite.agent.messages.*;
 
 import java.io.*;
@@ -68,8 +67,6 @@ public class Agent {
      * @param restReq Request.
      */
     public RestResult executeRest(RestRequest restReq) throws IOException, URISyntaxException {
-        HttpRequestBase httpReq;
-
         URIBuilder builder = new URIBuilder(cfg.getNodeUri());
 
         String path = restReq.getPath();
@@ -89,6 +86,8 @@ public class Agent {
         if (restReq.getHeaders() != null)
             restReq.setHeaders(restReq.getHeaders());
 
+        HttpRequestBase httpReq;
+
         if ("GET".equalsIgnoreCase(restReq.getMethod()))
             httpReq = new HttpGet(builder.build());
         else if ("POST".equalsIgnoreCase(restReq.getMethod())) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e050e9f/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLine.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLine.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLine.java
index 849c94b..f45bd86 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLine.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLine.java
@@ -80,7 +80,7 @@ public class AgentCommandLine {
      * @param srvUri Server uri.
      */
     public void setServerUri(String srvUri) {
-        this.serverUri = srvUri;
+        serverUri = srvUri;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e050e9f/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthMessage.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthMessage.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthMessage.java
index 2cb3945..9a32a99 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthMessage.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthMessage.java
@@ -36,11 +36,11 @@ public class AuthMessage extends AbstractMessage {
 
     /**
      * @param login Login.
-     * @param password Password.
+     * @param pwd Password.
      */
-    public AuthMessage(String login, String password) {
+    public AuthMessage(String login, String pwd) {
         this.login = login;
-        this.password = password;
+        password = pwd;
     }
 
     /**
@@ -68,6 +68,6 @@ public class AuthMessage extends AbstractMessage {
      * @param pwd Password.
      */
     public void setPassword(String pwd) {
-        this.password = pwd;
+        password = pwd;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e050e9f/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthResult.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthResult.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthResult.java
index 85871ac..5513193 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthResult.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/AuthResult.java
@@ -49,9 +49,9 @@ public class AuthResult extends AbstractMessage {
     }
 
     /**
-     * @param message Message.
+     * @param msg Message.
      */
-    public void setMessage(String message) {
-        this.message = message;
+    public void setMessage(String msg) {
+        message = msg;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e050e9f/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestRequest.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestRequest.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestRequest.java
index e1f6db8..9c06332 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestRequest.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestRequest.java
@@ -94,7 +94,7 @@ public class RestRequest extends AbstractMessage {
      * @param mtd Method.
      */
     public void setMethod(String mtd) {
-        this.method = mtd;
+        method = mtd;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e050e9f/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestResult.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestResult.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestResult.java
index 5da5f18..16ffa1b 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestResult.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/messages/RestResult.java
@@ -44,7 +44,7 @@ public class RestResult extends AbstractMessage {
      * @param reqId Request id.
      */
     public void setRequestId(int reqId) {
-        this.requestId = reqId;
+        requestId = reqId;
     }
 
     /**
@@ -72,7 +72,7 @@ public class RestResult extends AbstractMessage {
      * @param msg Message.
      */
     public void setMessage(String msg) {
-        this.message = msg;
+        message = msg;
     }
 
     /**


[19/50] [abbrv] incubator-ignite git commit: removing Google Compute Engine buckets on test finish

Posted by an...@apache.org.
removing Google Compute Engine buckets on test finish


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

Branch: refs/heads/ignite-843
Commit: f22de3ea35b1506c8bcf4d2f7bb6d423a0b3225d
Parents: 9bfc184
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Jul 27 11:06:30 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Jul 27 11:06:30 2015 +0300

----------------------------------------------------------------------
 .../TcpDiscoveryIpFinderAbstractSelfTest.java   |  2 +-
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  | 18 ++++++++++++
 ...pDiscoveryGoogleStorageIpFinderSelfTest.java | 29 +++++++++++++++++++-
 3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f22de3ea/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java
index b5b8c63..ba660b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinderAbstractSelfTest.java
@@ -31,7 +31,7 @@ import java.util.*;
 public abstract class TcpDiscoveryIpFinderAbstractSelfTest<T extends TcpDiscoveryIpFinder>
     extends GridCommonAbstractTest {
     /** */
-    private T finder;
+    protected T finder;
 
     /**
      * Constructor.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f22de3ea/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
index 48991e8..c2b1a91 100644
--- a/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
+++ b/modules/gce/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinder.java
@@ -380,4 +380,22 @@ public class TcpDiscoveryGoogleStorageIpFinder extends TcpDiscoveryIpFinderAdapt
 
         return new InetSocketAddress(res[0], port);
     }
+
+    /**
+     * Used by TEST SUITES only. Called through reflection.
+     *
+     * @param bucketName Bucket to delete.
+     */
+    private void removeBucket(String bucketName) {
+        init();
+
+        try {
+            Storage.Buckets.Delete deleteBucket = storage.buckets().delete(bucketName);
+
+            deleteBucket.execute();
+        }
+        catch (Exception e) {
+            throw new IgniteSpiException("Failed to remove the bucket: " + bucketName, e);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f22de3ea/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java b/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java
index 2fa0d43..f8929cc 100644
--- a/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java
+++ b/modules/gce/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/gce/TcpDiscoveryGoogleStorageIpFinderSelfTest.java
@@ -21,6 +21,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.testsuites.*;
 
+import java.lang.reflect.*;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.Collection;
@@ -30,6 +31,9 @@ import java.util.Collection;
  */
 public class TcpDiscoveryGoogleStorageIpFinderSelfTest
     extends TcpDiscoveryIpFinderAbstractSelfTest<TcpDiscoveryGoogleStorageIpFinder> {
+    /** Bucket name. */
+    private static String bucketName;
+
     /**
      * Constructor.
      *
@@ -40,6 +44,29 @@ public class TcpDiscoveryGoogleStorageIpFinderSelfTest
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        bucketName = "ip-finder-test-bucket-" + InetAddress.getLocalHost().getAddress()[3];
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        try {
+            Method method = TcpDiscoveryGoogleStorageIpFinder.class.getDeclaredMethod("removeBucket", String.class);
+
+            method.setAccessible(true);
+
+            method.invoke(finder, bucketName);
+        }
+        catch (Exception e) {
+            log.warning("Failed to remove bucket on GCE [bucketName=" + bucketName + ", mes=" + e.getMessage() + ']');
+        }
+
+        super.afterTestsStopped();
+    }
+
+    /** {@inheritDoc} */
     @Override protected TcpDiscoveryGoogleStorageIpFinder ipFinder() throws Exception {
         TcpDiscoveryGoogleStorageIpFinder finder = new TcpDiscoveryGoogleStorageIpFinder();
 
@@ -52,7 +79,7 @@ public class TcpDiscoveryGoogleStorageIpFinderSelfTest
         finder.setProjectName(IgniteGCETestSuite.getProjectName());
 
         // Bucket name must be unique across the whole GCE platform.
-        finder.setBucketName("ip-finder-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]);
+        finder.setBucketName(bucketName);
 
         for (int i = 0; i < 5; i++) {
             Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();


[42/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121

Posted by an...@apache.org.
Merge branch 'ignite-843' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1121


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

Branch: refs/heads/ignite-843
Commit: 6b621759a2fb23f0b8ab121db2e69ff74868ea05
Parents: 89220b1 9652287
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 29 13:44:13 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 29 13:44:13 2015 +0700

----------------------------------------------------------------------
 .../control-center-web/licenses/apache-2.0.txt  |  202 +++
 .../control-center-web/src/main/js/.gitignore   |    4 +
 .../control-center-web/src/main/js/DEVNOTES.txt |   21 +
 modules/control-center-web/src/main/js/app.js   |  158 +++
 modules/control-center-web/src/main/js/bin/www  |  110 ++
 .../src/main/js/config/default.json             |   17 +
 .../src/main/js/controllers/admin-controller.js |   68 +
 .../js/controllers/cache-viewer-controller.js   |   77 ++
 .../main/js/controllers/caches-controller.js    |  349 +++++
 .../main/js/controllers/clusters-controller.js  |  308 +++++
 .../src/main/js/controllers/common-module.js    |  484 +++++++
 .../main/js/controllers/metadata-controller.js  |  709 ++++++++++
 .../src/main/js/controllers/models/caches.json  |  943 +++++++++++++
 .../main/js/controllers/models/clusters.json    |  909 +++++++++++++
 .../main/js/controllers/models/metadata.json    |  252 ++++
 .../src/main/js/controllers/models/sql.json     |    5 +
 .../src/main/js/controllers/models/summary.json |  163 +++
 .../main/js/controllers/profile-controller.js   |   51 +
 .../src/main/js/controllers/sql-controller.js   |  129 ++
 .../main/js/controllers/summary-controller.js   |  170 +++
 modules/control-center-web/src/main/js/db.js    |  370 +++++
 .../src/main/js/helpers/configuration-loader.js |   22 +
 .../src/main/js/helpers/data-structures.js      |   84 ++
 .../control-center-web/src/main/js/package.json |   50 +
 .../src/main/js/public/favicon.ico              |  Bin 0 -> 1150 bytes
 .../src/main/js/public/images/docker.png        |  Bin 0 -> 994 bytes
 .../src/main/js/public/images/java.png          |  Bin 0 -> 170 bytes
 .../src/main/js/public/images/logo.png          |  Bin 0 -> 8148 bytes
 .../src/main/js/public/images/xml.png           |  Bin 0 -> 232 bytes
 .../src/main/js/public/stylesheets/style.scss   | 1270 ++++++++++++++++++
 .../src/main/js/routes/admin.js                 |   79 ++
 .../src/main/js/routes/caches.js                |  105 ++
 .../src/main/js/routes/clusters.js              |  104 ++
 .../src/main/js/routes/generator/common.js      |  312 +++++
 .../src/main/js/routes/generator/docker.js      |   58 +
 .../src/main/js/routes/generator/java.js        |  788 +++++++++++
 .../src/main/js/routes/generator/xml.js         |  736 ++++++++++
 .../src/main/js/routes/metadata.js              |   95 ++
 .../src/main/js/routes/profile.js               |   97 ++
 .../src/main/js/routes/public.js                |  123 ++
 .../src/main/js/routes/sql.js                   |   24 +
 .../src/main/js/routes/summary.js               |  108 ++
 .../src/main/js/views/configuration/caches.jade |   74 +
 .../main/js/views/configuration/clusters.jade   |   77 ++
 .../main/js/views/configuration/metadata.jade   |  121 ++
 .../main/js/views/configuration/sidebar.jade    |   39 +
 .../main/js/views/configuration/summary.jade    |  113 ++
 .../src/main/js/views/error.jade                |   22 +
 .../src/main/js/views/includes/controls.jade    |  350 +++++
 .../src/main/js/views/includes/footer.jade      |   22 +
 .../src/main/js/views/includes/header.jade      |   39 +
 .../src/main/js/views/index.jade                |   30 +
 .../src/main/js/views/login.jade                |   55 +
 .../src/main/js/views/settings/admin.jade       |   58 +
 .../src/main/js/views/settings/profile.jade     |   58 +
 .../src/main/js/views/sql/sql.jade              |   84 ++
 .../src/main/js/views/templates/confirm.jade    |   27 +
 .../src/main/js/views/templates/copy.jade       |   31 +
 .../src/main/js/views/templates/layout.jade     |   61 +
 .../src/main/js/views/templates/select.jade     |   26 +
 .../src/main/js/views/templates/tab.jade        |   26 +
 .../web-control-center/licenses/apache-2.0.txt  |  202 ---
 .../web-control-center/src/main/js/.gitignore   |    4 -
 .../web-control-center/src/main/js/DEVNOTES.txt |   21 -
 modules/web-control-center/src/main/js/app.js   |  158 ---
 modules/web-control-center/src/main/js/bin/www  |  110 --
 .../src/main/js/config/default.json             |   17 -
 .../src/main/js/controllers/admin-controller.js |   68 -
 .../js/controllers/cache-viewer-controller.js   |   77 --
 .../main/js/controllers/caches-controller.js    |  349 -----
 .../main/js/controllers/clusters-controller.js  |  308 -----
 .../src/main/js/controllers/common-module.js    |  484 -------
 .../main/js/controllers/metadata-controller.js  |  709 ----------
 .../src/main/js/controllers/models/caches.json  |  943 -------------
 .../main/js/controllers/models/clusters.json    |  909 -------------
 .../main/js/controllers/models/metadata.json    |  252 ----
 .../src/main/js/controllers/models/sql.json     |    5 -
 .../src/main/js/controllers/models/summary.json |  163 ---
 .../main/js/controllers/profile-controller.js   |   51 -
 .../src/main/js/controllers/sql-controller.js   |  129 --
 .../main/js/controllers/summary-controller.js   |  170 ---
 modules/web-control-center/src/main/js/db.js    |  370 -----
 .../src/main/js/helpers/configuration-loader.js |   22 -
 .../src/main/js/helpers/data-structures.js      |   84 --
 .../web-control-center/src/main/js/package.json |   50 -
 .../src/main/js/public/favicon.ico              |  Bin 1150 -> 0 bytes
 .../src/main/js/public/images/docker.png        |  Bin 994 -> 0 bytes
 .../src/main/js/public/images/java.png          |  Bin 170 -> 0 bytes
 .../src/main/js/public/images/logo.png          |  Bin 8148 -> 0 bytes
 .../src/main/js/public/images/xml.png           |  Bin 232 -> 0 bytes
 .../src/main/js/public/stylesheets/style.scss   | 1270 ------------------
 .../src/main/js/routes/admin.js                 |   79 --
 .../src/main/js/routes/caches.js                |  105 --
 .../src/main/js/routes/clusters.js              |  104 --
 .../src/main/js/routes/generator/common.js      |  324 -----
 .../src/main/js/routes/generator/docker.js      |   58 -
 .../src/main/js/routes/generator/java.js        |  626 ---------
 .../src/main/js/routes/generator/xml.js         |  738 ----------
 .../src/main/js/routes/metadata.js              |   95 --
 .../src/main/js/routes/profile.js               |   97 --
 .../src/main/js/routes/public.js                |  123 --
 .../src/main/js/routes/sql.js                   |   24 -
 .../src/main/js/routes/summary.js               |  108 --
 .../src/main/js/views/configuration/caches.jade |   74 -
 .../main/js/views/configuration/clusters.jade   |   77 --
 .../main/js/views/configuration/metadata.jade   |  121 --
 .../main/js/views/configuration/sidebar.jade    |   39 -
 .../main/js/views/configuration/summary.jade    |  113 --
 .../src/main/js/views/error.jade                |   22 -
 .../src/main/js/views/includes/controls.jade    |  350 -----
 .../src/main/js/views/includes/footer.jade      |   22 -
 .../src/main/js/views/includes/header.jade      |   39 -
 .../src/main/js/views/index.jade                |   30 -
 .../src/main/js/views/login.jade                |   55 -
 .../src/main/js/views/settings/admin.jade       |   58 -
 .../src/main/js/views/settings/profile.jade     |   58 -
 .../src/main/js/views/sql/sql.jade              |   84 --
 .../src/main/js/views/templates/confirm.jade    |   27 -
 .../src/main/js/views/templates/copy.jade       |   31 -
 .../src/main/js/views/templates/layout.jade     |   61 -
 .../src/main/js/views/templates/select.jade     |   26 -
 .../src/main/js/views/templates/tab.jade        |   26 -
 122 files changed, 10867 insertions(+), 10719 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/app.js
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/app.js
index 0000000,a67afc8..930c798
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/app.js
+++ b/modules/control-center-web/src/main/js/app.js
@@@ -1,0 -1,156 +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.
+  */
+ 
+ var flash = require('connect-flash');
+ var express = require('express');
+ var path = require('path');
+ var favicon = require('serve-favicon');
+ var logger = require('morgan');
+ var cookieParser = require('cookie-parser');
+ var bodyParser = require('body-parser');
+ var session = require('express-session');
+ var mongoStore = require('connect-mongo')(session);
+ 
+ var publicRoutes = require('./routes/public');
+ var clustersRouter = require('./routes/clusters');
+ var cachesRouter = require('./routes/caches');
+ var metadataRouter = require('./routes/metadata');
+ var summary = require('./routes/summary');
+ var adminRouter = require('./routes/admin');
+ var profileRouter = require('./routes/profile');
+ var sqlRouter = require('./routes/sql');
++var agentRouter = require('./routes/agent');
+ 
+ var passport = require('passport');
+ 
+ var db = require('./db');
+ 
+ var app = express();
+ 
+ // Views engine setup.
+ app.set('views', path.join(__dirname, 'views'));
+ app.set('view engine', 'jade');
+ 
+ // Site favicon.
+ app.use(favicon(__dirname + '/public/favicon.ico'));
+ 
+ app.use(logger('dev'));
+ 
+ app.use(bodyParser.json());
+ app.use(bodyParser.urlencoded({extended: false}));
+ 
+ app.use(require('node-sass-middleware')({
+     /* Options */
+     src: path.join(__dirname, 'public'),
+     dest: path.join(__dirname, 'public'),
+     debug: true,
+     outputStyle: 'nested'
+ }));
+ 
+ app.use(express.static(path.join(__dirname, 'public')));
+ app.use(express.static(path.join(__dirname, 'controllers')));
+ app.use(express.static(path.join(__dirname, 'helpers')));
+ 
+ app.use(cookieParser('keyboard cat'));
+ 
+ app.use(session({
+     secret: 'keyboard cat',
+     resave: false,
+     saveUninitialized: true,
+     store: new mongoStore({
+         mongooseConnection: db.mongoose.connection
+     })
+ }));
+ 
+ app.use(flash());
+ 
+ app.use(passport.initialize());
+ app.use(passport.session());
+ 
+ passport.serializeUser(db.Account.serializeUser());
+ passport.deserializeUser(db.Account.deserializeUser());
+ 
+ passport.use(db.Account.createStrategy());
+ 
+ var mustAuthenticated = function (req, res, next) {
+     req.isAuthenticated() ? next() : res.redirect('/');
+ };
+ 
+ var adminOnly = function(req, res, next) {
+     req.isAuthenticated() && req.user.admin ? next() : res.sendStatus(403);
+ };
+ 
+ app.all('/configuration/*', mustAuthenticated);
+ 
+ app.all('*', function(req, res, next) {
+     var becomeUsed = req.session.viewedUser && req.user.admin;
+ 
+     res.locals.user = becomeUsed ? req.session.viewedUser : req.user;
+     res.locals.becomeUsed = becomeUsed;
+ 
+     req.currentUserId = function() {
+         if (!req.user)
+             return null;
+ 
+         if (req.session.viewedUser && req.user.admin)
+             return req.session.viewedUser._id;
+ 
+         return req.user._id;
+     };
+ 
+     next();
+ });
+ 
+ app.use('/', publicRoutes);
+ app.use('/admin', mustAuthenticated, adminOnly, adminRouter);
+ app.use('/profile', mustAuthenticated, profileRouter);
+ 
+ app.use('/configuration/clusters', clustersRouter);
+ app.use('/configuration/caches', cachesRouter);
+ app.use('/configuration/metadata', metadataRouter);
+ app.use('/configuration/summary', summary);
+ app.use('/sql', sqlRouter);
++app.use('/agent', agentRouter);
+ 
+ // Catch 404 and forward to error handler.
+ app.use(function (req, res, next) {
+     var err = new Error('Not Found: ' + req.originalUrl);
+     err.status = 404;
+     next(err);
+ });
+ 
+ // Error handlers.
+ 
+ // Development error handler: will print stacktrace.
+ if (app.get('env') === 'development') {
+     app.use(function (err, req, res) {
+         res.status(err.status || 500);
+         res.render('error', {
+             message: err.message,
+             error: err
+         });
+     });
+ }
+ 
+ // Production error handler: no stacktraces leaked to user.
+ app.use(function (err, req, res) {
+     res.status(err.status || 500);
+     res.render('error', {
+         message: err.message,
+         error: {}
+     });
+ });
+ 
+ module.exports = app;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/bin/www
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/bin/www
index 0000000,4cf0583..cbc637a
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/bin/www
+++ b/modules/control-center-web/src/main/js/bin/www
@@@ -1,0 -1,85 +1,110 @@@
+ #!/usr/bin/env node
+ 
+ /**
+  * Module dependencies.
+  */
 -var app = require('../app');
++var http = require('http');
++var https = require('https');
+ var config = require('../helpers/configuration-loader.js');
++var app = require('../app');
++var agentManager = require('../agents/agent-manager');
++
++var fs = require('fs');
++
+ var debug = require('debug')('ignite-web-control-center:server');
 -var http = require('http');
+ 
+ /**
+  * Get port from environment and store in Express.
+  */
+ var port = normalizePort(process.env.PORT || config.get('express:port'));
+ app.set('port', port);
+ 
+ /**
+  * Create HTTP server.
+  */
+ var server = http.createServer(app);
+ 
+ /**
+  * Listen on provided port, on all network interfaces.
+  */
+ server.listen(port);
+ server.on('error', onError);
+ server.on('listening', onListening);
+ 
+ /**
++ * Start agent server.
++ */
++var agentServer;
++
++if (config.get('monitor:server:ssl')) {
++    agentServer = https.createServer({
++    key: fs.readFileSync(config.get('monitor:server:key')),
++    cert: fs.readFileSync(config.get('monitor:server:cert')),
++    passphrase: config.get('monitor:server:keyPassphrase')
++  });
++}
++else {
++  agentServer = http.createServer();
++}
++
++agentServer.listen(config.get('monitor:server:port'));
++
++agentManager.createManager(agentServer);
++
++/**
+  * Normalize a port into a number, string, or false.
+  */
+ function normalizePort(val) {
+   var port = parseInt(val, 10);
+ 
+   if (isNaN(port)) {
+     // named pipe
+     return val;
+   }
+ 
+   if (port >= 0) {
+     // port number
+     return port;
+   }
+ 
+   return false;
+ }
+ 
+ /**
+  * Event listener for HTTP server "error" event.
+  */
+ function onError(error) {
+   if (error.syscall !== 'listen') {
+     throw error;
+   }
+ 
+   var bind = typeof port === 'string'
+     ? 'Pipe ' + port
+     : 'Port ' + port;
+ 
+   // handle specific listen errors with friendly messages
+   switch (error.code) {
+     case 'EACCES':
+       console.error(bind + ' requires elevated privileges');
+       process.exit(1);
+       break;
+     case 'EADDRINUSE':
+       console.error(bind + ' is already in use');
+       process.exit(1);
+       break;
+     default:
+       throw error;
+   }
+ }
+ 
+ /**
+  * Event listener for HTTP server "listening" event.
+  */
+ function onListening() {
+   var addr = server.address();
+   var bind = typeof addr === 'string'
+     ? 'pipe ' + addr
+     : 'port ' + addr.port;
+ 
+   debug('Listening on ' + bind);
+ }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/config/default.json
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/config/default.json
index 0000000,72dbd4e..f7f7a02
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/config/default.json
+++ b/modules/control-center-web/src/main/js/config/default.json
@@@ -1,0 -1,8 +1,17 @@@
+ {
+     "express": {
+         "port": 3000
+     },
+     "mongoDB": {
+         "url": "mongodb://localhost/web-control-center"
++    },
++    "monitor": {
++        "server": {
++            "port": 3001,
++            "ssl": true,
++            "key": "keys/test.key",
++            "cert": "keys/test.crt",
++            "keyPassphrase": "password"
++        }
+     }
 -}
++}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/controllers/sql-controller.js
index 0000000,12772c6..b4b4335
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@@ -1,0 -1,84 +1,129 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *      http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ 
 -var demoResults = [
 -    {
 -        id: 256,
 -        firstName: 'Ivan',
 -        lastName: 'Ivanov'
 -    },
 -    {
 -        id: 384,
 -        firstName: 'Sergey',
 -        lastName: 'Petrov'
 -    },
 -    {
 -        id: 923,
 -        firstName: 'Andrey',
 -        lastName: 'Sidorov'
 -    }
 -];
 -
 -var demoCaches = [{_id: '1', name: 'Users', mode: 'LOCAL'}, {_id: '2', name: 'Organizations', mode: 'REPLICATED'}, {_id: '3', name: 'Cities', mode: 'PARTITIONED'}];
 -
 -
 -
+ controlCenterModule.controller('sqlController', ['$scope', '$http', '$common', function ($scope, $http, $common) {
+     $scope.joinTip = $common.joinTip;
+ 
+     $scope.pageSizes = [50, 100, 200, 400, 800, 1000];
+ 
 -    $scope.tabs = [
 -        {
 -            query: "SELECT u.id, u.firstName, u.lastName FROM User u WHERE u.name LIKE 'aaaa'",
 -            cols: Object.keys(demoResults[0]),
 -            page: 1,
 -            hasMore: true,
 -            total: 0,
 -            rows: demoResults
 -        },
 -        {query: "SELECT * FROM Organization"}
++    $scope.modes = [
++        {value: 'PARTITIONED', label: 'PARTITIONED'},
++        {value: 'REPLICATED', label: 'REPLICATED'},
++        {value: 'LOCAL', label: 'LOCAL'}
+     ];
+ 
++    $scope.tabs = [];
++
+     $scope.addTab = function() {
 -        console.log('addTab');
++        var tab = {query: "", pageSize: $scope.pageSizes[0]};
++
++        if ($scope.caches.length > 0)
++            tab.selectedItem = $scope.caches[0];
+ 
 -        $scope.tabs.push({query: "SELECT "});
++        $scope.tabs.push(tab);
+     };
+ 
+     $scope.removeTab = function(idx) {
 -        console.log('removeTab');
 -
+         $scope.tabs.splice(idx, 1);
+     };
+ 
 -    $scope.modes = [
 -        {value: 'PARTITIONED', label: 'PARTITIONED'},
 -        {value: 'REPLICATED', label: 'REPLICATED'},
 -        {value: 'LOCAL', label: 'LOCAL'}
 -    ];
 -
+     $http.get('/models/sql.json')
+         .success(function (data) {
+             $scope.screenTip = data.screenTip;
+         })
+         .error(function (errMsg) {
+             $common.showError(errMsg);
+         });
+ 
 -    $scope.caches = demoCaches;
++    $scope.caches = [];
++
++    $http.post('/agent/topology')
++        .success(function (clusters) {
++            var node = clusters[0];
++
++            $scope.caches = node.caches;
++
++            if ($scope.tabs.length == 0)
++                $scope.addTab();
++        })
++        .error(function (errMsg) {
++            $common.showError(errMsg);
++        });
++
++    $scope.execute = function(tab) {
++        $http.post('/agent/query', {query: tab.query, pageSize: tab.pageSize, cacheName: tab.selectedItem.name})
++            .success(function (res) {
++                tab.meta = [];
++
++                if (res.meta)
++                    tab.meta = res.meta;
++
++                tab.page = 1;
++
++                tab.total = 0;
++
++                tab.queryId = res.queryId;
++
++                tab.rows = res.rows;
++            })
++            .error(function (errMsg) {
++                $common.showError(errMsg);
++            });
++    };
++
++    $scope.explain = function(tab) {
++        $http.post('/agent/query', {query: 'EXPLAIN ' + tab.query, pageSize: tab.pageSize, cacheName: tab.selectedItem.name})
++            .success(function (res) {
++                tab.meta = [];
++
++                if (res.meta)
++                    tab.meta = res.meta;
++
++                tab.page = 1;
++
++                tab.total = 0;
++
++                tab.queryId = res.queryId;
++
++                tab.rows = res.rows;
++            })
++            .error(function (errMsg) {
++                $common.showError(errMsg);
++            });
++    };
++
++    $scope.nextPage = function(tab) {
++        $http.post('/agent/next_page', {queryId: tab.queryId, pageSize: tab.pageSize, cacheName: tab.selectedItem.name})
++            .success(function (res) {
++                tab.page++;
++
++                tab.total += tab.rows.length;
++
++                tab.rows = res.rows;
++
++                if (res.last)
++                    delete tab.queryId;
++            })
++            .error(function (errMsg) {
++                $common.showError(errMsg);
++            });
++    };
++
++    $scope.getter = function (value) {
++        return value;
++    }
+ }]);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/package.json
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/package.json
index 0000000,fd82196..f7926cf
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/package.json
+++ b/modules/control-center-web/src/main/js/package.json
@@@ -1,0 -1,49 +1,50 @@@
+ {
+   "name": "ignite-web-control-center",
+   "version": "1.0.0",
+   "description": "Web application for configuration, monitoring Ignite Cluster",
+   "private": true,
+   "scripts": {
+     "start": "node ./bin/www"
+   },
+   "author": "",
+   "contributors": [
+     {
+       "name": "",
+       "email": ""
+     }
+   ],
+   "license": "Apache-2.0",
+   "keywords": "grid",
+   "homepage": "https://ignite.incubator.apache.org/",
+   "engines": {
+     "node": ">=0.12.4"
+   },
+   "dependencies": {
+     "angular-ui-ace": "^0.2.3",
+     "archiver": "^0.14.4",
+     "body-parser": "~1.12.0",
+     "connect-flash": "^0.1.1",
+     "connect-mongo": "^0.8.1",
+     "cookie-parser": "~1.3.4",
+     "debug": "~2.1.1",
+     "express": "~4.12.2",
+     "express-session": "^1.11.1",
+     "jade": "~1.9.2",
+     "lodash": "3.10.0",
+     "mongoose": "^4.0.2",
+     "mongoose-deep-populate": "1.1.0",
+     "nconf": "^0.7.1",
+     "node-sass-middleware": "^0.9.0",
+     "passport": "^0.2.1",
+     "passport-local": "^1.0.0",
+     "passport-local-mongoose": "^1.0.0",
 -    "serve-favicon": "~2.2.0"
++    "serve-favicon": "~2.2.0",
++    "ws": "~0.7.2"
+   },
+   "devDependencies": {
+     "morgan": "~1.5.1",
+     "supertest": "^1.0.1",
+     "mocha": "~2.0.1",
+     "should": "~3.1.3"
+   }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/views/sql/sql.jade
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/views/sql/sql.jade
index 0000000,97d34de..2ce6958
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/views/sql/sql.jade
+++ b/modules/control-center-web/src/main/js/views/sql/sql.jade
@@@ -1,0 -1,85 +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.
+ extends ../templates/layout
+ 
+ append scripts
+     script(src='/sql-controller.js')
+ 
+     script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/theme-chrome.js')
+     script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/mode-sql.js')
+     script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ext-language_tools.js')
+ 
+ block container
+     .row
+         .col-sm-12
+             .docs-content
+                 .docs-header
+                     h1 Connect to Ignite and Execute SQL Queries
+                     hr
+                 .docs-body(ng-controller='sqlController')
+                     - var tab = 'tabs[tabs.activeIdx]'
+ 
+                     .block-callout-parent.block-callout-border.margin-bottom-dflt
+                         .block-callout
+                             p(ng-bind-html='joinTip(screenTip)')
+                     .tabs-below(bs-tabs bs-active-pane='tabs.activeIdx' data-template='/tab')
+                         div(ng-repeat='tab in tabs' title='Query' bs-pane)
+                     .row
+                         .col-sm-9(style='border-right: 1px solid #eee')
+                             div(style='height: 200px' ui-ace='{ theme: "chrome", mode: "sql",' +
+                                 'require: ["ace/ext/language_tools"],' +
+                                 'rendererOptions: {showPrintMargin: false, highlightGutterLine: false, fontSize: 14},' +
+                                 'advanced: {enableSnippets: false, enableBasicAutocompletion: true, enableLiveAutocompletion: true}}' ng-model='#{tab}.query')
+                         .col-sm-3
+                             div(ng-hide='caches.length == 0' style='margin-top: 0.65em')
+                                 lable.labelHeader Caches:
+                                 table.links(st-table='caches')
+                                     tbody
 -                                        tr(ng-repeat='row in caches track by row._id')
 -                                            td.col-sm-6(ng-class='{active: row._id == #{tab}.selectedItem._id}')
 -                                                a(ng-click='#{tab}.selectedItem = row') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}}
++                                        tr(ng-repeat='row in caches track by row.name')
++                                            td.col-sm-6(ng-class='{active: row.name == #{tab}.selectedItem.name}')
++                                                a(ng-click='#{tab}.selectedItem = row') {{$index + 1}}) {{::row.name}}, {{::row.mode}}
+                     hr(style='margin: 0')
+                     .settings-row
+                         label Page Size:&nbsp;
 -                        button.btn.btn-default.base-control(ng-init='pageSize = pageSizes[0]' ng-model='pageSize' bs-options='item for item in pageSizes' bs-select)
++                        button.btn.btn-default.base-control(ng-model='#{tab}.pageSize' bs-options='item for item in pageSizes' bs-select)
+                     .settings-row
 -                        button.btn.btn-primary(ng-click='') Explain
 -                        button.btn.btn-primary(ng-click='') Execute
 -                        button.btn.btn-primary(ng-click='' disabled) Scan
++                        button.btn.btn-primary(ng-click='explain(#{tab})') Explain
++                        button.btn.btn-primary(ng-click='execute(#{tab})') Execute
++                        button.btn.btn-primary(ng-click='scan(#{tab})' disabled) Scan
+ 
+                     div(ng-show='#{tab}.rows.length > 0' style='margin-top: 0.65em')
+                         hr
+                         div
 -                            table.table.table-striped.col-sm-12.sql-results(st-table='rows' st-safe-src='#{tab}.rows')
++                            table.table.table-striped.col-sm-12.sql-results(st-table='displayedCollection' st-safe-src='#{tab}.rows')
+                                 thead
+                                     tr(style='border-size: 0')
 -                                        td(colspan='{{#{tab}.cols.length}}')
++                                        td(colspan='{{#{tab}.meta.length}}')
+                                             .col-sm-8
+                                                 lable Page #:&nbsp;
+                                                 b {{#{tab}.page}}&nbsp;&nbsp;&nbsp;
+                                                 | Results:&nbsp;
+                                                 b {{#{tab}.rows.length + #{tab}.total}}
+                                             .col-sm-4
 -                                                button.btn.btn-primary.fieldButton(ng-click='') Next page
 -                                                .input-tip
 -                                                    input.form-control(type='text' st-search='' placeholder='Filter...')
 -
++                                                button.btn.btn-primary.fieldButton(ng-click='nextPage(#{tab})' ng-disabled='!#{tab}.queryId') Next page
++                                                //.input-tip
++                                                //    input.form-control(st-search placeholder='Filter...' type='search')
+                                     tr
 -                                        th(ng-repeat='column in #{tab}.cols' st-sort='{{column}}') {{column}}
++                                        th(ng-repeat='col in #{tab}.meta track by $index' st-sort='getter' data-ng-bind='::col.fieldName' bs-tooltip='col.schemaName + "." + col.typeName + "." + col.fieldName')
+                                 tbody
+                                     //tr
+                                     //    td(colspan='{{#{tab}.cols.length}}')
+                                     //        .loading-indicator
 -                                    tr(ng-repeat='row in rows')
 -                                        td(ng-repeat='column in #{tab}.cols') {{row[column]}}
++                                    tr(ng-repeat='row in displayedCollection track by $index')
++                                        td(ng-repeat='val in row track by $index') {{ val }}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b621759/modules/control-center-web/src/main/js/views/templates/layout.jade
----------------------------------------------------------------------
diff --cc modules/control-center-web/src/main/js/views/templates/layout.jade
index 0000000,71d8936..8e92edb
mode 000000,100644..100644
--- a/modules/control-center-web/src/main/js/views/templates/layout.jade
+++ b/modules/control-center-web/src/main/js/views/templates/layout.jade
@@@ -1,0 -1,61 +1,61 @@@
+ //-
+     Licensed to the Apache Software Foundation (ASF) under one or more
+     contributor license agreements.  See the NOTICE file distributed with
+     this work for additional information regarding copyright ownership.
+     The ASF licenses this file to You under the Apache License, Version 2.0
+     (the "License"); you may not use this file except in compliance with
+     the License.  You may obtain a copy of the License at
+ 
+          http://www.apache.org/licenses/LICENSE-2.0
+ 
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+ 
+ doctype html
+ html(ng-app='ignite-web-control-center' ng-init='user = #{JSON.stringify(user)}; becomeUsed = #{becomeUsed}')
+     head
+         title= title
+ 
+         block css
+             // Bootstrap
+             link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css')
+ 
+             // Font Awesome Icons
+             link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css')
+ 
+             // Font
+             link(rel='stylesheet', href='//fonts.googleapis.com/css?family=Roboto+Slab:700:serif|Roboto+Slab:400:serif')
+ 
+             link(rel='stylesheet', href='/stylesheets/style.css')
+ 
+         block scripts
+             script(src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js')
+ 
+             script(src='//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js')
+ 
+             script(src='//ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.js')
+             script(src='//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.2/angular-sanitize.js')
+             script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.0/angular-strap.js')
+             script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.0/angular-strap.tpl.min.js')
+ 
 -            script(src='//cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.0.3/smart-table.js')
++            script(src='//cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.1/smart-table.js')
+ 
+             script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js')
+             script(src='//angular-ui.github.io/ui-ace/dist/ui-ace.min.js')
+ 
+             script(src='/common-module.js')
+             script(src='/data-structures.js')
+ 
+     body.theme-line.body-overlap.greedy
+         .wrapper
+             include ../includes/header
+ 
+             block main-container
+                 .container.body-container
+                     .main-content
+                         block container
+ 
+             include ../includes/footer


[40/50] [abbrv] incubator-ignite git commit: # ignite-1148 Added sql tab.

Posted by an...@apache.org.
# ignite-1148 Added sql tab.


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

Branch: refs/heads/ignite-843
Commit: 94bb0d9587b0479cd64c48496e500c570fa6350a
Parents: f621c3e
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 29 10:27:57 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 29 10:27:57 2015 +0700

----------------------------------------------------------------------
 modules/nodejs/src/main/js/cache.js             |  13 ++
 .../src/main/js/agents/agent-manager.js         |   4 +-
 .../src/main/js/controllers/sql-controller.js   | 131 +++++++++++++------
 .../src/main/js/routes/agent.js                 |  57 +++++++-
 .../src/main/js/views/sql.jade                  |  70 ----------
 .../src/main/js/views/sql/sql.jade              |  31 +++--
 .../src/main/js/views/templates/layout.jade     |   2 +-
 7 files changed, 171 insertions(+), 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/nodejs/src/main/js/cache.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js
index 1600eaa..e9db1b3 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -421,6 +421,19 @@ QueryCursor.prototype.page = function() {
 }
 
 /**
+ * Gets queryId of the query.
+ *
+ * @this{QueryCursor}
+ * @returns {Object} Query id may be null.
+ */
+QueryCursor.prototype.queryId = function() {
+    if (this.isFinished())
+        return undefined;
+
+    return this._res.queryId;
+}
+
+/**
  * Closes all resources related to this cursor.
  *
  * @this{QueryCursor}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/web-control-center/src/main/js/agents/agent-manager.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/agents/agent-manager.js b/modules/web-control-center/src/main/js/agents/agent-manager.js
index 252b984..10d3a56 100644
--- a/modules/web-control-center/src/main/js/agents/agent-manager.js
+++ b/modules/web-control-center/src/main/js/agents/agent-manager.js
@@ -17,7 +17,7 @@
 
 var WebSocketServer = require('ws').Server;
 
-var ignite = require('apache-ignite');
+var apacheIgnite = require('apache-ignite');
 
 var db = require('../db');
 
@@ -216,7 +216,7 @@ Client.prototype._handleMessage = function(msg) {
 
                             self._manager._addClient(account._id, self);
 
-                            self._ignite = new ignite.Ignite(new AgentServer(self));
+                            self._ignite = new apacheIgnite.Ignite(new AgentServer(self));
                         }
                     });
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/web-control-center/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/controllers/sql-controller.js b/modules/web-control-center/src/main/js/controllers/sql-controller.js
index 12772c6..b4b4335 100644
--- a/modules/web-control-center/src/main/js/controllers/sql-controller.js
+++ b/modules/web-control-center/src/main/js/controllers/sql-controller.js
@@ -15,63 +15,32 @@
  * limitations under the License.
  */
 
-var demoResults = [
-    {
-        id: 256,
-        firstName: 'Ivan',
-        lastName: 'Ivanov'
-    },
-    {
-        id: 384,
-        firstName: 'Sergey',
-        lastName: 'Petrov'
-    },
-    {
-        id: 923,
-        firstName: 'Andrey',
-        lastName: 'Sidorov'
-    }
-];
-
-var demoCaches = [{_id: '1', name: 'Users', mode: 'LOCAL'}, {_id: '2', name: 'Organizations', mode: 'REPLICATED'}, {_id: '3', name: 'Cities', mode: 'PARTITIONED'}];
-
-
-
 controlCenterModule.controller('sqlController', ['$scope', '$http', '$common', function ($scope, $http, $common) {
     $scope.joinTip = $common.joinTip;
 
     $scope.pageSizes = [50, 100, 200, 400, 800, 1000];
 
-    $scope.tabs = [
-        {
-            query: "SELECT u.id, u.firstName, u.lastName FROM User u WHERE u.name LIKE 'aaaa'",
-            cols: Object.keys(demoResults[0]),
-            page: 1,
-            hasMore: true,
-            total: 0,
-            rows: demoResults
-        },
-        {query: "SELECT * FROM Organization"}
+    $scope.modes = [
+        {value: 'PARTITIONED', label: 'PARTITIONED'},
+        {value: 'REPLICATED', label: 'REPLICATED'},
+        {value: 'LOCAL', label: 'LOCAL'}
     ];
 
+    $scope.tabs = [];
+
     $scope.addTab = function() {
-        console.log('addTab');
+        var tab = {query: "", pageSize: $scope.pageSizes[0]};
+
+        if ($scope.caches.length > 0)
+            tab.selectedItem = $scope.caches[0];
 
-        $scope.tabs.push({query: "SELECT "});
+        $scope.tabs.push(tab);
     };
 
     $scope.removeTab = function(idx) {
-        console.log('removeTab');
-
         $scope.tabs.splice(idx, 1);
     };
 
-    $scope.modes = [
-        {value: 'PARTITIONED', label: 'PARTITIONED'},
-        {value: 'REPLICATED', label: 'REPLICATED'},
-        {value: 'LOCAL', label: 'LOCAL'}
-    ];
-
     $http.get('/models/sql.json')
         .success(function (data) {
             $scope.screenTip = data.screenTip;
@@ -80,5 +49,81 @@ controlCenterModule.controller('sqlController', ['$scope', '$http', '$common', f
             $common.showError(errMsg);
         });
 
-    $scope.caches = demoCaches;
+    $scope.caches = [];
+
+    $http.post('/agent/topology')
+        .success(function (clusters) {
+            var node = clusters[0];
+
+            $scope.caches = node.caches;
+
+            if ($scope.tabs.length == 0)
+                $scope.addTab();
+        })
+        .error(function (errMsg) {
+            $common.showError(errMsg);
+        });
+
+    $scope.execute = function(tab) {
+        $http.post('/agent/query', {query: tab.query, pageSize: tab.pageSize, cacheName: tab.selectedItem.name})
+            .success(function (res) {
+                tab.meta = [];
+
+                if (res.meta)
+                    tab.meta = res.meta;
+
+                tab.page = 1;
+
+                tab.total = 0;
+
+                tab.queryId = res.queryId;
+
+                tab.rows = res.rows;
+            })
+            .error(function (errMsg) {
+                $common.showError(errMsg);
+            });
+    };
+
+    $scope.explain = function(tab) {
+        $http.post('/agent/query', {query: 'EXPLAIN ' + tab.query, pageSize: tab.pageSize, cacheName: tab.selectedItem.name})
+            .success(function (res) {
+                tab.meta = [];
+
+                if (res.meta)
+                    tab.meta = res.meta;
+
+                tab.page = 1;
+
+                tab.total = 0;
+
+                tab.queryId = res.queryId;
+
+                tab.rows = res.rows;
+            })
+            .error(function (errMsg) {
+                $common.showError(errMsg);
+            });
+    };
+
+    $scope.nextPage = function(tab) {
+        $http.post('/agent/next_page', {queryId: tab.queryId, pageSize: tab.pageSize, cacheName: tab.selectedItem.name})
+            .success(function (res) {
+                tab.page++;
+
+                tab.total += tab.rows.length;
+
+                tab.rows = res.rows;
+
+                if (res.last)
+                    delete tab.queryId;
+            })
+            .error(function (errMsg) {
+                $common.showError(errMsg);
+            });
+    };
+
+    $scope.getter = function (value) {
+        return value;
+    }
 }]);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/web-control-center/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/routes/agent.js b/modules/web-control-center/src/main/js/routes/agent.js
index 19379e2..4646c28 100644
--- a/modules/web-control-center/src/main/js/routes/agent.js
+++ b/modules/web-control-center/src/main/js/routes/agent.js
@@ -18,20 +18,67 @@
 var router = require('express').Router();
 var agentManager = require('../agents/agent-manager');
 
+var apacheIgnite = require('apache-ignite');
+var SqlFieldsQuery = apacheIgnite.SqlFieldsQuery;
+
 /* GET summary page. */
 router.post('/topology', function(req, res) {
-    var c = agentManager.getAgentManager().getOneClient();
+    var client = agentManager.getAgentManager().getOneClient();
 
-    if (!c)
+    if (!client)
         return res.status(500).send("Client not found");
 
-    var ignite = c.ignite();
+    client.ignite().cluster().then(function (clusters) {
+        res.json(clusters.map(function (cluster) {
+            var caches = Object.keys(cluster._caches).map(function(key) {
+                return {"name" : key, "mode" : cluster._caches[key] }
+            });
 
-    ignite.cluster().then(function (cluster) {
-        res.json(cluster);
+            return { nodeId: cluster._nodeId, caches: caches };
+        }));
     }, function (err) {
         res.send(err);
     });
 });
 
+/* GET summary page. */
+router.post('/query', function(req, res) {
+    var client = agentManager.getAgentManager().getOneClient();
+
+    if (!client)
+        return res.status(500).send("Client not found");
+
+    // Create sql query.
+    var qry = new SqlFieldsQuery(req.body.query);
+
+    // Set page size for query.
+    qry.setPageSize(req.body.pageSize);
+
+    // Get query cursor.
+    client.ignite().cache(req.body.cacheName).query(qry).nextPage().then(function (cursor) {
+        res.json({meta: cursor.fieldsMetadata(), rows: cursor.page(), queryId: cursor.queryId()});
+    }, function (err) {
+        res.status(500).send(err);
+    });
+});
+
+/* GET summary page. */
+router.post('/next_page', function(req, res) {
+    var client = agentManager.getAgentManager().getOneClient();
+
+    if (!client)
+        return res.status(500).send("Client not found");
+
+    var cache = client.ignite().cache(req.body.cacheName);
+
+    var cmd = cache._createCommand("qryfetch").addParam("qryId", req.body.queryId).
+        addParam("psz", req.body.pageSize);
+
+    cache.__createPromise(cmd).then(function (page) {
+        res.json({rows: page["items"], last: page === null || page["last"]});
+    }, function (err) {
+        res.status(500).send(err);
+    });
+});
+
 module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/web-control-center/src/main/js/views/sql.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/views/sql.jade b/modules/web-control-center/src/main/js/views/sql.jade
deleted file mode 100644
index 9ba3056..0000000
--- a/modules/web-control-center/src/main/js/views/sql.jade
+++ /dev/null
@@ -1,70 +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.
-extends ../templates/layout
-
-append scripts
-    script(src='/sql-controller.js')
-
-    script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/theme-chrome.js')
-    script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/mode-sql.js')
-    script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ext-language_tools.js')
-
-block container
-    .row
-        .col-sm-12
-            .docs-content
-                .docs-header
-                    h1 Connect to Ignite and execute SQL queries
-                    hr
-                .docs-body(ng-controller='sqlController')
-                    .block-callout
-                        p(ng-bind-html='joinTip(screenTip)')
-                    .tabs-below(bs-tabs bs-active-pane='tabs.activeTab')
-                        div(title='Query #1' bs-pane)
-                            .row
-                                .col-sm-9
-                                    div(style='height: 200px' ui-ace='{ theme: "chrome", mode: "sql",' +
-                                        'require: ["ace/ext/language_tools"],' +
-                                        'rendererOptions: {showPrintMargin: false, highlightGutterLine: false, fontSize: 14},' +
-                                        'advanced: {enableSnippets: false, enableBasicAutocompletion: true, enableLiveAutocompletion: true}}'  ng-model='query')
-                                .col-sm-3
-                                    .links(ng-hide='caches.length == 0' style='margin-top: 0.65em')
-                                        lable.labelHeader Caches:
-                                        table(st-table='caches')
-                                            tbody
-                                                tr(ng-repeat='row in caches track by row._id')
-                                                    td.col-sm-6(ng-class='{active: row._id == selectedItem._id}')
-                                                        a(ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}}
-                        div(title='Query #2' bs-pane)
-                            .row
-                    .settings-row
-                        button.btn.btn-primary(ng-click='') Explain
-                        button.btn.btn-primary(ng-click='') Execute
-                        button.btn.btn-primary(ng-click='' disabled) Scan
-                    //#resultPanel
-                    //    strong Results
-                    //
-                    //    #queryResult
-                    //        div(ng-repeat='r in results')
-                    //            .resultRow
-                    //                | {{r.id}} -> {{r.s}}
-                    //                span.props  {{r.fields}}
-
-                    div(ng-hide='results.length == 0' style='margin-top: 0.65em')
-                        lable.labelHeader Results:
-                        table.table-bordered(st-table='results')
-                            tbody
-                                tr(ng-repeat='row in results')
-                                    td
-                                        a(ng-click='selectItem(row)') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/web-control-center/src/main/js/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/views/sql/sql.jade b/modules/web-control-center/src/main/js/views/sql/sql.jade
index 97d34de..2ce6958 100644
--- a/modules/web-control-center/src/main/js/views/sql/sql.jade
+++ b/modules/web-control-center/src/main/js/views/sql/sql.jade
@@ -46,40 +46,39 @@ block container
                                 lable.labelHeader Caches:
                                 table.links(st-table='caches')
                                     tbody
-                                        tr(ng-repeat='row in caches track by row._id')
-                                            td.col-sm-6(ng-class='{active: row._id == #{tab}.selectedItem._id}')
-                                                a(ng-click='#{tab}.selectedItem = row') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}}
+                                        tr(ng-repeat='row in caches track by row.name')
+                                            td.col-sm-6(ng-class='{active: row.name == #{tab}.selectedItem.name}')
+                                                a(ng-click='#{tab}.selectedItem = row') {{$index + 1}}) {{::row.name}}, {{::row.mode}}
                     hr(style='margin: 0')
                     .settings-row
                         label Page Size:&nbsp;
-                        button.btn.btn-default.base-control(ng-init='pageSize = pageSizes[0]' ng-model='pageSize' bs-options='item for item in pageSizes' bs-select)
+                        button.btn.btn-default.base-control(ng-model='#{tab}.pageSize' bs-options='item for item in pageSizes' bs-select)
                     .settings-row
-                        button.btn.btn-primary(ng-click='') Explain
-                        button.btn.btn-primary(ng-click='') Execute
-                        button.btn.btn-primary(ng-click='' disabled) Scan
+                        button.btn.btn-primary(ng-click='explain(#{tab})') Explain
+                        button.btn.btn-primary(ng-click='execute(#{tab})') Execute
+                        button.btn.btn-primary(ng-click='scan(#{tab})' disabled) Scan
 
                     div(ng-show='#{tab}.rows.length > 0' style='margin-top: 0.65em')
                         hr
                         div
-                            table.table.table-striped.col-sm-12.sql-results(st-table='rows' st-safe-src='#{tab}.rows')
+                            table.table.table-striped.col-sm-12.sql-results(st-table='displayedCollection' st-safe-src='#{tab}.rows')
                                 thead
                                     tr(style='border-size: 0')
-                                        td(colspan='{{#{tab}.cols.length}}')
+                                        td(colspan='{{#{tab}.meta.length}}')
                                             .col-sm-8
                                                 lable Page #:&nbsp;
                                                 b {{#{tab}.page}}&nbsp;&nbsp;&nbsp;
                                                 | Results:&nbsp;
                                                 b {{#{tab}.rows.length + #{tab}.total}}
                                             .col-sm-4
-                                                button.btn.btn-primary.fieldButton(ng-click='') Next page
-                                                .input-tip
-                                                    input.form-control(type='text' st-search='' placeholder='Filter...')
-
+                                                button.btn.btn-primary.fieldButton(ng-click='nextPage(#{tab})' ng-disabled='!#{tab}.queryId') Next page
+                                                //.input-tip
+                                                //    input.form-control(st-search placeholder='Filter...' type='search')
                                     tr
-                                        th(ng-repeat='column in #{tab}.cols' st-sort='{{column}}') {{column}}
+                                        th(ng-repeat='col in #{tab}.meta track by $index' st-sort='getter' data-ng-bind='::col.fieldName' bs-tooltip='col.schemaName + "." + col.typeName + "." + col.fieldName')
                                 tbody
                                     //tr
                                     //    td(colspan='{{#{tab}.cols.length}}')
                                     //        .loading-indicator
-                                    tr(ng-repeat='row in rows')
-                                        td(ng-repeat='column in #{tab}.cols') {{row[column]}}
\ No newline at end of file
+                                    tr(ng-repeat='row in displayedCollection track by $index')
+                                        td(ng-repeat='val in row track by $index') {{ val }}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94bb0d95/modules/web-control-center/src/main/js/views/templates/layout.jade
----------------------------------------------------------------------
diff --git a/modules/web-control-center/src/main/js/views/templates/layout.jade b/modules/web-control-center/src/main/js/views/templates/layout.jade
index 71d8936..8e92edb 100644
--- a/modules/web-control-center/src/main/js/views/templates/layout.jade
+++ b/modules/web-control-center/src/main/js/views/templates/layout.jade
@@ -41,7 +41,7 @@ html(ng-app='ignite-web-control-center' ng-init='user = #{JSON.stringify(user)};
             script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.0/angular-strap.js')
             script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.0/angular-strap.tpl.min.js')
 
-            script(src='//cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.0.3/smart-table.js')
+            script(src='//cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.1.1/smart-table.js')
 
             script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js')
             script(src='//angular-ui.github.io/ui-ace/dist/ui-ace.min.js')


[20/50] [abbrv] incubator-ignite git commit: #ignite-961: merge

Posted by an...@apache.org.
#ignite-961:  merge


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

Branch: refs/heads/ignite-843
Commit: 206c78902c6f7c2ef601f0b5c8acae944ce576f2
Parents: 4475be8 9bfc184
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 12:38:22 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 12:38:22 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   5 +
 assembly/release-base.xml                       |   5 +
 config/ignite-log4j2.xml                        |  81 +++
 config/ignite-log4j2.xml~                       |  65 +++
 examples/config/example-ignite.xml              |   2 +-
 modules/clients/README.txt                      |  16 +
 modules/clients/readme.md                       |  32 --
 modules/clients/readme.pdf                      | Bin 47887 -> 0 bytes
 .../rest/protocols/tcp/MockNioSession.java      |  15 -
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  63 ++-
 .../apache/ignite/internal/IgniteKernal.java    |  49 +-
 .../GridClientConnectionManagerAdapter.java     |   2 +-
 .../client/router/impl/GridTcpRouterImpl.java   |   2 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../discovery/GridDiscoveryManager.java         |   7 +-
 .../cache/CacheEvictableEntryImpl.java          |   2 +-
 .../processors/cache/GridCacheAdapter.java      |  13 +-
 .../processors/cache/GridCacheEntryEx.java      |  32 +-
 .../cache/GridCacheEvictionManager.java         |  12 +-
 .../processors/cache/GridCacheMapEntry.java     | 208 +------
 .../processors/cache/GridCacheUtils.java        |  18 +-
 .../extras/GridCacheAttributesEntryExtras.java  |  37 +-
 .../GridCacheAttributesMvccEntryExtras.java     |  35 +-
 ...dCacheAttributesMvccObsoleteEntryExtras.java |  35 +-
 ...cheAttributesMvccObsoleteTtlEntryExtras.java |  35 +-
 .../GridCacheAttributesMvccTtlEntryExtras.java  |  35 +-
 .../GridCacheAttributesObsoleteEntryExtras.java |  36 +-
 ...idCacheAttributesObsoleteTtlEntryExtras.java |  36 +-
 .../GridCacheAttributesTtlEntryExtras.java      |  36 +-
 .../cache/extras/GridCacheEntryExtras.java      |  14 -
 .../extras/GridCacheEntryExtrasAdapter.java     |   8 -
 .../cache/extras/GridCacheMvccEntryExtras.java  |   8 -
 .../GridCacheMvccObsoleteEntryExtras.java       |   8 -
 .../GridCacheMvccObsoleteTtlEntryExtras.java    |   9 -
 .../extras/GridCacheMvccTtlEntryExtras.java     |   8 -
 .../extras/GridCacheObsoleteEntryExtras.java    |   8 -
 .../extras/GridCacheObsoleteTtlEntryExtras.java |   9 -
 .../cache/extras/GridCacheTtlEntryExtras.java   |   8 -
 .../store/GridCacheStoreManagerAdapter.java     |   2 +-
 .../cache/transactions/IgniteInternalTx.java    |  16 +-
 .../cache/transactions/IgniteTxAdapter.java     |   6 +-
 .../query/CacheQueryFieldsMetaResult.java       |   7 +
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  20 +-
 .../processors/task/GridTaskProcessor.java      |   3 +-
 .../util/lang/GridMetadataAwareAdapter.java     | 296 +++++-----
 .../ignite/internal/util/nio/GridNioServer.java |  28 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 519 ++++++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |  53 +-
 .../util/nio/ssl/GridNioSslHandler.java         |  79 ++-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  58 ++
 .../spi/IgniteSpiOperationTimeoutException.java |  43 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    | 102 ++++
 .../communication/tcp/TcpCommunicationSpi.java  | 294 ++++++++--
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  52 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 529 +++++++++++-------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  11 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 169 ++++--
 .../tcp/internal/TcpDiscoveryNode.java          |  21 +
 .../TcpDiscoveryConnectionCheckMessage.java     |  64 +++
 .../apache/ignite/ssl/SslContextFactory.java    | 458 ++++++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 modules/core/src/test/config/log4j2-test.xml    |  57 ++
 modules/core/src/test/config/log4j2-test.xml~   |  63 +++
 .../src/test/config/log4j2-verbose-test.xml     |  48 ++
 .../IgniteClientReconnectAbstractTest.java      |   4 +-
 .../IgniteTopologyPrintFormatSelfTest.java      |   6 +-
 .../CacheGetFutureHangsSelfTest.java            | 214 ++++++++
 .../cache/eviction/GridCacheMockEntry.java      |  12 +-
 .../internal/util/nio/GridNioSslSelfTest.java   |   2 +-
 .../nio/impl/GridNioFilterChainSelfTest.java    |  15 -
 .../GridMetadataAwareAdapterLoadSelfTest.java   | 135 +++++
 .../lang/GridMetadataAwareAdapterSelfTest.java  |  58 +-
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../GridTcpCommunicationSpiAbstractTest.java    |   2 +-
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |   3 +-
 ...tionSpiRecoveryFailureDetectionSelfTest.java |  54 ++
 ...GridTcpCommunicationSpiRecoverySelfTest.java |  23 +-
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 ++
 ...unicationSpiTcpFailureDetectionSelfTest.java |  75 +++
 .../tcp/IgniteCacheSslStartStopSelfTest.java    |  46 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  36 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 205 +++++++
 .../tcp/TcpClientDiscoverySpiSelfTest.java      | 116 ++--
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   1 +
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  | 402 ++++++++++++++
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 +
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteCacheFailoverTestSuite.java           |   4 +-
 .../IgniteSpiCommunicationSelfTestSuite.java    |   3 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   5 +
 modules/hadoop/docs/HADOOP_README.txt           | 122 +++++
 modules/hadoop/docs/hadoop_readme.md            | 135 -----
 modules/hadoop/docs/hadoop_readme.pdf           | Bin 82219 -> 0 bytes
 modules/log4j/README.txt                        |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   2 +-
 modules/log4j2/README.txt                       |  32 ++
 modules/log4j2/licenses/apache-2.0.txt          | 202 +++++++
 modules/log4j2/pom.xml                          |  63 +++
 modules/log4j2/pom.xml~                         |  45 ++
 .../ignite/logger/log4j2/Log4J2Logger.java      | 486 +++++++++++++++++
 .../ignite/logger/log4j2/Log4J2Logger.java~     | 542 +++++++++++++++++++
 .../ignite/logger/log4j2/Log4j2FileAware.java   |  35 ++
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |  33 ++
 .../ignite/logger/log4j2/Log4jFileAware.java~   |  13 +
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../log4j2/GridLog4j2CorrectFileNameTest.java   |  95 ++++
 .../log4j2/GridLog4j2CorrectFileNameTest.java~  |  95 ++++
 .../log4j2/GridLog4j2InitializedTest.java       |  79 +++
 .../log4j2/GridLog4j2InitializedTest.java~      |  79 +++
 .../log4j2/GridLog4j2LoggingFileTest.java       |  72 +++
 .../log4j2/GridLog4j2LoggingFileTest.java~      |  74 +++
 .../logger/log4j2/Log4j2LoggerSelfTest.java     | 174 ++++++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 117 ++++
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../testsuites/IgniteLog4j2TestSuite.java       |  38 ++
 .../http/jetty/GridJettyRestHandler.java        |  57 ++
 .../visor/commands/open/VisorOpenCommand.scala  |  17 +-
 .../scala/org/apache/ignite/visor/visor.scala   |   3 +
 modules/yardstick/README.md                     |  85 ---
 modules/yardstick/README.txt                    |  93 ++++
 parent/pom.xml                                  |   4 +-
 pom.xml                                         |   1 +
 128 files changed, 6982 insertions(+), 1493 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/206c7890/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/206c7890/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
index 0000000,0000000..040c44e
new file mode 100644
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
@@@ -1,0 -1,0 +1,7 @@@
++package org.apache.ignite.internal.processors.rest.handlers.query;
++
++/**
++ * Created by GridGain on 27.07.2015.
++ */
++public class CacheQueryFieldsMetaResult {
++}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/206c7890/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --cc modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 2cf9988,bf0f2c8..9068487
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@@ -577,129 -469,63 +577,186 @@@ public class GridJettyRestHandler exten
                  break;
              }
  
+             case EXECUTE_SQL_QUERY:
+             case EXECUTE_SQL_FIELDS_QUERY: {
+                 RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+ 
+                 restReq0.sqlQuery((String) params.get("qry"));
+ 
+                 restReq0.arguments(values("arg", params).toArray());
+ 
+                 restReq0.typeName((String) params.get("type"));
+ 
+                 String psz = (String) params.get("psz");
+ 
+                 if (psz != null)
+                     restReq0.pageSize(Integer.parseInt(psz));
+ 
+                 restReq0.cacheName((String)params.get("cacheName"));
+ 
+                 restReq = restReq0;
+ 
+                 break;
+             }
+ 
+             case FETCH_SQL_QUERY: {
+                 RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+ 
+                 String qryId = (String) params.get("qryId");
+ 
+                 if (qryId != null)
+                     restReq0.queryId(Long.parseLong(qryId));
+ 
+                 String psz = (String) params.get("psz");
+ 
+                 if (psz != null)
+                     restReq0.pageSize(Integer.parseInt(psz));
+ 
+                 restReq0.cacheName((String)params.get("cacheName"));
+ 
+                 restReq = restReq0;
+ 
+                 break;
+             }
+ 
+             case CLOSE_SQL_QUERY: {
+                 RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+ 
+                 String qryId = (String) params.get("qryId");
+ 
+                 if (qryId != null)
+                     restReq0.queryId(Long.parseLong(qryId));
+ 
+                 restReq0.cacheName((String)params.get("cacheName"));
+ 
+                 restReq = restReq0;
+ 
+                 break;
+             }
+ 
 +            case RUN_SCRIPT: {
 +                RestRunScriptRequest restReq0 = new RestRunScriptRequest();
 +
 +                restReq0.script((String)params.get("func"));
 +
 +                if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
 +                    Map o = parseRequest(req);
 +                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
 +                }
 +                else
 +                    restReq0.argument(params.get("arg"));
 +
 +                restReq = restReq0;
 +
 +                break;
 +            }
 +
 +            case AFFINITY_RUN_SCRIPT: {
 +                RestRunScriptRequest restReq0 = new RestRunScriptRequest();
 +
 +                restReq0.script((String)params.get("func"));
 +                restReq0.cacheName((String) params.get("cacheName"));
 +
 +                if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
 +                    Map o = parseRequest(req);
 +                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
 +
 +                    Object cacheObj = ctx.scripting().toJavaObject(o.get("key"));
 +                    restReq0.affinityKey(cacheObj);
 +                }
 +                else {
 +                    restReq0.argument(params.get("arg"));
 +                    restReq0.affinityKey(params.get("key"));
 +                }
 +
 +                restReq = restReq0;
 +
 +                break;
 +            }
 +
 +            case EXECUTE_MAP_REDUCE_SCRIPT: {
 +                RestMapReduceScriptRequest restReq0 = new RestMapReduceScriptRequest();
 +
 +                restReq0.mapFunction((String) params.get("map"));
 +
 +
 +                if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
 +                    Map o = parseRequest(req);
 +                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
 +                }
 +                else
 +                    restReq0.argument(params.get("arg"));
 +
 +                restReq0.reduceFunction((String) params.get("reduce"));
 +
 +                restReq = restReq0;
 +
 +                break;
 +            }
 +
 +            case EXECUTE_SQL_QUERY:
 +            case EXECUTE_SQL_FIELDS_QUERY: {
 +                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
 +
 +                restReq0.sqlQuery((String) params.get("qry"));
 +
 +                if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
 +                    Map o = parseRequest(req);
 +                    List args = (List) ctx.scripting().toScriptObject(o.get("arg"));
 +                    restReq0.arguments(args.toArray());
 +                }
 +                else
 +                    restReq0.arguments(values("arg", params).toArray());
 +
 +                restReq0.typeName((String) params.get("type"));
 +
 +                String psz = (String) params.get("psz");
 +
 +                if (psz != null)
 +                    restReq0.pageSize(Integer.parseInt(psz));
 +
 +                restReq0.cacheName((String)params.get("cacheName"));
 +
 +                restReq = restReq0;
 +
 +                break;
 +            }
 +
 +            case FETCH_SQL_QUERY: {
 +                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
 +
 +                String qryId = (String) params.get("qryId");
 +
 +                if (qryId != null)
 +                    restReq0.queryId(Long.parseLong(qryId));
 +
 +                String psz = (String) params.get("psz");
 +
 +                if (psz != null)
 +                    restReq0.pageSize(Integer.parseInt(psz));
 +
 +                restReq0.cacheName((String)params.get("cacheName"));
 +
 +                restReq = restReq0;
 +
 +                break;
 +            }
 +
 +            case CLOSE_SQL_QUERY: {
 +                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
 +
 +                String qryId = (String) params.get("qryId");
 +
 +                if (qryId != null)
 +                    restReq0.queryId(Long.parseLong(qryId));
 +
 +                restReq0.cacheName((String)params.get("cacheName"));
 +
 +                restReq = restReq0;
 +
 +                break;
 +            }
 +
              default:
                  throw new IgniteCheckedException("Invalid command: " + cmd);
          }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/206c7890/parent/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/206c7890/pom.xml
----------------------------------------------------------------------


[26/50] [abbrv] incubator-ignite git commit: #ignite-961: Add sql fields metadata to rest query response.

Posted by an...@apache.org.
#ignite-961:  Add sql fields metadata to rest query response.


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

Branch: refs/heads/ignite-843
Commit: 201e208e82b0d0c8f8fdb16747d703eedc7f95db
Parents: f22de3e
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 13:58:37 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 13:58:37 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     |  41 +++++-
 .../query/CacheQueryFieldsMetaResult.java       | 133 +++++++++++++++++++
 .../rest/handlers/query/CacheQueryResult.java   |  19 +++
 .../handlers/query/QueryCommandHandler.java     |  21 +++
 4 files changed, 212 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/201e208e/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 160046c..8ce070f 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
@@ -650,7 +650,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jsonEquals(ret, cacheBulkPattern(true, true));
 
-        ret = content(F.asMap("cmd", "rmvall"));
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1001,7 +1001,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testVersion() throws Exception {
-        String ret = content(F.asMap("cmd", "version"));
+        String ret = content(F.asMap("cmd", GridRestCommand.VERSION.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1119,6 +1119,43 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     /**
      * @throws Exception If failed.
      */
+    public void testSqlFieldsMetadataQuery() throws Exception {
+        String qry = "select firstName, lastName from Person";
+
+        Map<String, String> params = new HashMap<>();
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
+        params.put("psz", "10");
+        params.put("cacheName", "person");
+        params.put("qry", URLEncoder.encode(qry));
+
+        String ret = content(params);
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        JSONObject json = JSONObject.fromObject(ret);
+
+        List items = (List)((Map)json.get("response")).get("items");
+
+        List meta = (List)((Map)json.get("response")).get("fieldsMetadata");
+
+        assertEquals(4, items.size());
+
+        assertEquals(2, meta.size());
+
+        JSONObject o = (JSONObject)meta.get(0);
+
+        assertEquals("FIRSTNAME", o.get("fieldName"));
+        assertEquals("java.lang.String", o.get("fieldTypeName"));
+        assertEquals("person", o.get("schemaName"));
+        assertEquals("PERSON", o.get("typeName"));
+
+        assertFalse(queryCursorFound());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testQueryClose() throws Exception {
         String qry = "salary > ? and salary <= ?";
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/201e208e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
new file mode 100644
index 0000000..8c4ddb0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.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.internal.processors.rest.handlers.query;
+
+import org.apache.ignite.internal.processors.query.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Cache query fields metadata.
+ */
+public class CacheQueryFieldsMetaResult implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Schema name. */
+    private String schemaName;
+
+    /** Type name. */
+    private String typeName;
+
+    /** Name. */
+    private String fieldName;
+
+    /** Type. */
+    private String fieldTypeName;
+
+    /**
+     * Empty constructor for Externalizable.
+     */
+    public CacheQueryFieldsMetaResult() {
+        // No-op.
+    }
+
+    /**
+     * @param meta Metadata
+     */
+    public CacheQueryFieldsMetaResult(GridQueryFieldMetadata meta) {
+        schemaName = meta.schemaName();
+        typeName = meta.typeName();
+        fieldName = meta.fieldName();
+        fieldTypeName = meta.fieldTypeName();
+    }
+
+    /**
+     * @return Schema name.
+     */
+    public String getSchemaName() {
+        return schemaName;
+    }
+
+    /**
+     * @param schemaName Schema name.
+     */
+    public void setSchemaName(String schemaName) {
+        this.schemaName = schemaName;
+    }
+
+    /**
+     * @return Type name.
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * @param typeName Type name.
+     */
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    /**
+     * @return Field name.
+     */
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * @param fieldName Field name.
+     */
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+
+    /**
+     * @return Field type name.
+     */
+    public String getFieldTypeName() {
+        return fieldTypeName;
+    }
+
+    /**
+     * @param fieldName Field name.
+     */
+    public void setFieldTypeName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeString(out, schemaName);
+        U.writeString(out, typeName);
+        U.writeString(out, fieldName);
+        U.writeString(out, fieldTypeName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        schemaName = U.readString(in);
+        typeName = U.readString(in);
+        fieldName = U.readString(in);
+        fieldTypeName = U.readString(in);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/201e208e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
index 3e49576..544a094 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
@@ -35,6 +35,9 @@ public class CacheQueryResult implements Externalizable {
     /** Result items. */
     private Collection<?> items;
 
+    /** Fields metadata. */
+    private Collection<?> fieldsMeta;
+
     /** Last flag. */
     private boolean last;
 
@@ -67,6 +70,20 @@ public class CacheQueryResult implements Externalizable {
     }
 
     /**
+     * @param fieldsMeta Fields metadata.
+     */
+    public void setFieldsMetadata(Collection<?> fieldsMeta) {
+        this.fieldsMeta = fieldsMeta;
+    }
+
+    /**
+     * @return Fields metadata.
+     */
+    public Collection<?> getFieldsMetadata() {
+        return fieldsMeta;
+    }
+
+    /**
      * @return Last flag.
      */
     public boolean getLast() {
@@ -90,6 +107,7 @@ public class CacheQueryResult implements Externalizable {
         out.writeBoolean(last);
         out.writeLong(qryId);
         U.writeCollection(out, items);
+        U.writeCollection(out, fieldsMeta);
     }
 
     /** {@inheritDoc} */
@@ -97,5 +115,6 @@ public class CacheQueryResult implements Externalizable {
         last = in.readBoolean();
         qryId = in.readLong();
         items = U.readCollection(in);
+        fieldsMeta = U.readCollection(in);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/201e208e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index defca37..59f95c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.rest.handlers.query;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.query.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.processors.rest.*;
 import org.apache.ignite.internal.processors.rest.handlers.*;
 import org.apache.ignite.internal.processors.rest.request.*;
@@ -146,6 +148,10 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
 
                 CacheQueryResult res = createQueryResult(qryCurs, cur, req, qryId);
 
+                List<GridQueryFieldMetadata> fieldsMeta = ((QueryCursorImpl<?>) qryCur).fieldsMeta();
+
+                res.setFieldsMetadata(convertMetadata(fieldsMeta));
+
                 return new GridRestResponse(res);
             }
             catch (Exception e) {
@@ -154,6 +160,21 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
                 return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
             }
         }
+
+        /**
+         * @param meta Internal query field metadata.
+         * @return Rest query field metadata.
+         */
+        private Collection<CacheQueryFieldsMetaResult> convertMetadata(Collection<GridQueryFieldMetadata> meta) {
+            List<CacheQueryFieldsMetaResult> res = new ArrayList<>();
+
+            if (meta != null) {
+                for (GridQueryFieldMetadata info : meta)
+                    res.add(new CacheQueryFieldsMetaResult(info));
+            }
+
+            return res;
+        }
     }
 
     /**


[10/50] [abbrv] incubator-ignite git commit: # ignite-788

Posted by an...@apache.org.
# ignite-788


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

Branch: refs/heads/ignite-843
Commit: 6894a87bf66f9de058f184197a6f03b7c01f628f
Parents: ae148f1
Author: glutters <mi...@gmail.com>
Authored: Sat Jul 18 14:03:47 2015 +0200
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 24 16:58:06 2015 +0300

----------------------------------------------------------------------
 config/ignite-log4j2.xml                        |  65 +++
 config/ignite-log4j2.xml~                       |  65 +++
 modules/core/src/test/config/log4j2-test.xml    |  63 +++
 modules/core/src/test/config/log4j2-test.xml~   |  63 +++
 modules/log4j2/README.txt                       |  32 ++
 modules/log4j2/licenses/apache-2.0.txt          | 202 +++++++
 modules/log4j2/pom.xml                          |  55 ++
 modules/log4j2/pom.xml~                         |  45 ++
 .../ignite/logger/log4j2/Log4J2Logger.java      | 544 +++++++++++++++++++
 .../ignite/logger/log4j2/Log4J2Logger.java~     | 542 ++++++++++++++++++
 .../ignite/logger/log4j2/Log4j2FileAware.java   |  35 ++
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |  33 ++
 .../ignite/logger/log4j2/Log4jFileAware.java~   |  13 +
 .../ignite/logger/log4j2/package-info.java      |  23 +
 .../log4j2/GridLog4j2CorrectFileNameTest.java   |  95 ++++
 .../log4j2/GridLog4j2CorrectFileNameTest.java~  |  95 ++++
 .../log4j2/GridLog4j2InitializedTest.java       |  79 +++
 .../log4j2/GridLog4j2InitializedTest.java~      |  79 +++
 .../log4j2/GridLog4j2LoggingFileTest.java       |  72 +++
 .../log4j2/GridLog4j2LoggingFileTest.java~      |  74 +++
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../testsuites/IgniteLog4j2TestSuite.java       |  43 ++
 pom.xml                                         |   1 +
 23 files changed, 2340 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
new file mode 100644
index 0000000..3c4af7a
--- /dev/null
+++ b/config/ignite-log4j2.xml
@@ -0,0 +1,65 @@
+<?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.
+  Configuration file for apache ignite 2 
+  -->
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
+    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<Configuration status="debug" strict="true" name="XMLConfigTest"
+               packages="org.apache.ignite.logger.log4j2">
+  <Filter type="ThresholdFilter" level="TRACE"/>
+  <Appenders>
+    <Appender type="Console" name="CONSOLE_ERR">
+    </Appender>
+	<Routing name="Routing">	
+	   <Routes pattern="$${ctx:ROUTINGKEY}">
+	   <Route key="$${ctx:ROUTINGKEY}">
+		  <RollingFile name="Rolling-default" fileName="work/log/ignite.log"
+					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
+			<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
+			</PatternLayout>
+			<Policies>
+			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+			  <SizeBasedTriggeringPolicy size="10 MB" />
+			</Policies>
+		  </RollingFile>
+		</Route>
+	   <Route>
+		<RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
+					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
+		<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
+		</PatternLayout>
+		<Policies>
+		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+		  <SizeBasedTriggeringPolicy size="10 MB" />
+		</Policies>
+		  </RollingFile>
+		</Route>
+		  </Routes>
+		</Routing>
+	</Appenders>
+  <Loggers>
+    <Logger name="org.springframework" level="warn"/>
+    <Logger name="rg.eclipse.jetty" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
+    <Logger name="com.amazonaws" level="warn"/>
+    <Root level="TRACE">
+    	<AppenderRef ref="Routing"/>
+   </Root>
+  </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/config/ignite-log4j2.xml~
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml~ b/config/ignite-log4j2.xml~
new file mode 100644
index 0000000..9abb65d
--- /dev/null
+++ b/config/ignite-log4j2.xml~
@@ -0,0 +1,65 @@
+<?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.
+  Configuration file for apache ignite 2 
+  -->
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
+    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<Configuration status="debug" strict="true" name="XMLConfigTest"
+               packages="org.apache.ignite.logger.log4j2">
+  <Filter type="ThresholdFilter" level="TRACE"/>
+  <Appenders>
+    <Appender type="Console" name="CONSOLE_ERR">
+    </Appender>
+	<Routing name="Routing">	
+	   <Routes pattern="$${ctx:ROUTINGKEY}">
+	   <Route key="$${ctx:ROUTINGKEY}">
+		  <RollingFile name="Rolling-default" fileName="work/log/default.log"
+					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
+			<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
+			</PatternLayout>
+			<Policies>
+			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+			  <SizeBasedTriggeringPolicy size="10 MB" />
+			</Policies>
+		  </RollingFile>
+		</Route>
+	   <Route>
+		<RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
+					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
+		<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
+		</PatternLayout>
+		<Policies>
+		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+		  <SizeBasedTriggeringPolicy size="10 MB" />
+		</Policies>
+		  </RollingFile>
+		</Route>
+		  </Routes>
+		</Routing>
+	</Appenders>
+  <Loggers>
+    <Logger name="org.springframework" level="warn"/>
+    <Logger name="rg.eclipse.jetty" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
+    <Logger name="com.amazonaws" level="warn"/>
+    <Root level="TRACE">
+    	<AppenderRef ref="Routing"/>
+   </Root>
+  </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/core/src/test/config/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml b/modules/core/src/test/config/log4j2-test.xml
new file mode 100644
index 0000000..fcfae43
--- /dev/null
+++ b/modules/core/src/test/config/log4j2-test.xml
@@ -0,0 +1,63 @@
+<?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.
+-->
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
+    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<Configuration status="debug" strict="true" name="XMLConfigTest"
+               packages="org.apache.ignite.logger.log4j2">
+  <Filter type="ThresholdFilter" level="TRACE"/>
+  <Appenders>
+    <Appender type="Console" name="CONSOLE_ERR">
+    </Appender>
+	<Routing name="Routing">	
+	   <Routes pattern="$${ctx:ROUTINGKEY}">
+	   <Route key="$${ctx:ROUTINGKEY}">
+		  <RollingFile name="Rolling-default" fileName="work/log/ignite.log"
+					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
+			<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
+			</PatternLayout>
+			<Policies>
+			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+			  <SizeBasedTriggeringPolicy size="10 MB" />
+			</Policies>
+		  </RollingFile>
+		</Route>
+	   <Route>
+		  <RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
+					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
+		<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
+		</PatternLayout>
+		<Policies>
+		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+		  <SizeBasedTriggeringPolicy size="10 MB" />
+		</Policies>
+		  </RollingFile>
+		</Route>
+		  </Routes>
+		</Routing>
+	</Appenders>
+  <Loggers>
+    <Logger name="org.springframework" level="warn"/>
+    <Logger name="rg.eclipse.jetty" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
+    <Logger name="com.amazonaws" level="warn"/>
+    <Root level="TRACE">
+    	<AppenderRef ref="Routing"/>
+   </Root>
+  </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/core/src/test/config/log4j2-test.xml~
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml~ b/modules/core/src/test/config/log4j2-test.xml~
new file mode 100644
index 0000000..4222b0c
--- /dev/null
+++ b/modules/core/src/test/config/log4j2-test.xml~
@@ -0,0 +1,63 @@
+<?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.
+-->
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
+    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<Configuration status="debug" strict="true" name="XMLConfigTest"
+               packages="org.apache.ignite.logger.log4j2">
+  <Filter type="ThresholdFilter" level="TRACE"/>
+  <Appenders>
+    <Appender type="Console" name="CONSOLE_ERR">
+    </Appender>
+	<Routing name="Routing">	
+	   <Routes pattern="$${ctx:ROUTINGKEY}">
+	   <Route key="$${ctx:ROUTINGKEY}">
+		  <RollingFile name="Rolling-default" fileName="work/log/default.log"
+					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
+			<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
+			</PatternLayout>
+			<Policies>
+			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+			  <SizeBasedTriggeringPolicy size="10 MB" />
+			</Policies>
+		  </RollingFile>
+		</Route>
+	   <Route>
+		  <RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
+					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
+		<PatternLayout>
+		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
+		</PatternLayout>
+		<Policies>
+		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+		  <SizeBasedTriggeringPolicy size="10 MB" />
+		</Policies>
+		  </RollingFile>
+		</Route>
+		  </Routes>
+		</Routing>
+	</Appenders>
+  <Loggers>
+    <Logger name="org.springframework" level="warn"/>
+    <Logger name="rg.eclipse.jetty" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
+    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
+    <Logger name="com.amazonaws" level="warn"/>
+    <Root level="TRACE">
+    	<AppenderRef ref="Routing"/>
+   </Root>
+  </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/README.txt
----------------------------------------------------------------------
diff --git a/modules/log4j2/README.txt b/modules/log4j2/README.txt
new file mode 100644
index 0000000..2bf9e79
--- /dev/null
+++ b/modules/log4j2/README.txt
@@ -0,0 +1,32 @@
+Apache Ignite Log4J2 Module
+--------------------------
+
+Apache Ignite Log4J2 module provides GridLogger implementation based on Apache Log4J2.
+
+To enable Log4J2 module when starting a standalone node, move 'optional/ignite-log4j2' folder to
+'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
+be added to classpath in this case.
+
+Importing Log4J2 Module In Maven Project
+---------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add Log4J2 module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<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">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-log4j2</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/log4j2/licenses/apache-2.0.txt b/modules/log4j2/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/log4j2/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/incubator-ignite/blob/6894a87b/modules/log4j2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
new file mode 100644
index 0000000..f25a31b
--- /dev/null
+++ b/modules/log4j2/pom.xml
@@ -0,0 +1,55 @@
+<?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>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+    <artifactId>ignite-log4j2</artifactId>
+    <version>1.0.6-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+          <dependency>
+           <groupId>org.apache.logging.log4j</groupId>
+           <artifactId>log4j-api</artifactId>
+           <version>2.3</version>
+         </dependency>
+         <dependency>
+           <groupId>org.apache.logging.log4j</groupId>
+           <artifactId>log4j-core</artifactId>
+           <version>2.3</version>
+         </dependency>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/pom.xml~
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml~ b/modules/log4j2/pom.xml~
new file mode 100644
index 0000000..65912a6
--- /dev/null
+++ b/modules/log4j2/pom.xml~
@@ -0,0 +1,45 @@
+<?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>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+    <artifactId>ignite-log4j2</artifactId>
+    <version>1.0.6-SNAPSHOT</version>
+    <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>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
new file mode 100644
index 0000000..15ef44d
--- /dev/null
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -0,0 +1,544 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.logger.log4j2;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.C1;
+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.lang.IgniteClosure;
+import org.apache.ignite.logger.LoggerNodeIdAware;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.ConsoleAppender;
+import org.apache.logging.log4j.core.appender.FileAppender;
+import org.apache.logging.log4j.core.appender.RollingFileAppender;
+import org.apache.logging.log4j.core.config.AppenderRef;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Log4j2-based implementation for logging. This logger should be used by
+ * loaders that have prefer <a target=_new
+ * href="http://logging.apache.org/log4j/2.x/">log4j2</a>-based logging.
+ * <p>
+ * Here is a typical example of configuring log4j logger in Ignite configuration
+ * file:
+ * 
+ * <pre name="code" class="xml">
+ *      &lt;property name="gridLogger"&gt;
+ *          &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4J2Logger"&gt;
+ *              &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j2.xml"/&gt;
+ *          &lt;/bean>
+ *      &lt;/property&gt;
+ * </pre>
+ * 
+ * and from your code:
+ * 
+ * <pre name="code" class="java">
+ *      IgniteConfiguration cfg = new IgniteConfiguration();
+ *      ...
+ *      URL xml = U.resolveIgniteUrl("config/custom-log4j.xml");
+ *      IgniteLogger log = new Log4J2Logger(xml);
+ *      ...
+ *      cfg.setGridLogger(log);
+ * </pre>
+ *
+ * Please take a look at <a target=_new
+ * href="http://logging.apache.org/log4j/2.x/">Apache Log4j 2.7</a> for
+ * additional information.
+ * <p>
+ * It's recommended to use Ignite logger injection instead of
+ * using/instantiating logger apacin your task/job code. See
+ * {@link org.apache.ignite.resources.LoggerResource} annotation about logger
+ * injection.
+ * 
+ * Porting for the Log4j2
+ * 
+ * @author Gianfranco Murador
+ */
+public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
+        Log4j2FileAware {
+
+    /** custom message */
+    private static String LOG_MESSAGE = ">>> Local Node [ID: ";
+
+    /** Appenders. */
+    private static Collection<FileAppender> fileAppenders = new GridConcurrentHashSet<>();
+
+    /** */
+    private static volatile boolean inited;
+
+    /** */
+    private static volatile boolean quiet0;
+
+    /** */
+    private static final Object mux = new Object();
+
+    /** Logger implementation. */
+    @GridToStringExclude
+    private Logger impl;
+
+    /** Path to configuration file. */
+    private final String path;
+
+    /** Quiet flag. */
+    private final boolean quiet;
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /**
+     * Creates new logger and automatically detects if root logger already has
+     * appenders configured. If it does not, the root logger will be configured
+     * with default appender (analogous to calling
+     * {@link #Log4J2Logger(boolean) Log4J2Logger(boolean)} with parameter
+     * {@code true}, otherwise, existing appenders will be used (analogous to
+     * calling {@link #Log4J2Logger(boolean) Log4J2Logger(boolean)} with
+     * parameter
+     */
+    public Log4J2Logger() {
+        this(!isConfigured());
+    }
+
+    /**
+     * Creates new logger with given implementation.
+     * 
+     * @param impl Log4j implementation to use.
+     */
+    public Log4J2Logger(final Logger impl) {
+        assert impl != null;
+
+        path = null;
+
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override
+            public Logger apply(Boolean init) {
+                return impl;
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Creates new logger. If initialize parameter is {@code true} the Log4j
+     * logger will be initialized with default console appender and {@code INFO}
+     * log level.
+     *
+     * @param init If {@code true}, then a default console appender with
+     *            following pattern layout will be created: {@code %d ABSOLUTE}
+     *            %-5p [%c{1}] %m%n}. If {@code false}, then no implicit
+     *            initialization will take place, and {@code Log4j} should be
+     *            configured prior to calling this constructor.
+     */
+    public Log4J2Logger(boolean init) {
+        impl = LogManager.getRootLogger();
+
+        if (init) {
+            // Implementation has already been inited, passing NULL.
+            addConsoleAppenderIfNeeded(Level.INFO, null);
+            quiet = quiet0;
+        } else
+            quiet = true;
+        path = null;
+    }
+
+    /**
+     * Creates new logger with given configuration {@code cfgFile}.
+     *
+     * @param cfgFile Log4j configuration XML file.
+     * @throws IgniteCheckedException Thrown in case logger can't be created.
+     */
+    public Log4J2Logger(File cfgFile) throws IgniteCheckedException {
+
+        final String uri;
+
+        if (cfgFile == null)
+            throw new IgniteCheckedException(
+                    "Configuration XML file for Log4j must be specified.");
+
+        if (!cfgFile.exists() || cfgFile.isDirectory())
+            throw new IgniteCheckedException(
+                    "Log4j configuration path was not found or is a directory: "
+                            + cfgFile);
+        try {
+            uri = cfgFile.toURI().toURL().toString();
+        } catch (MalformedURLException e) {
+            throw new IgniteCheckedException(e.toString());
+        }
+        path = cfgFile.getAbsolutePath();
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override
+            public Logger apply(Boolean init) {
+                if (init) {
+                    Configurator.initialize("Log4J2Logger", uri);
+                }
+                return LogManager.getRootLogger();
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Creates new logger with given configuration {@code path}.
+     * @param path Path to log4j configuration XML file.
+     * @throws IgniteCheckedException Thrown in case logger can't be created.
+     */
+    public Log4J2Logger(String path) throws IgniteCheckedException {
+        if (path == null)
+            throw new IgniteCheckedException(
+                    "Configuration XML file for Log4j must be specified.");
+
+        this.path = path;
+
+        final URL cfgUrl = U.resolveIgniteUrl(path);
+
+        if (cfgUrl == null)
+            throw new IgniteCheckedException(
+                    "Log4j configuration path was not found: " + path);
+
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override
+            public Logger apply(Boolean init) {
+
+                if (init) {
+                    Configurator.initialize("Log4J2Logger", cfgUrl.toString());
+                }
+                return LogManager.getRootLogger();
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Creates new logger with given configuration {@code cfgUrl}.
+     *
+     * @param cfgUrl URL for Log4j configuration XML file.
+     * @throws IgniteCheckedException Thrown in case logger can't be created.
+     */
+    public Log4J2Logger(final URL cfgUrl) throws IgniteCheckedException {
+        if (cfgUrl == null)
+            throw new IgniteCheckedException(
+                    "Configuration XML file for Log4j must be specified.");
+        path = null;
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override
+            public Logger apply(Boolean init) {
+                if (init) {
+                    Configurator.initialize("Log4J2Logger", cfgUrl.toString());
+                }
+                return LogManager.getRootLogger();
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Checks if Log4j is already configured within this VM or not
+     * 
+     * @return {@code True} if log4j was already configured, {@code false}
+     *         otherwise.
+     */
+    public static boolean isConfigured() {
+        return !(LogManager.getLogger("Log4J2Logger") != null);
+    }
+
+    /**
+     * Sets level for internal log4j implementation.
+     *
+     * @param level Log level to set.
+     */
+    public void setLevel(Level level) {
+        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+        Configuration conf = ctx.getConfiguration();
+        conf.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(level);
+        ctx.updateLoggers(conf);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable
+    @Override
+    public String fileName() {
+        org.apache.logging.log4j.core.Logger loggerImpl = (org.apache.logging.log4j.core.Logger) impl;
+        Collection<Appender> appenders = loggerImpl.getAppenders().values();
+        for (Appender a : appenders) {
+            if (a instanceof FileAppender) {
+                return ((FileAppender) a).getFileName();
+            }
+            if (a instanceof RollingFileAppender) {
+                return ((RollingFileAppender) a).getFileName();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Adds console appender when needed with some default logging settings.
+     *
+     * @param logLevel Optional log level.
+     * @param implInitC Optional log implementation init closure.
+     */
+    private void addConsoleAppenderIfNeeded(@Nullable Level logLevel,
+            @Nullable IgniteClosure<Boolean, Logger> implInitC) {
+        if (inited) {
+            if (implInitC != null)
+                // Do not init.
+                impl = implInitC.apply(false);
+
+            return;
+        }
+        synchronized (mux) {
+            if (inited) {
+                if (implInitC != null)
+                    // Do not init.
+                    impl = implInitC.apply(false);
+
+                return;
+            }
+
+            if (implInitC != null)
+                // Init logger impl.
+                impl = implInitC.apply(true);
+
+            // use the local quite instead of this
+            boolean quiet = isQuiet();
+
+            // here added a console logger if not exists, programmatically
+            // the implementations is more easy with new API
+            // Log4j2 has always a console logger by default
+            Logger clog = LogManager.getLogger("CONSOLE");
+            if (clog == null) {
+
+                ConsoleAppender console = ConsoleAppender.createAppender(
+                        PatternLayout.createDefaultLayout(), null, "CONSOLE",
+                        "console", null, null);
+                final LoggerContext ctx = (LoggerContext) new org.apache.logging.log4j.core.LoggerContext(
+                        "console");
+
+                final Configuration config = ((org.apache.logging.log4j.core.LoggerContext) ctx)
+                        .getConfiguration();
+                config.addAppender(console);
+                AppenderRef ref = AppenderRef.createAppenderRef("console",
+                        logLevel, null);
+                AppenderRef[] refs = new AppenderRef[] { ref };
+                LoggerConfig loggerConfig = LoggerConfig.createLogger("false",
+                        logLevel, "org.apache.logging.log4j", "true", refs,
+                        null, config, null);
+                loggerConfig.addAppender(console, null, null);
+
+                config.addLogger("org.apache.logging.log4j", loggerConfig);
+                ((org.apache.logging.log4j.core.LoggerContext) ctx)
+                        .updateLoggers();
+
+            }
+
+            quiet0 = quiet;
+            inited = true;
+        }
+    }
+
+    /**
+     * With the new Log4j2 API when can choose the filename in the ThreadContext
+     * instead of do some hack to setup the file in according to the nodeid. So
+     * this method is deprecated
+     */
+    @Override
+    @Deprecated
+    public void updateFilePath(IgniteClosure<String, String> filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+        for (FileAppender a : fileAppenders) {
+
+        }
+    }
+
+    /**
+     * Adds file appender.
+     *
+     * @param a Appender.
+     */
+    public static void addAppender(FileAppender a) {
+        A.notNull(a, "a");
+        fileAppenders.add(a);
+    }
+
+    /**
+     * Removes file appender.
+     *
+     * @param a Appender.
+     */
+    public static void removeAppender(FileAppender a) {
+        A.notNull(a, "a");
+        fileAppenders.remove(a);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public UUID getNodeId() {
+        return nodeId;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void setNodeId(UUID nodeid) {
+        A.notNull(nodeid, "nodeId");
+        String uid = U.id8(nodeid);
+
+        // set up the new thread context
+        ThreadContext.put("nodeidmsg", LOG_MESSAGE + uid + "]");
+        ThreadContext.put("ROUTINGKEY", uid);
+
+        ((org.apache.logging.log4j.core.LoggerContext) LogManager
+                .getContext(false)).reconfigure();
+        this.nodeId = nodeid;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void debug(String msg) {
+        if (!impl.isDebugEnabled())
+            warning("Logging at DEBUG level without checking if DEBUG level is enabled: "
+                    + msg);
+        impl.debug(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void warning(String msg) {
+        impl.warn(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void warning(String msg, @Nullable Throwable e) {
+        impl.warn(msg, e);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void error(String msg) {
+        impl.error(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void error(String msg, @Nullable Throwable e) {
+        impl.error(msg, e);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void info(String msg) {
+        if (!impl.isInfoEnabled())
+            warning("Logging at INFO level without checking if INFO level is enabled: "
+                    + msg);
+
+        impl.info(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean isTraceEnabled() {
+        return impl.isTraceEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean isDebugEnabled() {
+        return impl.isDebugEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean isInfoEnabled() {
+        return impl.isInfoEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean isQuiet() {
+        return !isInfoEnabled() && !isDebugEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String toString() {
+        return S.toString(Log4J2Logger.class, this);
+    }
+
+    /**
+     * Gets files for all registered file appenders.
+     *
+     * @return List of files.
+     */
+    public static Collection<String> logFiles() {
+        Collection<String> res = new ArrayList<String>(fileAppenders.size());
+        for (FileAppender a : fileAppenders)
+            res.add(a.getFileName());
+        return res;
+    }
+
+    /**
+     * Gets {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger
+     * for the given category. If category is {@code null}, then root logger is
+     * returned. If category is an instance of {@link Class} then
+     * {@code (Class)ctgr).getName()} is used as category name.
+     *
+     * @param ctgr {@inheritDoc}
+     * @return {@link org.apache.ignite.IgniteLogger} wrapper around log4j
+     *         logger.
+     */
+    @Override
+    public Log4J2Logger getLogger(Object ctgr) {
+        return new Log4J2Logger(
+                ctgr == null ? LogManager.getRootLogger()
+                        : ctgr instanceof Class ? LogManager
+                                .getLogger(((Class<?>) ctgr).getName())
+                                : LogManager.getLogger(ctgr.toString()));
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void trace(String msg) {
+        if (!impl.isTraceEnabled())
+            warning("Logging at TRACE level without checking if TRACE level is enabled: "
+                    + msg);
+        impl.trace(msg);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java~
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java~ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java~
new file mode 100644
index 0000000..2ac3307
--- /dev/null
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java~
@@ -0,0 +1,542 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.logger.log4j2;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.C1;
+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.lang.IgniteClosure;
+import org.apache.ignite.logger.LoggerNodeIdAware;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.ConsoleAppender;
+import org.apache.logging.log4j.core.appender.FileAppender;
+import org.apache.logging.log4j.core.appender.RollingFileAppender;
+import org.apache.logging.log4j.core.config.AppenderRef;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Log4j2-based implementation for logging. This logger should be used by
+ * loaders that have prefer <a target=_new
+ * href="http://logging.apache.org/log4j/2.x/">log4j2</a>-based logging.
+ * <p>
+ * Here is a typical example of configuring log4j logger in Ignite configuration
+ * file:
+ * 
+ * <pre name="code" class="xml">
+ *      &lt;property name="gridLogger"&gt;
+ *          &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4J2Logger"&gt;
+ *              &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j2.xml"/&gt;
+ *          &lt;/bean>
+ *      &lt;/property&gt;
+ * </pre>
+ * 
+ * and from your code:
+ * 
+ * <pre name="code" class="java">
+ *      IgniteConfiguration cfg = new IgniteConfiguration();
+ *      ...
+ *      URL xml = U.resolveIgniteUrl("config/custom-log4j.xml");
+ *      IgniteLogger log = new Log4J2Logger(xml);
+ *      ...
+ *      cfg.setGridLogger(log);
+ * </pre>
+ *
+ * Please take a look at <a target=_new
+ * href="http://logging.apache.org/log4j/2.x/">Apache Log4j 2.7</a> for
+ * additional information.
+ * <p>
+ * It's recommended to use Ignite logger injection instead of
+ * using/instantiating logger apacin your task/job code. See
+ * {@link org.apache.ignite.resources.LoggerResource} annotation about logger
+ * injection.
+ * 
+ * Porting for the Log4j2
+ * 
+ * @author Gianfranco Murador
+ */
+public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
+		Log4j2FileAware {
+
+	/** custom message */
+	private static String LOG_MESSAGE = ">>> Local Node [ID: ";
+
+	/** Appenders. */
+	private static Collection<FileAppender> fileAppenders = new GridConcurrentHashSet<>();
+
+	/** */
+	private static volatile boolean inited;
+
+	/** */
+	private static volatile boolean quiet0;
+
+	/** */
+	private static final Object mux = new Object();
+
+	/** Logger implementation. */
+	@GridToStringExclude
+	private Logger impl;
+
+	/** Path to configuration file. */
+	private final String path;
+
+	/** Quiet flag. */
+	private final boolean quiet;
+
+	/** Node ID. */
+	private UUID nodeId;
+
+	/**
+	 * Creates new logger and automatically detects if root logger already has
+	 * appenders configured. If it does not, the root logger will be configured
+	 * with default appender (analogous to calling {@link #Log4J2Logger(boolean)
+	 * Log4J2Logger(boolean)} with parameter {@code true}, otherwise, existing
+	 * appenders will be used (analogous to calling
+	 * {@link #Log4J2Logger(boolean) Log4J2Logger(boolean)} with parameter
+	 */
+	public Log4J2Logger() {
+		this(!isConfigured());
+	}
+
+	/**
+	 * Creates new logger with given implementation.
+	 * @param impl Log4j implementation to use.
+	 */
+	public Log4J2Logger(final Logger impl) {
+		assert impl != null;
+
+		path = null;
+
+		addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+			@Override
+			public Logger apply(Boolean init) {
+				return impl;
+			}
+		});
+
+		quiet = quiet0;
+	}
+
+     	/**
+        * Creates new logger. If initialize parameter is {@code true} the Log4j
+        * logger will be initialized with default console appender and {@code INFO}
+        * log level.
+        *
+        * @param init If {@code true}, then a default console appender with
+        *      following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
+        *      If {@code false}, then no implicit initialization will take place,
+        *      and {@code Log4j} should be configured prior to calling this
+        *      constructor.
+        */
+	public Log4J2Logger(boolean init) {
+		impl = LogManager.getRootLogger();
+
+		if (init) {
+			// Implementation has already been inited, passing NULL.
+			addConsoleAppenderIfNeeded(Level.INFO, null);
+			quiet = quiet0;
+		} else
+			quiet = true;
+		path = null;
+	}
+
+	/**
+         * Creates new logger with given configuration {@code cfgFile}.
+         *
+         * @param cfgFile Log4j configuration XML file.
+         * @throws IgniteCheckedException Thrown in case logger can't be created.
+         */
+	public Log4J2Logger(File cfgFile) throws IgniteCheckedException {
+
+		final String uri;
+
+		if (cfgFile == null)
+			throw new IgniteCheckedException(
+					"Configuration XML file for Log4j must be specified.");
+
+		if (!cfgFile.exists() || cfgFile.isDirectory())
+			throw new IgniteCheckedException(
+					"Log4j configuration path was not found or is a directory: "
+							+ cfgFile);
+		try {
+			uri = cfgFile.toURI().toURL().toString();
+		} catch (MalformedURLException e) {
+			throw new IgniteCheckedException(e.toString());
+		}
+		path = cfgFile.getAbsolutePath();
+		addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+			@Override
+			public Logger apply(Boolean init) {
+				if (init) {
+					Configurator.initialize("Log4J2Logger", uri);
+				}
+				return LogManager.getRootLogger();
+			}
+		});
+
+		quiet = quiet0;
+	}
+
+	 /**
+          * Creates new logger with given configuration {@code path}.
+          *
+          * @param path Path to log4j configuration XML file.
+          * @throws IgniteCheckedException Thrown in case logger can't be created.
+          */
+	public Log4J2Logger(String path) throws IgniteCheckedException {
+		if (path == null)
+			throw new IgniteCheckedException(
+					"Configuration XML file for Log4j must be specified.");
+
+		this.path = path;
+
+		final URL cfgUrl = U.resolveIgniteUrl(path);
+
+		if (cfgUrl == null)
+			throw new IgniteCheckedException(
+					"Log4j configuration path was not found: " + path);
+
+		addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+			@Override
+			public Logger apply(Boolean init) {
+
+				if (init) {
+					Configurator.initialize("Log4J2Logger", cfgUrl.toString());
+				}
+				return LogManager.getRootLogger();
+			}
+		});
+
+		quiet = quiet0;
+	}
+
+	/**
+         * Creates new logger with given configuration {@code cfgUrl}.
+         *
+         * @param cfgUrl URL for Log4j configuration XML file.
+         * @throws IgniteCheckedException Thrown in case logger can't be created.
+         */
+	public Log4J2Logger(final URL cfgUrl) throws IgniteCheckedException {
+		if (cfgUrl == null)
+			throw new IgniteCheckedException(
+					"Configuration XML file for Log4j must be specified.");
+		path = null;
+		addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+			@Override
+			public Logger apply(Boolean init) {
+				if (init) {
+					Configurator.initialize("Log4J2Logger", cfgUrl.toString());
+				}
+				return LogManager.getRootLogger();
+			}
+		});
+
+		quiet = quiet0;
+	}
+
+	/**
+	 * Checks if Log4j is already configured within this VM or not
+	 * 
+	 * @return {@code True} if log4j was already configured, {@code false}
+	 *         otherwise.
+	 */
+	public static boolean isConfigured() {
+		return !(LogManager.getLogger("Log4J2Logger") != null);
+	}
+
+	/**
+     * Sets level for internal log4j implementation.
+     *
+     * @param level Log level to set.
+     */
+	public void setLevel(Level level) {
+		LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+		Configuration conf = ctx.getConfiguration();
+		conf.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(level);
+		ctx.updateLoggers(conf);
+	}
+
+	/** {@inheritDoc} */
+	@Nullable
+	@Override
+	public String fileName() {
+		org.apache.logging.log4j.core.Logger loggerImpl = (org.apache.logging.log4j.core.Logger) impl;
+		Collection<Appender> appenders = loggerImpl.getAppenders().values();
+		for (Appender a : appenders) {
+			if (a instanceof FileAppender) {
+				return ((FileAppender) a).getFileName();
+			}
+			if (a instanceof RollingFileAppender) {
+				return ((RollingFileAppender) a).getFileName();
+			}
+		}
+		return null;
+	}
+
+	/**
+    	 * Adds console appender when needed with some default logging settings.
+    	 *
+     	 * @param logLevel Optional log level.
+     	 * @param implInitC Optional log implementation init closure.
+     	 */
+	private void addConsoleAppenderIfNeeded(@Nullable Level logLevel,
+			@Nullable IgniteClosure<Boolean, Logger> implInitC) {
+		if (inited) {
+			if (implInitC != null)
+				// Do not init.
+				impl = implInitC.apply(false);
+
+			return;
+		}
+		synchronized (mux) {
+			if (inited) {
+				if (implInitC != null)
+					// Do not init.
+					impl = implInitC.apply(false);
+
+				return;
+			}
+
+			if (implInitC != null)
+				// Init logger impl.
+				impl = implInitC.apply(true);
+
+			// use the local quite instead of this
+			boolean quiet = isQuiet();
+
+			// here added a console logger if not exists, programmatically
+			// the implementations is more easy with new API
+			// Log4j2 has always a console logger by default
+			Logger clog = LogManager.getLogger("CONSOLE");
+			if (clog == null) {
+
+				ConsoleAppender console = ConsoleAppender.createAppender(
+						PatternLayout.createDefaultLayout(), null, "CONSOLE",
+						"console", null, null);
+				final LoggerContext ctx = (LoggerContext) new org.apache.logging.log4j.core.LoggerContext(
+						"console");
+
+				final Configuration config = ((org.apache.logging.log4j.core.LoggerContext) ctx)
+						.getConfiguration();
+				config.addAppender(console);
+				AppenderRef ref = AppenderRef.createAppenderRef("console",
+						logLevel, null);
+				AppenderRef[] refs = new AppenderRef[] { ref };
+				LoggerConfig loggerConfig = LoggerConfig.createLogger("false",
+						logLevel, "org.apache.logging.log4j", "true", refs,
+						null, config, null);
+				loggerConfig.addAppender(console, null, null);
+
+				config.addLogger("org.apache.logging.log4j", loggerConfig);
+				((org.apache.logging.log4j.core.LoggerContext) ctx)
+						.updateLoggers();
+
+			}
+
+			quiet0 = quiet;
+			inited = true;
+		}
+	}
+
+	/**
+	 * With the new Log4j2 API when can choose the filename in the ThreadContext
+	 * instead of do some hack to setup the file in according to the nodeid. 
+	 * So this method is deprecated
+	 */
+	@Override
+	@Deprecated
+	public void updateFilePath(IgniteClosure<String, String> filePathClos) {
+		A.notNull(filePathClos, "filePathClos");
+		for (FileAppender a : fileAppenders) {
+
+		}
+	}
+
+	/**
+     	 * Adds file appender.
+     	 *
+     	 * @param a Appender.
+     	 */
+	public static void addAppender(FileAppender a) {
+		A.notNull(a, "a");
+		fileAppenders.add(a);
+	}
+
+	/**
+     	 * Removes file appender.
+      	 *
+     	 * @param a Appender.
+     	 */
+	public static void removeAppender(FileAppender a) {
+		A.notNull(a, "a");
+		fileAppenders.remove(a);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public UUID getNodeId() {
+		return nodeId;
+	}
+
+   	 /** {@inheritDoc} */
+	@Override
+	public void setNodeId(UUID nodeid) {
+		A.notNull(nodeid, "nodeId");
+		String uid = U.id8(nodeid);
+
+		// set up the new thread context
+		ThreadContext.put("nodeidmsg", LOG_MESSAGE + uid + "]");
+		ThreadContext.put("ROUTINGKEY", uid);
+
+		((org.apache.logging.log4j.core.LoggerContext) LogManager
+				.getContext(false)).reconfigure();
+		this.nodeId = nodeid;
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void debug(String msg) {
+		if (!impl.isDebugEnabled())
+			warning("Logging at DEBUG level without checking if DEBUG level is enabled: "
+					+ msg);
+		impl.debug(msg);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void warning(String msg) {
+		impl.warn(msg);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void warning(String msg, @Nullable Throwable e) {
+		impl.warn(msg, e);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void error(String msg) {
+		impl.error(msg);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void error(String msg, @Nullable Throwable e) {
+		impl.error(msg, e);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void info(String msg) {
+		if (!impl.isInfoEnabled())
+			warning("Logging at INFO level without checking if INFO level is enabled: "
+					+ msg);
+
+		impl.info(msg);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public boolean isTraceEnabled() {
+		return impl.isTraceEnabled();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public boolean isDebugEnabled() {
+		return impl.isDebugEnabled();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public boolean isInfoEnabled() {
+		return impl.isInfoEnabled();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public boolean isQuiet() {
+		return !isInfoEnabled() && !isDebugEnabled();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public String toString() {
+		return S.toString(Log4J2Logger.class, this);
+	}
+
+	/**
+     	 * Gets files for all registered file appenders.
+     	 *
+     	 * @return List of files.
+     	 */
+	public static Collection<String> logFiles() {
+		Collection<String> res = new ArrayList<String>(fileAppenders.size());
+		for (FileAppender a : fileAppenders)
+			res.add(a.getFileName());
+		return res;
+	}
+
+	 /**
+      	  * Gets {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger for the given
+      	  * category. If category is {@code null}, then root logger is returned. If
+          * category is an instance of {@link Class} then {@code (Class)ctgr).getName()}
+          * is used as category name.
+     	  *
+     	  * @param ctgr {@inheritDoc}
+     	  * @return {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger.
+     	  */
+	@Override
+	public Log4J2Logger getLogger(Object ctgr) {
+		return new Log4J2Logger(
+				ctgr == null ? LogManager.getRootLogger()
+						: ctgr instanceof Class ? LogManager
+								.getLogger(((Class<?>) ctgr).getName())
+								: LogManager.getLogger(ctgr.toString()));
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void trace(String msg) {
+		if (!impl.isTraceEnabled())
+			warning("Logging at TRACE level without checking if TRACE level is enabled: "
+					+ msg);
+		impl.trace(msg);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java
new file mode 100644
index 0000000..c389e69
--- /dev/null
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.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.logger.log4j2;
+
+import org.apache.ignite.lang.IgniteClosure;
+
+/**
+ * Porting for the Log4j2, the interface is useless with the new implementation
+ * of the module
+ * 
+ * @author Gianfranco Murador
+ */
+public interface Log4j2FileAware {
+
+    /**
+     * Sets closure that later evaluate file path.
+     *
+     * @param filePathClos Closure that generates actual file path.
+     */
+    void updateFilePath(IgniteClosure<String, String> filePathClos);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java~
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java~ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.java~
new file mode 100644
index 0000000..53b3803
--- /dev/null
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4j2FileAware.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.logger.log4j2;
+
+import org.apache.ignite.lang.IgniteClosure;
+/**
+ * Porting for the Log4j2, the interface is useless with the new implementation
+ * of the module  
+ * @author  Gianfranco Murador 
+ */
+public interface Log4j2FileAware {
+
+	 /**
+     * Sets closure that later evaluate file path.
+     *
+     * @param filePathClos Closure that generates actual file path.
+     */
+    void updateFilePath(IgniteClosure<String, String> filePathClos);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4jFileAware.java~
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4jFileAware.java~ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4jFileAware.java~
new file mode 100644
index 0000000..4405f36
--- /dev/null
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4jFileAware.java~
@@ -0,0 +1,13 @@
+package org.apache.ignite.logger.log4j2;
+
+import org.apache.ignite.lang.IgniteClosure;
+
+public interface Log4jFileAware {
+
+	 /**
+     * Sets closure that later evaluate file path.
+     *
+     * @param filePathClos Closure that generates actual file path.
+     */
+    void updateFilePath(IgniteClosure<String, String> filePathClos);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
new file mode 100644
index 0000000..642cf8c
--- /dev/null
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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 <b>default</b> Log4j2 implementation for logging.
+ */
+package org.apache.ignite.logger.log4j2;
+

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java
new file mode 100644
index 0000000..476b3c8
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.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.logger.log4j2;
+
+import java.io.File;
+import junit.framework.TestCase;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.logger.log4j2.Log4J2Logger;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Tests that several grids log to files with correct names.
+ */
+@GridCommonTest(group = "Logger")
+public class GridLog4j2CorrectFileNameTest extends TestCase {
+
+    /**
+     * Tests correct behaviour in case 2 local nodes are started.
+     *
+     * @throws Exception If error occurs.
+     */
+    public void testLogFilesTwoNodes() throws Exception {
+        checkOneNode(0);
+        checkOneNode(1);
+    }
+
+    /**
+     * Starts the local node and checks for presence of log file. Also checks
+     * that this is really a log of a started node.
+     * 
+     * @param id Test-local node ID.
+     * @throws Exception If error occurred.
+     */
+    private void checkOneNode(int id) throws Exception {
+        try (Ignite ignite = G.start(getConfiguration("grid" + id))) {
+            String id8 = U.id8(ignite.cluster().localNode().id());
+            String logPath = "work/log/ignite-" + id8 + ".log";
+            File logFile = U.resolveIgnitePath(logPath);
+            assertNotNull("Failed to resolve path: " + logPath, logFile);
+            assertTrue("Log file does not exist: " + logFile, logFile.exists());
+            // We have a row in log with the following content
+            // con >>> Local node [ID=NodeId ]
+            String logContent = U.readFileToString(logFile.getAbsolutePath(),
+                    "UTF-8");
+            assertTrue(
+                    "Log file does not contain it's node ID: " + logFile,
+                    logContent.contains(">>> Local node [ID="
+                            + id8.toUpperCase()));
+        }
+    }
+
+    /**
+     * Creates grid configuration.
+     *
+     * @param gridName Grid name.
+     * @return Grid configuration.
+     * @throws Exception If error occurred.
+     */
+    private static IgniteConfiguration getConfiguration(String gridName)
+            throws Exception {
+        IgniteConfiguration cfg = new IgniteConfiguration();
+        
+   
+        cfg.setGridName(gridName);
+        // We need of a configuration file passed in
+        File xml = GridTestUtils
+                .resolveIgnitePath("modules/core/src/test/config/log4j2-test.xml");
+
+        assert xml != null;
+        assert xml.exists() == true;
+
+        cfg.setGridLogger(new Log4J2Logger(xml));
+        cfg.setConnectorConfiguration(null);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java~
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java~ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.java~
new file mode 100644
index 0000000..074eab2
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2CorrectFileNameTest.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.logger.log4j2;
+
+import java.io.File;
+import junit.framework.TestCase;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.logger.log4j2.Log4J2Logger;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Tests that several grids log to files with correct names.
+ */
+@GridCommonTest(group = "Logger")
+public class GridLog4j2CorrectFileNameTest extends TestCase {
+
+    /**
+     * Tests correct behaviour in case 2 local nodes are started.
+     *
+     * @throws Exception If error occurs.
+     */
+    public void testLogFilesTwoNodes() throws Exception {
+        checkOneNode(0);
+        checkOneNode(1);
+    }
+
+    /**
+     * Starts the local node and checks for presence of log file. Also checks
+     * that this is really a log of a started node.
+     * 
+     * @param id Test-local node ID.
+     * @throws Exception If error occurred.
+     */
+    private void checkOneNode(int id) throws Exception {
+        try (Ignite ignite = G.start(getConfiguration("grid" + id))) {
+            String id8 = U.id8(ignite.cluster().localNode().id());
+            String logPath = "/home/glutters/Documenti/apache-ignite/commit-patch-788/incubator-ignite/work/log/ignite-" + id8 + ".log";
+            File logFile = U.resolveIgnitePath(logPath);
+            assertNotNull("Failed to resolve path: " + logPath, logFile);
+            assertTrue("Log file does not exist: " + logFile, logFile.exists());
+            // We have a row in log with the following content
+            // con >>> Local node [ID=NodeId ]
+            String logContent = U.readFileToString(logFile.getAbsolutePath(),
+                    "UTF-8");
+            assertTrue(
+                    "Log file does not contain it's node ID: " + logFile,
+                    logContent.contains(">>> Local node [ID="
+                            + id8.toUpperCase()));
+        }
+    }
+
+    /**
+     * Creates grid configuration.
+     *
+     * @param gridName Grid name.
+     * @return Grid configuration.
+     * @throws Exception If error occurred.
+     */
+    private static IgniteConfiguration getConfiguration(String gridName)
+            throws Exception {
+        IgniteConfiguration cfg = new IgniteConfiguration();
+        
+   
+        cfg.setGridName(gridName);
+        // We need of a configuration file passed in
+        File xml = GridTestUtils
+                .resolveIgnitePath("modules/core/src/test/config/log4j2-test.xml");
+
+        assert xml != null;
+        assert xml.exists() == true;
+
+        cfg.setGridLogger(new Log4J2Logger(xml));
+        cfg.setConnectorConfiguration(null);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6894a87b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.java
new file mode 100644
index 0000000..3059861
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2InitializedTest.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.logger.log4j2;
+
+import java.net.URL;
+import java.util.UUID;
+import junit.framework.TestCase;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.logger.log4j2.Log4J2Logger;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Log4j initialized test.
+ */
+@GridCommonTest(group = "Logger")
+public class GridLog4j2InitializedTest extends TestCase {
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Override
+    protected void setUp() throws Exception {
+  
+    }
+
+    /** */
+    public void testLogInitialize() {
+
+        IgniteConfiguration cfg = new IgniteConfiguration();
+
+        cfg.setGridName("grid" + 1);
+        cfg.setNodeId(new UUID(1, 1));
+        // cfg.setIgniteHome("/home/glutters/Documenti/apache-ignite/ignite-master/incubator-ignite/");
+       
+        URL xml = U.resolveIgniteUrl("config/ignite-log4j2.xml");
+        IgniteLogger log;
+        try {
+
+            log = new Log4J2Logger(xml);
+            // log.isQuiet();
+            cfg.setGridLogger(log);
+        } catch (IgniteCheckedException e) {
+            e.printStackTrace();
+            return;
+        }
+
+        assert log.isInfoEnabled() == true;
+
+        if (log.isDebugEnabled())
+            log.debug("This is 'debug' message.");
+
+        log.info("This is 'info' message.");
+        log.warning("This is 'warning' message.");
+        log.warning("This is 'warning' message.", new Exception(
+                "It's a test warning exception"));
+        log.error("This is 'error' message.");
+
+        assert log.getLogger(GridLog4j2InitializedTest.class.getName()) instanceof Log4J2Logger;
+    }
+
+}


[21/50] [abbrv] incubator-ignite git commit: #ignite-961: add metadata for sql fields query.

Posted by an...@apache.org.
#ignite-961:  add metadata for sql fields query.


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

Branch: refs/heads/ignite-843
Commit: a0f4af95eedb3cc2a6c934d10b2639c2cf8206e3
Parents: 206c789
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 12:39:09 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 12:39:09 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     |  33 ++++-
 .../processors/rest/GridRestProcessor.java      |   8 ++
 .../query/CacheQueryFieldsMetaResult.java       | 130 ++++++++++++++++++-
 .../rest/handlers/query/CacheQueryResult.java   |  19 +++
 .../handlers/query/QueryCommandHandler.java     |  21 +++
 .../http/jetty/GridJettyRestHandler.java        |  57 --------
 6 files changed, 208 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0f4af95/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 5a54cd1..c6363be 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
@@ -124,7 +124,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @return Request result.
      * @throws Exception If failed.
      */
-    private String makePostRequest(Map<String, String> params, String postParams) throws Exception {
+    protected String makePostRequest(Map<String, String> params, String postParams) throws Exception {
         String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?";
 
         for (Map.Entry<String, String> e : params.entrySet())
@@ -1397,6 +1397,37 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     /**
      * @throws Exception If failed.
      */
+    public void testSqlFieldsMetadataQuery() throws Exception {
+        String qry = "select firstName, lastName from Person";
+
+        Map<String, String> params = new HashMap<>();
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
+        params.put("psz", "10");
+        params.put("cacheName", "person");
+        params.put("qry", URLEncoder.encode(qry));
+
+        String ret = content(params);
+
+        assertNotNull(ret);
+        assertTrue(!ret.isEmpty());
+
+        JSONObject json = JSONObject.fromObject(ret);
+
+        List items = (List)((Map)json.get("response")).get("items");
+
+        List meta = (List)((Map)json.get("response")).get("fieldsMetadata");
+
+        assertEquals(4, items.size());
+
+        assertEquals(2, meta.size());
+
+
+        assertFalse(queryCursorFound());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testQueryClose() throws Exception {
         String qry = "salary > ? and salary <= ?";
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0f4af95/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 4b57962..f8ccf8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -580,6 +580,14 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
                 break;
 
+            case RUN_SCRIPT:
+            case AFFINITY_RUN_SCRIPT:
+            case EXECUTE_MAP_REDUCE_SCRIPT:
+                perm = SecurityPermission.TASK_EXECUTE;
+                name = "";
+
+                break;
+
             case GET_OR_CREATE_CACHE:
             case DESTROY_CACHE:
                 perm = SecurityPermission.ADMIN_CACHE;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0f4af95/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
index 040c44e..8c4ddb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryFieldsMetaResult.java
@@ -1,7 +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.internal.processors.rest.handlers.query;
 
+import org.apache.ignite.internal.processors.query.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+
 /**
- * Created by GridGain on 27.07.2015.
+ * Cache query fields metadata.
  */
-public class CacheQueryFieldsMetaResult {
+public class CacheQueryFieldsMetaResult implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Schema name. */
+    private String schemaName;
+
+    /** Type name. */
+    private String typeName;
+
+    /** Name. */
+    private String fieldName;
+
+    /** Type. */
+    private String fieldTypeName;
+
+    /**
+     * Empty constructor for Externalizable.
+     */
+    public CacheQueryFieldsMetaResult() {
+        // No-op.
+    }
+
+    /**
+     * @param meta Metadata
+     */
+    public CacheQueryFieldsMetaResult(GridQueryFieldMetadata meta) {
+        schemaName = meta.schemaName();
+        typeName = meta.typeName();
+        fieldName = meta.fieldName();
+        fieldTypeName = meta.fieldTypeName();
+    }
+
+    /**
+     * @return Schema name.
+     */
+    public String getSchemaName() {
+        return schemaName;
+    }
+
+    /**
+     * @param schemaName Schema name.
+     */
+    public void setSchemaName(String schemaName) {
+        this.schemaName = schemaName;
+    }
+
+    /**
+     * @return Type name.
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * @param typeName Type name.
+     */
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    /**
+     * @return Field name.
+     */
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * @param fieldName Field name.
+     */
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+
+    /**
+     * @return Field type name.
+     */
+    public String getFieldTypeName() {
+        return fieldTypeName;
+    }
+
+    /**
+     * @param fieldName Field name.
+     */
+    public void setFieldTypeName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeString(out, schemaName);
+        U.writeString(out, typeName);
+        U.writeString(out, fieldName);
+        U.writeString(out, fieldTypeName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        schemaName = U.readString(in);
+        typeName = U.readString(in);
+        fieldName = U.readString(in);
+        fieldTypeName = U.readString(in);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0f4af95/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
index 3e49576..544a094 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/CacheQueryResult.java
@@ -35,6 +35,9 @@ public class CacheQueryResult implements Externalizable {
     /** Result items. */
     private Collection<?> items;
 
+    /** Fields metadata. */
+    private Collection<?> fieldsMeta;
+
     /** Last flag. */
     private boolean last;
 
@@ -67,6 +70,20 @@ public class CacheQueryResult implements Externalizable {
     }
 
     /**
+     * @param fieldsMeta Fields metadata.
+     */
+    public void setFieldsMetadata(Collection<?> fieldsMeta) {
+        this.fieldsMeta = fieldsMeta;
+    }
+
+    /**
+     * @return Fields metadata.
+     */
+    public Collection<?> getFieldsMetadata() {
+        return fieldsMeta;
+    }
+
+    /**
      * @return Last flag.
      */
     public boolean getLast() {
@@ -90,6 +107,7 @@ public class CacheQueryResult implements Externalizable {
         out.writeBoolean(last);
         out.writeLong(qryId);
         U.writeCollection(out, items);
+        U.writeCollection(out, fieldsMeta);
     }
 
     /** {@inheritDoc} */
@@ -97,5 +115,6 @@ public class CacheQueryResult implements Externalizable {
         last = in.readBoolean();
         qryId = in.readLong();
         items = U.readCollection(in);
+        fieldsMeta = U.readCollection(in);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0f4af95/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index 9457c3a..35fbcef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.rest.handlers.query;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.query.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.processors.rest.*;
 import org.apache.ignite.internal.processors.rest.handlers.*;
 import org.apache.ignite.internal.processors.rest.request.*;
@@ -146,6 +148,10 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
 
                 CacheQueryResult res = createQueryResult(qryCurs, cur, req, qryId, ctx);
 
+                List<GridQueryFieldMetadata> fieldsMeta = ((QueryCursorImpl) qryCur).fieldsMeta();
+
+                res.setFieldsMetadata(convertMetadata(fieldsMeta));
+
                 return new GridRestResponse(res);
             }
             catch (Exception e) {
@@ -154,6 +160,21 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
                 return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
             }
         }
+
+        /**
+         * @param meta Internal query field metadata.
+         * @return Rest query field metadata.
+         */
+        private Collection<CacheQueryFieldsMetaResult> convertMetadata(Collection<GridQueryFieldMetadata> meta) {
+            List<CacheQueryFieldsMetaResult> res = new ArrayList<>();
+
+            if (meta != null) {
+                for (GridQueryFieldMetadata info : meta)
+                    res.add(new CacheQueryFieldsMetaResult(info));
+            }
+
+            return res;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a0f4af95/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 9068487..2cf9988 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -577,63 +577,6 @@ public class GridJettyRestHandler extends AbstractHandler {
                 break;
             }
 
-            case EXECUTE_SQL_QUERY:
-            case EXECUTE_SQL_FIELDS_QUERY: {
-                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
-
-                restReq0.sqlQuery((String) params.get("qry"));
-
-                restReq0.arguments(values("arg", params).toArray());
-
-                restReq0.typeName((String) params.get("type"));
-
-                String psz = (String) params.get("psz");
-
-                if (psz != null)
-                    restReq0.pageSize(Integer.parseInt(psz));
-
-                restReq0.cacheName((String)params.get("cacheName"));
-
-                restReq = restReq0;
-
-                break;
-            }
-
-            case FETCH_SQL_QUERY: {
-                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
-
-                String qryId = (String) params.get("qryId");
-
-                if (qryId != null)
-                    restReq0.queryId(Long.parseLong(qryId));
-
-                String psz = (String) params.get("psz");
-
-                if (psz != null)
-                    restReq0.pageSize(Integer.parseInt(psz));
-
-                restReq0.cacheName((String)params.get("cacheName"));
-
-                restReq = restReq0;
-
-                break;
-            }
-
-            case CLOSE_SQL_QUERY: {
-                RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
-
-                String qryId = (String) params.get("qryId");
-
-                if (qryId != null)
-                    restReq0.queryId(Long.parseLong(qryId));
-
-                restReq0.cacheName((String)params.get("cacheName"));
-
-                restReq = restReq0;
-
-                break;
-            }
-
             case RUN_SCRIPT: {
                 RestRunScriptRequest restReq0 = new RestRunScriptRequest();
 


[36/50] [abbrv] incubator-ignite git commit: IGNITE-1121 Rename 'config.properties' to 'default.config.properties'

Posted by an...@apache.org.
IGNITE-1121 Rename 'config.properties' to 'default.config.properties'


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

Branch: refs/heads/ignite-843
Commit: a4be95ffa1cee69d892162d9246367e61a031715
Parents: b9d650a
Author: sevdokimov <se...@gridgain.com>
Authored: Tue Jul 28 18:48:48 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue Jul 28 18:48:48 2015 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/agent/AgentLauncher.java |  2 +-
 .../src/main/resources/config.properties                 | 11 -----------
 .../src/main/resources/default.config.properties         | 11 +++++++++++
 3 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4be95ff/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
index 1ed5448..0e173d8 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
@@ -51,7 +51,7 @@ public class AgentLauncher {
     protected static AgentConfiguration getConfiguration(String[] args) throws IOException {
         AgentConfiguration cfg = new AgentConfiguration();
 
-        URL dftlCfgUrl = AgentLauncher.class.getResource("/config.properties");
+        URL dftlCfgUrl = AgentLauncher.class.getResource("/default.config.properties");
 
         cfg.load(dftlCfgUrl);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4be95ff/modules/control-center-agent/src/main/resources/config.properties
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/resources/config.properties b/modules/control-center-agent/src/main/resources/config.properties
deleted file mode 100644
index e7064b7..0000000
--- a/modules/control-center-agent/src/main/resources/config.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# Ignite Control Center web-socket server URI.
-serverURI=wss://localhost:3001
-
-# Default Ignite node server URI.
-nodeURI=http://localhost:8080
-
-# User's login (email) on Ignite Control Center
-# login=ivan.ivanov@gmail.com
-
-# User's password
-# password=qwert
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a4be95ff/modules/control-center-agent/src/main/resources/default.config.properties
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/resources/default.config.properties b/modules/control-center-agent/src/main/resources/default.config.properties
new file mode 100644
index 0000000..e7064b7
--- /dev/null
+++ b/modules/control-center-agent/src/main/resources/default.config.properties
@@ -0,0 +1,11 @@
+# Ignite Control Center web-socket server URI.
+serverURI=wss://localhost:3001
+
+# Default Ignite node server URI.
+nodeURI=http://localhost:8080
+
+# User's login (email) on Ignite Control Center
+# login=ivan.ivanov@gmail.com
+
+# User's password
+# password=qwert
\ No newline at end of file


[30/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-961

Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-961


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

Branch: refs/heads/ignite-843
Commit: 63e642750f87eeb0d62f121017ba40446a4c7b72
Parents: 70a8b2f a127756
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 27 17:57:08 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 27 17:57:08 2015 +0300

----------------------------------------------------------------------
 .../handlers/query/QueryCommandHandler.java     |  4 ++
 .../TcpDiscoveryIpFinderAbstractSelfTest.java   |  2 +-
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  | 18 ++++++
 ...pDiscoveryGoogleStorageIpFinderSelfTest.java | 29 ++++++++-
 modules/yardstick/config/benchmark.properties   |  6 +-
 .../yardstick/IgniteBenchmarkArguments.java     | 22 +++++++
 .../yardstick/cache/IgnitePutAllBenchmark.java  | 67 +++++++++++++++++++
 .../cache/IgnitePutAllTxBenchmark.java          | 68 ++++++++++++++++++++
 8 files changed, 213 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/63e64275/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index 35fbcef,59f95c9..d4e101a
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@@ -146,12 -146,12 +146,16 @@@ public class QueryCommandHandler extend
  
                  qryCurs.put(qryId, new IgniteBiTuple<>(qryCur, cur));
  
 -                CacheQueryResult res = createQueryResult(qryCurs, cur, req, qryId);
 +                CacheQueryResult res = createQueryResult(qryCurs, cur, req, qryId, ctx);
 +
 +                List<GridQueryFieldMetadata> fieldsMeta = ((QueryCursorImpl) qryCur).fieldsMeta();
 +
 +                res.setFieldsMetadata(convertMetadata(fieldsMeta));
  
+                 List<GridQueryFieldMetadata> fieldsMeta = ((QueryCursorImpl<?>) qryCur).fieldsMeta();
+ 
+                 res.setFieldsMetadata(convertMetadata(fieldsMeta));
+ 
                  return new GridRestResponse(res);
              }
              catch (Exception e) {


[35/50] [abbrv] incubator-ignite git commit: IGNITE-1121 Fix issues found on review.

Posted by an...@apache.org.
IGNITE-1121 Fix issues found on review.


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

Branch: refs/heads/ignite-843
Commit: b9d650a7bc26e27d66e9f176dcb3878540224d4a
Parents: d5925e6
Author: sevdokimov <se...@gridgain.com>
Authored: Tue Jul 28 14:31:43 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue Jul 28 14:31:43 2015 +0300

----------------------------------------------------------------------
 modules/control-center-agent/README.txt         | 20 ++++++++++++++++++++
 .../java/org/apache/ignite/agent/Agent.java     | 12 ++++++------
 .../org/apache/ignite/agent/AgentLauncher.java  |  2 +-
 .../src/main/resources/config.properties        |  9 +++++++++
 4 files changed, 36 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b9d650a7/modules/control-center-agent/README.txt
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/README.txt b/modules/control-center-agent/README.txt
new file mode 100644
index 0000000..29abc2f
--- /dev/null
+++ b/modules/control-center-agent/README.txt
@@ -0,0 +1,20 @@
+Apache Ignite Control Center Agent
+---------------------------
+Apache Ignite Control Center Agent is a java standalone application that allow to connect grid to control center.
+Control Center Agent communicates with grid nodes via REST interface and connects to Control Center via web-socket.
+
+---------------------------
+Usage example:
+agent.sh -l ivan.ivanov@gmail.com -p qwerty -s wss://control-center.gridgain.com
+
+Command line arguments:
+    -l User's login (email) on web-control-center
+    -p User's password
+    -s Link to Ignite Control Center web-socket server.
+    -n Ignite REST server
+    -c Configure agent using configuration file. Configuration file is a properties file,
+       see /control-center-agent/src/main/resources/config.properties as example.
+
+---------------------------
+Building module:
+to build module run "mvn package"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b9d650a7/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
index ca2ff51..ba3a9fd 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/Agent.java
@@ -39,7 +39,7 @@ public class Agent {
     private final AgentConfiguration cfg;
 
     /** */
-    private CloseableHttpClient httpclient;
+    private CloseableHttpClient httpClient;
 
     /**
      * @param cfg Config.
@@ -52,15 +52,15 @@ public class Agent {
      *
      */
     public void start() {
-        httpclient = HttpClientBuilder.create().build();
+        httpClient = HttpClientBuilder.create().build();
     }
 
     /**
      *
      */
     public void stop() throws IOException {
-        if (httpclient != null)
-            httpclient.close();
+        if (httpClient != null)
+            httpClient.close();
     }
 
     /**
@@ -100,7 +100,7 @@ public class Agent {
 
                 post = new HttpPost(builder.build());
 
-                if (nvps.size() > 0)
+                if (!nvps.isEmpty())
                     post.setEntity(new UrlEncodedFormEntity(nvps));
             }
             else {
@@ -114,7 +114,7 @@ public class Agent {
         else
             throw new IOException("Unknown HTTP-method: " + restReq.getMethod());
 
-        try (CloseableHttpResponse resp = httpclient.execute(httpReq)) {
+        try (CloseableHttpResponse resp = httpClient.execute(httpReq)) {
             ByteArrayOutputStream out = new ByteArrayOutputStream();
 
             resp.getEntity().writeTo(out);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b9d650a7/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
index fabd603..1ed5448 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java
@@ -57,7 +57,7 @@ public class AgentLauncher {
 
         AgentCommandLine cmdCfg = new AgentCommandLine();
 
-        JCommander cmd = new JCommander(cmdCfg, args);
+        new JCommander(cmdCfg, args);
 
         if (cmdCfg.getConfigFile() != null)
             cfg.load(new File(cmdCfg.getConfigFile()).toURI().toURL());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b9d650a7/modules/control-center-agent/src/main/resources/config.properties
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/resources/config.properties b/modules/control-center-agent/src/main/resources/config.properties
index f9b48b7..e7064b7 100644
--- a/modules/control-center-agent/src/main/resources/config.properties
+++ b/modules/control-center-agent/src/main/resources/config.properties
@@ -1,2 +1,11 @@
+# Ignite Control Center web-socket server URI.
 serverURI=wss://localhost:3001
+
+# Default Ignite node server URI.
 nodeURI=http://localhost:8080
+
+# User's login (email) on Ignite Control Center
+# login=ivan.ivanov@gmail.com
+
+# User's password
+# password=qwert
\ No newline at end of file


[04/50] [abbrv] incubator-ignite git commit: master: back merge from ignite-752

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index b7d6e3f..6130bd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -65,12 +65,20 @@ import java.util.concurrent.atomic.*;
  * and then this info goes to coordinator. When coordinator processes join request
  * and issues node added messages and all other nodes then receive info about new node.
  * <h1 class="header">Failure Detection</h1>
- * Configuration defaults (see Configuration section below for details)
- * are chosen to make possible for discovery SPI work reliably on
- * most of hardware and virtual deployments, but this has made failure detection time worse.
+ * Configuration defaults (see Configuration section below and
+ * {@link IgniteConfiguration#getFailureDetectionTimeout()}) for details) are chosen to make possible for discovery
+ * SPI work reliably on most of hardware and virtual deployments, but this has made failure detection time worse.
  * <p>
- * For stable low-latency networks the following more aggressive settings are recommended
- * (which allows failure detection time ~200ms):
+ * If it's needed to tune failure detection then it's highly recommended to do this using
+ * {@link IgniteConfiguration#setFailureDetectionTimeout(long)}. This failure timeout automatically controls the
+ * following parameters: {@link #getSocketTimeout()}, {@link #getAckTimeout()}, {@link #getMaxAckTimeout()},
+ * {@link #getReconnectCount()}. If any of those parameters is set explicitly, then the failure timeout setting will be
+ * ignored.
+ * <p>
+ * If it's required to perform advanced settings of failure detection and
+ * {@link IgniteConfiguration#getFailureDetectionTimeout()} is unsuitable then various {@code TcpDiscoverySpi}
+ * configuration parameters may be used. As an example, for stable low-latency networks the following more aggressive
+ * settings are recommended (which allows failure detection time ~200ms):
  * <ul>
  * <li>Heartbeat frequency (see {@link #setHeartbeatFrequency(long)}) - 100ms</li>
  * <li>Socket timeout (see {@link #setSocketTimeout(long)}) - 200ms</li>
@@ -157,6 +165,15 @@ import java.util.concurrent.atomic.*;
 @DiscoverySpiOrderSupport(true)
 @DiscoverySpiHistorySupport(true)
 public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, TcpDiscoverySpiMBean {
+    /** Failure detection timeout feature major version. */
+    final static byte FAILURE_DETECTION_MAJOR_VER = 1;
+
+    /** Failure detection timeout feature minor version. */
+    final static byte FAILURE_DETECTION_MINOR_VER = 4;
+
+    /** Failure detection timeout feature maintainance version. */
+    final static byte FAILURE_DETECTION_MAINT_VER = 1;
+
     /** Node attribute that is mapped to node's external addresses (value is <tt>disc.tcp.ext-addrs</tt>). */
     public static final String ATTR_EXT_ADDRS = "disc.tcp.ext-addrs";
 
@@ -221,10 +238,10 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     protected TcpDiscoveryIpFinder ipFinder;
 
     /** Socket operations timeout. */
-    protected long sockTimeout; // Must be initialized in the constructor of child class.
+    private long sockTimeout; // Must be initialized in the constructor of child class.
 
     /** Message acknowledgement timeout. */
-    protected long ackTimeout; // Must be initialized in the constructor of child class.
+    private long ackTimeout; // Must be initialized in the constructor of child class.
 
     /** Network timeout. */
     protected long netTimeout = DFLT_NETWORK_TIMEOUT;
@@ -286,14 +303,14 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
     /** Reconnect attempts count. */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
-    protected int reconCnt = DFLT_RECONNECT_CNT;
+    private int reconCnt = DFLT_RECONNECT_CNT;
 
     /** Statistics print frequency. */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized", "RedundantFieldInitialization"})
     protected long statsPrintFreq = DFLT_STATS_PRINT_FREQ;
 
     /** Maximum message acknowledgement timeout. */
-    protected long maxAckTimeout = DFLT_MAX_ACK_TIMEOUT;
+    private long maxAckTimeout = DFLT_MAX_ACK_TIMEOUT;
 
     /** Max heartbeats count node can miss without initiating status check. */
     protected int maxMissedHbs = DFLT_MAX_MISSED_HEARTBEATS;
@@ -521,6 +538,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * on every retry.
      * <p>
      * If not specified, default is {@link #DFLT_RECONNECT_CNT}.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param reconCnt Number of retries during message sending.
      * @see #setAckTimeout(long)
@@ -529,6 +548,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     public TcpDiscoverySpi setReconnectCount(int reconCnt) {
         this.reconCnt = reconCnt;
 
+        failureDetectionTimeoutEnabled(false);
+
         return this;
     }
 
@@ -548,6 +569,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * If not specified, default is {@link #DFLT_MAX_ACK_TIMEOUT}.
      * <p>
      * Affected server nodes only.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param maxAckTimeout Maximum acknowledgement timeout.
      */
@@ -555,6 +578,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     public TcpDiscoverySpi setMaxAckTimeout(long maxAckTimeout) {
         this.maxAckTimeout = maxAckTimeout;
 
+        failureDetectionTimeoutEnabled(false);
+
         return this;
     }
 
@@ -701,7 +726,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     /**
      * Sets IP finder for IP addresses sharing and storing.
      * <p>
-     * If not provided {@link org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder} will be used by default.
+     * If not provided {@link org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder} will
+     * be used by default.
      *
      * @param ipFinder IP finder.
      */
@@ -720,6 +746,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * significantly greater than the default (e.g. to {@code 30000}).
      * <p>
      * If not specified, default is {@link #DFLT_SOCK_TIMEOUT} or {@link #DFLT_SOCK_TIMEOUT_CLIENT}.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param sockTimeout Socket connection timeout.
      */
@@ -727,6 +755,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     public TcpDiscoverySpi setSocketTimeout(long sockTimeout) {
         this.sockTimeout = sockTimeout;
 
+        failureDetectionTimeoutEnabled(false);
+
         return this;
     }
 
@@ -737,6 +767,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * and SPI tries to repeat message sending.
      * <p>
      * If not specified, default is {@link #DFLT_ACK_TIMEOUT} or {@link #DFLT_ACK_TIMEOUT_CLIENT}.
+     * <p>
+     * When this property is explicitly set {@link IgniteConfiguration#getFailureDetectionTimeout()} is ignored.
      *
      * @param ackTimeout Acknowledgement timeout.
      */
@@ -744,6 +776,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     public TcpDiscoverySpi setAckTimeout(long ackTimeout) {
         this.ackTimeout = ackTimeout;
 
+        failureDetectionTimeoutEnabled(false);
+
         return this;
     }
 
@@ -1123,10 +1157,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
     /**
      * @param sockAddr Remote address.
+     * @param timeoutHelper Timeout helper.
      * @return Opened socket.
      * @throws IOException If failed.
      */
-    protected Socket openSocket(InetSocketAddress sockAddr) throws IOException {
+    protected Socket openSocket(InetSocketAddress sockAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)
+        throws IOException, IgniteSpiOperationTimeoutException {
         assert sockAddr != null;
 
         InetSocketAddress resolved = sockAddr.isUnresolved() ?
@@ -1142,9 +1178,9 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         sock.setTcpNoDelay(true);
 
-        sock.connect(resolved, (int)sockTimeout);
+        sock.connect(resolved, (int)timeoutHelper.nextTimeoutChunk(sockTimeout));
 
-        writeToSocket(sock, U.IGNITE_HEADER);
+        writeToSocket(sock, U.IGNITE_HEADER, timeoutHelper.nextTimeoutChunk(sockTimeout));
 
         return sock;
     }
@@ -1154,14 +1190,15 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      *
      * @param sock Socket.
      * @param data Raw data to write.
+     * @param timeout Socket write timeout.
      * @throws IOException If IO failed or write timed out.
      */
     @SuppressWarnings("ThrowFromFinallyBlock")
-    protected void writeToSocket(Socket sock, byte[] data) throws IOException {
+    private void writeToSocket(Socket sock, byte[] data, long timeout) throws IOException {
         assert sock != null;
         assert data != null;
 
-        SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + sockTimeout);
+        SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + timeout);
 
         addTimeoutObject(obj);
 
@@ -1197,11 +1234,13 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      *
      * @param sock Socket.
      * @param msg Message.
+     * @param timeout Socket write timeout.
      * @throws IOException If IO failed or write timed out.
      * @throws IgniteCheckedException If marshalling failed.
      */
-    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg) throws IOException, IgniteCheckedException {
-        writeToSocket(sock, msg, new GridByteArrayOutputStream(8 * 1024)); // 8K.
+    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout)
+        throws IOException, IgniteCheckedException {
+        writeToSocket(sock, msg, new GridByteArrayOutputStream(8 * 1024), timeout); // 8K.
     }
 
     /**
@@ -1214,8 +1253,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * @throws IgniteCheckedException If marshalling failed.
      */
     @SuppressWarnings("ThrowFromFinallyBlock")
-    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, GridByteArrayOutputStream bout)
-        throws IOException, IgniteCheckedException {
+    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, GridByteArrayOutputStream bout,
+        long timeout) throws IOException, IgniteCheckedException {
         assert sock != null;
         assert msg != null;
         assert bout != null;
@@ -1223,7 +1262,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         // Marshall message first to perform only write after.
         marsh.marshal(msg, bout);
 
-        SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + sockTimeout);
+        SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + timeout);
 
         addTimeoutObject(obj);
 
@@ -1260,13 +1299,15 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * @param msg Received message.
      * @param sock Socket.
      * @param res Integer response.
+     * @param timeout Socket timeout.
      * @throws IOException If IO failed or write timed out.
      */
     @SuppressWarnings("ThrowFromFinallyBlock")
-    protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res) throws IOException {
+    protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res, long timeout)
+        throws IOException {
         assert sock != null;
 
-        SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + sockTimeout);
+        SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + timeout);
 
         addTimeoutObject(obj);
 
@@ -1307,7 +1348,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * @throws IOException If IO failed or read timed out.
      * @throws IgniteCheckedException If unmarshalling failed.
      */
-    protected <T> T readMessage(Socket sock, @Nullable InputStream in, long timeout) throws IOException, IgniteCheckedException {
+    protected <T> T readMessage(Socket sock, @Nullable InputStream in, long timeout) throws IOException,
+        IgniteCheckedException {
         assert sock != null;
 
         int oldTimeout = sock.getSoTimeout();
@@ -1315,7 +1357,11 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         try {
             sock.setSoTimeout((int)timeout);
 
-            return marsh.unmarshal(in == null ? sock.getInputStream() : in, U.gridClassLoader());
+            T res = marsh.unmarshal(in == null ? sock.getInputStream() : in, U.gridClassLoader());
+
+            impl.onDataReceived();
+
+            return res;
         }
         catch (IOException | IgniteCheckedException e) {
             if (X.hasCause(e, SocketTimeoutException.class))
@@ -1356,6 +1402,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
             if (res == -1)
                 throw new EOFException();
 
+            impl.onDataReceived();
+
             return res;
         }
         catch (SocketTimeoutException e) {
@@ -1570,6 +1618,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
     /** {@inheritDoc} */
     @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
+        initFailureDetectionTimeout();
+
         if (!forceSrvMode && (Boolean.TRUE.equals(ignite.configuration().isClientMode()))) {
             if (ackTimeout == 0)
                 ackTimeout = DFLT_ACK_TIMEOUT_CLIENT;
@@ -1591,18 +1641,21 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
             impl = new ServerImpl(this);
         }
 
+        if (!failureDetectionTimeoutEnabled()) {
+            assertParameter(sockTimeout > 0, "sockTimeout > 0");
+            assertParameter(ackTimeout > 0, "ackTimeout > 0");
+            assertParameter(maxAckTimeout > ackTimeout, "maxAckTimeout > ackTimeout");
+            assertParameter(reconCnt > 0, "reconnectCnt > 0");
+        }
+
+        assertParameter(netTimeout > 0, "networkTimeout > 0");
         assertParameter(ipFinder != null, "ipFinder != null");
         assertParameter(hbFreq > 0, "heartbeatFreq > 0");
-        assertParameter(netTimeout > 0, "networkTimeout > 0");
-        assertParameter(sockTimeout > 0, "sockTimeout > 0");
-        assertParameter(ackTimeout > 0, "ackTimeout > 0");
 
         assertParameter(ipFinderCleanFreq > 0, "ipFinderCleanFreq > 0");
         assertParameter(locPort > 1023, "localPort > 1023");
         assertParameter(locPortRange >= 0, "localPortRange >= 0");
         assertParameter(locPort + locPortRange <= 0xffff, "locPort + locPortRange <= 0xffff");
-        assertParameter(maxAckTimeout > ackTimeout, "maxAckTimeout > ackTimeout");
-        assertParameter(reconCnt > 0, "reconnectCnt > 0");
         assertParameter(maxMissedHbs > 0, "maxMissedHeartbeats > 0");
         assertParameter(maxMissedClientHbs > 0, "maxMissedClientHeartbeats > 0");
         assertParameter(threadPri > 0, "threadPri > 0");
@@ -1620,11 +1673,20 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
             log.debug(configInfo("localPort", locPort));
             log.debug(configInfo("localPortRange", locPortRange));
             log.debug(configInfo("threadPri", threadPri));
-            log.debug(configInfo("networkTimeout", netTimeout));
-            log.debug(configInfo("sockTimeout", sockTimeout));
-            log.debug(configInfo("ackTimeout", ackTimeout));
-            log.debug(configInfo("maxAckTimeout", maxAckTimeout));
-            log.debug(configInfo("reconnectCount", reconCnt));
+
+            if (!failureDetectionTimeoutEnabled()) {
+                log.debug("Failure detection timeout is ignored because at least one of the parameters from this list" +
+                    " has been set explicitly: 'sockTimeout', 'ackTimeout', 'maxAckTimeout', 'reconnectCount'.");
+
+                log.debug(configInfo("networkTimeout", netTimeout));
+                log.debug(configInfo("sockTimeout", sockTimeout));
+                log.debug(configInfo("ackTimeout", ackTimeout));
+                log.debug(configInfo("maxAckTimeout", maxAckTimeout));
+                log.debug(configInfo("reconnectCount", reconCnt));
+            }
+            else
+                log.debug(configInfo("failureDetectionTimeout", failureDetectionTimeout()));
+
             log.debug(configInfo("ipFinder", ipFinder));
             log.debug(configInfo("ipFinderCleanFreq", ipFinderCleanFreq));
             log.debug(configInfo("heartbeatFreq", hbFreq));
@@ -1837,7 +1899,10 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
                 U.closeQuiet(sock);
 
                 LT.warn(log, null, "Socket write has timed out (consider increasing " +
-                    "'sockTimeout' configuration property) [sockTimeout=" + sockTimeout + ']');
+                    (failureDetectionTimeoutEnabled() ?
+                    "'IgniteConfiguration.failureDetectionTimeout' configuration property) [" +
+                    "failureDetectionTimeout=" + failureDetectionTimeout() + ']' :
+                    "'sockTimeout' configuration property) [sockTimeout=" + sockTimeout + ']'));
 
                 stats.onSocketTimeout();
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index 142dbea..44e9006 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -89,6 +89,9 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     @GridToStringExclude
     private volatile long lastUpdateTime = U.currentTimeMillis();
 
+    /** The most recent time when a data chunk was received from a node. */
+    private volatile long lastDataReceivedTime = U.currentTimeMillis();
+
     /** Metrics provider (transient). */
     @GridToStringExclude
     private DiscoveryMetricsProvider metricsProvider;
@@ -390,6 +393,24 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     }
 
     /**
+     * Gets the last time a node received a data chunk from a remote node.
+     *
+     * @return Time in milliseconds.
+     */
+    public long lastDataReceivedTime() {
+        return lastDataReceivedTime;
+    }
+
+    /**
+     * Sets the last time a node receive a data chunk from a remote node in a topology.
+     *
+     * @param lastDataReceivedTime Time in milliseconds.
+     */
+    public void lastDataReceivedTime(long lastDataReceivedTime) {
+        this.lastDataReceivedTime = lastDataReceivedTime;
+    }
+
+    /**
      * Gets visible flag.
      *
      * @return {@code true} if node is in visible state.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
new file mode 100644
index 0000000..c7e99c8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery.tcp.messages;
+
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.internal.*;
+
+import java.io.*;
+
+/**
+ * Message used to check whether a node is still connected to the topology.
+ * The difference from {@link TcpDiscoveryStatusCheckMessage} is that this message is sent to the next node
+ * which directly replies to the sender without message re-translation to the coordinator.
+ */
+public class TcpDiscoveryConnectionCheckMessage extends TcpDiscoveryAbstractMessage implements Externalizable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Default no-arg constructor for {@link Externalizable} interface.
+     */
+    public TcpDiscoveryConnectionCheckMessage() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNode Node created this message.
+     */
+    public TcpDiscoveryConnectionCheckMessage(TcpDiscoveryNode creatorNode) {
+        super(creatorNode.id());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        // This method has been left empty intentionally to keep message size at min.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        // This method has been left empty intentionally to keep message size at min.
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryConnectionCheckMessage.class, this, "super", super.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
index fbaea11..7247d54 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectAbstractTest.java
@@ -281,7 +281,7 @@ public abstract class IgniteClientReconnectAbstractTest extends GridCommonAbstra
         volatile CountDownLatch writeLatch;
 
         /** {@inheritDoc} */
-        @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg)
+        @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout)
             throws IOException, IgniteCheckedException {
             if (msg instanceof TcpDiscoveryJoinRequestMessage) {
                 CountDownLatch writeLatch0 = writeLatch;
@@ -293,7 +293,7 @@ public abstract class IgniteClientReconnectAbstractTest extends GridCommonAbstra
                 }
             }
 
-            super.writeToSocket(sock, msg);
+            super.writeToSocket(sock, msg, timeout);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
index eee38a5..538ead5 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
@@ -79,7 +79,7 @@ abstract class GridTcpCommunicationSpiAbstractTest extends GridAbstractCommunica
         for (CommunicationSpi spi : spis.values()) {
             ConcurrentMap<UUID, GridCommunicationClient> clients = U.field(spi, "clients");
 
-            assertEquals(2, clients.size());
+            assertEquals(getSpiCount() - 1, clients.size());
 
             clients.put(UUID.randomUUID(), F.first(clients.values()));
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
index 1a4ba22..b4090d0 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
@@ -166,7 +166,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
                                 @Override public boolean apply() {
                                     return recoveryDesc.messagesFutures().isEmpty();
                                 }
-                            }, 10_000);
+                            }, spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() + 7000 :
+                                10_000);
 
                             assertEquals("Unexpected messages: " + recoveryDesc.messagesFutures(), 0,
                                 recoveryDesc.messagesFutures().size());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryFailureDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryFailureDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryFailureDetectionSelfTest.java
new file mode 100644
index 0000000..a6bfe00
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryFailureDetectionSelfTest.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.spi.communication.tcp;
+
+import org.apache.ignite.configuration.*;
+
+/**
+ *
+ */
+public class GridTcpCommunicationSpiRecoveryFailureDetectionSelfTest extends GridTcpCommunicationSpiRecoverySelfTest {
+    /** {@inheritDoc} */
+    @Override protected TcpCommunicationSpi getSpi(int idx) {
+        TcpCommunicationSpi spi = new TcpCommunicationSpi();
+
+        spi.setSharedMemoryPort(-1);
+        spi.setLocalPort(port++);
+        spi.setIdleConnectionTimeout(10_000);
+        spi.setAckSendThreshold(5);
+        spi.setSocketSendBuffer(512);
+        spi.setSocketReceiveBuffer(512);
+
+        return spi;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long awaitForSocketWriteTimeout() {
+        return IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT + 5_000;
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testFailureDetectionEnabled() throws Exception {
+        for (TcpCommunicationSpi spi: spis) {
+            assertTrue(spi.failureDetectionTimeoutEnabled());
+            assertTrue(spi.failureDetectionTimeout() == IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
index 5d3afd9..67d42d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -60,7 +60,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
     private static final int ITERS = 10;
 
     /** */
-    private static int port = 30_000;
+    protected static int port = 30_000;
 
     /**
      *
@@ -163,6 +163,15 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
     }
 
     /**
+     * Time to wait for socket write timeout.
+     *
+     * @return Timeout.
+     */
+    protected long awaitForSocketWriteTimeout() {
+        return 5000;
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testBlockListener() throws Exception {
@@ -245,7 +254,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
             @Override public boolean apply() {
                 return lsnr0.rcvCnt.get() >= expMsgs && lsnr1.rcvCnt.get() >= expMsgs;
             }
-        }, 5000);
+        }, awaitForSocketWriteTimeout());
 
         assertEquals(expMsgs, lsnr0.rcvCnt.get());
         assertEquals(expMsgs, lsnr1.rcvCnt.get());
@@ -301,7 +310,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
                         @Override public boolean apply() {
                             return ses0.closeTime() != 0;
                         }
-                    }, 5000);
+                    }, awaitForSocketWriteTimeout());
 
                     assertTrue("Failed to wait for session close", ses0.closeTime() != 0);
 
@@ -411,7 +420,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
                         @Override public boolean apply() {
                             return ses0.closeTime() != 0;
                         }
-                    }, 5000);
+                    }, awaitForSocketWriteTimeout());
 
                     assertTrue("Failed to wait for session close", ses0.closeTime() != 0);
 
@@ -423,7 +432,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
                         public boolean apply() {
                             return ses1.closeTime() != 0;
                         }
-                    }, 5000);
+                    }, awaitForSocketWriteTimeout());
 
                     assertTrue("Failed to wait for session close", ses1.closeTime() != 0);
 
@@ -528,7 +537,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
                         @Override public boolean apply() {
                             return ses0.closeTime() != 0;
                         }
-                    }, 5000);
+                    }, awaitForSocketWriteTimeout());
 
                     assertTrue("Failed to wait for session close", ses0.closeTime() != 0);
 
@@ -592,7 +601,7 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
 
                 return !sessions.isEmpty();
             }
-        }, 5000);
+        }, awaitForSocketWriteTimeout());
 
         Collection<? extends GridNioSession> sessions = GridTestUtils.getFieldValue(srv, "sessions");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpFailureDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpFailureDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpFailureDetectionSelfTest.java
new file mode 100644
index 0000000..56873d1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpFailureDetectionSelfTest.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.spi.communication.tcp;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.communication.*;
+
+/**
+ *
+ */
+public class GridTcpCommunicationSpiTcpFailureDetectionSelfTest extends GridTcpCommunicationSpiTcpSelfTest {
+    /** */
+    private final static int SPI_COUNT = 4;
+
+    private TcpCommunicationSpi spis[] = new TcpCommunicationSpi[SPI_COUNT];
+
+    /** {@inheritDoc} */
+    @Override protected int getSpiCount() {
+        return SPI_COUNT;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CommunicationSpi getSpi(int idx) {
+        TcpCommunicationSpi spi = (TcpCommunicationSpi)super.getSpi(idx);
+
+        switch (idx) {
+            case 0:
+                // Ignore
+                break;
+            case 1:
+                spi.setConnectTimeout(4000);
+                break;
+            case 2:
+                spi.setMaxConnectTimeout(TcpCommunicationSpi.DFLT_MAX_CONN_TIMEOUT);
+                break;
+            case 3:
+                spi.setReconnectCount(2);
+                break;
+            default:
+                assert false;
+        }
+
+        spis[idx] = spi;
+
+        return spi;
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testFailureDetectionEnabled() throws Exception {
+        assertTrue(spis[0].failureDetectionTimeoutEnabled());
+        assertTrue(spis[0].failureDetectionTimeout() == IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT);
+
+        for (int i = 1; i < SPI_COUNT; i++) {
+            assertFalse(spis[i].failureDetectionTimeoutEnabled());
+            assertEquals(0, spis[i].failureDetectionTimeout());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index 61bb944..892d87d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -43,12 +43,18 @@ import static org.apache.ignite.lang.IgniteProductVersion.*;
 @SuppressWarnings({"JUnitAbstractTestClassNamingConvention"})
 public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends GridSpiAbstractTest<T> {
     /** */
-    private static final List<DiscoverySpi> spis = new ArrayList<>();
+    private static final String HTTP_ADAPTOR_MBEAN_NAME = "mbeanAdaptor:protocol=HTTP";
+
+    /** */
+    protected static final List<DiscoverySpi> spis = new ArrayList<>();
 
     /** */
     private static final Collection<IgniteTestResources> spiRsrcs = new ArrayList<>();
 
     /** */
+    private static final List<HttpAdaptor> httpAdaptors = new ArrayList<>();
+
+    /** */
     private static long spiStartTime;
 
     /** */
@@ -424,10 +430,12 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
         adaptor.setPort(Integer.valueOf(GridTestProperties.getProperty("discovery.mbeanserver.selftest.baseport")) +
             idx);
 
-        srv.registerMBean(adaptor, new ObjectName("mbeanAdaptor:protocol=HTTP"));
+        srv.registerMBean(adaptor, new ObjectName(HTTP_ADAPTOR_MBEAN_NAME));
 
         adaptor.start();
 
+        httpAdaptors.add(adaptor);
+
         return srv;
     }
 
@@ -442,12 +450,21 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
             spi.spiStop();
         }
 
-        for (IgniteTestResources rscrs : spiRsrcs)
+        for (IgniteTestResources rscrs : spiRsrcs) {
+            MBeanServer mBeanServer = rscrs.getMBeanServer();
+
+            mBeanServer.unregisterMBean(new ObjectName(HTTP_ADAPTOR_MBEAN_NAME));
+
             rscrs.stopThreads();
+        }
+
+        for (HttpAdaptor adaptor : httpAdaptors)
+            adaptor.stop();
 
         // Clear.
         spis.clear();
         spiRsrcs.clear();
+        httpAdaptors.clear();
 
         spiStartTime = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
new file mode 100644
index 0000000..3cf44f2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.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.spi.discovery.tcp;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.messages.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * Client-based discovery SPI test with failure detection timeout enabled.
+ */
+public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscoverySpiSelfTest {
+    /** */
+    private final static int FAILURE_AWAIT_TIME = 7_000;
+
+    /** */
+    private final static long FAILURE_THRESHOLD = 10_000;
+
+    /** */
+    private static long failureThreshold = FAILURE_THRESHOLD;
+
+    /** */
+    private static boolean useTestSpi;
+
+    /** {@inheritDoc} */
+    @Override protected boolean useFailureDetectionTimeout() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long failureDetectionTimeout() {
+        return failureThreshold;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long awaitTime() {
+        return failureDetectionTimeout() + FAILURE_AWAIT_TIME;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected TcpDiscoverySpi getDiscoverySpi() {
+        return useTestSpi ? new TestTcpDiscoverySpi() : super.getDiscoverySpi();
+    }
+
+    /**
+     * @throws Exception in case of error.
+     */
+    public void testFailureDetectionTimeoutEnabled() throws Exception {
+        startServerNodes(1);
+        startClientNodes(1);
+
+        checkNodes(1, 1);
+
+        assertTrue(((TcpDiscoverySpi)(G.ignite("server-0").configuration().getDiscoverySpi())).
+                failureDetectionTimeoutEnabled());
+        assertEquals(failureDetectionTimeout(),
+            ((TcpDiscoverySpi)(G.ignite("server-0").configuration().getDiscoverySpi())).failureDetectionTimeout());
+
+        assertTrue(((TcpDiscoverySpi)(G.ignite("client-0").configuration().getDiscoverySpi())).
+                failureDetectionTimeoutEnabled());
+        assertEquals(failureDetectionTimeout(),
+            ((TcpDiscoverySpi)(G.ignite("client-0").configuration().getDiscoverySpi())).failureDetectionTimeout());
+    }
+
+    /**
+     * @throws Exception in case of error.
+     */
+    public void testFailureTimeoutWorkabilityAvgTimeout() throws Exception {
+        failureThreshold = 3000;
+
+        try {
+            checkFailureThresholdWorkability();
+        }
+        finally {
+            failureThreshold = FAILURE_THRESHOLD;
+        }
+    }
+
+    /**
+     * @throws Exception in case of error.
+     */
+    public void testFailureTimeoutWorkabilitySmallTimeout() throws Exception {
+        failureThreshold = 500;
+
+        try {
+            checkFailureThresholdWorkability();
+        }
+        finally {
+            failureThreshold = FAILURE_THRESHOLD;
+        }
+    }
+
+    /**
+     * @throws Exception in case of error.
+     */
+    private void checkFailureThresholdWorkability() throws Exception {
+        useTestSpi = true;
+
+        TestTcpDiscoverySpi firstSpi = null;
+        TestTcpDiscoverySpi secondSpi = null;
+
+        try {
+            startServerNodes(2);
+
+            checkNodes(2, 0);
+
+            firstSpi = (TestTcpDiscoverySpi)(G.ignite("server-0").configuration().getDiscoverySpi());
+            secondSpi = (TestTcpDiscoverySpi)(G.ignite("server-1").configuration().getDiscoverySpi());
+
+            assert firstSpi.err == null;
+
+            secondSpi.readDelay = failureDetectionTimeout() + 5000;
+
+            assertFalse(firstSpi.pingNode(secondSpi.getLocalNodeId()));
+
+            Thread.sleep(failureDetectionTimeout());
+
+            assertTrue(firstSpi.err != null && X.hasCause(firstSpi.err, SocketTimeoutException.class));
+
+            firstSpi.reset();
+            secondSpi.reset();
+
+            assertTrue(firstSpi.pingNode(secondSpi.getLocalNodeId()));
+
+            assertTrue(firstSpi.err == null);
+        }
+        finally {
+            useTestSpi = false;
+
+            if (firstSpi != null)
+                firstSpi.reset();
+
+            if (secondSpi != null)
+                secondSpi.reset();
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+        /** */
+        private long readDelay;
+
+        /** */
+        private Exception err;
+
+        /** {@inheritDoc} */
+        @Override protected <T> T readMessage(Socket sock, @Nullable InputStream in, long timeout)
+            throws IOException, IgniteCheckedException {
+
+            if (readDelay < failureDetectionTimeout()) {
+                try {
+                    return super.readMessage(sock, in, timeout);
+                }
+                catch (Exception e) {
+                    err = e;
+
+                    throw e;
+                }
+            }
+            else {
+                T msg = super.readMessage(sock, in, timeout);
+
+                if (msg instanceof TcpDiscoveryPingRequest) {
+                    try {
+                        Thread.sleep(2000);
+                    } catch (InterruptedException e) {
+                        // Ignore
+                    }
+                    throw new SocketTimeoutException("Forced timeout");
+                }
+
+                return msg;
+            }
+        }
+
+        /**
+         * Resets testing state.
+         */
+        private void reset() {
+            readDelay = 0;
+            err = null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index 63db0c1..69a5f13 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -118,7 +118,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        TestTcpDiscoverySpi disco = new TestTcpDiscoverySpi();
+        TcpDiscoverySpi disco = getDiscoverySpi();
 
         disco.setMaxMissedClientHeartbeats(maxMissedClientHbs);
 
@@ -154,9 +154,19 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
         else
             throw new IllegalArgumentException();
 
-        if (longSockTimeouts) {
-            disco.setAckTimeout(2000);
-            disco.setSocketTimeout(2000);
+        if (useFailureDetectionTimeout())
+            cfg.setFailureDetectionTimeout(failureDetectionTimeout());
+        else {
+            if (longSockTimeouts) {
+                disco.setAckTimeout(2000);
+                disco.setSocketTimeout(2000);
+            }
+            else {
+                disco.setAckTimeout(gridName.startsWith("client") ? TcpDiscoverySpi.DFLT_ACK_TIMEOUT_CLIENT :
+                    TcpDiscoverySpi.DFLT_ACK_TIMEOUT);
+                disco.setSocketTimeout(gridName.startsWith("client") ? TcpDiscoverySpi.DFLT_SOCK_TIMEOUT_CLIENT :
+                    TcpDiscoverySpi.DFLT_SOCK_TIMEOUT);
+            }
         }
 
         disco.setJoinTimeout(joinTimeout);
@@ -164,7 +174,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         disco.setClientReconnectDisabled(reconnectDisabled);
 
-        disco.afterWrite(afterWrite);
+        if (disco instanceof TestTcpDiscoverySpi)
+            ((TestTcpDiscoverySpi)disco).afterWrite(afterWrite);
 
         cfg.setDiscoverySpi(disco);
 
@@ -174,6 +185,14 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
         return cfg;
     }
 
+    /**
+     * Returns TCP Discovery SPI instance to use in a test.
+     * @return TCP Discovery SPI.
+     */
+    protected TcpDiscoverySpi getDiscoverySpi() {
+        return new TestTcpDiscoverySpi();
+    }
+
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         Collection<InetSocketAddress> addrs = IP_FINDER.getRegisteredAddresses();
@@ -205,6 +224,24 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Checks whether to use failure detection timeout instead of setting explicit timeouts.
+     *
+     * @return {@code true} if use.
+     */
+    protected boolean useFailureDetectionTimeout() {
+        return false;
+    }
+
+    /**
+     * Gets failure detection timeout to use.
+     *
+     * @return Failure detection timeout.
+     */
+    protected long failureDetectionTimeout() {
+        return 0;
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testJoinTimeout() throws Exception {
@@ -390,12 +427,12 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         final CountDownLatch latch = new CountDownLatch(1);
 
-        ((TcpDiscoverySpi)srv1.configuration().getDiscoverySpi()).addIncomeConnectionListener(new IgniteInClosure<Socket>() {
+        ((TcpDiscoverySpi)srv1.configuration().getDiscoverySpi()).addIncomeConnectionListener(new IgniteInClosure
+            <Socket>() {
             @Override public void apply(Socket sock) {
                 try {
                     latch.await();
-                }
-                catch (InterruptedException e) {
+                } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }
             }
@@ -414,11 +451,14 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
         startServerNodes(2);
         startClientNodes(1);
 
+        checkNodes(2, 1);
+
         Ignite srv0 = G.ignite("server-0");
         Ignite srv1 = G.ignite("server-1");
         Ignite client = G.ignite("client-0");
 
-        ((TcpDiscoverySpi)srv0.configuration().getDiscoverySpi()).setAckTimeout(1000);
+        if (!useFailureDetectionTimeout())
+            ((TcpDiscoverySpi)srv0.configuration().getDiscoverySpi()).setAckTimeout(1000);
 
         ((TestTcpDiscoverySpi)client.configuration().getDiscoverySpi()).pauseSocketWrite();
 
@@ -756,8 +796,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
             @Override public void apply(TcpDiscoveryAbstractMessage msg) {
                 try {
                     Thread.sleep(1000000);
-                }
-                catch (InterruptedException ignored) {
+                } catch (InterruptedException ignored) {
                     Thread.interrupted();
                 }
             }
@@ -1405,8 +1444,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         latch.countDown();
 
-        assertTrue(disconnectLatch.await(10_000, MILLISECONDS));
-        assertTrue(reconnectLatch.await(10_000, MILLISECONDS));
+        assertTrue(disconnectLatch.await(awaitTime(), MILLISECONDS));
+        assertTrue(reconnectLatch.await(awaitTime(), MILLISECONDS));
 
         clientNodeIds.add(client.cluster().localNode().id());
 
@@ -1474,7 +1513,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @param failSrv If {@code true} fails server, otherwise server does not send join message.
      * @throws Exception If failed.
      */
-    private void reconnectSegmentedAfterJoinTimeout(boolean failSrv) throws Exception {
+    protected void reconnectSegmentedAfterJoinTimeout(boolean failSrv) throws Exception {
         netTimeout = 4000;
         joinTimeout = 5000;
 
@@ -1542,9 +1581,9 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
             clientSpi.brakeConnection();
         }
 
-        assertTrue(disconnectLatch.await(10_000, MILLISECONDS));
+        assertTrue(disconnectLatch.await(awaitTime(), MILLISECONDS));
 
-        assertTrue(segmentedLatch.await(10_000, MILLISECONDS));
+        assertTrue(segmentedLatch.await(awaitTime(), MILLISECONDS));
 
         waitSegmented(client);
 
@@ -1557,7 +1596,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
                 @Override public boolean apply() {
                     return srv.cluster().nodes().size() == 1;
                 }
-            }, 10_000);
+            }, awaitTime());
 
             checkNodes(1, 0);
         }
@@ -1614,7 +1653,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         srv.close();
 
-        assertTrue(disconnectLatch.await(10_000, MILLISECONDS));
+        assertTrue(disconnectLatch.await(awaitTime(), MILLISECONDS));
 
         srvNodeIds.clear();
         srvIdx.set(0);
@@ -1625,7 +1664,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         startServerNodes(1);
 
-        assertTrue(reconnectLatch.await(10_000, MILLISECONDS));
+        assertTrue(reconnectLatch.await(awaitTime(), MILLISECONDS));
 
         clientNodeIds.clear();
         clientNodeIds.add(client.cluster().localNode().id());
@@ -1695,7 +1734,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         clientSpi.brakeConnection();
 
-        assertTrue(disconnectLatch.await(10_000, MILLISECONDS));
+        assertTrue(disconnectLatch.await(awaitTime(), MILLISECONDS));
 
         log.info("Fail client connection2.");
 
@@ -1704,7 +1743,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         clientSpi.brakeConnection();
 
-        assertTrue(reconnectLatch.await(10_000, MILLISECONDS));
+        assertTrue(reconnectLatch.await(awaitTime(), MILLISECONDS));
 
         clientNodeIds.clear();
 
@@ -1715,7 +1754,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
             public boolean apply() {
                 return srv.cluster().nodes().size() == 2;
             }
-        }, 10_000);
+        }, awaitTime());
 
         checkNodes(1, 1);
 
@@ -1759,7 +1798,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @param cnt Number of nodes.
      * @throws Exception In case of error.
      */
-    private void startServerNodes(int cnt) throws Exception {
+    protected void startServerNodes(int cnt) throws Exception {
         for (int i = 0; i < cnt; i++) {
             Ignite g = startGrid("server-" + srvIdx.getAndIncrement());
 
@@ -1771,7 +1810,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @param cnt Number of nodes.
      * @throws Exception In case of error.
      */
-    private void startClientNodes(int cnt) throws Exception {
+    protected void startClientNodes(int cnt) throws Exception {
         for (int i = 0; i < cnt; i++) {
             Ignite g = startGrid("client-" + clientIdx.getAndIncrement());
 
@@ -1888,7 +1927,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @param srvCnt Number of server nodes.
      * @param clientCnt Number of client nodes.
      */
-    private void checkNodes(int srvCnt, int clientCnt) {
+    protected void checkNodes(int srvCnt, int clientCnt) {
         long topVer = -1;
 
         for (int i = 0; i < srvCnt; i++) {
@@ -1950,8 +1989,17 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @param latch Latch.
      * @throws InterruptedException If interrupted.
      */
-    private void await(CountDownLatch latch) throws InterruptedException {
-        assertTrue("Latch count: " + latch.getCount(), latch.await(10_000, MILLISECONDS));
+    protected void await(CountDownLatch latch) throws InterruptedException {
+        assertTrue("Latch count: " + latch.getCount(), latch.await(awaitTime(), MILLISECONDS));
+    }
+
+    /**
+     * Time to wait for operation completion.
+     *
+     * @return Time in milliseconds.
+     */
+    protected long awaitTime() {
+        return 10_000;
     }
 
     /**
@@ -2072,7 +2120,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg,
-            GridByteArrayOutputStream bout) throws IOException, IgniteCheckedException {
+            GridByteArrayOutputStream bout, long timeout) throws IOException, IgniteCheckedException {
             waitFor(writeLock);
 
             boolean fail = false;
@@ -2097,17 +2145,18 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
                 sock.close();
             }
 
-            super.writeToSocket(sock, msg, bout);
+            super.writeToSocket(sock, msg, bout, timeout);
 
             if (afterWrite != null)
                 afterWrite.apply(msg, sock);
         }
 
         /** {@inheritDoc} */
-        @Override protected Socket openSocket(InetSocketAddress sockAddr) throws IOException {
+        @Override protected Socket openSocket(InetSocketAddress sockAddr,
+            IgniteSpiOperationTimeoutHelper timeoutHelper) throws IOException, IgniteSpiOperationTimeoutException {
             waitFor(openSockLock);
 
-            return super.openSocket(sockAddr);
+            return super.openSocket(sockAddr, new IgniteSpiOperationTimeoutHelper(this));
         }
 
         /**
@@ -2137,7 +2186,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res) throws IOException {
+        @Override protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res, long timeout)
+            throws IOException {
             if (delayJoinAckFor != null && msg instanceof TcpDiscoveryJoinRequestMessage) {
                 TcpDiscoveryJoinRequestMessage msg0 = (TcpDiscoveryJoinRequestMessage)msg;
 
@@ -2155,7 +2205,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
                 }
             }
 
-            super.writeToSocket(msg, sock, res);
+            super.writeToSocket(msg, sock, res, timeout);
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
index 3e895be..8ab2116 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.spi.discovery.tcp;
 
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.testframework.junits.spi.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
new file mode 100644
index 0000000..fbea187
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
@@ -0,0 +1,402 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery.tcp;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.io.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.spi.discovery.tcp.internal.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.spi.discovery.tcp.messages.*;
+
+import java.io.*;
+import java.net.*;
+
+/**
+ *
+ */
+public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelfTest {
+    /** */
+    private static final int SPI_COUNT = 6;
+
+    /** */
+    private TcpDiscoveryIpFinder ipFinder =  new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected int getSpiCount() {
+        return SPI_COUNT;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected DiscoverySpi getSpi(int idx) {
+        TestTcpDiscoverySpi spi = new TestTcpDiscoverySpi();
+
+        spi.setMetricsProvider(createMetricsProvider());
+        spi.setIpFinder(ipFinder);
+
+        switch (idx) {
+            case 0:
+            case 1:
+                // Ignore
+                break;
+            case 2:
+                spi.setAckTimeout(3000);
+                break;
+            case 3:
+                spi.setSocketTimeout(4000);
+                break;
+            case 4:
+                spi.setReconnectCount(4);
+                break;
+            case 5:
+                spi.setMaxAckTimeout(10000);
+                break;
+            default:
+                assert false;
+        }
+
+        return spi;
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testFailureDetectionTimeoutEnabled() throws Exception {
+        assertTrue(firstSpi().failureDetectionTimeoutEnabled());
+        assertTrue(secondSpi().failureDetectionTimeoutEnabled());
+
+        assertEquals(IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT.longValue(),
+                firstSpi().failureDetectionTimeout());
+        assertEquals(IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT.longValue(),
+                secondSpi().failureDetectionTimeout());
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testFailureDetectionTimeoutDisabled() throws Exception {
+        for (int i = 2; i < spis.size(); i++) {
+            assertFalse(((TcpDiscoverySpi)spis.get(i)).failureDetectionTimeoutEnabled());
+            assertEquals(0, ((TcpDiscoverySpi)spis.get(i)).failureDetectionTimeout());
+        }
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testFailureDetectionOnSocketOpen() throws Exception {
+        try {
+            ClusterNode node = secondSpi().getLocalNode();
+
+            firstSpi().openSocketTimeout = true;
+
+            assertFalse(firstSpi().pingNode(node.id()));
+            assertTrue(firstSpi().validTimeout);
+            assertTrue(firstSpi().err.getMessage().equals("Timeout: openSocketTimeout"));
+
+            firstSpi().openSocketTimeout = false;
+            firstSpi().openSocketTimeoutWait = true;
+
+            assertFalse(firstSpi().pingNode(node.id()));
+            assertTrue(firstSpi().validTimeout);
+            assertTrue(firstSpi().err.getMessage().equals("Timeout: openSocketTimeoutWait"));
+        }
+        finally {
+            firstSpi().resetState();
+        }
+    }
+
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testFailureDetectionOnSocketWrite() throws Exception {
+        try {
+            ClusterNode node = secondSpi().getLocalNode();
+
+            firstSpi().writeToSocketTimeoutWait = true;
+
+            assertFalse(firstSpi().pingNode(node.id()));
+            assertTrue(firstSpi().validTimeout);
+
+            firstSpi().writeToSocketTimeoutWait = false;
+
+            assertTrue(firstSpi().pingNode(node.id()));
+            assertTrue(firstSpi().validTimeout);
+        }
+        finally {
+            firstSpi().resetState();
+        }
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testConnectionCheckMessage() throws Exception {
+        TestTcpDiscoverySpi nextSpi = null;
+
+        try {
+            assert firstSpi().connCheckStatusMsgCntSent == 0;
+
+            TcpDiscoveryNode nextNode = ((ServerImpl)(firstSpi().impl)).ring().nextNode();
+
+            assertNotNull(nextNode);
+
+            nextSpi = null;
+
+            for (int i = 1; i < spis.size(); i++)
+                if (spis.get(i).getLocalNode().id().equals(nextNode.id())) {
+                    nextSpi = (TestTcpDiscoverySpi)spis.get(i);
+                    break;
+                }
+
+            assertNotNull(nextSpi);
+
+            assert nextSpi.connCheckStatusMsgCntReceived == 0;
+
+            firstSpi().countConnCheckMsg = true;
+            nextSpi.countConnCheckMsg = true;
+
+            Thread.sleep(firstSpi().failureDetectionTimeout());
+
+            firstSpi().countConnCheckMsg = false;
+            nextSpi.countConnCheckMsg = false;
+
+            int sent = firstSpi().connCheckStatusMsgCntSent;
+            int received = nextSpi.connCheckStatusMsgCntReceived;
+
+            assert sent >= 3 && sent < 7 : "messages sent: " + sent;
+            assert received >= 3 && received < 7 : "messages received: " + received;
+        }
+        finally {
+            firstSpi().resetState();
+
+            if (nextSpi != null)
+                nextSpi.resetState();
+        }
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testConnectionCheckMessageBackwardCompatibility() throws Exception {
+        TestTcpDiscoverySpi nextSpi = null;
+        TcpDiscoveryNode nextNode = null;
+
+        IgniteProductVersion nextNodeVer = null;
+
+        try {
+            assert firstSpi().connCheckStatusMsgCntSent == 0;
+
+            nextNode = ((ServerImpl)(firstSpi().impl)).ring().nextNode();
+
+            assertNotNull(nextNode);
+
+            nextSpi = null;
+
+            for (int i = 1; i < spis.size(); i++)
+                if (spis.get(i).getLocalNode().id().equals(nextNode.id())) {
+                    nextSpi = (TestTcpDiscoverySpi)spis.get(i);
+                    break;
+                }
+
+            assertNotNull(nextSpi);
+
+            assert nextSpi.connCheckStatusMsgCntReceived == 0;
+
+            nextNodeVer = nextNode.version();
+
+            // Overriding the version of the next node. Connection check message must not been sent to it.
+            nextNode.version(new IgniteProductVersion(TcpDiscoverySpi.FAILURE_DETECTION_MAJOR_VER,
+                (byte)(TcpDiscoverySpi.FAILURE_DETECTION_MINOR_VER - 1), TcpDiscoverySpi.FAILURE_DETECTION_MAINT_VER,
+                0l, null));
+
+            firstSpi().countConnCheckMsg = true;
+            nextSpi.countConnCheckMsg = true;
+
+            Thread.sleep(firstSpi().failureDetectionTimeout() / 2);
+
+            firstSpi().countConnCheckMsg = false;
+            nextSpi.countConnCheckMsg = false;
+
+            int sent = firstSpi().connCheckStatusMsgCntSent;
+            int received = nextSpi.connCheckStatusMsgCntReceived;
+
+            assert sent == 0 : "messages sent: " + sent;
+            assert received == 0 : "messages received: " + received;
+        }
+        finally {
+            firstSpi().resetState();
+
+            if (nextSpi != null)
+                nextSpi.resetState();
+
+            if (nextNode != null && nextNodeVer != null)
+                nextNode.version(nextNodeVer);
+        }
+    }
+
+    /**
+     * Returns the first spi with failure detection timeout enabled.
+     *
+     * @return SPI.
+     */
+    private TestTcpDiscoverySpi firstSpi() {
+        return (TestTcpDiscoverySpi)spis.get(0);
+    }
+
+
+    /**
+     * Returns the second spi with failure detection timeout enabled.
+     *
+     * @return SPI.
+     */
+    private TestTcpDiscoverySpi secondSpi() {
+        return (TestTcpDiscoverySpi)spis.get(1);
+    }
+
+    /**
+     *
+     */
+    private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+        /** */
+        private volatile boolean openSocketTimeout;
+
+        /** */
+        private volatile boolean openSocketTimeoutWait;
+
+        /** */
+        private volatile boolean writeToSocketTimeoutWait;
+
+        /** */
+        private volatile boolean countConnCheckMsg;
+
+        /** */
+        private volatile int connCheckStatusMsgCntSent;
+
+        /** */
+        private volatile int connCheckStatusMsgCntReceived;
+
+        /** */
+        private volatile boolean validTimeout = true;
+
+        /** */
+        private volatile IgniteSpiOperationTimeoutException err;
+
+
+        /** {@inheritDoc} */
+        @Override protected Socket openSocket(InetSocketAddress sockAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)
+            throws IOException, IgniteSpiOperationTimeoutException {
+
+            if (openSocketTimeout) {
+                err = new IgniteSpiOperationTimeoutException("Timeout: openSocketTimeout");
+                throw err;
+            }
+            else if (openSocketTimeoutWait) {
+                long timeout = timeoutHelper.nextTimeoutChunk(0);
+
+                try {
+                    Thread.sleep(timeout + 1000);
+                }
+                catch (InterruptedException e) {
+                    // Ignore
+                }
+
+                try {
+                    timeoutHelper.nextTimeoutChunk(0);
+                }
+                catch (IgniteSpiOperationTimeoutException e) {
+                    throw (err = new IgniteSpiOperationTimeoutException("Timeout: openSocketTimeoutWait"));
+                }
+            }
+
+            Socket sock = super.openSocket(sockAddr, timeoutHelper);
+
+            try {
+                Thread.sleep(1500);
+            } catch (InterruptedException e) {
+                // Ignore
+            }
+
+            return sock;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout)
+            throws IOException, IgniteCheckedException {
+            if (!(msg instanceof TcpDiscoveryPingRequest)) {
+                super.writeToSocket(sock, msg, timeout);
+                return;
+            }
+
+            if (timeout >= IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT) {
+                validTimeout = false;
+
+                throw new IgniteCheckedException("Invalid timeout: " + timeout);
+            }
+
+            if (writeToSocketTimeoutWait) {
+                try {
+                    Thread.sleep(timeout);
+                }
+                catch (InterruptedException e) {
+                    // Ignore
+                }
+            }
+            else
+                super.writeToSocket(sock, msg, timeout);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg,
+            GridByteArrayOutputStream bout, long timeout) throws IOException, IgniteCheckedException {
+            if (countConnCheckMsg && msg instanceof TcpDiscoveryConnectionCheckMessage)
+                connCheckStatusMsgCntSent++;
+
+            super.writeToSocket(sock, msg, bout, timeout);
+        }
+
+        /** {@inheritDoc} */
+        protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res, long timeout)
+            throws IOException {
+            if (countConnCheckMsg && msg instanceof TcpDiscoveryConnectionCheckMessage)
+                connCheckStatusMsgCntReceived++;
+
+            super.writeToSocket(msg, sock, res, timeout);
+        }
+
+        /**
+         *
+         */
+        private void resetState() {
+            openSocketTimeout = false;
+            openSocketTimeoutWait = false;
+            writeToSocketTimeoutWait = false;
+            err = null;
+            validTimeout = true;
+            connCheckStatusMsgCntSent = 0;
+            connCheckStatusMsgCntReceived = 0;
+            countConnCheckMsg = false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
index ff86bda..3f71d7d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
@@ -45,6 +45,9 @@ public class IgniteSpiCommunicationSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(GridTcpCommunicationSpiMultithreadedSelfTest.class));
         suite.addTest(new TestSuite(GridTcpCommunicationSpiMultithreadedShmemTest.class));
 
+        suite.addTest(new TestSuite(GridTcpCommunicationSpiRecoveryFailureDetectionSelfTest.class));
+        suite.addTest(new TestSuite(GridTcpCommunicationSpiTcpFailureDetectionSelfTest.class));
+
         suite.addTest(new TestSuite(GridTcpCommunicationSpiConfigSelfTest.class));
 
         return suite;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cff25e91/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
index b7014ad..d77c432 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
@@ -44,6 +44,7 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
 
         suite.addTest(new TestSuite(TcpDiscoverySelfTest.class));
         suite.addTest(new TestSuite(TcpDiscoverySpiSelfTest.class));
+        suite.addTest(new TestSuite(TcpDiscoverySpiFailureTimeoutSelfTest.class));
         suite.addTest(new TestSuite(TcpDiscoverySpiStartStopSelfTest.class));
         suite.addTest(new TestSuite(TcpDiscoverySpiConfigSelfTest.class));
         suite.addTest(new TestSuite(TcpDiscoveryMarshallerCheckSelfTest.class));
@@ -54,6 +55,7 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(TcpClientDiscoverySpiSelfTest.class));
         suite.addTest(new TestSuite(TcpClientDiscoveryMarshallerCheckSelfTest.class));
         suite.addTest(new TestSuite(TcpClientDiscoverySpiMulticastTest.class));
+        suite.addTest(new TestSuite(TcpClientDiscoverySpiFailureTimeoutSelfTest.class));
 
         suite.addTest(new TestSuite(TcpDiscoveryNodeConsistentIdSelfTest.class));
         suite.addTest(new TestSuite(TcpDiscoveryNodeConfigConsistentIdSelfTest.class));


[25/50] [abbrv] incubator-ignite git commit: Added putAll benchmarks.

Posted by an...@apache.org.
Added putAll benchmarks.


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

Branch: refs/heads/ignite-843
Commit: 5304e6ee47970c6989784a2ab47f875437883cfa
Parents: f22de3e
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jul 27 13:46:47 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jul 27 13:46:47 2015 +0300

----------------------------------------------------------------------
 modules/yardstick/config/benchmark.properties   |  6 +-
 .../yardstick/IgniteBenchmarkArguments.java     | 22 +++++++
 .../yardstick/cache/IgnitePutAllBenchmark.java  | 67 +++++++++++++++++++
 .../cache/IgnitePutAllTxBenchmark.java          | 68 ++++++++++++++++++++
 4 files changed, 162 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5304e6ee/modules/yardstick/config/benchmark.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark.properties b/modules/yardstick/config/benchmark.properties
index edda9ee..d691f1e 100644
--- a/modules/yardstick/config/benchmark.properties
+++ b/modules/yardstick/config/benchmark.properties
@@ -86,5 +86,9 @@ CONFIGS="\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutTxOffHeapValuesBenchmark -sn IgniteNode -ds ${ver}tx-put-offheap-val-1-backup,\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-offheap-1-backup,\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryJoinOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-join-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-put-offheap-1-backup\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds ${ver}sql-query-put-offheap-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -bs 1000 -sm PRIMARY_SYNC -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -bs 1000 -col -sm PRIMARY_SYNC -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-collocated-putAll-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -bs 1000 -sm PRIMARY_SYNC -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-tx-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -bs 1000 -col -sm PRIMARY_SYNC -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}atomic-collocated-putAll-tx-1-backup\
 "

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5304e6ee/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 b21bed3..1562b26 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
@@ -98,6 +98,14 @@ public class IgniteBenchmarkArguments {
     @Parameter(names = {"-wb", "--writeBehind"}, description = "Enable or disable writeBehind for cache store")
     private boolean writeBehind;
 
+    /** */
+    @Parameter(names = {"-bs", "--batchSize"}, description = "Batch size")
+    private int batch = 500;
+
+    /** */
+    @Parameter(names = {"-col", "--collocated"}, description = "Collocated")
+    private boolean collocated;
+
     /**
      * @return Transaction concurrency.
      */
@@ -232,6 +240,20 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return Batch size.
+     */
+    public int batch() {
+        return batch;
+    }
+
+    /**
+     * @return Collocated.
+     */
+    public boolean collocated() {
+        return collocated;
+    }
+
+    /**
      * @return Description.
      */
     public String description() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5304e6ee/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
new file mode 100644
index 0000000..6b30875
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllBenchmark.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cluster.*;
+import org.yardstickframework.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs putAll operations.
+ */
+public class IgnitePutAllBenchmark extends IgniteCacheAbstractBenchmark {
+    /** Affinity mapper. */
+    private Affinity<Integer> aff;
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        aff = ignite().affinity("atomic");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        SortedMap<Integer, Integer> vals = new TreeMap<>();
+
+        ClusterNode node = args.collocated() ? aff.mapKeyToNode(nextRandom(args.range())) : null;
+
+        for (int i = 0; i < args.batch(); ) {
+            int key = nextRandom(args.range());
+
+            if (args.collocated() && !aff.isPrimary(node, key))
+                continue;
+
+            ++i;
+
+            vals.put(key, key);
+        }
+
+        cache.putAll(vals);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<Integer, Object> cache() {
+        return ignite().cache("atomic");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5304e6ee/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
new file mode 100644
index 0000000..01890c9
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutAllTxBenchmark.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cluster.*;
+import org.yardstickframework.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs transactional putAll operations.
+ */
+public class IgnitePutAllTxBenchmark extends IgniteCacheAbstractBenchmark {
+    /** Affinity mapper. */
+    private Affinity<Integer> aff;
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        aff = ignite().affinity("tx");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        SortedMap<Integer, Integer> vals = new TreeMap<>();
+
+        ClusterNode node = args.collocated() ? aff.mapKeyToNode(nextRandom(args.range())) : null;
+
+        for (int i = 0; i < args.batch(); ) {
+            int key = nextRandom(args.range());
+
+            if (args.collocated() && !aff.isPrimary(node, key))
+                continue;
+
+            ++i;
+
+            vals.put(key, key);
+        }
+
+        // Implicit transaction is used.
+        cache.putAll(vals);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<Integer, Object> cache() {
+        return ignite().cache("tx");
+    }
+}