You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/07/28 13:20:26 UTC

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

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1121 aa3fc51cc -> d5925e688


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/a57707f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a57707f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a57707f6

Branch: refs/heads/ignite-1121
Commit: a57707f6ef387ea6f48fd878747e8c5044e7758e
Parents: 0b25ec2 c044bb8
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 22 15:49:04 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 22 15:49:04 2015 +0300

----------------------------------------------------------------------
 modules/apache-license-gen/pom.xml              | 13 --------
 .../processors/cache/GridCacheMvccManager.java  | 14 +++++++++
 .../distributed/dht/GridDhtTxFinishFuture.java  | 13 +++++++-
 .../GridDhtPartitionsExchangeFuture.java        | 10 +++++--
 .../near/GridNearOptimisticTxPrepareFuture.java |  4 ++-
 .../GridNearPessimisticTxPrepareFuture.java     |  2 +-
 .../near/GridNearTxFinishFuture.java            | 17 ++++++++++-
 .../cache/transactions/IgniteTxManager.java     |  5 ++--
 .../cache/GridCachePutAllFailoverSelfTest.java  |  3 ++
 .../GridCacheAbstractNodeRestartSelfTest.java   |  9 ++++++
 ...NearDisabledOptimisticTxNodeRestartTest.java | 31 ++++++++++++++++++++
 .../GridCachePartitionedFailoverSelfTest.java   |  5 ----
 ...ePartitionedOptimisticTxNodeRestartTest.java | 12 +++++++-
 .../IgniteCacheFailoverTestSuite2.java          |  4 +++
 .../testsuites/IgniteCacheRestartTestSuite.java |  5 ++--
 ...QueryOffheapEvictsMultiThreadedSelfTest.java |  5 ++++
 .../org/apache/ignite/spark/IgniteContext.scala | 14 +++++++++
 17 files changed, 135 insertions(+), 31 deletions(-)
----------------------------------------------------------------------



[02/50] [abbrv] incubator-ignite git commit: minor

Posted by se...@apache.org.
minor


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

Branch: refs/heads/ignite-1121
Commit: 993dec44d10db33106a3a4c63b61cae9425809ff
Parents: 26112a8
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 22 15:52:42 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 22 15:52:42 2015 +0300

----------------------------------------------------------------------
 examples/config/example-ignite.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/993dec44/examples/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-ignite.xml b/examples/config/example-ignite.xml
index e746e59..e7adb54 100644
--- a/examples/config/example-ignite.xml
+++ b/examples/config/example-ignite.xml
@@ -68,7 +68,7 @@
                     -->
                     <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                     <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                         <property name="addresses">
                             <list>
                                 <!-- In distributed environment, replace with actual host IP address. -->


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

Posted by se...@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-1121
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
----------------------------------------------------------------------


[10/50] [abbrv] incubator-ignite git commit: # HELPDESC-777 Fix javadoc. (cherry picked from commit 77b14fe)

Posted by se...@apache.org.
# HELPDESC-777 Fix javadoc.
(cherry picked from commit 77b14fe)


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

Branch: refs/heads/ignite-1121
Commit: 0055b4050481758a3b989cf3cab019768e664f0a
Parents: 4092c0f
Author: sevdokimov <se...@jetbrains.com>
Authored: Wed Jul 22 20:29:09 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Wed Jul 22 20:31:54 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/IgniteSystemProperties.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0055b405/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index b5685b2..d0dd29b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -318,7 +318,7 @@ public final class IgniteSystemProperties {
 
     /**
      * If this property is set to {@code true} then Ignite will append
-     * hash code of class loader to bean name returned by {@link RuntimeMXBean#getName()}.
+     * hash code of class loader to MXBean name.
      * <p>
      * Default is {@code true}.
      */


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

Posted by se...@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-1121
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;
         }


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

Posted by se...@apache.org.
Merge branches 'ignite-1015' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1015


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

Branch: refs/heads/ignite-1121
Commit: 1eb0d79bd6c81e1f8e901de9b58600bc70883cd3
Parents: 2e1dea9 a57707f
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jul 22 17:53:38 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jul 22 17:53:38 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------



[30/50] [abbrv] incubator-ignite git commit: Moved changes from mater for test with 150 clients.

Posted by se...@apache.org.
Moved changes from mater for test with 150 clients.


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

Branch: refs/heads/ignite-1121
Commit: ccebd43af56950b11644cb778572c9c10fd56a2a
Parents: fc1fb7a
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 24 10:45:02 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 24 10:45:02 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/distributed/IgniteCache150ClientsTest.java     | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ccebd43a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
index 282c7c8..3fc44c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
@@ -51,6 +51,7 @@ public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        cfg.setLocalHost("127.0.0.1");
         cfg.setNetworkTimeout(30_000);
         cfg.setConnectorConfiguration(null);
         cfg.setPeerClassLoadingEnabled(false);


[31/50] [abbrv] incubator-ignite git commit: # refactor ignite README files

Posted by se...@apache.org.
# refactor ignite README files


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

Branch: refs/heads/ignite-1121
Commit: fcf5ecb62ac03b9adfa2be8e91e494c1cedb2b30
Parents: 0055b40
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 24 12:38:20 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 24 12:38:20 2015 +0300

----------------------------------------------------------------------
 modules/clients/README.txt            |  16 ++++
 modules/clients/readme.md             |  32 -------
 modules/clients/readme.pdf            | Bin 47887 -> 0 bytes
 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/yardstick/README.md           |  85 ------------------
 modules/yardstick/README.txt          |  93 ++++++++++++++++++++
 parent/pom.xml                        |   2 +
 9 files changed, 233 insertions(+), 252 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/clients/README.txt
----------------------------------------------------------------------
diff --git a/modules/clients/README.txt b/modules/clients/README.txt
new file mode 100644
index 0000000..8299c33
--- /dev/null
+++ b/modules/clients/README.txt
@@ -0,0 +1,16 @@
+Java Client README
+==================
+Java Client is a lightweight gateway to Ignite nodes.
+
+Client communicates with grid nodes via REST interface and provides reduced but powerful subset of Ignite API.
+Java Client allows to use Ignite features from devices and environments where fully-functional Ignite node
+could not (or should not) be started.
+
+Client vs Grid Node
+===================
+Note that for performance and ease-of-use reasons, you should always prefer to start grid node in your cluster
+instead of remote client. Grid node will generally perform a lot faster and can easily exhibit client-only
+functionality by excluding it from task/job execution and from caching data.
+
+For example, you can prevent a grid node from participating in caching by setting
+`CacheConfiguration.setDistributionMode(...)` value to either `CLIENT_ONLY` or `NEAR_ONLY`.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/clients/readme.md
----------------------------------------------------------------------
diff --git a/modules/clients/readme.md b/modules/clients/readme.md
deleted file mode 100644
index 007daf4..0000000
--- a/modules/clients/readme.md
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-
-<center>
-![Ignite Logo](https://ignite.incubator.apache.org/images/logo3.png "Ignite Logo")
-</center>
-
-## Java Client README
-
-Java Client is a **lightweight gateway** to Ignite nodes.
-
-Client communicates with grid nodes via REST interface and provides reduced but powerful subset of Ignite API.
-Java Client allows to use Ignite features from devices and environments where fully-functional Ignite node
-could not (*or should not*) be started.
-
-## Client vs Grid Node
-Note that for performance and ease-of-use reasons, you should always prefer to start grid node in your cluster instead of remote client. Grid node will generally perform a lot faster and can easily exhibit client-only functionality by excluding it from task/job execution and from caching data. 
-

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/clients/readme.pdf
----------------------------------------------------------------------
diff --git a/modules/clients/readme.pdf b/modules/clients/readme.pdf
deleted file mode 100644
index 5ecb8d8..0000000
Binary files a/modules/clients/readme.pdf and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/hadoop/docs/HADOOP_README.txt
----------------------------------------------------------------------
diff --git a/modules/hadoop/docs/HADOOP_README.txt b/modules/hadoop/docs/HADOOP_README.txt
new file mode 100644
index 0000000..8915554
--- /dev/null
+++ b/modules/hadoop/docs/HADOOP_README.txt
@@ -0,0 +1,122 @@
+1. Apache Ignite In-Memory Accelerator For Apache Hadoop
+========================================================
+
+Ignite In-Memory Accelerator For Apache Hadoop is designed to deliver uncompromised performance for existing Apache
+Hadoop 2.2 or above applications with zero code change as well as simplicity of installation and configuration across all the
+supported platforms.
+
+2. Installation
+===============
+
+Ignite distribution comes in a ZIP file that simply needs to be unzipped. The Accelerator requires Apache Hadoop of
+version 2.2 or above to be already installed on the system either using Apache Bigtop packages or manually (manual installation
+just means that Apache Hadoop binary distribution must be unpacked somewhere on the system). In case of manual
+installation `HADOOP_HOME` environment variable must point to the installation directory of Apache Hadoop.
+
+> NOTE: You do not need any Apache Hadoop processes to be started, you only need to deploy the Apache Hadoop
+> distribution on your system. Nevertheless you can run Apache Hadoop jobs with Ignite Accelerator over HDFS,
+> in this case up and running HDFS infrastructure will be needed.
+
+The Accelerator comes with command line setup tool `bin/setup-hadoop.sh` (`bin/setup-hadoop.bat` on Windows) which
+will guide you through all the needed setup steps (note that the setup tool will require write permissions to the
+Apache Hadoop installation directory).
+
+Installation requirements:
+
+1. Windows, Linux, or MacOS environment.
+2. Java 7 or 8 (latest update is advisable).
+3. Point `JAVA_HOME` environment variable to your JDK or JRE installation.
+4. Apache Hadoop 2.2 or above installed.
+5. Point `HADOOP_HOME` environment variable to the installation directory of Apache Hadoop.
+6. Run `bin/setup-hadoop.{sh|bat}` setup script and follow instructions.
+
+> NOTE: On Windows platform Apache Hadoop client requires `JAVA_HOME` path to not contain space characters.
+> Java installed to `C:\\Program Files\` will not work, install JRE to correct location and point `JAVA_HOME` there.
+
+2.1 Check Apache Ignite Installation
+====================================
+
+After setup script successfully completed, you can execute the Ignite startup script.
+The following command will startup Ignite node with default configuration using multicast node discovery.
+
+    bin/ignite.{sh|bat}
+
+If Ignite was installed successfully, the output from above commands should produce no exceptions or errors.
+Note that you may see some other warnings during startup, but this is OK as they are meant to inform that certain
+functionality is turned on or off by default.
+
+You can execute the above commands multiple times on the same machine and make sure that nodes discover each other.
+Here is an example of log printout when 2 nodes join topology:
+
+    ... Topology snapshot [nodes=2, CPUs=8, hash=0xD551B245]
+
+You can also start Ignite Management Console, called Visor, and observe started nodes. To startup Visor, you should execute the following script:
+
+    /bin/ignitevisorcmd.{sh|bat}
+
+3. Configuration
+================
+
+To configure Ignite nodes you can change configuration files at `config` directory of Ignite installation. Those are conventional Spring files. Please refer to shipped configuration files and Ignite javadocs for more details.
+
+3.1 Distributed File System Configuration
+=========================================
+
+Ignite has it's own distributed in-memory file system called IgniteFS. Hadoop jobs can use it instead of HDFS to achieve maximum performance and scalability. Setting up IGFS is much simpler than HDFS, it requires just few tweaks of Ignite node configuration and does not require starting any additional processes. Default configuration shipped with the Accelerator contains one configured instance named "ignitefs" which can be used as reference.
+
+Generally URI for IgniteFS which will be used by Apache Hadoop looks like:
+
+    igfs://igfs_name@host_name
+
+Where `igfs_name` is IgniteFS instance name, `host_name` is any host running Ignite node with that IgniteFS instance configured.
+For more details please refer to IgniteFS documentation.
+
+3.2 Apache Hadoop Client Configuration
+======================================
+
+To run Apache Hadoop jobs with Ignite cluster you need to configure `core-site.xml` and `mapred-site.xml` at
+`$HADOOP_HOME/etc/hadoop` directory the same way as it is done in templates shipped with the Accelerator.
+The setup tool `bin/setup-hadoop.{sh|bat}` will ask you to replace those files with Ignite templates or
+you can find these templates at `config/hadoop/core-site.ignite.xml` and `config/hadoop/mapred-site.ignite.xml`
+respectively and perform the needed configuration manually.
+
+Apache Hadoop client will need to have Ignite jar files in classpath, the setup tool will care of that as well.
+
+4. Running Apache Hadoop Job With Ignite In-Memory Accelerator
+==============================================================
+
+To run Apache Hadoop job with Ignite cluster you have to start one or multiple Ignite nodes and make sure they successfully discovered each other.
+
+When all the configuration is complete and Ignite nodes are started, running Apache Hadoop job will be the same as with conventional Apache Hadoop distribution except that all Ignite nodes are equal and any of them can be treated as Job Tracker and DFS Name Node.
+
+To run "Word Count" example you can load some text files to IGFS using standard Apache Hadoop tools:
+
+    cd $HADOOP_HOME/bin
+
+    ./hadoop fs -mkdir /input
+
+    ./hadoop fs -copyFromLocal $HADOOP_HOME/README.txt /input/WORD_COUNT_ME.txt
+
+Run the job:
+
+    ./hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/*-mapreduce-examples-*.jar wordcount /input /output
+
+Check results:
+
+    ./hadoop fs -ls /output
+
+    ./hadoop fs -cat /output/part-r-00000
+
+A job can be ran on multiple nodes on localhost or in cluster environment the same way. The only changes needed to
+switch Apache Hadoop client to a cluster are to fix host in default DFS URI in `core-site.xml` and host in job tracker
+address in `mapred-site.xml`.
+
+5. Management & Monitoring with Visor
+=====================================
+Ignite comes with CLI (command) based DevOps Managements Console, called Visor, delivering advance set of management and monitoring capabilities.
+
+To start Visor in console mode you should execute the following command:
+
+    `bin/ignitevisorcmd.sh`
+
+On Windows, run the same commands with `.bat` extension.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/hadoop/docs/hadoop_readme.md
----------------------------------------------------------------------
diff --git a/modules/hadoop/docs/hadoop_readme.md b/modules/hadoop/docs/hadoop_readme.md
deleted file mode 100644
index 8f73ede..0000000
--- a/modules/hadoop/docs/hadoop_readme.md
+++ /dev/null
@@ -1,135 +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.
--->
-
-<center>
-![Ignite Logo](https://ignite.incubator.apache.org/images/logo3.png "Ignite Logo")
-</center>
-
-## 1. Apache Ignite In-Memory Accelerator For Apache Hadoop
-
-Ignite In-Memory Accelerator For Apache Hadoop is designed to deliver uncompromised performance for existing Apache 
-Hadoop 2.2 or above applications with zero code change as well as simplicity of installation and configuration across all the 
-supported platforms. 
-
-## 2. Installation
-
-Ignite distribution comes in a ZIP file that simply needs to be unzipped. The Accelerator requires Apache Hadoop of 
-version 2.2 or above to be already installed on the system either using Apache Bigtop packages or manually (manual installation
-just means that Apache Hadoop binary distribution must be unpacked somewhere on the system). In case of manual 
-installation `HADOOP_HOME` environment variable must point to the installation directory of Apache Hadoop. 
-
-> **NOTE:** You do not need any Apache Hadoop processes to be started, you only need to deploy the Apache Hadoop 
-> distribution on your system. Nevertheless you can run Apache Hadoop jobs with Ignite Accelerator over HDFS,
-> in this case up and running HDFS infrastructure will be needed.
-
-The Accelerator comes with command line setup tool `bin/setup-hadoop.sh` (`bin/setup-hadoop.bat` on Windows) which 
-will guide you through all the needed setup steps (note that the setup tool will require write permissions to the 
-Apache Hadoop installation directory). 
-
-Installation requirements:
-
-1. Windows, Linux, or MacOS environment.
-2. Java 7 or 8 (latest update is advisable).
-3. Point `JAVA_HOME` environment variable to your JDK or JRE installation.
-4. Apache Hadoop 2.2 or above installed.
-5. Point `HADOOP_HOME` environment variable to the installation directory of Apache Hadoop.
-6. Run `bin/setup-hadoop.{sh|bat}` setup script and follow instructions.
-
-> **NOTE:** On Windows platform Apache Hadoop client requires `JAVA_HOME` path to not contain space characters.
-> Java installed to `C:\\Program Files\` will not work, install JRE to correct location and point `JAVA_HOME` there.
-
-### 2.1 Check Apache Ignite Installation
-
-After setup script successfully completed, you can execute the Ignite startup script.
-The following command will startup Ignite node with default configuration using multicast node discovery.
-
-    bin/ignite.{sh|bat}
-
-If Ignite was installed successfully, the output from above commands should produce no exceptions or errors.
-Note that you may see some other warnings during startup, but this is OK as they are meant to inform that certain
-functionality is turned on or off by default.
-
-You can execute the above commands multiple times on the same machine and make sure that nodes discover each other.
-Here is an example of log printout when 2 nodes join topology:
-
-    ... Topology snapshot [nodes=2, CPUs=8, hash=0xD551B245]
-
-You can also start Ignite Management Console, called Visor, and observe started nodes. To startup Visor, you should execute the following script:
-
-    /bin/ignitevisorcmd.{sh|bat}
-
-## 3. Configuration
-
-To configure Ignite nodes you can change configuration files at `config` directory of Ignite installation. Those are conventional Spring files. Please refer to shipped configuration files and Ignite javadocs for more details.
-
-### 3.1 Distributed File System Configuration
-
-Ignite has it's own distributed in-memory file system called IgniteFS. Hadoop jobs can use it instead of HDFS to achieve maximum performance and scalability. Setting up IGFS is much simpler than HDFS, it requires just few tweaks of Ignite node configuration and does not require starting any additional processes. Default configuration shipped with the Accelerator contains one configured instance named "ignitefs" which can be used as reference.
-
-Generally URI for IgniteFS which will be used by Apache Hadoop looks like:
-
-    igfs://igfs_name@host_name
-
-Where `igfs_name` is IgniteFS instance name, `host_name` is any host running Ignite node with that IgniteFS instance configured.
-For more details please refer to IgniteFS documentation.
-
-### 3.2 Apache Hadoop Client Configuration
-
-To run Apache Hadoop jobs with Ignite cluster you need to configure `core-site.xml` and `mapred-site.xml` at 
-`$HADOOP_HOME/etc/hadoop` directory the same way as it is done in templates shipped with the Accelerator. 
-The setup tool `bin/setup-hadoop.{sh|bat}` will ask you to replace those files with Ignite templates or 
-you can find these templates at `config/hadoop/core-site.ignite.xml` and `config/hadoop/mapred-site.ignite.xml`
-respectively and perform the needed configuration manually.
-
-Apache Hadoop client will need to have Ignite jar files in classpath, the setup tool will care of that as well.
-
-## 4. Running Apache Hadoop Job With Ignite In-Memory Accelerator
-
-To run Apache Hadoop job with Ignite cluster you have to start one or multiple Ignite nodes and make sure they successfully discovered each other.
-
-When all the configuration is complete and Ignite nodes are started, running Apache Hadoop job will be the same as with conventional Apache Hadoop distribution except that all Ignite nodes are equal and any of them can be treated as Job Tracker and DFS Name Node.
-
-To run "Word Count" example you can load some text files to IGFS using standard Apache Hadoop tools:
- 
-    cd $HADOOP_HOME/bin
- 
-    ./hadoop fs -mkdir /input
-    
-    ./hadoop fs -copyFromLocal $HADOOP_HOME/README.txt /input/WORD_COUNT_ME.txt
-     
-Run the job:
-
-    ./hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/*-mapreduce-examples-*.jar wordcount /input /output
-
-Check results:
-
-    ./hadoop fs -ls /output
-    
-    ./hadoop fs -cat /output/part-r-00000
-
-A job can be ran on multiple nodes on localhost or in cluster environment the same way. The only changes needed to 
-switch Apache Hadoop client to a cluster are to fix host in default DFS URI in `core-site.xml` and host in job tracker 
-address in `mapred-site.xml`.
-
-## 5. Management & Monitoring with Visor
-Ignite comes with CLI (command) based DevOps Managements Console, called Visor, delivering advance set of management and monitoring capabilities. 
-
-To start Visor in console mode you should execute the following command:
-
-    `bin/ignitevisorcmd.sh`
-
-On Windows, run the same commands with `.bat` extension.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/hadoop/docs/hadoop_readme.pdf
----------------------------------------------------------------------
diff --git a/modules/hadoop/docs/hadoop_readme.pdf b/modules/hadoop/docs/hadoop_readme.pdf
deleted file mode 100644
index ffd8d13..0000000
Binary files a/modules/hadoop/docs/hadoop_readme.pdf and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/yardstick/README.md
----------------------------------------------------------------------
diff --git a/modules/yardstick/README.md b/modules/yardstick/README.md
deleted file mode 100644
index 36f4314..0000000
--- a/modules/yardstick/README.md
+++ /dev/null
@@ -1,85 +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.
--->
-
-# Yardstick Ignite Benchmarks
-Yardstick Ignite is a set of <a href="http://ignite.incubator.apache.org/">Ignite Grid</a> benchmarks written on top of Yardstick framework.
-
-## Yardstick Framework
-Visit <a href="https://github.com/gridgain/yardstick" target="_blank">Yardstick Repository</a> for detailed information on how to run Yardstick benchmarks and how to generate graphs.
-
-The documentation below describes configuration parameters in addition to standard Yardstick parameters.
-
-## Installation
-1. Create a local clone of Ignite repository
-2. Run `mvn package` command for Yardstick Ignite POM
-
-## Provided Benchmarks
-The following benchmarks are provided:
-
-1. `GetBenchmark` - benchmarks atomic distributed cache get operation
-2. `PutBenchmark` - benchmarks atomic distributed cache put operation
-3. `PutGetBenchmark` - benchmarks atomic distributed cache put and get operations together
-4. `PutTxBenchmark` - benchmarks transactional distributed cache put operation
-5. `PutGetTxBenchmark` - benchmarks transactional distributed cache put and get operations together
-6. `SqlQueryBenchmark` - benchmarks distributed SQL query over cached data
-7. `SqlQueryJoinBenchmark` - benchmarks distributed SQL query with a Join over cached data
-8. `SqlQueryPutBenchmark` - benchmarks distributed SQL query with simultaneous cache updates
-
-## Writing Ignite Benchmarks
-All benchmarks extend `AbstractBenchmark` class. A new benchmark should also extend this abstract class and implement `test` method. This is the method that is actually benchmarked.
-
-## Running Ignite Benchmarks
-Before running Ignite benchmarks, run `mvn package` command. This command will compile the project and also will unpack scripts from `yardstick-resources.zip` file to `bin` directory.
-
-### Properties And Command Line Arguments
-> Note that this section only describes configuration parameters specific to Ignite benchmarks, and not for Yardstick framework. To run Ignite benchmarks and generate graphs, you will need to run them using Yardstick framework scripts in `bin` folder.
-
-> Refer to [Yardstick Documentation](https://github.com/gridgain/yardstick) for common Yardstick properties and command line arguments for running Yardstick scripts.
-
-The following Ignite benchmark properties can be defined in the benchmark configuration:
-
-* `-nn <num>` or `--nodeNumber <num>` - Number of nodes (automatically set in `benchmark.properties`), used to wait for the specified number of nodes to start
-* `-b <num>` or `--backups <num>` - Number of backups for every key
-* `-cfg <path>` or `--Config <path>` - Path to Ignite configuration file
-* `-sm <mode>` or `-syncMode <mode>` - Synchronization mode (defined in `CacheWriteSynchronizationMode`)
-* `-cl` or `--client` - Client flag
-* `-nc` or `--nearCache` - Near cache flag
-* `-wom <mode>` or `--writeOrderMode <mode>` - Write order mode for ATOMIC caches (defined in `CacheAtomicWriteOrderMode`)
-* `-txc <value>` or `--txConcurrency <value>` - Cache transaction concurrency control, either `OPTIMISTIC` or `PESSIMISTIC` (defined in `CacheTxConcurrency`)
-* `-txi <value>` or `--txIsolation <value>` - Cache transaction isolation (defined in `CacheTxIsolation`)
-* `-ot` or `--offheapTiered` - Flag indicating whether tiered off-heap mode is on
-* `-ov` or `--offheapValuesOnly` - Flag indicating whether off-heap mode is on and only cache values are stored off-heap
-* `-rtp <num>`  or `--restPort <num>` - REST TCP port, indicates that a Ignite node is ready to process Ignite Clients
-* `-rth <host>` or `--restHost <host>` - REST TCP host
-* `-ss` or `--syncSend` - Flag indicating whether synchronous send is used in `TcpCommunicationSpi`
-* `-r <num>` or `--range` - Range of keys that are randomly generated for cache operations
-
-For example if we need to run 2 `IgniteNode` servers on localhost with `PutBenchmark` benchmark on localhost, with number of backups set to 1, synchronization mode set to `PRIMARY_SYNC`, then the following configuration should be specified in `benchmark.properties` file:
-
-```
-SERVER_HOSTS=localhost,localhost
-    
-# Note that -dn and -sn, which stand for data node and server node, are 
-# native Yardstick parameters and are documented in Yardstick framework.
-CONFIGS="-b 1 -sm PRIMARY_SYNC -dn PutBenchmark -sn IgniteNode"
-```
-
-## Issues
-Use Ignite Apache JIRA (https://issues.apache.org/jira/browse/IGNITE) to file bugs.
-
-## License
-Yardstick Ignite is available under [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) Open Source license.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/modules/yardstick/README.txt
----------------------------------------------------------------------
diff --git a/modules/yardstick/README.txt b/modules/yardstick/README.txt
new file mode 100644
index 0000000..c52838d
--- /dev/null
+++ b/modules/yardstick/README.txt
@@ -0,0 +1,93 @@
+Yardstick Ignite Benchmarks
+===========================
+Yardstick Ignite is a set of Ignite Grid (http://ignite.incubator.apache.org/) benchmarks written on top of Yardstick framework.
+
+Yardstick Framework
+===================
+Visit Yardstick Repository (https://github.com/gridgain/yardstick) for detailed information on how to run Yardstick benchmarks and how to generate graphs.
+
+The documentation below describes configuration parameters in addition to standard Yardstick parameters.
+
+Installation
+============
+1. Create a local clone of Ignite repository
+2. Run
+
+mvn package
+
+command for Yardstick Ignite POM
+
+Provided Benchmarks
+===================
+The following benchmarks are provided:
+
+1. `GetBenchmark` - benchmarks atomic distributed cache get operation
+2. `PutBenchmark` - benchmarks atomic distributed cache put operation
+3. `PutGetBenchmark` - benchmarks atomic distributed cache put and get operations together
+4. `PutTxBenchmark` - benchmarks transactional distributed cache put operation
+5. `PutGetTxBenchmark` - benchmarks transactional distributed cache put and get operations together
+6. `SqlQueryBenchmark` - benchmarks distributed SQL query over cached data
+7. `SqlQueryJoinBenchmark` - benchmarks distributed SQL query with a Join over cached data
+8. `SqlQueryPutBenchmark` - benchmarks distributed SQL query with simultaneous cache updates
+
+Writing Ignite Benchmarks
+=========================
+All benchmarks extend `AbstractBenchmark` class. A new benchmark should also extend this abstract class
+and implement `test` method. This is the method that is actually benchmarked.
+
+Running Ignite Benchmarks
+=========================
+Before running Ignite benchmarks, run:
+
+mvn package
+
+command. This command will compile the project and also will unpack scripts from `yardstick-resources.zip` file to `bin` directory.
+
+Properties And Command Line Arguments
+=====================================
+Note that this section only describes configuration parameters specific to Ignite benchmarks,
+and not for Yardstick framework. To run Ignite benchmarks and generate graphs, you will need to run them using
+Yardstick framework scripts in `bin` folder.
+
+Refer to Yardstick Documentation (https://github.com/gridgain/yardstick) for common Yardstick properties
+and command line arguments for running Yardstick scripts.
+
+The following Ignite benchmark properties can be defined in the benchmark configuration:
+
+* `-nn <num>` or `--nodeNumber <num>` - Number of nodes (automatically set in `benchmark.properties`), used to wait for the specified number of nodes to start
+* `-b <num>` or `--backups <num>` - Number of backups for every key
+* `-cfg <path>` or `--Config <path>` - Path to Ignite configuration file
+* `-sm <mode>` or `-syncMode <mode>` - Synchronization mode (defined in `CacheWriteSynchronizationMode`)
+* `-cl` or `--client` - Client flag
+* `-nc` or `--nearCache` - Near cache flag
+* `-wom <mode>` or `--writeOrderMode <mode>` - Write order mode for ATOMIC caches (defined in `CacheAtomicWriteOrderMode`)
+* `-txc <value>` or `--txConcurrency <value>` - Cache transaction concurrency control, either `OPTIMISTIC` or `PESSIMISTIC` (defined in `CacheTxConcurrency`)
+* `-txi <value>` or `--txIsolation <value>` - Cache transaction isolation (defined in `CacheTxIsolation`)
+* `-ot` or `--offheapTiered` - Flag indicating whether tiered off-heap mode is on
+* `-ov` or `--offheapValuesOnly` - Flag indicating whether off-heap mode is on and only cache values are stored off-heap
+* `-rtp <num>`  or `--restPort <num>` - REST TCP port, indicates that a Ignite node is ready to process Ignite Clients
+* `-rth <host>` or `--restHost <host>` - REST TCP host
+* `-ss` or `--syncSend` - Flag indicating whether synchronous send is used in `TcpCommunicationSpi`
+* `-r <num>` or `--range` - Range of keys that are randomly generated for cache operations
+
+For example if we need to run 2 `IgniteNode` servers on localhost with `PutBenchmark` benchmark on localhost,
+with number of backups set to 1, synchronization mode set to `PRIMARY_SYNC`, then the following configuration
+should be specified in `benchmark.properties` file:
+
+```
+SERVER_HOSTS=localhost,localhost
+...
+
+Note that -dn and -sn, which stand for data node and server node, are native Yardstick parameters and are documented in Yardstick framework.
+===========================================================================================================================================
+
+CONFIGS="-b 1 -sm PRIMARY_SYNC -dn PutBenchmark -sn IgniteNode"
+```
+
+Issues
+======
+Use Ignite Apache JIRA (https://issues.apache.org/jira/browse/IGNITE) to file bugs.
+
+License
+=======
+Yardstick Ignite is available under Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) Open Source license.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcf5ecb6/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 1dbd511..4ca023a 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -673,6 +673,8 @@
                                         <exclude>**/*.dylib</exclude><!--bin-files-->
                                         <exclude>**/*.gar</exclude><!--bin-files-->
                                         <exclude>**/licenses/*.txt</exclude><!--files of licenses-->
+                                        <exclude>**/*readme*.txt</exclude><!--readme files-->
+                                        <exclude>**/*README*.txt</exclude><!--readme files-->
                                         <exclude>**/*.timestamp</exclude><!--tmp-files-->
                                         <exclude>**/*.iml</exclude><!--IDEA files-->
                                         <exclude>**/pom-installed.xml</exclude><!--tmp-files-->


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

Posted by se...@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-1121
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;
 }
 
 /**


[13/50] [abbrv] incubator-ignite git commit: Added client auth for servers.

Posted by se...@apache.org.
Added client auth for servers.


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

Branch: refs/heads/ignite-1121
Commit: f49db319d7ff29259b46c4fb9850ac61c3394e83
Parents: e37efa3
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jul 23 11:51:19 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jul 23 11:51:19 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f49db319/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 48dc52e..a665a3a 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
@@ -1482,6 +1482,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                     sslFilter.directMode(true);
 
+                    sslFilter.wantClientAuth(true);
+                    sslFilter.needClientAuth(true);
+
                     filters = new GridNioFilter[] {
                         new GridNioCodecFilter(parser, log, true),
                         new GridConnectionBytesVerifyFilter(log),


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

Posted by se...@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-1121
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
----------------------------------------------------------------------


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

Posted by se...@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/ae148f1c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ae148f1c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ae148f1c

Branch: refs/heads/ignite-1121
Commit: ae148f1c5ea551b0d6cac3e82cfcff21197c88e0
Parents: fcf5ecb ed5d3ed
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 24 12:42:27 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 24 12:42:27 2015 +0300

----------------------------------------------------------------------
 .../rest/protocols/tcp/MockNioSession.java      |  15 -
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   |   2 +-
 .../apache/ignite/internal/IgniteKernal.java    |   5 +
 .../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 +-
 .../util/lang/GridMetadataAwareAdapter.java     | 296 +++++++++----------
 .../cache/eviction/GridCacheMockEntry.java      |  12 +-
 .../nio/impl/GridNioFilterChainSelfTest.java    |  15 -
 .../GridMetadataAwareAdapterLoadSelfTest.java   | 135 +++++++++
 .../lang/GridMetadataAwareAdapterSelfTest.java  |  58 ++--
 34 files changed, 415 insertions(+), 797 deletions(-)
----------------------------------------------------------------------



[04/50] [abbrv] incubator-ignite git commit: ignite-1015 - review fixes

Posted by se...@apache.org.
ignite-1015 - review fixes


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

Branch: refs/heads/ignite-1121
Commit: 624ec83022f8d8c950d4cb393ebe961096e168c4
Parents: 1eb0d79
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jul 22 18:41:06 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jul 22 18:41:06 2015 +0300

----------------------------------------------------------------------
 .../processors/query/h2/sql/GridSqlQuerySplitter.java     | 10 +++++-----
 .../cache/GridCacheCrossCacheQuerySelfTest.java           |  2 ++
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/624ec830/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 056aafe..502366d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -137,13 +137,13 @@ public class GridSqlQuerySplitter {
         // nullifying or updating things, have to make sure that we will not need them in the original form later.
         final GridSqlSelect mapQry = wrapUnion(collectAllSpaces(GridSqlQueryParser.parse(stmt), spaces));
 
-        final String mergeTable = TABLE_FUNC_NAME + "()"; // table(0); TODO
+        final String mergeTable = TABLE_FUNC_NAME + "()"; // table(0); TODO IGNITE-1142
 
         final boolean explain = mapQry.explain();
 
         mapQry.explain(false);
 
-        GridSqlSelect rdcQry = new GridSqlSelect().from(new GridSqlFunction(null, TABLE_FUNC_NAME)); // table(mergeTable)); TODO
+        GridSqlSelect rdcQry = new GridSqlSelect().from(new GridSqlFunction(null, TABLE_FUNC_NAME)); // table(mergeTable)); TODO IGNITE-1142
 
         // Split all select expressions into map-reduce parts.
         List<GridSqlElement> mapExps = F.addAll(new ArrayList<GridSqlElement>(mapQry.allColumns()),
@@ -176,7 +176,7 @@ public class GridSqlQuerySplitter {
 
         // -- HAVING
         if (mapQry.havingColumn() >= 0 && !collocated) {
-            // TODO Find aggregate functions in HAVING clause or rewrite query to put all aggregates to SELECT clause.
+            // TODO IGNITE-1140 - Find aggregate functions in HAVING clause or rewrite query to put all aggregates to SELECT clause.
             rdcQry.whereAnd(column(columnName(mapQry.havingColumn())));
 
             mapQry.havingColumn(-1);
@@ -189,7 +189,7 @@ public class GridSqlQuerySplitter {
 
             if (aggregateFound) // Ordering over aggregates does not make sense.
                 mapQry.clearSort(); // Otherwise map sort will be used by offset-limit.
-            // TODO Check if sorting is done over aggregated expression, otherwise we can sort and use offset-limit.
+            // TODO IGNITE-1141 - Check if sorting is done over aggregated expression, otherwise we can sort and use offset-limit.
         }
 
         // -- LIMIT
@@ -425,7 +425,7 @@ public class GridSqlQuerySplitter {
                 GridSqlType type = el.expressionResultType();
 
                 if (type != null && type.type() == Value.UUID) // There is no JDBC type UUID, so conversion to bytes occurs.
-                    rdcEl = function(CAST).setCastType("UUID").addChild(rdcEl); // TODO remove this cast when table function removed
+                    rdcEl = function(CAST).setCastType("UUID").addChild(rdcEl); // TODO IGNITE-1142 - remove this cast when table function removed
 
                 if (colNames.add(rdcColAlias)) // To handle column name duplication (usually wildcard for few tables).
                     rdcEl = alias(rdcColAlias, rdcEl);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/624ec830/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
index a393991..63744f1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
@@ -151,6 +151,7 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest {
 
         qry = new SqlFieldsQuery("select p.name, avg(f.price), min(f.price), max(f.price), sum(f.price), count(*), " +
             "count(nullif(f.price, 5)), (max(f.price) - min(f.price)) * 3 as nn " +
+            ", CAST(max(f.price) + 7 AS VARCHAR) " +
             "from FactPurchase f, \"replicated\".DimProduct p " +
             "where p.id = f.productId " +
             "group by f.productId, p.name");
@@ -161,6 +162,7 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest {
             assertTrue(names.add((String)o.get(0)));
             assertEquals(i(o, 4), i(o, 2) + i(o, 3));
             assertEquals(i(o, 7), (i(o, 3) - i(o, 2)) * 3);
+            assertEquals(o.get(8), Integer.toString(i(o, 3) + 7));
         }
 
         X.println("___ SUM HAVING");


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

Posted by se...@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-1121
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(-)
----------------------------------------------------------------------



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

Posted by se...@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-1121
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();
 


[14/50] [abbrv] incubator-ignite git commit: Merge branch 'ignite-gg-10591' into ignite-1.3.3

Posted by se...@apache.org.
Merge branch 'ignite-gg-10591' into ignite-1.3.3


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

Branch: refs/heads/ignite-1121
Commit: 6b84399d77f0a7cb9e9aa7866353fcd4837a7d2b
Parents: f49db31 c9ee1da
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jul 23 17:07:39 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jul 23 17:07:39 2015 +0700

----------------------------------------------------------------------
 .../visor/commands/open/VisorOpenCommand.scala      | 16 +++++-----------
 .../main/scala/org/apache/ignite/visor/visor.scala  |  3 +++
 2 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------



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

Posted by se...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-961-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/fb4f38d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fb4f38d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fb4f38d3

Branch: refs/heads/ignite-1121
Commit: fb4f38d3a02843795174621a40e357b108ffffa7
Parents: 9dd00ac c4a4bd4
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 16:09:19 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 16:09:19 2015 +0300

----------------------------------------------------------------------
 modules/apache-license-gen/pom.xml              |  13 -
 .../apache/ignite/IgniteSystemProperties.java   |   8 +
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   |   2 +-
 .../processors/cache/GridCacheMvccManager.java  |  14 +
 .../distributed/dht/GridDhtTxFinishFuture.java  |  13 +-
 .../GridDhtPartitionsExchangeFuture.java        |  10 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   4 +-
 .../GridNearPessimisticTxPrepareFuture.java     |   2 +-
 .../near/GridNearTxFinishFuture.java            |  17 +-
 .../cache/transactions/IgniteTxManager.java     |   5 +-
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  58 +--
 .../cache/GridCachePutAllFailoverSelfTest.java  |   3 +
 .../GridCacheAbstractNodeRestartSelfTest.java   |   9 +
 ...NearDisabledOptimisticTxNodeRestartTest.java |  31 ++
 .../GridCachePartitionedFailoverSelfTest.java   |   5 -
 ...ePartitionedOptimisticTxNodeRestartTest.java |  12 +-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   2 +
 .../IgniteCacheFailoverTestSuite2.java          |   4 +
 .../testsuites/IgniteCacheRestartTestSuite.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 -
 .../cache/GridCacheCrossCacheQuerySelfTest.java |  77 +---
 ...QueryOffheapEvictsMultiThreadedSelfTest.java |   5 +
 .../IgniteCacheQueryNodeRestartSelfTest.java    |   5 -
 .../org/apache/ignite/spark/IgniteContext.scala |  14 +
 42 files changed, 532 insertions(+), 442 deletions(-)
----------------------------------------------------------------------



[17/50] [abbrv] incubator-ignite git commit: #ignite-961-master: add security check for rest create and destroy cache.

Posted by se...@apache.org.
#ignite-961-master: add security check for rest create and destroy 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/9dd00aca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9dd00aca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9dd00aca

Branch: refs/heads/ignite-1121
Commit: 9dd00aca14f38a43ebdc7d6651e5830c6c2f5b6b
Parents: cdf8da8
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 16:04:39 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 16:04:39 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/rest/GridRestProcessor.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9dd00aca/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 4549db0..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
@@ -581,6 +581,13 @@ 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:
@@ -592,8 +599,6 @@ public class GridRestProcessor extends GridProcessorAdapter {
             case ATOMIC_DECREMENT:
             case NAME:
             case LOG:
-            case GET_OR_CREATE_CACHE:
-            case DESTROY_CACHE:
                 break;
 
             default:


[25/50] [abbrv] incubator-ignite git commit: #ignite-961: merge commands.

Posted by se...@apache.org.
#ignite-961:  merge 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/8201b48f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8201b48f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8201b48f

Branch: refs/heads/ignite-1121
Commit: 8201b48fe9123c641747bf5e2ca4d73b49f8dcc5
Parents: 47ddae7
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 18:43:07 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 18:43:07 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     | 102 ++++++++++---------
 modules/nodejs/src/main/js/cache.js             |  26 ++---
 modules/nodejs/src/main/js/ignite.js            |   4 +-
 .../http/jetty/GridJettyRestHandler.java        |   6 +-
 4 files changed, 74 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/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 762e496..5a54cd1 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
@@ -24,6 +24,7 @@ import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cache.query.annotations.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.json.*;
 import org.apache.ignite.internal.processors.rest.handlers.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.testframework.*;
@@ -389,10 +390,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testGetPost() throws Exception {
-        jcache().put("key0", "val0");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
 
         String val = "{\"key\":\"key0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "get"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -406,10 +407,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testReplacePost() throws Exception {
-        jcache().put("key0", "val0");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
 
         String val = "{\"key\":\"key0\", \"val\":\"val2\", \"oldVal\":\"val1\"}";
-        String ret = makePostRequest(F.asMap("cmd", "repval"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -419,31 +420,32 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         jsonEquals(ret, cachePattern(false, true));
 
         val = "{\"key\":\"key0\", \"val\":\"val2\"}";
-        ret = makePostRequest(F.asMap("cmd", "getandreplace"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key()),
+            val);
 
         jsonEquals(ret, cachePattern("val0", true));
 
-        assertEquals("val2", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val2"), grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\":\"key0\", \"val\":\"val3\"}";
-        ret = makePostRequest(F.asMap("cmd", "rep"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         info("Get command result: " + ret);
 
-        assertEquals("val3", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val3"), grid(0).cache(null).get(new IgniteJsonString("key0")));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testRemovePost() throws Exception {
-        jcache().put("key0", "val0");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
 
         String val = "{\"key\":\"key0\", \"val\":\"val2\"}";
-        String ret = makePostRequest(F.asMap("cmd", "rmvvalue"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -452,25 +454,25 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jsonEquals(ret, cachePattern(false, true));
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val0"), grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\":\"key0\"}";
-        ret = makePostRequest(F.asMap("cmd", "getandrmv"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key()), val);
 
         jsonEquals(ret, cachePattern("val0", true));
 
-        assertNull(grid(0).cache(null).get("key0"));
+        assertNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testRemoveAllPost() throws Exception {
-        jcache().put("key0", "val0");
-        jcache().put("key1", "val1");
+        jcache().put(new IgniteJsonString("key0"), new IgniteJsonString("val0"));
+        jcache().put(new IgniteJsonString("key1"), new IgniteJsonString("val1"));
 
         String val = "{\"keys\": [\"key0\", \"key1\"]}";
-        String ret = makePostRequest(F.asMap("cmd", "rmvall"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -483,15 +485,18 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testPutPost() throws Exception {
         String val = "{\"key\":\"key0\",\"val\":\"val0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "put"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
-        assertNotNull(grid(0).cache(null).get("key0"));
+        info("Result: " + ret);
+
+        assertEquals(1, grid(0).cache(null).size());
+        assertNotNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\":\"key0\"}";
-        ret = makePostRequest(F.asMap("cmd", "containskey"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -504,7 +509,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testIncorrectPutPost() throws Exception {
         String val = "{\"key\":\"key0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "put"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -516,42 +521,42 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testGetAndPutPost() throws Exception {
         String val = "{\"key\":\"key0\", \"val\":\"val0\"}";
-        String ret = makePostRequest(F.asMap("cmd", "getandput"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cacheNullPattern(true));
 
-        assertNotNull(grid(0).cache(null).get("key0"));
+        assertNotNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\": \"key0\", \"val\":\"val1\"}";
-        ret = makePostRequest(F.asMap("cmd", "getandputifabsent"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cachePattern("val0", true));
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val0"), grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\": \"key0\"}";
-        ret = makePostRequest(F.asMap("cmd", "rmv"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_REMOVE.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
-        assertNull(grid(0).cache(null).get("key0"));
+        assertNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"key\": \"key0\", \"val\":\"val1\"}";
-        ret = makePostRequest(F.asMap("cmd", "putifabsent"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cachePattern(true, true));
 
-        assertEquals("val1", grid(0).cache(null).get("key0"));
+        assertEquals(new IgniteJsonString("val1"), grid(0).cache(null).get(new IgniteJsonString("key0")));
     }
 
     /**
@@ -559,22 +564,22 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testPutAllPost() throws Exception {
         String val = "{\"entries\": [{\"key\":\"key0\", \"value\": \"val0\"}, {\"key\":\"key1\", \"value\":\"val1\"}]}";
-        String ret = makePostRequest(F.asMap("cmd", "putAll"), val);
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_PUT_ALL.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
-        assertNotNull(grid(0).cache(null).get("key0"));
+        assertNotNull(grid(0).cache(null).get(new IgniteJsonString("key0")));
 
         val = "{\"keys\": [\"key0\",\"key1\"]}";
-        ret = makePostRequest(F.asMap("cmd", "containskeys"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
 
         jsonEquals(ret, cacheBulkPattern(true, true));
 
-        ret = makePostRequest(F.asMap("cmd", "getAll"), val);
+        ret = makePostRequest(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key()), val);
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -923,7 +928,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());
@@ -1274,7 +1279,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());
@@ -1437,7 +1442,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testRunScriptPost() throws Exception {
         String f = "function(param){return param;}";
-        String ret = makePostRequest(F.asMap("cmd", "runscript", "func", URLEncoder.encode(f)), "{\"arg\":\"hello\"}");
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.RUN_SCRIPT.key(), "func", URLEncoder.encode(f)), "{\"arg\":\"hello\"}");
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1450,7 +1455,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      */
     public void testRunScript() throws Exception {
         String f = "function(param){return param;}";
-        String ret = content(F.asMap("cmd", "runscript", "func", URLEncoder.encode(f), "arg", "hello"));
+        String ret = content(F.asMap("cmd", GridRestCommand.RUN_SCRIPT.key(), "func",
+            URLEncoder.encode(f), "arg", "hello"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1462,7 +1468,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testRunAffinityScriptPost() throws Exception {
-        ClusterNode node = grid(0).affinity(null).mapKeyToNode("key0");
+        ClusterNode node = grid(0).affinity(null).mapKeyToNode(new IgniteJsonString("key0"));
 
         Ignite ignite = null;
 
@@ -1479,7 +1485,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "}" +
             "return ignite.name();}";
 
-        String ret = makePostRequest(F.asMap("cmd", "affrun", "func", URLEncoder.encode(f)),
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.AFFINITY_RUN_SCRIPT.key(),
+                "func", URLEncoder.encode(f)),
             "{\"arg\":\"" + "hello" + "\",\"key\":\"key0\"}");
 
         assertNotNull(ret);
@@ -1509,8 +1516,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "}" +
             "return ignite.name();}";
 
-        String ret = content(F.asMap("cmd", "affrun", "func", URLEncoder.encode(f),
-            "key", "key0", "arg", "hello"));
+        String ret = content(F.asMap("cmd", GridRestCommand.AFFINITY_RUN_SCRIPT.key(),
+            "func", URLEncoder.encode(f), "key", "key0", "arg", "hello"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1540,7 +1547,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "return sum;" +
             "};";
 
-        String ret = makePostRequest(F.asMap("cmd", "excmapreduce", "map", URLEncoder.encode(map),
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.EXECUTE_MAP_REDUCE_SCRIPT.key(),
+            "map", URLEncoder.encode(map),
             "reduce", URLEncoder.encode(reduce)), "{\"arg\": \"Hello world!\"}");
 
         assertNotNull(ret);
@@ -1571,8 +1579,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             "return sum;" +
             "};";
 
-        String ret = content(F.asMap("cmd", "excmapreduce", "map", URLEncoder.encode(map),
-            "reduce", URLEncoder.encode(reduce), "arg", URLEncoder.encode("Hello world!")));
+        String ret = content(F.asMap("cmd", GridRestCommand.EXECUTE_MAP_REDUCE_SCRIPT.key(),
+            "map", URLEncoder.encode(map),
+            "reduce", URLEncoder.encode(reduce),
+            "arg", URLEncoder.encode("Hello world!")));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -1586,9 +1596,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testQueryArgsPost() throws Exception {
         String qry = "salary > ? and salary <= ?";
 
-        String ret = makePostRequest(F.asMap("cmd", "qryexecute", "type", "Person", "psz", "10", "cacheName", "person",
-                "qry", URLEncoder.encode(qry)),
-            "{\"arg\": [1000, 2000]}");
+        String ret = makePostRequest(F.asMap("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key(),
+                "type", "Person", "psz", "10", "cacheName", "person",
+                "qry", URLEncoder.encode(qry)), "{\"arg\": [1000, 2000]}");
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/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 6cae632..a232558 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -75,7 +75,7 @@ Cache.prototype.put = function(key, value) {
  * @param {string} value Value
  */
 Cache.prototype.putIfAbsent = function(key, value) {
-    return this.__createPromise(this._createCommand("putifabsent").
+    return this.__createPromise(this._createCommand("putifabs").
         setPostData(JSON.stringify({"key": key, "val" : value})));
 }
 
@@ -98,7 +98,7 @@ Cache.prototype.remove = function(key, callback) {
  * @param value Value
  */
 Cache.prototype.removeValue = function(key, value, callback) {
-    return this.__createPromise(this._createCommand("rmvvalue").
+    return this.__createPromise(this._createCommand("rmvval").
         setPostData(JSON.stringify({"key": key, "val" : value})));
 }
 
@@ -109,7 +109,7 @@ Cache.prototype.removeValue = function(key, value, callback) {
  * @param {string} key Key
  */
 Cache.prototype.getAndRemove = function(key, callback) {
-    return this.__createPromise(this._createCommand("getandrmv").
+    return this.__createPromise(this._createCommand("getrmv").
         setPostData(JSON.stringify({"key": key})));
 }
 
@@ -179,7 +179,7 @@ Cache.prototype.getAll = function(keys, callback) {
  * @param {Object} key Key
  */
 Cache.prototype.containsKey = function(key) {
-    return this.__createPromise(this._createCommand("containskey").
+    return this.__createPromise(this._createCommand("conkey").
         setPostData(JSON.stringify({"key" : key})));
 }
 
@@ -190,7 +190,7 @@ Cache.prototype.containsKey = function(key) {
  * @param {Object[]} keys Keys
  */
 Cache.prototype.containsKeys = function(keys, callback) {
-    return this.__createPromise(this._createCommand("containskeys").
+    return this.__createPromise(this._createCommand("conkeys").
         setPostData(JSON.stringify({"keys" : keys})));
 }
 
@@ -202,7 +202,7 @@ Cache.prototype.containsKeys = function(keys, callback) {
  * @param {string} value Value
  */
 Cache.prototype.getAndPut = function(key, val) {
-    return this.__createPromise(this._createCommand("getandput").
+    return this.__createPromise(this._createCommand("getput").
         setPostData(JSON.stringify({"key" : key, "val" : val})));
 }
 
@@ -227,7 +227,7 @@ Cache.prototype.replace = function(key, val, callback) {
  * @param oldVal Old value
  */
 Cache.prototype.replaceValue = function(key, val, oldVal) {
-    return this.__createPromise(this._createCommand("repVal").
+    return this.__createPromise(this._createCommand("repval").
         setPostData(JSON.stringify({"key" : key, "val" : val, "oldVal" : oldVal})));
 }
 
@@ -239,7 +239,7 @@ Cache.prototype.replaceValue = function(key, val, oldVal) {
  * @param {string} value Value
  */
 Cache.prototype.getAndReplace = function(key, val) {
-    return this.__createPromise(this._createCommand("getandreplace").
+    return this.__createPromise(this._createCommand("getrep").
         setPostData(JSON.stringify({"key" : key, "val" : val})));
 }
 
@@ -251,7 +251,7 @@ Cache.prototype.getAndReplace = function(key, val) {
  * @param {string} value Value
  */
 Cache.prototype.getAndPutIfAbsent = function(key, val) {
-    return this.__createPromise(this._createCommand("getandputifabsent").
+    return this.__createPromise(this._createCommand("getputifabs").
         setPostData(JSON.stringify({"key" : key, "val" : val})));
 }
 
@@ -259,7 +259,7 @@ Cache.prototype.getAndPutIfAbsent = function(key, val) {
  * @this {Cache}
  */
 Cache.prototype.size = function(callback) {
-    return this.__createPromise(this._createCommand("cachesize"));
+    return this.__createPromise(this._createCommand("size"));
 }
 
 /**
@@ -412,7 +412,7 @@ QueryCursor.prototype.close = function() {
     }
 
     var server = this._cache._server;
-    var cmd = this._createQueryCommand("qryclose", this._qry).addParam("qryId", this._res.queryId);
+    var cmd = this._createQueryCommand("qrycls", this._qry).addParam("qryId", this._res.queryId);
 
     return new Promise(function(resolve, reject) {
        server.runCommand(cmd, function(err, res) {
@@ -455,12 +455,12 @@ QueryCursor.prototype._getQueryCommand = function() {
 }
 
 QueryCursor.prototype._sqlFieldsQuery = function(qry) {
-    return this._createQueryCommand("qryfieldsexecute", qry).
+    return this._createQueryCommand("qryfldexe", qry).
         setPostData(JSON.stringify({"arg" : qry.arguments()}));
 }
 
 QueryCursor.prototype._sqlQuery = function(qry) {
-    return this._createQueryCommand("qryexecute", qry).addParam("type", qry.returnType()).
+    return this._createQueryCommand("qryexe", qry).addParam("type", qry.returnType()).
         setPostData(JSON.stringify({"arg" : qry.arguments()}));
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/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 c3d90ac..5b68c23 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -60,7 +60,7 @@ Ignite.prototype.cache = function(cacheName) {
 Ignite.prototype.getOrCreateCache = function(cacheName) {
     var server = this._server;
     return new Promise(function(resolve, reject) {
-        server.runCommand(new Command("getorcreatecache").addParam("cacheName", cacheName),
+        server.runCommand(new Command("getorcreate").addParam("cacheName", cacheName),
             function(err, res) {
                 if (err != null) {
                     reject(err);
@@ -79,7 +79,7 @@ Ignite.prototype.getOrCreateCache = function(cacheName) {
  * @param {string} cacheName Cache name to stop
  */
 Ignite.prototype.destroyCache = function(cacheName) {
-    return this._createPromise(new Command("destroycache").addParam("cacheName", cacheName));
+    return this._createPromise(new Command("destcache").addParam("cacheName", cacheName));
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8201b48f/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 196e680..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
@@ -584,7 +584,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
                     Map o = parseRequest(req);
-                    restReq0.argument(ctx.scripting().toJavaObject(o.get("arg")));
+                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
                 }
                 else
                     restReq0.argument(params.get("arg"));
@@ -602,7 +602,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
                     Map o = parseRequest(req);
-                    restReq0.argument(ctx.scripting().toJavaObject(o.get("arg")));
+                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
 
                     Object cacheObj = ctx.scripting().toJavaObject(o.get("key"));
                     restReq0.affinityKey(cacheObj);
@@ -625,7 +625,7 @@ public class GridJettyRestHandler extends AbstractHandler {
 
                 if (req.getHeader("Content-Type") != null && req.getHeader("Content-Type").contains("json")) {
                     Map o = parseRequest(req);
-                    restReq0.argument(ctx.scripting().toJavaObject(o.get("arg")));
+                    restReq0.argument(ctx.scripting().toScriptObject(o.get("arg")));
                 }
                 else
                     restReq0.argument(params.get("arg"));


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

Posted by se...@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-1121
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;
+    }
+
+}


[24/50] [abbrv] incubator-ignite git commit: fixed update checker on slow connection

Posted by se...@apache.org.
fixed update checker on slow  connection


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

Branch: refs/heads/ignite-1121
Commit: 06b2504570be3c639b41bf62eb828ad3a63d35e2
Parents: c4a4bd4
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jul 23 18:28:21 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jul 23 18:28:21 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/internal/IgniteKernal.java  | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06b25045/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 d2f018a..3f340d1 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
@@ -705,6 +705,11 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                             // Just wait for 10 secs.
                             Thread.sleep(PERIODIC_VER_CHECK_CONN_TIMEOUT);
 
+                            // Just wait another 60 secs in order to get
+                            // version info even on slow connection.
+                            for (int i = 0; i < 60 && verChecker.latestVersion() == null; i++)
+                                Thread.sleep(1000);
+
                             // Report status if one is available.
                             // No-op if status is NOT available.
                             verChecker.reportStatus(log);


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

Posted by se...@apache.org.
#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-1121
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>


[28/50] [abbrv] incubator-ignite git commit: review

Posted by se...@apache.org.
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/e22f030e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e22f030e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e22f030e

Branch: refs/heads/ignite-1121
Commit: e22f030e20521c3c05c9d1be2bde5c366f4bf7d4
Parents: 58c5a12
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Jul 24 10:06:22 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jul 24 10:06:22 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/util/nio/ssl/GridNioSslFilter.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e22f030e/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 a05135f..596344b 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
@@ -182,7 +182,8 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public void onExceptionCaught(GridNioSession ses, IgniteCheckedException ex) throws IgniteCheckedException {
+    @Override public void onExceptionCaught(GridNioSession ses, IgniteCheckedException ex)
+        throws IgniteCheckedException {
         proceedExceptionCaught(ses, ex);
     }
 
@@ -327,7 +328,8 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
      * @throws GridNioException If failed to forward requests to filter chain.
      * @return Close future.
      */
-    private GridNioFuture<Boolean> shutdownSession(GridNioSession ses, GridNioSslHandler hnd) throws IgniteCheckedException {
+    private GridNioFuture<Boolean> shutdownSession(GridNioSession ses, GridNioSslHandler hnd)
+        throws IgniteCheckedException {
         try {
             hnd.closeOutbound();
 


[12/50] [abbrv] incubator-ignite git commit: Fixed SSL bugs. Added test.

Posted by se...@apache.org.
Fixed SSL bugs. Added 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/e37efa33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e37efa33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e37efa33

Branch: refs/heads/ignite-1121
Commit: e37efa3357d96e7831068eaec29627bd1bcc2ba0
Parents: c5dc492
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jul 23 11:37:26 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jul 23 11:38:35 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |  5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 61 ++++++++++++--------
 .../communication/tcp/TcpCommunicationSpi.java  | 60 ++++++++++---------
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  5 +-
 .../tcp/IgniteCacheSslStartStopSelfTest.java    | 46 +++++++++++++++
 .../IgniteCacheFailoverTestSuite.java           |  4 +-
 6 files changed, 125 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e37efa33/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 8a246dc..b746261 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
@@ -2064,9 +2064,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     private void ackSecurity() {
         assert log != null;
 
-        if (log.isInfoEnabled())
-            log.info("Security status [authentication=" + onOff(ctx.security().enabled())
-                + ", communication encrypted=" + onOff(ctx.config().getSslContextFactory() != null) + ']');
+        U.quietAndInfo(log, "Security status [authentication=" + onOff(ctx.security().enabled())
+            + ", communication encrypted=" + onOff(ctx.config().getSslContextFactory() != null) + ']');
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e37efa33/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 eee90d8..9890efe 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
@@ -39,14 +39,14 @@ public class BlockingSslHandler {
     /** Logger. */
     private IgniteLogger log;
 
-    /** */
+    /** Socket channel. */
     private SocketChannel ch;
 
-    /** */
-    private GridFutureAdapter<ByteBuffer> fut;
+    /** Order. */
+    private final ByteOrder order;
 
     /** SSL engine. */
-    private SSLEngine sslEngine;
+    private final SSLEngine sslEngine;
 
     /** Handshake completion flag. */
     private boolean handshakeFinished;
@@ -69,33 +69,38 @@ public class BlockingSslHandler {
     /**
      * @param sslEngine SSLEngine.
      * @param ch Socket channel.
-     * @param fut Future.
+     * @param directBuf Direct buffer flag.
+     * @param order Byte order.
      * @param log Logger.
      */
-    public BlockingSslHandler(SSLEngine sslEngine, SocketChannel ch, GridFutureAdapter<ByteBuffer> fut,
-        IgniteLogger log) throws SSLException {
+    public BlockingSslHandler(SSLEngine sslEngine,
+        SocketChannel ch,
+        boolean directBuf,
+        ByteOrder order,
+        IgniteLogger log)
+        throws SSLException {
         this.ch = ch;
-        this.fut = fut;
         this.log = log;
-
         this.sslEngine = sslEngine;
+        this.order = order;
 
         // 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);
 
         // Initially buffer is empty.
         outNetBuf.position(0);
         outNetBuf.limit(0);
 
+        inNetBuf = directBuf ? ByteBuffer.allocateDirect(netBufSize) : ByteBuffer.allocate(netBufSize);
+        inNetBuf.order(order);
+
         appBuf = allocateAppBuff();
 
         handshakeStatus = sslEngine.getHandshakeStatus();
 
-        sslEngine.setUseClientMode(true);
-
         if (log.isDebugEnabled())
             log.debug("Started SSL session [netBufSize=" + netBufSize + ", appBufSize=" + appBuf.capacity() + ']');
     }
@@ -122,12 +127,6 @@ public class BlockingSslHandler {
                 case FINISHED: {
                     handshakeFinished = true;
 
-                    if (fut != null) {
-                        appBuf.flip();
-
-                        fut.onDone(appBuf);
-                    }
-
                     loop = false;
 
                     break;
@@ -187,6 +186,15 @@ public class BlockingSslHandler {
     }
 
     /**
+     * @return Application buffer with decoded data.
+     */
+    public ByteBuffer applicationBuffer() {
+        appBuf.flip();
+
+        return appBuf;
+    }
+
+    /**
      * Encrypts data to be written to the network.
      *
      * @param src data to encrypt.
@@ -439,27 +447,32 @@ public class BlockingSslHandler {
 
         int appBufSize = Math.max(sslEngine.getSession().getApplicationBufferSize() + 50, netBufSize * 2);
 
-        return ByteBuffer.allocate(appBufSize);
+        ByteBuffer buf = ByteBuffer.allocate(appBufSize);
+        buf.order(order);
+
+        return buf;
     }
 
     /**
      * Read data from net buffer.
      */
-    private void readFromNet() {
+    private void readFromNet() throws IgniteCheckedException {
         try {
             inNetBuf.clear();
 
-            ch.read(inNetBuf);
+            int read = ch.read(inNetBuf);
+
+            if (read == -1)
+                throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
         }
         catch (IOException e) {
-            e.printStackTrace();
+            throw new IgniteCheckedException("Failed to write byte to socket.", e);
         }
     }
 
     /**
      * Copies data from out net buffer and passes it to the underlying chain.
      *
-     * @return Nothing.
      * @throws GridNioException If send failed.
      */
     private void writeNetBuffer() throws IgniteCheckedException {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e37efa33/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 99ca2b7..48dc52e 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
@@ -2051,12 +2051,18 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                     long rcvCnt = -1;
 
-                    GridTuple<SSLEngine> ssl = new GridTuple<>();
+                    SSLEngine sslEngine = null;
 
                     try {
                         ch.socket().connect(addr, (int)connTimeout);
 
-                        rcvCnt = safeHandshake(ch, recoveryDesc, node.id(), connTimeout0, ssl);
+                        if (isSslEnabled()) {
+                            sslEngine = ignite.configuration().getSslContextFactory().create().createSSLEngine();
+
+                            sslEngine.setUseClientMode(true);
+                        }
+
+                        rcvCnt = safeHandshake(ch, recoveryDesc, node.id(), connTimeout0, sslEngine);
 
                         if (rcvCnt == -1)
                             return null;
@@ -2072,10 +2078,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         meta.put(NODE_ID_META, node.id());
 
                         if (isSslEnabled()) {
-                            assert ssl != null;
-                            assert ssl.get() != null;
+                            assert sslEngine != null;
 
-                            meta.put(GridNioSessionMetaKey.SSL_ENGINE.ordinal(), ssl.get());
+                            meta.put(GridNioSessionMetaKey.SSL_ENGINE.ordinal(), sslEngine);
                         }
                         if (recoveryDesc != null) {
                             recoveryDesc.onHandshake(rcvCnt);
@@ -2211,7 +2216,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         @Nullable GridNioRecoveryDescriptor recovery,
         UUID rmtNodeId,
         long timeout,
-        @Nullable GridTuple<SSLEngine> ssl
+        @Nullable SSLEngine ssl
     ) throws IgniteCheckedException {
         HandshakeTimeoutObject<T> obj = new HandshakeTimeoutObject<>(client, U.currentTimeMillis() + timeout);
 
@@ -2233,23 +2238,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     ByteBuffer buf;
 
                     if (isSslEnabled()) {
-                        GridFutureAdapter<ByteBuffer> handFut = new GridFutureAdapter<>();
-
-                        SSLEngine sslEngine = ignite.configuration().getSslContextFactory()
-                            .create().createSSLEngine();
-
-                        sslEngine.setUseClientMode(true);
-
-                        sslHnd = new BlockingSslHandler(sslEngine, ch, handFut, log);
+                        sslHnd = new BlockingSslHandler(ssl, ch, directBuf, ByteOrder.nativeOrder(), log);
 
                         if (!sslHnd.handshake())
-                            throw new IgniteCheckedException("SSL handshake isn't completed.");
-
-                        ssl.set(sslEngine);
+                            throw new IgniteCheckedException("SSL handshake is not completed.");
 
-                        ByteBuffer handBuff = handFut.get();
+                        ByteBuffer handBuff = sslHnd.applicationBuffer();
 
-                        if (handBuff.limit() < 17) {
+                        if (handBuff.remaining() < 17) {
                             buf = ByteBuffer.allocate(1000);
 
                             int read = ch.read(buf);
@@ -2338,18 +2334,30 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                             buf = ByteBuffer.allocate(1000);
 
+                            ByteBuffer decode = null;
+
                             buf.order(ByteOrder.nativeOrder());
 
-                            int read = ch.read(buf);
+                            for (int i = 0; i < 9; ) {
+                                int read = ch.read(buf);
 
-                            if (read == -1)
-                                throw new IgniteCheckedException("Failed to read remote node recovery handshake " +
-                                    "(connection closed).");
+                                if (read == -1)
+                                    throw new IgniteCheckedException("Failed to read remote node recovery handshake " +
+                                        "(connection closed).");
 
-                            buf.flip();
+                                buf.flip();
+
+                                decode = sslHnd.decode(buf);
 
-                            rcvCnt = sslHnd.decode(buf).getLong(1);
-                        } else {
+                                i += decode.remaining();
+
+                                buf.flip();
+                                buf.compact();
+                            }
+
+                            rcvCnt = decode.getLong(1);
+                        }
+                        else {
                             buf = ByteBuffer.allocate(9);
 
                             buf.order(ByteOrder.nativeOrder());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e37efa33/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 34f90f7..68552a6 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
@@ -4242,10 +4242,11 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (log.isDebugEnabled())
                         U.error(log, "Caught exception on handshake [err=" + e +", sock=" + sock + ']', e);
 
-                    if (X.hasCause(e, SSLException.class) && spi.isSslEnabled())
+                    if (X.hasCause(e, SSLException.class) && spi.isSslEnabled() && !spi.isNodeStopping0())
                         LT.warn(log, null, "Failed to initialize connection. Not encrypted data received. " +
                             "Missed SSL configuration on node? [sock=" + sock + ']');
-                    else if (X.hasCause(e, ObjectStreamException.class) || !sock.isClosed()) {
+                    else if ((X.hasCause(e, ObjectStreamException.class) || !sock.isClosed())
+                        && !spi.isNodeStopping0()) {
                         if (U.isMacInvalidArgumentError(e))
                             LT.error(log, e, "Failed to initialize connection [sock=" + sock + "]\n\t" +
                                 U.MAC_INVALID_ARG_MSG);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e37efa33/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
new file mode 100644
index 0000000..9bf6caa
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.testframework.*;
+
+/**
+ *
+ */
+public class IgniteCacheSslStartStopSelfTest extends IgniteCachePutRetryAbstractSelfTest {
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setSslContextFactory(GridTestUtils.sslFactory());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int keysCount() {
+        return 60_000;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e37efa33/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index 80bfbf2..524bfb3 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -23,7 +23,7 @@ import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+import org.apache.ignite.spi.communication.tcp.*;
 import org.apache.ignite.testframework.*;
 
 import java.util.*;
@@ -75,6 +75,8 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
         suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
 
+        suite.addTestSuite(IgniteCacheSslStartStopSelfTest.class);
+
         return suite;
     }
 }


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

Posted by se...@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-1121
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
----------------------------------------------------------------------


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

Posted by se...@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-1121
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 <= ?");


[27/50] [abbrv] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-630'

Posted by se...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-630'


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

Branch: refs/heads/ignite-1121
Commit: ed5d3ed1c03f062d29cfc53a35b6b35436859f28
Parents: 06b2504 80cec1b
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Thu Jul 23 18:47:00 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Thu Jul 23 18:47:00 2015 +0300

----------------------------------------------------------------------
 .../rest/protocols/tcp/MockNioSession.java      |  15 -
 .../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 +-
 .../util/lang/GridMetadataAwareAdapter.java     | 296 +++++++++----------
 .../cache/eviction/GridCacheMockEntry.java      |  12 +-
 .../nio/impl/GridNioFilterChainSelfTest.java    |  15 -
 .../GridMetadataAwareAdapterLoadSelfTest.java   | 135 +++++++++
 .../lang/GridMetadataAwareAdapterSelfTest.java  |  58 ++--
 32 files changed, 409 insertions(+), 796 deletions(-)
----------------------------------------------------------------------



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

Posted by se...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-961-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/47ddae7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/47ddae7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/47ddae7c

Branch: refs/heads/ignite-1121
Commit: 47ddae7c11f720be5c5fcb34f21680ded9daf21b
Parents: 5993321 dde9a4d
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 18:04:30 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 18:04:30 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     | 137 +++++++++++--------
 .../processors/rest/GridRestCommand.java        |  28 ++--
 .../processors/rest/GridRestProcessor.java      |   9 +-
 3 files changed, 104 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/47ddae7c/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/47ddae7c/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
index f5c2546,76a33b1..44dec65
--- 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
@@@ -130,25 -130,16 +130,25 @@@ public enum GridRestCommand 
      QUIT("quit"),
  
      /** Get or create cache. */
-     GET_OR_CREATE_CACHE("getorcreatecache"),
+     GET_OR_CREATE_CACHE("getorcreate"),
  
      /** Stops dynamically started cache. */
-     DESTROY_CACHE("destroycache"),
+     DESTROY_CACHE("destcache"),
  
 +    /** Run script. */
 +    RUN_SCRIPT("runscript"),
 +
 +    /** Affinity run script. */
 +    AFFINITY_RUN_SCRIPT("affrun"),
 +
 +    /** Execute map reduce script. */
 +    EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce"),
 +
      /** Execute sql query. */
-     EXECUTE_SQL_QUERY("qryexecute"),
+     EXECUTE_SQL_QUERY("qryexe"),
  
      /** Execute sql fields query. */
-     EXECUTE_SQL_FIELDS_QUERY("qryfieldsexecute"),
+     EXECUTE_SQL_FIELDS_QUERY("qryfldexe"),
  
      /** Fetch query results. */
      FETCH_SQL_QUERY("qryfetch"),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/47ddae7c/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------


[26/50] [abbrv] incubator-ignite git commit: Rename variable byte buffer.

Posted by se...@apache.org.
Rename variable byte buffer.


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

Branch: refs/heads/ignite-1121
Commit: 58c5a1222b3d2cec413801cb415bb45ffc290f3c
Parents: 65feef6
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jul 23 18:44:41 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jul 23 18:44:41 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/nio/GridNioServer.java | 30 +++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/58c5a122/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index d3f439a..b57bf22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -70,6 +70,9 @@ public class GridNioServer<T> {
     /** SSL system data buffer metadata key. */
     private static final int BUF_SSL_SYSTEM_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
 
+    /** SSL write buf limit. */
+    private static final int WRITE_BUF_LIMIT = GridNioSessionMetaKey.nextUniqueKey();
+
     /** Accept worker thread. */
     @GridToStringExclude
     private final IgniteThread acceptThread;
@@ -920,6 +923,10 @@ public class GridNioServer<T> {
                 }
 
                 ByteBuffer buf = ses.writeBuffer();
+
+                if (ses.meta(WRITE_BUF_LIMIT) != null)
+                    buf.limit((int)ses.meta(WRITE_BUF_LIMIT));
+
                 NioOperationFuture<?> req = ses.removeMeta(NIO_OPERATION.ordinal());
 
                 List<NioOperationFuture<?>> doneFuts = null;
@@ -971,19 +978,24 @@ public class GridNioServer<T> {
                             writer.reset();
                     }
 
+                    int sesBufLimit = buf.limit();
+                    int sesCap = buf.capacity();
+
                     buf.flip();
 
+                    buf = sslFilter.encrypt(ses, buf);
+
                     ByteBuffer sesBuf = ses.writeBuffer();
 
-                    buf = sslFilter.encrypt(ses, sesBuf);
+                    sesBuf.clear();
 
-                    int expand = sesBuf.limit() - buf.limit();
+                    if (sesCap - buf.limit() < 0) {
+                        int limit = sesBufLimit + (sesCap - buf.limit()) - 100;
 
-                    sesBuf.clear();
+                        ses.addMeta(WRITE_BUF_LIMIT, limit);
 
-                    // SSL data more then socket buffer size
-                    if (expand < 0)
-                        sesBuf.limit(sesBuf.limit() + expand - 100);
+                        sesBuf.limit(limit);
+                    }
 
                     assert buf.hasRemaining();
 
@@ -1022,8 +1034,12 @@ public class GridNioServer<T> {
 
                         break;
                     }
-                    else
+                    else {
                         buf = ses.writeBuffer();
+
+                        if (ses.meta(WRITE_BUF_LIMIT) != null)
+                            buf.limit((int)ses.meta(WRITE_BUF_LIMIT));
+                    }
                 }
             }
             finally {


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

Posted by se...@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-1121
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
----------------------------------------------------------------------


[05/50] [abbrv] incubator-ignite git commit: master - enabled test, IGNITE-484 is already fixed

Posted by se...@apache.org.
master - enabled test, IGNITE-484 is already fixed


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

Branch: refs/heads/ignite-1121
Commit: ec0f7c8c6cc8c9061adca550d845ea43520dee7e
Parents: 624ec83
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jul 22 19:02:50 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jul 22 19:02:50 2015 +0300

----------------------------------------------------------------------
 .../distributed/near/IgniteCacheQueryNodeRestartSelfTest.java   | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ec0f7c8c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
index 5c87603..410f492 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
@@ -45,11 +45,6 @@ import static org.apache.ignite.cache.CacheRebalanceMode.*;
  * Test for distributed queries with node restarts.
  */
 public class IgniteCacheQueryNodeRestartSelfTest extends GridCacheAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-484");
-    }
-
     /** */
     private static final int GRID_CNT = 3;
 


[06/50] [abbrv] incubator-ignite git commit: #ignite-1.1.3: security fixes.

Posted by se...@apache.org.
#ignite-1.1.3: security fixes.


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

Branch: refs/heads/ignite-1121
Commit: 8d063095c5b1ef1126737e5e01cd91d9832c5765
Parents: 993dec4
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 22 20:15:58 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 22 20:15:58 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/task/GridTaskProcessor.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d063095/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
index d59a51d..a19b0b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
@@ -113,7 +113,8 @@ public class GridTaskProcessor extends GridProcessorAdapter {
 
     /** {@inheritDoc} */
     @Override public void onKernalStart() throws IgniteCheckedException {
-        tasksMetaCache = ctx.security().enabled() ? ctx.cache().<GridTaskNameHashKey, String>utilityCache() : null;
+        tasksMetaCache = ctx.security().enabled() && !ctx.isDaemon() ?
+            ctx.cache().<GridTaskNameHashKey, String>utilityCache() : null;
 
         startLatch.countDown();
     }


[21/50] [abbrv] incubator-ignite git commit: #ignite-961: remove unused class.

Posted by se...@apache.org.
#ignite-961: remove unused class.


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

Branch: refs/heads/ignite-1121
Commit: 5993321a5cea1bf359f8d70e3e6f7b464b67a5e9
Parents: ba38952
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 16:50:51 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 16:50:51 2015 +0300

----------------------------------------------------------------------
 .../scripting/IgniteScriptingConverter.java     |  7 +-
 .../scripting/IgniteScriptingProcessor.java     |  1 -
 .../org/apache/ignite/json/JSONCacheObject.java | 95 --------------------
 3 files changed, 1 insertion(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5993321a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingConverter.java
index b51d00e..5383c90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingConverter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingConverter.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.internal.processors.scripting;
 
-import org.apache.ignite.json.*;
-
 /**
  * Convert json object ot java objects.
  */
@@ -28,7 +26,7 @@ public class IgniteScriptingConverter {
      * @return  Object for Ignite cache.
      */
     public Object toJavaObject(Object o) {
-        return JSONCacheObject.toSimpleObject(o);
+        return o;
     }
 
     /**
@@ -44,9 +42,6 @@ public class IgniteScriptingConverter {
      * @return Object to store in cache.
      */
     public Object getField(String key, Object o) {
-        if (o instanceof JSONCacheObject)
-            return ((JSONCacheObject)o).getField(key);
-
         return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5993321a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 49f2c8a..1a5f882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.scripting;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.*;
-import org.apache.ignite.json.*;
 
 import javax.script.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5993321a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
deleted file mode 100644
index 13c9321..0000000
--- a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.json;
-
-import java.util.*;
-
-/**
- * JSON cache object.
- */
-public class JSONCacheObject extends HashMap<Object, Object> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Empty constructor.
-     */
-    public JSONCacheObject() {
-        // No-op.
-    }
-
-    /**
-     * @param key Field name.
-     * @return Field value.
-     */
-    public Object getField(Object key) {
-        return get(key);
-    }
-
-    /**
-     * Convert JSON object to RestJSONCacheObject
-     *
-     * @param o Object to convert.
-     * @return Converted object.
-     */
-    public static Object toSimpleObject(Object o) {
-        if (o == null)
-            return null;
-
-        if (o instanceof Map) {
-            Map o1 = (Map)o;
-
-            JSONCacheObject res = new JSONCacheObject();
-
-            for (Object key : o1.keySet())
-                res.put(toSimpleObject(key), toSimpleObject(o1.get(key)));
-
-            return res;
-        }
-        else if (o instanceof List) {
-            List o1 = (List) o;
-
-            List<Object> val = new ArrayList<>();
-
-            for (Object v : o1)
-                val.add(toSimpleObject(v));
-
-            return val;
-        }
-        else if (o.getClass().isArray()) {
-            Object[] o1 = (Object[]) o;
-
-            List<Object> val = new ArrayList<>();
-
-            for (Object v : o1)
-                val.add(toSimpleObject(v));
-
-            return val;
-        }
-
-        return o;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        if (obj == null || !(obj instanceof JSONCacheObject))
-            return false;
-
-        return super.equals(obj);
-    }
-}


[11/50] [abbrv] incubator-ignite git commit: GG-10591 Reworked daemon node stop fix.

Posted by se...@apache.org.
GG-10591 Reworked daemon node stop fix.


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

Branch: refs/heads/ignite-1121
Commit: c9ee1dae971f0c5a85efea10b7b2d41170335ea7
Parents: c5dc492
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jul 23 10:29:21 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jul 23 10:29:21 2015 +0700

----------------------------------------------------------------------
 .../visor/commands/open/VisorOpenCommand.scala      | 16 +++++-----------
 .../main/scala/org/apache/ignite/visor/visor.scala  |  3 +++
 2 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9ee1dae/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
index 5ec4cd0..7d2ee3c 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
@@ -240,11 +240,11 @@ class VisorOpenCommand extends VisorConsoleCommand {
         if ("true".equalsIgnoreCase(sys.props.getOrElse(IGNITE_QUIET, "true")))
             cfg.setGridLogger(new NullLogger)
 
-        val startedGridName = try {
+        ignite = try {
             // We need to stop previous daemon node before to start new one.
-            Ignition.stopAll(true)
+            prevIgnite.foreach(g => Ignition.stop(g.name(), true))
 
-            Ignition.start(cfg).name
+            Ignition.start(cfg).asInstanceOf[IgniteEx]
         }
         finally {
             Ignition.setDaemon(daemon)
@@ -252,15 +252,9 @@ class VisorOpenCommand extends VisorConsoleCommand {
             System.setProperty(IGNITE_NO_SHUTDOWN_HOOK, shutdownHook)
         }
 
-        ignite =
-            try
-                Ignition.ignite(startedGridName).asInstanceOf[IgniteEx]
-            catch {
-                case _: IllegalStateException =>
-                    throw new IgniteException("Named grid unavailable: " + startedGridName)
-            }
+        prevIgnite = Some(ignite)
 
-        visor.open(startedGridName, cfgPath)
+        visor.open(ignite.name(), cfgPath)
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c9ee1dae/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index 67e3d70..7bd6818 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -228,6 +228,9 @@ object visor extends VisorTag {
     /** */
     @volatile var ignite: IgniteEx = null
 
+    /** */
+    @volatile var prevIgnite: Option[IgniteEx] = None
+
     private var reader: ConsoleReader = null
 
     def reader(reader: ConsoleReader) {


[22/50] [abbrv] incubator-ignite git commit: #ignite-961: Change commands.

Posted by se...@apache.org.
#ignite-961: Change 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/dde9a4d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dde9a4d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dde9a4d3

Branch: refs/heads/ignite-1121
Commit: dde9a4d3879fb78d5a9596c503fa6408df8dcf38
Parents: fb4f38d
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 18:02:55 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 18:02:55 2015 +0300

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     | 137 +++++++++++--------
 .../processors/rest/GridRestCommand.java        |  28 ++--
 2 files changed, 97 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dde9a4d3/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 55d60d2..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
@@ -248,7 +248,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     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());
@@ -266,7 +266,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("getKey", "getVal");
 
-        String ret = content(F.asMap("cmd", "cachesize"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_SIZE.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -280,7 +280,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testIgniteName() throws Exception {
-        String ret = content(F.asMap("cmd", "name"));
+        String ret = content(F.asMap("cmd", GridRestCommand.NAME.key()));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -294,7 +294,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testGetOrCreateCache() throws Exception {
-        String ret = content(F.asMap("cmd", "getorcreatecache", "cacheName", "testCache"));
+        String ret = content(F.asMap("cmd", GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -303,7 +303,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         grid(0).cache("testCache").put("1", "1");
 
-        ret = content(F.asMap("cmd", "destroycache", "cacheName", "testCache"));
+        ret = content(F.asMap("cmd", GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -318,7 +318,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         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());
@@ -335,7 +335,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testIncorrectPut() throws Exception {
-        String ret = content(F.asMap("cmd", "put", "key", "key0"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -348,7 +348,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testContainsKey() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "containskey", "key", "key0"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -363,7 +363,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         grid(0).cache(null).put("key0", "val0");
         grid(0).cache(null).put("key1", "val1");
 
-        String ret = content(F.asMap("cmd", "containskeys", "k1", "key0", "k2", "key1"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
+            "k1", "key0", "k2", "key1"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -377,7 +378,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testGetAndPut() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "getandput", "key", "key0", "val", "val1"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -393,7 +394,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testGetAndPutIfAbsent() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "getandputifabsent", "key", "key0", "val", "val1"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
+            "key", "key0", "val", "val1"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -407,7 +409,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testPutIfAbsent2() throws Exception {
-        String ret = content(F.asMap("cmd", "putifabsent", "key", "key0", "val", "val1"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
+            "key", "key0", "val", "val1"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -423,7 +426,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testRemoveValue() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "rmvvalue", "key", "key0", "val", "val1"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+            "key", "key0", "val", "val1"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -432,7 +436,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("val0", grid(0).cache(null).get("key0"));
 
-        ret = content(F.asMap("cmd", "rmvvalue", "key", "key0", "val", "val0"));
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+            "key", "key0", "val", "val0"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -448,7 +453,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testGetAndRemove() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "getandrmv", "key", "key0"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
+            "key", "key0"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -464,7 +470,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testReplaceValue() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "repval", "key", "key0", "val", "val1", "val2", "val2"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+            "key", "key0", "val", "val1", "val2", "val2"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -473,7 +480,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("val0", grid(0).cache(null).get("key0"));
 
-        ret = content(F.asMap("cmd", "repval", "key", "key0", "val", "val1", "val2", "val0"));
+        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+            "key", "key0", "val", "val1", "val2", "val0"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -489,7 +497,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testGetAndReplace() throws Exception {
         grid(0).cache(null).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", "getandreplace", "key", "key0", "val", "val1"));
+        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
+            "key", "key0", "val", "val1"));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());
@@ -503,7 +512,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -519,7 +529,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -539,7 +550,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     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());
@@ -554,7 +566,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -572,7 +585,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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);
@@ -594,7 +608,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -620,7 +635,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         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());
@@ -658,7 +674,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -680,7 +697,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -700,7 +718,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -721,7 +740,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     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());
@@ -737,7 +757,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     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());
@@ -751,7 +772,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -760,7 +782,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -774,7 +796,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -783,7 +806,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -801,7 +825,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -819,7 +844,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     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());
@@ -839,7 +865,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -855,7 +881,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -869,7 +895,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -883,7 +909,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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);
@@ -893,7 +919,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -902,7 +928,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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);
@@ -921,7 +947,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @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());
@@ -931,7 +957,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         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());
@@ -943,7 +969,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         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());
@@ -952,7 +978,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -961,7 +987,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         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());
@@ -990,7 +1016,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String qry = "salary > ? and salary <= ?";
 
         Map<String, String> params = new HashMap<>();
-        params.put("cmd", "qryexecute");
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
         params.put("type", "Person");
         params.put("psz", "10");
         params.put("cacheName", "person");
@@ -1021,7 +1047,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         grid(0).cache(null).put("3", "3");
 
         Map<String, String> params = new HashMap<>();
-        params.put("cmd", "qryexecute");
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
         params.put("type", "String");
         params.put("psz", "1");
         params.put("qry", URLEncoder.encode("select * from String"));
@@ -1037,7 +1063,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertNotNull(qryId);
 
-        ret = content(F.asMap("cmd", "qryfetch", "psz", "1", "qryId", String.valueOf(qryId)));
+        ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+            "psz", "1", "qryId", String.valueOf(qryId)));
 
         json = JSONObject.fromObject(ret);
 
@@ -1048,7 +1075,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertEquals(qryId0, qryId);
         assertFalse(last);
 
-        ret = content(F.asMap("cmd", "qryfetch", "psz", "1", "qryId", String.valueOf(qryId)));
+        ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+            "psz", "1", "qryId", String.valueOf(qryId)));
 
         json = JSONObject.fromObject(ret);
 
@@ -1069,7 +1097,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String qry = "select concat(firstName, ' ', lastName) from Person";
 
         Map<String, String> params = new HashMap<>();
-        params.put("cmd", "qryfieldsexecute");
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
         params.put("psz", "10");
         params.put("cacheName", "person");
         params.put("qry", URLEncoder.encode(qry));
@@ -1095,7 +1123,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         String qry = "salary > ? and salary <= ?";
 
         Map<String, String> params = new HashMap<>();
-        params.put("cmd", "qryexecute");
+        params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
         params.put("type", "Person");
         params.put("psz", "1");
         params.put("cacheName", "person");
@@ -1120,7 +1148,8 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertNotNull(qryId);
 
-        ret = content(F.asMap("cmd", "qryclose", "cacheName", "person", "qryId", String.valueOf(qryId)));
+        ret = content(F.asMap("cmd", GridRestCommand.CLOSE_SQL_QUERY.key(),
+            "cacheName", "person", "qryId", String.valueOf(qryId)));
 
         assertNotNull(ret);
         assertTrue(!ret.isEmpty());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dde9a4d3/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 ab8929f..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
@@ -34,25 +34,25 @@ public enum GridRestCommand {
     CACHE_GET("get"),
 
     /** Contains cached value. */
-    CACHE_CONTAINS_KEY("containskey"),
+    CACHE_CONTAINS_KEY("conkey"),
 
     /** Contains cached values. */
-    CACHE_CONTAINS_KEYS("containskeys"),
+    CACHE_CONTAINS_KEYS("conkeys"),
 
     /** Get several cached values. */
     CACHE_GET_ALL("getall"),
 
     /** Store value in cache and return previous value. */
-    CACHE_GET_AND_PUT("getandput"),
+    CACHE_GET_AND_PUT("getput"),
 
     /** Store value in cache and return previous value. */
-    CACHE_GET_AND_PUT_IF_ABSENT("getandputifabsent"),
+    CACHE_GET_AND_PUT_IF_ABSENT("getputifabs"),
 
     /** Store value in cache. */
     CACHE_PUT("put"),
 
     /** Store value in cache. */
-    CACHE_PUT_IF_ABSENT("putifabsent"),
+    CACHE_PUT_IF_ABSENT("putifabs"),
 
     /** Store value in cache if it doesn't exist. */
     CACHE_ADD("add"),
@@ -64,10 +64,10 @@ public enum GridRestCommand {
     CACHE_REMOVE("rmv"),
 
     /** Remove value from cache. */
-    CACHE_REMOVE_VALUE("rmvvalue"),
+    CACHE_REMOVE_VALUE("rmvval"),
 
     /** Remove value from cache. */
-    CACHE_GET_AND_REMOVE("getandrmv"),
+    CACHE_GET_AND_REMOVE("getrmv"),
 
     /** Remove several values from cache. */
     CACHE_REMOVE_ALL("rmvall"),
@@ -79,7 +79,7 @@ public enum GridRestCommand {
     CACHE_REPLACE_VALUE("repval"),
 
     /** Replace cache value only if there is currently a mapping for it. */
-    CACHE_GET_AND_REPLACE("getandreplace"),
+    CACHE_GET_AND_REPLACE("getrep"),
 
     /** Compare and set. */
     CACHE_CAS("cas"),
@@ -94,7 +94,7 @@ public enum GridRestCommand {
     CACHE_METRICS("cache"),
 
     /** Cache size. */
-    CACHE_SIZE("cachesize"),
+    CACHE_SIZE("size"),
 
     /** Increment. */
     ATOMIC_INCREMENT("incr"),
@@ -130,22 +130,22 @@ public enum GridRestCommand {
     QUIT("quit"),
 
     /** Get or create cache. */
-    GET_OR_CREATE_CACHE("getorcreatecache"),
+    GET_OR_CREATE_CACHE("getorcreate"),
 
     /** Stops dynamically started cache. */
-    DESTROY_CACHE("destroycache"),
+    DESTROY_CACHE("destcache"),
 
     /** Execute sql query. */
-    EXECUTE_SQL_QUERY("qryexecute"),
+    EXECUTE_SQL_QUERY("qryexe"),
 
     /** Execute sql fields query. */
-    EXECUTE_SQL_FIELDS_QUERY("qryfieldsexecute"),
+    EXECUTE_SQL_FIELDS_QUERY("qryfldexe"),
 
     /** Fetch query results. */
     FETCH_SQL_QUERY("qryfetch"),
 
     /** Close query. */
-    CLOSE_SQL_QUERY("qryclose");
+    CLOSE_SQL_QUERY("qrycls");
 
     /** Enum values. */
     private static final GridRestCommand[] VALS = values();


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

Posted by se...@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-1121
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());
     }


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

Posted by se...@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-1121
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);
         }



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

Posted by se...@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>


[16/50] [abbrv] incubator-ignite git commit: GridGain -> Ignite

Posted by se...@apache.org.
GridGain -> 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/c4a4bd43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c4a4bd43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c4a4bd43

Branch: refs/heads/ignite-1121
Commit: c4a4bd43afff653f5d6fed4c5b01b520e5ed19b8
Parents: 0055b40
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Thu Jul 23 15:02:34 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Thu Jul 23 15:02:34 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4a4bd43/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
index 297f32e..cf493a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactory.java
@@ -45,7 +45,7 @@ import javax.sql.*;
  *                      ...
  *                      &lt;property name="cacheStoreFactory"&gt;
  *                          &lt;bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactory"&gt;
- *                              &lt;property name="user" value = "GridGain" /&gt;
+ *                              &lt;property name="user" value = "Ignite" /&gt;
  *                              &lt;property name="dataSourceBean" value = "simpleDataSource" /&gt;
  *                          &lt;/bean&gt;
  *                      &lt;/property&gt;


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

Posted by se...@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));


[18/50] [abbrv] incubator-ignite git commit: Decrease write buffer to avoid double sending.

Posted by se...@apache.org.
Decrease write buffer to avoid double sending.


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

Branch: refs/heads/ignite-1121
Commit: 65feef6d2d9bbe0ac19d1496f472c0ee06ef0b04
Parents: 6b84399
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jul 23 16:05:33 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jul 23 16:06:06 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/util/nio/GridNioServer.java     | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65feef6d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 24e1e08..d3f439a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -977,8 +977,14 @@ public class GridNioServer<T> {
 
                     buf = sslFilter.encrypt(ses, sesBuf);
 
+                    int expand = sesBuf.limit() - buf.limit();
+
                     sesBuf.clear();
 
+                    // SSL data more then socket buffer size
+                    if (expand < 0)
+                        sesBuf.limit(sesBuf.limit() + expand - 100);
+
                     assert buf.hasRemaining();
 
                     if (!skipWrite) {


[29/50] [abbrv] incubator-ignite git commit: Fixed basic suite.

Posted by se...@apache.org.
Fixed basic suite.


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

Branch: refs/heads/ignite-1121
Commit: fc1fb7a06a912326aeda59a05511ee5150b19a9e
Parents: e22f030
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 24 10:12:16 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 24 10:14:25 2015 +0300

----------------------------------------------------------------------
 .../discovery/IgniteTopologyPrintFormatSelfTest.java    |  6 +++---
 .../cmdline/GridCommandLineTransformerSelfTest.java     | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc1fb7a0/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
index 2a71f28..2ec4dec 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
@@ -124,7 +124,7 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
 
         assertTrue(F.forAny(log.logs(), new IgnitePredicate<String>() {
             @Override public boolean apply(String s) {
-                return s.contains("Topology snapshot [ver=2, server nodes=2, client nodes=0,")
+                return s.contains("Topology snapshot [ver=2, servers=2, clients=0,")
                     || (s.contains(">>> Number of server nodes: 2") && s.contains(">>> Number of client nodes: 0"));
             }
         }));
@@ -174,7 +174,7 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
 
         assertTrue(F.forAny(log.logs(), new IgnitePredicate<String>() {
             @Override public boolean apply(String s) {
-                return s.contains("Topology snapshot [ver=4, server nodes=2, client nodes=2,")
+                return s.contains("Topology snapshot [ver=4, servers=2, clients=2,")
                     || (s.contains(">>> Number of server nodes: 2") && s.contains(">>> Number of client nodes: 2"));
             }
         }));
@@ -225,7 +225,7 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
 
         assertTrue(F.forAny(log.logs(), new IgnitePredicate<String>() {
             @Override public boolean apply(String s) {
-                return s.contains("Topology snapshot [ver=5, server nodes=2, client nodes=3,")
+                return s.contains("Topology snapshot [ver=5, servers=2, clients=3,")
                     || (s.contains(">>> Number of server nodes: 2") && s.contains(">>> Number of client nodes: 3"));
             }
         }));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc1fb7a0/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
index ec85532..dafc649 100644
--- a/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
@@ -32,7 +32,7 @@ public class GridCommandLineTransformerSelfTest extends GridCommonAbstractTest {
     public void testTransformIfNoArguments() throws Exception {
         assertEquals(
             "\"INTERACTIVE=0\" \"QUIET=-DIGNITE_QUIET=true\" \"NO_PAUSE=0\" " +
-            "\"JVM_XOPTS=\" \"CONFIG=\"",
+                "\"NO_JMX=0\" \"JVM_XOPTS=\" \"CONFIG=\"",
             CommandLineTransformer.transform());
     }
 
@@ -101,7 +101,7 @@ public class GridCommandLineTransformerSelfTest extends GridCommonAbstractTest {
      */
     public void testTransformIfOnlyPathToConfigSpecified() throws Exception {
         assertEquals(
-            "\"INTERACTIVE=0\" \"QUIET=-DIGNITE_QUIET=true\" \"NO_PAUSE=0\" " +
+            "\"INTERACTIVE=0\" \"QUIET=-DIGNITE_QUIET=true\" \"NO_PAUSE=0\" \"NO_JMX=0\" " +
             "\"JVM_XOPTS=\" \"CONFIG=c:\\qw.xml\"",
             CommandLineTransformer.transform("c:\\qw.xml"));
     }
@@ -111,10 +111,10 @@ public class GridCommandLineTransformerSelfTest extends GridCommonAbstractTest {
      */
     public void testTransformIfAllSupportedArguments() throws Exception {
         assertEquals(
-            "\"INTERACTIVE=1\" \"QUIET=-DIGNITE_QUIET=false\" \"NO_PAUSE=1\" " +
-            "\"JVM_XOPTS=-Xmx1g -Xms1m\" " +
-            "\"CONFIG=\"c:\\path to\\русский каталог\"\"",
-            CommandLineTransformer.transform("-i", "-np", "-v", "-J-Xmx1g", "-J-Xms1m",
+            "\"INTERACTIVE=1\" \"QUIET=-DIGNITE_QUIET=false\" \"NO_PAUSE=1\" \"NO_JMX=1\" " +
+                "\"JVM_XOPTS=-Xmx1g -Xms1m\" " +
+                "\"CONFIG=\"c:\\path to\\русский каталог\"\"",
+            CommandLineTransformer.transform("-i", "-np", "-v", "-J-Xmx1g", "-J-Xms1m", "-nojmx",
                 "\"c:\\path to\\русский каталог\""));
     }
 }


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

Posted by se...@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-1121
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();


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

Posted by se...@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/ba389520
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ba389520
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ba389520

Branch: refs/heads/ignite-1121
Commit: ba389520ef238e1a7738f54cbf2367068a59d290
Parents: b901574 c4a4bd4
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 23 16:44:31 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 23 16:44:31 2015 +0300

----------------------------------------------------------------------
 modules/apache-license-gen/pom.xml              |  13 -
 .../apache/ignite/IgniteSystemProperties.java   |   8 +
 .../store/jdbc/CacheJdbcBlobStoreFactory.java   |   2 +-
 .../processors/cache/GridCacheMvccManager.java  |  14 +
 .../distributed/dht/GridDhtTxFinishFuture.java  |  13 +-
 .../GridDhtPartitionsExchangeFuture.java        |  10 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   4 +-
 .../GridNearPessimisticTxPrepareFuture.java     |   2 +-
 .../near/GridNearTxFinishFuture.java            |  17 +-
 .../cache/transactions/IgniteTxManager.java     |   5 +-
 .../ignite/internal/util/IgniteUtils.java       |   6 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  58 +--
 .../cache/GridCachePutAllFailoverSelfTest.java  |   3 +
 .../GridCacheAbstractNodeRestartSelfTest.java   |   9 +
 ...NearDisabledOptimisticTxNodeRestartTest.java |  31 ++
 .../GridCachePartitionedFailoverSelfTest.java   |   5 -
 ...ePartitionedOptimisticTxNodeRestartTest.java |  12 +-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   2 +
 .../IgniteCacheFailoverTestSuite2.java          |   4 +
 .../testsuites/IgniteCacheRestartTestSuite.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 -
 .../cache/GridCacheCrossCacheQuerySelfTest.java |  77 +---
 ...QueryOffheapEvictsMultiThreadedSelfTest.java |   5 +
 .../IgniteCacheQueryNodeRestartSelfTest.java    |   5 -
 .../org/apache/ignite/spark/IgniteContext.scala |  14 +
 42 files changed, 532 insertions(+), 442 deletions(-)
----------------------------------------------------------------------



[08/50] [abbrv] incubator-ignite git commit: HELPDESC-777 Add IGNITE_MBEAN_APPEND_CLASS_LOADER_ID system property.

Posted by se...@apache.org.
HELPDESC-777 Add IGNITE_MBEAN_APPEND_CLASS_LOADER_ID system property.


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

Branch: refs/heads/ignite-1121
Commit: 426479984f2f5fd972bacb3e063977a666a144ab
Parents: 8d06309
Author: sevdokimov <se...@jetbrains.com>
Authored: Wed Jul 22 13:38:09 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Wed Jul 22 20:30:17 2015 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/IgniteSystemProperties.java  | 8 ++++++++
 .../java/org/apache/ignite/internal/util/IgniteUtils.java    | 6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/42647998/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 40fc873..b5685b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -317,6 +317,14 @@ public final class IgniteSystemProperties {
     public static final String IGNITE_MBEAN_APPEND_JVM_ID = "IGNITE_MBEAN_APPEND_JVM_ID";
 
     /**
+     * If this property is set to {@code true} then Ignite will append
+     * hash code of class loader to bean name returned by {@link RuntimeMXBean#getName()}.
+     * <p>
+     * Default is {@code true}.
+     */
+    public static final String IGNITE_MBEAN_APPEND_CLASS_LOADER_ID = "IGNITE_MBEAN_APPEND_CLASS_LOADER_ID";
+
+    /**
      * Property controlling size of buffer holding last exception. Default value of {@code 1000}.
      */
     public static final String IGNITE_EXCEPTION_REGISTRY_MAX_SIZE = "IGNITE_EXCEPTION_REGISTRY_MAX_SIZE";

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/42647998/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index f457d6c..6bd361f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -3997,9 +3997,11 @@ public abstract class IgniteUtils {
      * @param sb Sb.
      */
     private static void appendClassLoaderHash(SB sb) {
-        String clsLdrHash = Integer.toHexString(Ignite.class.getClassLoader().hashCode());
+        if (getBoolean(IGNITE_MBEAN_APPEND_CLASS_LOADER_ID, true)) {
+            String clsLdrHash = Integer.toHexString(Ignite.class.getClassLoader().hashCode());
 
-        sb.a("clsLdr=").a(clsLdrHash).a(',');
+            sb.a("clsLdr=").a(clsLdrHash).a(',');
+        }
     }
 
     /**


[09/50] [abbrv] incubator-ignite git commit: HELPDESC-777 Add IGNITE_MBEAN_APPEND_CLASS_LOADER_ID system property. (cherry picked from commit 2581a12)

Posted by se...@apache.org.
HELPDESC-777 Add IGNITE_MBEAN_APPEND_CLASS_LOADER_ID system property.
(cherry picked from commit 2581a12)


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

Branch: refs/heads/ignite-1121
Commit: 4092c0fdcbc63dbbd162151164e4b060851f9949
Parents: ec0f7c8
Author: sevdokimov <se...@jetbrains.com>
Authored: Wed Jul 22 13:38:09 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Wed Jul 22 20:31:46 2015 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/IgniteSystemProperties.java  | 8 ++++++++
 .../java/org/apache/ignite/internal/util/IgniteUtils.java    | 6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4092c0fd/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 40fc873..b5685b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -317,6 +317,14 @@ public final class IgniteSystemProperties {
     public static final String IGNITE_MBEAN_APPEND_JVM_ID = "IGNITE_MBEAN_APPEND_JVM_ID";
 
     /**
+     * If this property is set to {@code true} then Ignite will append
+     * hash code of class loader to bean name returned by {@link RuntimeMXBean#getName()}.
+     * <p>
+     * Default is {@code true}.
+     */
+    public static final String IGNITE_MBEAN_APPEND_CLASS_LOADER_ID = "IGNITE_MBEAN_APPEND_CLASS_LOADER_ID";
+
+    /**
      * Property controlling size of buffer holding last exception. Default value of {@code 1000}.
      */
     public static final String IGNITE_EXCEPTION_REGISTRY_MAX_SIZE = "IGNITE_EXCEPTION_REGISTRY_MAX_SIZE";

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4092c0fd/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 351af06..ec72a4b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -4034,9 +4034,11 @@ public abstract class IgniteUtils {
      * @param sb Sb.
      */
     private static void appendClassLoaderHash(SB sb) {
-        String clsLdrHash = Integer.toHexString(Ignite.class.getClassLoader().hashCode());
+        if (getBoolean(IGNITE_MBEAN_APPEND_CLASS_LOADER_ID, true)) {
+            String clsLdrHash = Integer.toHexString(Ignite.class.getClassLoader().hashCode());
 
-        sb.a("clsLdr=").a(clsLdrHash).a(',');
+            sb.a("clsLdr=").a(clsLdrHash).a(',');
+        }
     }
 
     /**


[07/50] [abbrv] incubator-ignite git commit: # HELPDESC-777 Fix javadoc.

Posted by se...@apache.org.
# HELPDESC-777 Fix javadoc.


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

Branch: refs/heads/ignite-1121
Commit: c5dc4926aaa44178dad6cdad5fdd7f273d4da6ed
Parents: 4264799
Author: sevdokimov <se...@jetbrains.com>
Authored: Wed Jul 22 20:29:09 2015 +0300
Committer: sevdokimov <se...@jetbrains.com>
Committed: Wed Jul 22 20:30:17 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/IgniteSystemProperties.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5dc4926/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index b5685b2..d0dd29b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -318,7 +318,7 @@ public final class IgniteSystemProperties {
 
     /**
      * If this property is set to {@code true} then Ignite will append
-     * hash code of class loader to bean name returned by {@link RuntimeMXBean#getName()}.
+     * hash code of class loader to MXBean name.
      * <p>
      * Default is {@code true}.
      */


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

Posted by se...@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-1121
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();
+        }
+    }
+}


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

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


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

Branch: refs/heads/ignite-1121
Commit: 80cec1be0ef9887894e67e580c2e22e9be585c29
Parents: df0c86a 0055b40
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Thu Jul 23 14:49:01 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Thu Jul 23 14:49:01 2015 +0300

----------------------------------------------------------------------
 modules/apache-license-gen/pom.xml              |  13 -
 .../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 +-
 .../configuration/CacheConfiguration.java       |   4 +-
 .../configuration/IgniteConfiguration.java      |  26 ++
 .../apache/ignite/internal/IgniteKernal.java    |   3 +
 .../ignite/internal/IgniteNodeAttributes.java   |   3 +
 .../processors/cache/GridCacheAttributes.java   |   8 +-
 .../processors/cache/GridCacheMvccManager.java  |  14 +
 .../processors/cache/GridCacheProcessor.java    | 113 ++++--
 .../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 +-
 .../cache/transactions/IgniteTxManager.java     |   5 +-
 .../ignite/internal/util/IgniteUtils.java       |  31 +-
 .../ignite/internal/util/nio/GridNioServer.java |   9 +
 .../util/nio/GridSelectorNioSessionImpl.java    |   8 +
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  58 +--
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   3 +-
 .../tcp/internal/TcpDiscoveryNode.java          |  18 +-
 .../IgniteClientReconnectFailoverTest.java      |   6 +
 .../cache/CacheAffinityCallSelfTest.java        |  10 +-
 .../cache/GridCachePutAllFailoverSelfTest.java  |   3 +
 .../GridCacheAbstractNodeRestartSelfTest.java   |   9 +
 ...NearDisabledOptimisticTxNodeRestartTest.java |  31 ++
 .../GridCachePartitionedFailoverSelfTest.java   |   5 -
 ...achePartitionedMultiNodeFullApiSelfTest.java |   4 +-
 ...ePartitionedOptimisticTxNodeRestartTest.java |  12 +-
 .../internal/util/nio/GridNioSelfTest.java      |  88 +++-
 .../internal/util/nio/GridNioSslSelfTest.java   |  16 +-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   2 +
 ...DiscoveryNodeConfigConsistentIdSelfTest.java |  76 ++++
 .../testframework/junits/GridAbstractTest.java  |   3 +-
 .../IgniteCacheFailoverTestSuite2.java          |   4 +
 .../testsuites/IgniteCacheRestartTestSuite.java |   5 +-
 .../IgniteSpiDiscoverySelfTestSuite.java        |   1 +
 .../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 -
 .../org/apache/ignite/spark/IgniteContext.scala |  14 +
 pom.xml                                         |  12 +-
 67 files changed, 928 insertions(+), 544 deletions(-)
----------------------------------------------------------------------



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

Posted by se...@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-1121
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;
     }
-
 }