You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/07/24 19:22:24 UTC

[01/39] incubator-ignite git commit: 1.3.3-SNAPSHOT

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-gg-10576 8a20a2e3b -> 5cd5c3504


1.3.3-SNAPSHOT


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

Branch: refs/heads/ignite-gg-10576
Commit: f5cc4a1d26237d052e6d86795a370ba8c931af3b
Parents: 6711d2c
Author: Ignite Teamcity <ig...@apache.org>
Authored: Tue Jul 21 14:12:40 2015 +0300
Committer: Ignite Teamcity <ig...@apache.org>
Committed: Tue Jul 21 14:12:40 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                   | 2 +-
 modules/aop/pom.xml                                | 2 +-
 modules/apache-license-gen/pom.xml                 | 2 +-
 modules/aws/pom.xml                                | 2 +-
 modules/clients/pom.xml                            | 2 +-
 modules/cloud/pom.xml                              | 2 +-
 modules/codegen/pom.xml                            | 2 +-
 modules/core/pom.xml                               | 2 +-
 modules/core/src/main/resources/ignite.properties  | 2 +-
 modules/extdata/p2p/pom.xml                        | 2 +-
 modules/extdata/uri/modules/uri-dependency/pom.xml | 2 +-
 modules/extdata/uri/pom.xml                        | 2 +-
 modules/gce/pom.xml                                | 2 +-
 modules/geospatial/pom.xml                         | 2 +-
 modules/hadoop/pom.xml                             | 2 +-
 modules/hibernate/pom.xml                          | 2 +-
 modules/indexing/pom.xml                           | 2 +-
 modules/jcl/pom.xml                                | 2 +-
 modules/jta/pom.xml                                | 2 +-
 modules/kafka/pom.xml                              | 2 +-
 modules/log4j/pom.xml                              | 2 +-
 modules/mesos/pom.xml                              | 2 +-
 modules/rest-http/pom.xml                          | 2 +-
 modules/scalar-2.10/pom.xml                        | 2 +-
 modules/scalar/pom.xml                             | 2 +-
 modules/schedule/pom.xml                           | 2 +-
 modules/schema-import/pom.xml                      | 2 +-
 modules/slf4j/pom.xml                              | 2 +-
 modules/spark-2.10/pom.xml                         | 2 +-
 modules/spark/pom.xml                              | 2 +-
 modules/spring/pom.xml                             | 2 +-
 modules/ssh/pom.xml                                | 2 +-
 modules/tools/pom.xml                              | 2 +-
 modules/urideploy/pom.xml                          | 2 +-
 modules/visor-console-2.10/pom.xml                 | 2 +-
 modules/visor-console/pom.xml                      | 2 +-
 modules/visor-plugins/pom.xml                      | 2 +-
 modules/web/pom.xml                                | 2 +-
 modules/yardstick/pom.xml                          | 2 +-
 modules/yarn/pom.xml                               | 2 +-
 pom.xml                                            | 2 +-
 41 files changed, 41 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 6d3fb07..1338a18 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>ignite-examples</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/aop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aop/pom.xml b/modules/aop/pom.xml
index 3c55e7d..194ffab 100644
--- a/modules/aop/pom.xml
+++ b/modules/aop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aop</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/apache-license-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/apache-license-gen/pom.xml b/modules/apache-license-gen/pom.xml
index 2edb962..104624a 100644
--- a/modules/apache-license-gen/pom.xml
+++ b/modules/apache-license-gen/pom.xml
@@ -31,7 +31,7 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>ignite-apache-license-gen</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <build>
         <plugins>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/aws/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aws/pom.xml b/modules/aws/pom.xml
index 4a568b0..37f6250 100644
--- a/modules/aws/pom.xml
+++ b/modules/aws/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aws</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index 68204f3..1b33d4b 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-clients</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/cloud/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cloud/pom.xml b/modules/cloud/pom.xml
index a183522..45d08e7 100644
--- a/modules/cloud/pom.xml
+++ b/modules/cloud/pom.xml
@@ -29,7 +29,7 @@
     </parent>
 
     <artifactId>ignite-cloud</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <properties>
         <jcloud.version>1.9.0</jcloud.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/codegen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml
index ea9615c..2e8e4ed 100644
--- a/modules/codegen/pom.xml
+++ b/modules/codegen/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-codegen</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index c42be3d..222e14b 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-core</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/core/src/main/resources/ignite.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/ignite.properties b/modules/core/src/main/resources/ignite.properties
index 2313ac3..44e954e 100644
--- a/modules/core/src/main/resources/ignite.properties
+++ b/modules/core/src/main/resources/ignite.properties
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-ignite.version=1.3.2-SNAPSHOT
+ignite.version=1.3.3-SNAPSHOT
 ignite.build=0
 ignite.revision=DEV
 ignite.rel.date=01011970

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/extdata/p2p/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/pom.xml b/modules/extdata/p2p/pom.xml
index 5a80380..ad9fc03 100644
--- a/modules/extdata/p2p/pom.xml
+++ b/modules/extdata/p2p/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-extdata-p2p</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/extdata/uri/modules/uri-dependency/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/modules/uri-dependency/pom.xml b/modules/extdata/uri/modules/uri-dependency/pom.xml
index b8e4742..a0ed86e 100644
--- a/modules/extdata/uri/modules/uri-dependency/pom.xml
+++ b/modules/extdata/uri/modules/uri-dependency/pom.xml
@@ -27,7 +27,7 @@
     <artifactId>ignite-extdata-uri-dep</artifactId>
     <packaging>jar</packaging>
 
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
     <modelVersion>4.0.0</modelVersion>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/extdata/uri/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml
index e4e5bb6..46ec215 100644
--- a/modules/extdata/uri/pom.xml
+++ b/modules/extdata/uri/pom.xml
@@ -32,7 +32,7 @@
     </parent>
 
     <artifactId>ignite-extdata-uri</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/gce/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gce/pom.xml b/modules/gce/pom.xml
index b1be8ea..3c13c4c 100644
--- a/modules/gce/pom.xml
+++ b/modules/gce/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-gce</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/geospatial/pom.xml
----------------------------------------------------------------------
diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml
index ecee8d4..33fda30 100644
--- a/modules/geospatial/pom.xml
+++ b/modules/geospatial/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-geospatial</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 555778c..eee70d6 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hadoop</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/hibernate/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/pom.xml b/modules/hibernate/pom.xml
index 5976baa..a583d52 100644
--- a/modules/hibernate/pom.xml
+++ b/modules/hibernate/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hibernate</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/indexing/pom.xml
----------------------------------------------------------------------
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index 067ec2d..bf2b369 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-indexing</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/jcl/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jcl/pom.xml b/modules/jcl/pom.xml
index ed864ce..9583e52 100644
--- a/modules/jcl/pom.xml
+++ b/modules/jcl/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jcl</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/jta/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jta/pom.xml b/modules/jta/pom.xml
index ca5546c..2007d1b 100644
--- a/modules/jta/pom.xml
+++ b/modules/jta/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jta</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/kafka/pom.xml
----------------------------------------------------------------------
diff --git a/modules/kafka/pom.xml b/modules/kafka/pom.xml
index 5a8cb72..6a15c48 100644
--- a/modules/kafka/pom.xml
+++ b/modules/kafka/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-kafka</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/log4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j/pom.xml b/modules/log4j/pom.xml
index 0489518..6157eba 100644
--- a/modules/log4j/pom.xml
+++ b/modules/log4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-log4j</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index 8a63a57..c207f79 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-mesos</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <properties>
         <mesos.version>0.22.0</mesos.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 5cb522d..7e06bae 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-rest-http</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/scalar-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index 0770410..449dab2 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar_2.10</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index 4515772..ef39a79 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/schedule/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schedule/pom.xml b/modules/schedule/pom.xml
index 3b734b0..690f25b 100644
--- a/modules/schedule/pom.xml
+++ b/modules/schedule/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schedule</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index 959e231..2c56a3f 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schema-import</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/slf4j/pom.xml b/modules/slf4j/pom.xml
index 8fa09cb..7b51fcb 100644
--- a/modules/slf4j/pom.xml
+++ b/modules/slf4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-slf4j</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/spark-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark-2.10/pom.xml b/modules/spark-2.10/pom.xml
index 82b08bc..5b1745a 100644
--- a/modules/spark-2.10/pom.xml
+++ b/modules/spark-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark_2.10</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/spark/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark/pom.xml b/modules/spark/pom.xml
index 107424a..d793279 100644
--- a/modules/spark/pom.xml
+++ b/modules/spark/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index fdd2b0a..afee3f4 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spring</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/ssh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ssh/pom.xml b/modules/ssh/pom.xml
index 9fddc21..d6e9ab7 100644
--- a/modules/ssh/pom.xml
+++ b/modules/ssh/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-ssh</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/tools/pom.xml
----------------------------------------------------------------------
diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml
index f58fbdc..83c800d 100644
--- a/modules/tools/pom.xml
+++ b/modules/tools/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-tools</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/urideploy/pom.xml
----------------------------------------------------------------------
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
index 8c6224f..f22da10 100644
--- a/modules/urideploy/pom.xml
+++ b/modules/urideploy/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-urideploy</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/visor-console-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml
index fe56751..fc0fa57 100644
--- a/modules/visor-console-2.10/pom.xml
+++ b/modules/visor-console-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console_2.10</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index b310d4c..a6a9678 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/visor-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml
index 4417b49..fca86fd 100644
--- a/modules/visor-plugins/pom.xml
+++ b/modules/visor-plugins/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-plugins</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <!-- Ignite dependencies -->

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/web/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/pom.xml b/modules/web/pom.xml
index 74dd525..0a8d53f 100644
--- a/modules/web/pom.xml
+++ b/modules/web/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index 1044df1..853f9d4 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yardstick</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <properties>
         <yardstick.version>0.7.0</yardstick.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/modules/yarn/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yarn/pom.xml b/modules/yarn/pom.xml
index 35728fa..2d90422 100644
--- a/modules/yarn/pom.xml
+++ b/modules/yarn/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yarn</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
 
     <properties>
         <hadoop.version>2.7.0</hadoop.version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f5cc4a1d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 29f5fa5..260e45b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>apache-ignite</artifactId>
-    <version>1.3.2-SNAPSHOT</version>
+    <version>1.3.3-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>


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

Posted by ak...@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-gg-10576
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;
+    }
+
+}


[31/39] incubator-ignite git commit: master: back merge from ignite-752

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


[09/39] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-1.3.3' into ignite-1.3.3

Posted by ak...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.3.3' 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/8cfeb8e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8cfeb8e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8cfeb8e1

Branch: refs/heads/ignite-gg-10576
Commit: 8cfeb8e1ad264ccb48956f6f90c579d7160ff4da
Parents: 4b55407 bce894f
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 22 09:28:02 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 22 09:28:02 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  28 ++
 .../apache/ignite/internal/IgniteKernal.java    |   3 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  17 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 473 +++++++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |   2 +
 .../util/nio/ssl/GridNioSslHandler.java         |  12 +-
 .../communication/tcp/TcpCommunicationSpi.java  | 158 ++++++-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   5 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  34 +-
 .../apache/ignite/ssl/SslContextFactory.java    | 458 ++++++++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  13 +
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 ++
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   3 +
 parent/pom.xml                                  |   2 +-
 25 files changed, 1399 insertions(+), 32 deletions(-)
----------------------------------------------------------------------



[13/39] incubator-ignite git commit: GG-10591 Force stop prev node before start new one.

Posted by ak...@apache.org.
GG-10591 Force stop prev node before start new one.


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

Branch: refs/heads/ignite-gg-10576
Commit: dd92a5a0785a84f0d2a8226a9199a1fb78c4db93
Parents: a749ed8
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Jul 22 18:23:52 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Jul 22 18:23:52 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/visor/commands/open/VisorOpenCommand.scala  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd92a5a0/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 632a96b..5ec4cd0 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
@@ -241,6 +241,9 @@ class VisorOpenCommand extends VisorConsoleCommand {
             cfg.setGridLogger(new NullLogger)
 
         val startedGridName = try {
+            // We need to stop previous daemon node before to start new one.
+            Ignition.stopAll(true)
+
             Ignition.start(cfg).name
         }
         finally {


[18/39] incubator-ignite git commit: HELPDESC-777 Add IGNITE_MBEAN_APPEND_CLASS_LOADER_ID system property.

Posted by ak...@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-gg-10576
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(',');
+        }
     }
 
     /**


[39/39] incubator-ignite git commit: # GG-10576 Merge with master.

Posted by ak...@apache.org.
# GG-10576 Merge with 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/5cd5c350
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5cd5c350
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5cd5c350

Branch: refs/heads/ignite-gg-10576
Commit: 5cd5c350489ec52a76ca72ceadcf46c2ede71000
Parents: 8a20a2e 58f4822
Author: AKuznetsov <ak...@gridgain.com>
Authored: Sat Jul 25 00:13:31 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Sat Jul 25 00:13:31 2015 +0700

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   5 +
 assembly/release-base.xml                       |   5 +
 config/ignite-log4j2.xml                        |  81 +++
 config/ignite-log4j2.xml~                       |  65 +++
 examples/config/example-ignite.xml              |   2 +-
 modules/clients/README.txt                      |  16 +
 modules/clients/readme.md                       |  32 --
 modules/clients/readme.pdf                      | Bin 47887 -> 0 bytes
 .../src/main/java/org/apache/ignite/Ignite.java |   2 +-
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  63 ++-
 .../apache/ignite/internal/IgniteKernal.java    |  44 +-
 .../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 +
 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 +-
 .../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 +
 modules/hadoop/docs/HADOOP_README.txt           | 122 +++++
 modules/hadoop/docs/hadoop_readme.md            | 135 -----
 modules/hadoop/docs/hadoop_readme.pdf           | Bin 82219 -> 0 bytes
 modules/log4j/README.txt                        |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   2 +-
 modules/log4j2/README.txt                       |  32 ++
 modules/log4j2/licenses/apache-2.0.txt          | 202 +++++++
 modules/log4j2/pom.xml                          |  63 +++
 modules/log4j2/pom.xml~                         |  45 ++
 .../ignite/logger/log4j2/Log4J2Logger.java      | 486 +++++++++++++++++
 .../ignite/logger/log4j2/Log4J2Logger.java~     | 542 +++++++++++++++++++
 .../ignite/logger/log4j2/Log4j2FileAware.java   |  35 ++
 .../ignite/logger/log4j2/Log4j2FileAware.java~  |  33 ++
 .../ignite/logger/log4j2/Log4jFileAware.java~   |  13 +
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../log4j2/GridLog4j2CorrectFileNameTest.java   |  95 ++++
 .../log4j2/GridLog4j2CorrectFileNameTest.java~  |  95 ++++
 .../log4j2/GridLog4j2InitializedTest.java       |  79 +++
 .../log4j2/GridLog4j2InitializedTest.java~      |  79 +++
 .../log4j2/GridLog4j2LoggingFileTest.java       |  72 +++
 .../log4j2/GridLog4j2LoggingFileTest.java~      |  74 +++
 .../logger/log4j2/Log4j2LoggerSelfTest.java     | 174 ++++++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 117 ++++
 .../ignite/logger/log4j2/package-info.java      |  22 +
 .../testsuites/IgniteLog4j2TestSuite.java       |  38 ++
 .../visor/commands/open/VisorOpenCommand.scala  |  29 +-
 .../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 +
 93 files changed, 6297 insertions(+), 702 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5cd5c350/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
----------------------------------------------------------------------
diff --cc modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
index 2f20cc4,7d2ee3c..2616daf
--- 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
@@@ -248,9 -240,12 +248,19 @@@ class VisorOpenCommand extends VisorCon
          if ("true".equalsIgnoreCase(sys.props.getOrElse(IGNITE_QUIET, "true")))
              cfg.setGridLogger(new NullLogger)
  
-         val startedGridName = try {
-             Ignition.start(cfg).name
+         ignite = try {
+             // We need to stop previous daemon node before to start new one.
+             prevIgnite.foreach(g => Ignition.stop(g.name(), true))
+ 
+             Ignition.start(cfg).asInstanceOf[IgniteEx]
+         }
++        catch {
++            case e: Throwable =>
++                if (X.hasCause(e, classOf[IgniteSpiException]) && joinTimedOut(X.cause(e, classOf[IgniteSpiException]).getMessage))
++                    throw new IgniteException("Visor console failed to connect to any of server nodes", e)
++                else
++                    throw e                
 +        }
          finally {
              Ignition.setDaemon(daemon)
  


[28/39] incubator-ignite git commit: # refactor ignite README files

Posted by ak...@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-gg-10576
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-->


[08/39] incubator-ignite git commit: fixed ack topology message

Posted by ak...@apache.org.
fixed ack topology message


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

Branch: refs/heads/ignite-gg-10576
Commit: 4b55407ee9c8beeacd3cc761fc1c4bd78b1c8c33
Parents: 9cab55a
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 22 09:27:46 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 22 09:27:46 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/managers/discovery/GridDiscoveryManager.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b55407e/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git 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
index eae07ed..9f031bf 100644
--- 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
@@ -1030,8 +1030,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
     private String topologySnapshotMessage(int serverNodesNum, int clientNodesNum, int totalCpus, double heap) {
         return PREFIX + " [" +
             (discoOrdered ? "ver=" + topSnap.get().topVer.topologyVersion() + ", " : "") +
-            "server nodes=" + serverNodesNum +
-            ", client nodes=" + clientNodesNum +
+            "servers=" + serverNodesNum +
+            ", clients=" + clientNodesNum +
             ", CPUs=" + totalCpus +
             ", heap=" + heap + "GB" +
             ']';


[04/39] incubator-ignite git commit: Fixed javadoc.

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

Branch: refs/heads/ignite-gg-10576
Commit: 36dc9209441fa28c83b7e6f0d24156f679160a2e
Parents: 1fd3189
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jul 21 21:29:52 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jul 21 21:29:52 2015 +0300

----------------------------------------------------------------------
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36dc9209/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 55d0b43..2d18ee7 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -244,7 +244,7 @@
                             </group>
                             <group>
                                 <title>Security APIs</title>
-                                <packages>org.apache.ignite.plugin.security</packages>
+                                <packages>org.apache.ignite.plugin.security:org.apache.ignite.ssl</packages>
                             </group>
                             <group>
                                 <title>MXBeans classes</title>


[17/39] incubator-ignite git commit: # HELPDESC-777 Fix javadoc.

Posted by ak...@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-gg-10576
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}.
      */


[06/39] incubator-ignite git commit: IGNITE-323. Fixed javadoc.

Posted by ak...@apache.org.
IGNITE-323. Fixed 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/2650845e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2650845e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2650845e

Branch: refs/heads/ignite-gg-10576
Commit: 2650845e7b3770bfc22491fb5abc5f026e33c745
Parents: f7317ea
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jul 21 22:13:52 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jul 21 22:13:52 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/configuration/ConnectorConfiguration.java  | 4 ++--
 .../ignite/internal/client/ssl/GridSslBasicContextFactory.java   | 2 +-
 .../apache/ignite/internal/client/ssl/GridSslContextFactory.java | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2650845e/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
index a518cd8..98753e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
@@ -467,11 +467,11 @@ public class ConnectorConfiguration {
     }
 
     /**
-     * Sets instance of {@link Factory<SSLContext>} that will be used to create an instance of {@code SSLContext}
+     * Sets instance of {@link Factory} that will be used to create an instance of {@code SSLContext}
      * for Secure Socket Layer on TCP binary protocol. This factory will only be used if
      * {@link #setSslEnabled(boolean)} is set to {@code true}.
      *
-     * @param sslFactory Instance of {@link Factory<SSLContext>}
+     * @param sslFactory Instance of {@link Factory}
      */
     public void setSslFactory(Factory<SSLContext> sslFactory) {
         this.sslFactory = sslFactory;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2650845e/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
index d9a1f9d..ed52218 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
@@ -38,7 +38,7 @@ import java.util.*;
  *     factory.setTrustManagers(GridSslBasicContextFactory.getDisabledTrustManager());
  *     // Rest of initialization.
  * </pre>
- * @deprecated Use {@link Factory<SSLContext>} instead.
+ * @deprecated Use {@link Factory} instead.
  */
 @Deprecated
 public class GridSslBasicContextFactory implements GridSslContextFactory {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2650845e/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
index 7ae1995..34a13cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
@@ -25,7 +25,7 @@ import javax.net.ssl.*;
  * <p>
  * Usually, it is enough to configure context from a particular key and trust stores, this functionality is provided
  * in {@link GridSslBasicContextFactory}.
- * @deprecated Use {@link Factory<SSLContext>} instead.
+ * @deprecated Use {@link Factory} instead.
  */
 @Deprecated
 public interface GridSslContextFactory {


[16/39] incubator-ignite git commit: #ignite-1.1.3: security fixes.

Posted by ak...@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-gg-10576
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();
     }


[23/39] incubator-ignite git commit: Decrease write buffer to avoid double sending.

Posted by ak...@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-gg-10576
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) {


[14/39] incubator-ignite git commit: minor

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

Branch: refs/heads/ignite-gg-10576
Commit: 26112a8ed2dc828b6e47fab7158ee6a5728e7516
Parents: dd92a5a
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 22 15:46:20 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 22 15:46:20 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/cache/GridCacheAdapter.java  | 2 +-
 .../apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/26112a8e/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 e138520..18f4004 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
@@ -1627,7 +1627,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     ) {
         ctx.checkSecurity(SecurityPermission.CACHE_READ);
 
-       if (keyCheck)
+        if (keyCheck)
             validateCacheKeys(keys);
 
         return getAllAsync0(ctx.cacheKeysView(keys),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/26112a8e/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 b72299e..99ca2b7 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
@@ -2052,6 +2052,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     long rcvCnt = -1;
 
                     GridTuple<SSLEngine> ssl = new GridTuple<>();
+
                     try {
                         ch.socket().connect(addr, (int)connTimeout);
 


[22/39] incubator-ignite git commit: Merge branch 'ignite-gg-10591' into ignite-1.3.3

Posted by ak...@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-gg-10576
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(-)
----------------------------------------------------------------------



[02/39] incubator-ignite git commit: license generator deploy fix

Posted by ak...@apache.org.
license generator deploy 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/9cab55ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9cab55ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9cab55ad

Branch: refs/heads/ignite-gg-10576
Commit: 9cab55adab3cc23c20cbf86512e8faa446ac6929
Parents: f5cc4a1
Author: Anton Vinogradov <av...@gridgain.com>
Authored: Tue Jul 21 14:43:29 2015 +0300
Committer: Anton Vinogradov <av...@gridgain.com>
Committed: Tue Jul 21 14:43:29 2015 +0300

----------------------------------------------------------------------
 modules/apache-license-gen/pom.xml | 13 -------------
 1 file changed, 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9cab55ad/modules/apache-license-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/apache-license-gen/pom.xml b/modules/apache-license-gen/pom.xml
index 104624a..11259a5 100644
--- a/modules/apache-license-gen/pom.xml
+++ b/modules/apache-license-gen/pom.xml
@@ -32,17 +32,4 @@
     <groupId>org.apache.ignite</groupId>
     <artifactId>ignite-apache-license-gen</artifactId>
     <version>1.3.3-SNAPSHOT</version>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-deploy-plugin</artifactId>
-                <inherited>false</inherited>
-                <configuration>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>


[07/39] incubator-ignite git commit: Removed @Nullable annotation

Posted by ak...@apache.org.
Removed @Nullable annotation


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

Branch: refs/heads/ignite-gg-10576
Commit: bce894fdf0886bde29cdc9502ecf2e95aebe8dd8
Parents: 2650845
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Tue Jul 21 13:06:17 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Tue Jul 21 13:06:17 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bce894fd/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 7103b1b..209946b 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -308,7 +308,7 @@ public interface Ignite extends AutoCloseable {
      * @param name Cache name.
      * @return Instance of the cache for the specified name.
      */
-    @Nullable public <K, V> IgniteCache<K, V> cache(@Nullable String name);
+    public <K, V> IgniteCache<K, V> cache(@Nullable String name);
 
     /**
      * Gets grid transactions facade.


[21/39] incubator-ignite git commit: Added client auth for servers.

Posted by ak...@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-gg-10576
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),


[11/39] incubator-ignite git commit: Added log WARN in discovery when ssl cfg isn't consistent.

Posted by ak...@apache.org.
Added log WARN in discovery when ssl cfg isn't consistent.


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

Branch: refs/heads/ignite-gg-10576
Commit: f6b3b3d37a31dc69d7d9db8fb30a7379f8f042c0
Parents: 2650845
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jul 22 13:05:21 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jul 22 13:05:21 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/spi/discovery/tcp/ServerImpl.java   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f6b3b3d3/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 97e910a..34f90f7 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
@@ -39,6 +39,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
+import javax.net.ssl.*;
 import java.io.*;
 import java.net.*;
 import java.util.*;
@@ -4123,12 +4124,16 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (!Arrays.equals(buf, U.IGNITE_HEADER)) {
                         if (log.isDebugEnabled())
                             log.debug("Unknown connection detected (is some other software connecting to " +
-                                "this Ignite port?) " +
+                                "this Ignite port?" +
+                                (!spi.isSslEnabled() ? " missed SSL configuration?" : "" ) +
+                                ") " +
                                 "[rmtAddr=" + sock.getRemoteSocketAddress() +
                                 ", locAddr=" + sock.getLocalSocketAddress() + ']');
 
                         LT.warn(log, null, "Unknown connection detected (is some other software connecting to " +
-                            "this Ignite port?) [rmtAddr=" + sock.getRemoteSocketAddress() +
+                            "this Ignite port?" +
+                            (!spi.isSslEnabled() ? " missed SSL configuration?" : "" ) +
+                            ") [rmtAddr=" + sock.getRemoteSocketAddress() +
                             ", locAddr=" + sock.getLocalSocketAddress() + ']');
 
                         return;
@@ -4237,7 +4242,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (log.isDebugEnabled())
                         U.error(log, "Caught exception on handshake [err=" + e +", sock=" + sock + ']', e);
 
-                    if (X.hasCause(e, ObjectStreamException.class) || !sock.isClosed()) {
+                    if (X.hasCause(e, SSLException.class) && spi.isSslEnabled())
+                        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()) {
                         if (U.isMacInvalidArgumentError(e))
                             LT.error(log, e, "Failed to initialize connection [sock=" + sock + "]\n\t" +
                                 U.MAC_INVALID_ARG_MSG);


[34/39] incubator-ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by ak...@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-gg-10576
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
----------------------------------------------------------------------


[37/39] incubator-ignite git commit: # ignite-788: review

Posted by ak...@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-gg-10576
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;
     }
-
 }


[20/39] incubator-ignite git commit: Fixed SSL bugs. Added test.

Posted by ak...@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-gg-10576
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;
     }
 }


[10/39] incubator-ignite git commit: fixed ack topology message

Posted by ak...@apache.org.
fixed ack topology message


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

Branch: refs/heads/ignite-gg-10576
Commit: 960164a559de97216ec34244f92b1a74d7ae4f29
Parents: 8cfeb8e
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 22 09:31:53 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 22 09:31:53 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/managers/discovery/GridDiscoveryManager.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/960164a5/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git 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
index 9f031bf..fac6f6d 100644
--- 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
@@ -1033,8 +1033,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             "servers=" + serverNodesNum +
             ", clients=" + clientNodesNum +
             ", CPUs=" + totalCpus +
-            ", heap=" + heap + "GB" +
-            ']';
+            ", heap=" + heap + "GB]";
     }
 
     /** {@inheritDoc} */


[05/39] incubator-ignite git commit: Fixed build.

Posted by ak...@apache.org.
Fixed build.


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

Branch: refs/heads/ignite-gg-10576
Commit: f7317eaca8b0d39f044af6bb7bfa10b24adcd44a
Parents: 36dc920
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jul 21 21:54:09 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jul 21 21:54:09 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/ssl/SslContextFactory.java    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f7317eac/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java b/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
index bf09541..d52dcf3 100644
--- a/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
@@ -41,6 +41,9 @@ import java.util.*;
  * </pre>
  */
 public class SslContextFactory implements Factory<SSLContext> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
     /** Default key store type. */
     public static final String DFLT_STORE_TYPE = "JKS";
 


[29/39] incubator-ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by ak...@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-gg-10576
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(-)
----------------------------------------------------------------------



[33/39] incubator-ignite git commit: Merge branch 'ignite-1.3.3' into master.

Posted by ak...@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-gg-10576
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
----------------------------------------------------------------------


[24/39] incubator-ignite git commit: Rename variable byte buffer.

Posted by ak...@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-gg-10576
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 {


[32/39] incubator-ignite git commit: master: back merge from ignite-752

Posted by ak...@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-gg-10576
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;
         }


[26/39] incubator-ignite git commit: Fixed basic suite.

Posted by ak...@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-gg-10576
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\\русский каталог\""));
     }
 }


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

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


[19/39] incubator-ignite git commit: GG-10591 Reworked daemon node stop fix.

Posted by ak...@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-gg-10576
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) {


[03/39] incubator-ignite git commit: Cherry pick form IGNITE-323.

Posted by ak...@apache.org.
Cherry pick form IGNITE-323.


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

Branch: refs/heads/ignite-gg-10576
Commit: 1fd31892c7a87ecd1c5584b45aecd0b30e3411fb
Parents: 9cab55a
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jul 21 21:26:09 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jul 21 21:26:09 2015 +0300

----------------------------------------------------------------------
 .../configuration/ConnectorConfiguration.java   |  32 ++
 .../configuration/IgniteConfiguration.java      |  28 ++
 .../apache/ignite/internal/IgniteKernal.java    |   3 +-
 .../client/ssl/GridSslBasicContextFactory.java  |   3 +
 .../client/ssl/GridSslContextFactory.java       |   5 +-
 .../rest/protocols/tcp/GridTcpRestProtocol.java |  17 +-
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/ssl/BlockingSslHandler.java        | 473 +++++++++++++++++++
 .../internal/util/nio/ssl/GridNioSslFilter.java |   2 +
 .../util/nio/ssl/GridNioSslHandler.java         |  12 +-
 .../communication/tcp/TcpCommunicationSpi.java  | 158 ++++++-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   5 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  34 +-
 .../apache/ignite/ssl/SslContextFactory.java    | 455 ++++++++++++++++++
 .../org/apache/ignite/ssl/package-info.java     |  22 +
 .../GridAbstractCommunicationSelfTest.java      |  13 +
 .../tcp/GridTcpCommunicationSpiSslSelfTest.java |  38 ++
 .../discovery/AbstractDiscoverySelfTest.java    |  13 +
 .../tcp/TcpDiscoverySpiSslSelfTest.java         |  28 ++
 .../discovery/tcp/TcpDiscoverySslSelfTest.java  |  42 ++
 .../ignite/testframework/GridTestUtils.java     |  20 +
 .../ignite/testframework/junits/IgniteMock.java |  13 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   3 +
 23 files changed, 1394 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
index 970c54b..a518cd8 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
@@ -19,8 +19,12 @@ package org.apache.ignite.configuration;
 
 import org.apache.ignite.*;
 import org.apache.ignite.internal.client.ssl.*;
+import org.apache.ignite.ssl.*;
+
 import org.jetbrains.annotations.*;
 
+import javax.cache.configuration.*;
+import javax.net.ssl.*;
 import java.net.*;
 
 /**
@@ -99,6 +103,9 @@ public class ConnectorConfiguration {
     /** SSL context factory for rest binary server. */
     private GridSslContextFactory sslCtxFactory;
 
+    /** SSL context factory for rest binary server. */
+    private Factory<SSLContext> sslFactory;
+
     /** Port range */
     private int portRange = DFLT_PORT_RANGE;
 
@@ -429,7 +436,9 @@ public class ConnectorConfiguration {
      *
      * @return SslContextFactory instance.
      * @see GridSslContextFactory
+     * @deprecated Use {@link #getSslFactory()} instead.
      */
+    @Deprecated
     public GridSslContextFactory getSslContextFactory() {
         return sslCtxFactory;
     }
@@ -440,12 +449,35 @@ public class ConnectorConfiguration {
      * {@link #setSslEnabled(boolean)} is set to {@code true}.
      *
      * @param sslCtxFactory Instance of {@link GridSslContextFactory}
+     * @deprecated Use {@link #setSslFactory(Factory)} instead.
      */
+    @Deprecated
     public void setSslContextFactory(GridSslContextFactory sslCtxFactory) {
         this.sslCtxFactory = sslCtxFactory;
     }
 
     /**
+     * Gets context factory that will be used for creating a secure socket layer of rest binary server.
+     *
+     * @return SSL context factory instance.
+     * @see SslContextFactory
+     */
+    public Factory<SSLContext> getSslFactory() {
+        return sslFactory;
+    }
+
+    /**
+     * Sets instance of {@link Factory<SSLContext>} that will be used to create an instance of {@code SSLContext}
+     * for Secure Socket Layer on TCP binary protocol. This factory will only be used if
+     * {@link #setSslEnabled(boolean)} is set to {@code true}.
+     *
+     * @param sslFactory Instance of {@link Factory<SSLContext>}
+     */
+    public void setSslFactory(Factory<SSLContext> sslFactory) {
+        this.sslFactory = sslFactory;
+    }
+
+    /**
      * Gets number of ports to try if configured port is already in use.
      *
      * @return Number of ports to try.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 2d36c7a..54ef2ba 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
@@ -52,6 +52,7 @@ import org.apache.ignite.spi.loadbalancing.*;
 import org.apache.ignite.spi.loadbalancing.roundrobin.*;
 import org.apache.ignite.spi.swapspace.*;
 import org.apache.ignite.spi.swapspace.file.*;
+import org.apache.ignite.ssl.*;
 
 import javax.cache.configuration.*;
 import javax.cache.event.*;
@@ -59,6 +60,7 @@ import javax.cache.expiry.*;
 import javax.cache.integration.*;
 import javax.cache.processor.*;
 import javax.management.*;
+import javax.net.ssl.*;
 import java.lang.management.*;
 import java.util.*;
 
@@ -400,6 +402,9 @@ public class IgniteConfiguration {
     /** Cache store session listeners. */
     private Factory<CacheStoreSessionListener>[] storeSesLsnrs;
 
+    /** SSL connection factory. */
+    private Factory<SSLContext> sslCtxFactory;
+
     /**
      * Creates valid grid configuration with all default values.
      */
@@ -480,6 +485,7 @@ public class IgniteConfiguration {
         segResolvers = cfg.getSegmentationResolvers();
         sndRetryCnt = cfg.getNetworkSendRetryCount();
         sndRetryDelay = cfg.getNetworkSendRetryDelay();
+        sslCtxFactory = cfg.getSslContextFactory();
         storeSesLsnrs = cfg.getCacheStoreSessionListenerFactories();
         svcCfgs = cfg.getServiceConfiguration();
         sysPoolSize = cfg.getSystemThreadPoolSize();
@@ -1310,6 +1316,28 @@ public class IgniteConfiguration {
     }
 
     /**
+     * Sets SSL context factory that will be used for creating a secure socket  layer.
+     *
+     * @param sslCtxFactory Ssl context factory.
+     * @see SslContextFactory
+     */
+    public IgniteConfiguration setSslContextFactory(Factory<SSLContext> sslCtxFactory) {
+        this.sslCtxFactory = sslCtxFactory;
+
+        return this;
+    }
+
+    /**
+     * Returns SSL context factory that will be used for creating a secure socket layer.
+     *
+     * @return SSL connection factory.
+     * @see SslContextFactory
+     */
+    public Factory<SSLContext> getSslContextFactory() {
+        return sslCtxFactory;
+    }
+
+    /**
      * Should return fully configured event SPI implementation. If not provided,
      * {@link MemoryEventStorageSpi} will be used.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 024dc7b..8a246dc 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
@@ -2065,7 +2065,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         assert log != null;
 
         if (log.isInfoEnabled())
-            log.info("Security status [authentication=" + onOff(ctx.security().enabled()) + ']');
+            log.info("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/1fd31892/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
index 92c34e0..d9a1f9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslBasicContextFactory.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.client.ssl;
 
 import org.apache.ignite.internal.util.typedef.internal.*;
 
+import javax.cache.configuration.*;
 import javax.net.ssl.*;
 import java.io.*;
 import java.security.*;
@@ -37,7 +38,9 @@ import java.util.*;
  *     factory.setTrustManagers(GridSslBasicContextFactory.getDisabledTrustManager());
  *     // Rest of initialization.
  * </pre>
+ * @deprecated Use {@link Factory<SSLContext>} instead.
  */
+@Deprecated
 public class GridSslBasicContextFactory implements GridSslContextFactory {
     /** Default key store type. */
     public static final String DFLT_STORE_TYPE = "JKS";

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
index 8a9cd13..7ae1995 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/ssl/GridSslContextFactory.java
@@ -17,14 +17,17 @@
 
 package org.apache.ignite.internal.client.ssl;
 
+import javax.cache.configuration.*;
 import javax.net.ssl.*;
 
 /**
  * This interface provides creation of SSL context both for server and client use.
  * <p>
  * Usually, it is enough to configure context from a particular key and trust stores, this functionality is provided
- * in {@link org.apache.ignite.internal.client.ssl.GridSslBasicContextFactory}.
+ * in {@link GridSslBasicContextFactory}.
+ * @deprecated Use {@link Factory<SSLContext>} instead.
  */
+@Deprecated
 public interface GridSslContextFactory {
     /**
      * Creates SSL context based on factory settings.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 9b6f353..c37c17d 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
@@ -35,6 +35,7 @@ import org.apache.ignite.marshaller.jdk.*;
 import org.apache.ignite.spi.*;
 import org.jetbrains.annotations.*;
 
+import javax.cache.configuration.*;
 import javax.net.ssl.*;
 import java.io.*;
 import java.net.*;
@@ -106,13 +107,23 @@ public class GridTcpRestProtocol extends GridRestProtocolAdapter {
             SSLContext sslCtx = null;
 
             if (cfg.isSslEnabled()) {
-                GridSslContextFactory factory = cfg.getSslContextFactory();
+                Factory<SSLContext> igniteFactory = ctx.config().getSslContextFactory();
 
-                if (factory == null)
+                Factory<SSLContext> factory = cfg.getSslFactory();
+
+                // This factory deprecated and will be removed.
+                GridSslContextFactory depFactory = cfg.getSslContextFactory();
+
+                if (factory == null && depFactory == null && igniteFactory == null)
                     // Thrown SSL exception instead of IgniteCheckedException for writing correct warning message into log.
                     throw new SSLException("SSL is enabled, but SSL context factory is not specified.");
 
-                sslCtx = factory.createSslContext();
+                if (factory != null)
+                    sslCtx = factory.create();
+                else if (depFactory != null)
+                    sslCtx = depFactory.createSslContext();
+                else
+                    sslCtx = igniteFactory.create();
             }
 
             int lastPort = cfg.getPort() + cfg.getPortRange() - 1;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java
index d7eb2f3..004c327 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionMetaKey.java
@@ -42,7 +42,10 @@ public enum GridNioSessionMetaKey {
     MARSHALLER_ID,
 
     /** Message writer. */
-    MSG_WRITER;
+    MSG_WRITER,
+
+    /** SSL engine. */
+    SSL_ENGINE;
 
     /** Maximum count of NIO session keys in system. */
     public static final int MAX_KEYS_CNT = 64;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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
new file mode 100644
index 0000000..eee90d8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
@@ -0,0 +1,473 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.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.*;
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.nio.*;
+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.*;
+
+/**
+ *
+ */
+public class BlockingSslHandler {
+    /** Logger. */
+    private IgniteLogger log;
+
+    /** */
+    private SocketChannel ch;
+
+    /** */
+    private GridFutureAdapter<ByteBuffer> fut;
+
+    /** SSL engine. */
+    private SSLEngine sslEngine;
+
+    /** Handshake completion flag. */
+    private boolean handshakeFinished;
+
+    /** Engine handshake status. */
+    private HandshakeStatus handshakeStatus;
+
+    /** Output buffer into which encrypted data will be written. */
+    private ByteBuffer outNetBuf;
+
+    /** Input buffer from which SSL engine will decrypt data. */
+    private ByteBuffer inNetBuf;
+
+    /** Empty buffer used in handshake procedure.  */
+    private ByteBuffer handshakeBuf = ByteBuffer.allocate(0);
+
+    /** Application buffer. */
+    private ByteBuffer appBuf;
+
+    /**
+     * @param sslEngine SSLEngine.
+     * @param ch Socket channel.
+     * @param fut Future.
+     * @param log Logger.
+     */
+    public BlockingSslHandler(SSLEngine sslEngine, SocketChannel ch, GridFutureAdapter<ByteBuffer> fut,
+        IgniteLogger log) throws SSLException {
+        this.ch = ch;
+        this.fut = fut;
+        this.log = log;
+
+        this.sslEngine = sslEngine;
+
+        // 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);
+
+        // Initially buffer is empty.
+        outNetBuf.position(0);
+        outNetBuf.limit(0);
+
+        appBuf = allocateAppBuff();
+
+        handshakeStatus = sslEngine.getHandshakeStatus();
+
+        sslEngine.setUseClientMode(true);
+
+        if (log.isDebugEnabled())
+            log.debug("Started SSL session [netBufSize=" + netBufSize + ", appBufSize=" + appBuf.capacity() + ']');
+    }
+
+    /**
+     * Performs handshake procedure with remote peer.
+     *
+     * @throws GridNioException If filter processing has thrown an exception.
+     * @throws SSLException If failed to process SSL data.
+     */
+    public boolean handshake() throws IgniteCheckedException, SSLException {
+        if (log.isDebugEnabled())
+            log.debug("Entered handshake. Handshake status: " + handshakeStatus + '.');
+
+        sslEngine.beginHandshake();
+
+        handshakeStatus = sslEngine.getHandshakeStatus();
+
+        boolean loop = true;
+
+        while (loop) {
+            switch (handshakeStatus) {
+                case NOT_HANDSHAKING:
+                case FINISHED: {
+                    handshakeFinished = true;
+
+                    if (fut != null) {
+                        appBuf.flip();
+
+                        fut.onDone(appBuf);
+                    }
+
+                    loop = false;
+
+                    break;
+                }
+
+                case NEED_TASK: {
+                    handshakeStatus = runTasks();
+
+                    break;
+                }
+
+                case NEED_UNWRAP: {
+                    Status status = unwrapHandshake();
+
+                    handshakeStatus = sslEngine.getHandshakeStatus();
+
+                    if (status == BUFFER_UNDERFLOW && sslEngine.isInboundDone())
+                        // Either there is no enough data in buffer or session was closed.
+                        loop = false;
+
+                    break;
+                }
+
+                case NEED_WRAP: {
+                    // If the output buffer has remaining data, clear it.
+                    if (outNetBuf.hasRemaining())
+                        U.warn(log, "Output net buffer has unsent bytes during handshake (will clear). ");
+
+                    outNetBuf.clear();
+
+                    SSLEngineResult res = sslEngine.wrap(handshakeBuf, outNetBuf);
+
+                    outNetBuf.flip();
+
+                    handshakeStatus = res.getHandshakeStatus();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Wrapped handshake data [status=" + res.getStatus() + ", handshakeStatus=" +
+                        handshakeStatus + ']');
+
+                    writeNetBuffer();
+
+                    break;
+                }
+
+                default: {
+                    throw new IllegalStateException("Invalid handshake status in handshake method [handshakeStatus=" +
+                        handshakeStatus + ']');
+                }
+            }
+        }
+
+        if (log.isDebugEnabled())
+            log.debug("Leaved handshake. Handshake status:" + handshakeStatus + '.');
+
+        return handshakeFinished;
+    }
+
+    /**
+     * Encrypts data to be written to the network.
+     *
+     * @param src data to encrypt.
+     * @throws SSLException on errors.
+     * @return Output buffer with encrypted data.
+     */
+    public ByteBuffer encrypt(ByteBuffer src) throws SSLException {
+        assert handshakeFinished;
+
+        // The data buffer is (must be) empty, we can reuse the entire
+        // buffer.
+        outNetBuf.clear();
+
+        // Loop until there is no more data in src
+        while (src.hasRemaining()) {
+            int outNetRemaining = outNetBuf.capacity() - outNetBuf.position();
+
+            if (outNetRemaining < src.remaining() * 2) {
+                outNetBuf = expandBuffer(outNetBuf, Math.max(
+                    outNetBuf.position() + src.remaining() * 2, outNetBuf.capacity() * 2));
+
+                if (log.isDebugEnabled())
+                    log.debug("Expanded output net buffer: " + outNetBuf.capacity());
+            }
+
+            SSLEngineResult res = sslEngine.wrap(src, outNetBuf);
+
+            if (log.isDebugEnabled())
+                log.debug("Encrypted data [status=" + res.getStatus() + ", handshakeStaus=" +
+                    res.getHandshakeStatus() + ']');
+
+            if (res.getStatus() == OK) {
+                if (res.getHandshakeStatus() == NEED_TASK)
+                    runTasks();
+            }
+            else
+                throw new SSLException("Failed to encrypt data (SSL engine error) [status=" + res.getStatus() +
+                    ", handshakeStatus=" + res.getHandshakeStatus() + ']');
+        }
+
+        outNetBuf.flip();
+
+        return outNetBuf;
+    }
+
+    /**
+     * Called by SSL filter when new message was received.
+     *
+     * @param buf Received message.
+     * @throws GridNioException If exception occurred while forwarding events to underlying filter.
+     * @throws SSLException If failed to process SSL data.
+     */
+    public ByteBuffer decode(ByteBuffer buf) throws IgniteCheckedException, SSLException {
+        inNetBuf.clear();
+
+        if (buf.limit() > inNetBuf.remaining()) {
+            inNetBuf = expandBuffer(inNetBuf, inNetBuf.capacity() + buf.limit() * 2);
+
+            appBuf = expandBuffer(appBuf, inNetBuf.capacity() * 2);
+
+            if (log.isDebugEnabled())
+                log.debug("Expanded buffers [inNetBufCapacity=" + inNetBuf.capacity() + ", appBufCapacity=" +
+                    appBuf.capacity() + ']');
+        }
+
+        // append buf to inNetBuffer
+        inNetBuf.put(buf);
+
+        if (!handshakeFinished)
+            handshake();
+        else
+            unwrapData();
+
+        if (isInboundDone()) {
+            int newPosition = buf.position() - inNetBuf.position();
+
+            if (newPosition >= 0) {
+                buf.position(newPosition);
+
+                // If we received close_notify but not all bytes has been read by SSL engine, print a warning.
+                if (buf.hasRemaining())
+                    U.warn(log, "Got unread bytes after receiving close_notify message (will ignore).");
+            }
+
+            inNetBuf.clear();
+        }
+
+        appBuf.flip();
+
+        return appBuf;
+    }
+
+    /**
+     * @return {@code True} if inbound data stream has ended, i.e. SSL engine received
+     * <tt>close_notify</tt> message.
+     */
+    boolean isInboundDone() {
+        return sslEngine.isInboundDone();
+    }
+
+    /**
+     * Unwraps user data to the application buffer.
+     *
+     * @throws SSLException If failed to process SSL data.
+     * @throws GridNioException If failed to pass events to the next filter.
+     */
+    private void unwrapData() throws IgniteCheckedException, SSLException {
+        if (log.isDebugEnabled())
+            log.debug("Unwrapping received data.");
+
+        // Flip buffer so we can read it.
+        inNetBuf.flip();
+
+        SSLEngineResult res = unwrap0();
+
+        // prepare to be written again
+        inNetBuf.compact();
+
+        checkStatus(res);
+
+        renegotiateIfNeeded(res);
+    }
+
+    /**
+     * Runs all tasks needed to continue SSL work.
+     *
+     * @return Handshake status after running all tasks.
+     */
+    private HandshakeStatus runTasks() {
+        Runnable runnable;
+
+        while ((runnable = sslEngine.getDelegatedTask()) != null) {
+            if (log.isDebugEnabled())
+                log.debug("Running SSL engine task: " + runnable + '.');
+
+            runnable.run();
+        }
+
+        if (log.isDebugEnabled())
+            log.debug("Finished running SSL engine tasks. HandshakeStatus: " + sslEngine.getHandshakeStatus());
+
+        return sslEngine.getHandshakeStatus();
+    }
+
+
+    /**
+     * Unwraps handshake data and processes it.
+     *
+     * @return Status.
+     * @throws SSLException If SSL exception occurred while unwrapping.
+     * @throws GridNioException If failed to pass event to the next filter.
+     */
+    private Status unwrapHandshake() throws SSLException, IgniteCheckedException {
+        // Flip input buffer so we can read the collected data.
+        readFromNet();
+
+        inNetBuf.flip();
+
+        SSLEngineResult res = unwrap0();
+        handshakeStatus = res.getHandshakeStatus();
+
+        checkStatus(res);
+
+        // If handshake finished, no data was produced, and the status is still ok,
+        // try to unwrap more
+        if (handshakeStatus == FINISHED && res.getStatus() == OK && inNetBuf.hasRemaining()) {
+            res = unwrap0();
+
+            handshakeStatus = res.getHandshakeStatus();
+
+            // prepare to be written again
+            inNetBuf.compact();
+
+            renegotiateIfNeeded(res);
+        }
+        else
+            // prepare to be written again
+            inNetBuf.compact();
+
+        return res.getStatus();
+    }
+
+    /**
+     * Performs raw unwrap from network read buffer.
+     *
+     * @return Result.
+     * @throws SSLException If SSL exception occurs.
+     */
+    private SSLEngineResult unwrap0() throws SSLException {
+        SSLEngineResult res;
+
+        do {
+            res = sslEngine.unwrap(inNetBuf, appBuf);
+
+            if (log.isDebugEnabled())
+                log.debug("Unwrapped raw data [status=" + res.getStatus() + ", handshakeStatus=" +
+                    res.getHandshakeStatus() + ']');
+
+            if (res.getStatus() == Status.BUFFER_OVERFLOW)
+                appBuf = expandBuffer(appBuf, appBuf.capacity() * 2);
+        }
+        while ((res.getStatus() == OK || res.getStatus() == Status.BUFFER_OVERFLOW) &&
+            (handshakeFinished && res.getHandshakeStatus() == NOT_HANDSHAKING
+                || res.getHandshakeStatus() == NEED_UNWRAP));
+
+        return res;
+    }
+
+    /**
+     * @param res SSL engine result.
+     * @throws SSLException If status is not acceptable.
+     */
+    private void checkStatus(SSLEngineResult res)
+        throws SSLException {
+
+        Status status = res.getStatus();
+
+        if (status != OK && status != CLOSED && status != BUFFER_UNDERFLOW)
+            throw new SSLException("Failed to unwrap incoming data (SSL engine error). Status: " + status);
+    }
+
+    /**
+     * Check status and retry the negotiation process if needed.
+     *
+     * @param res Result.
+     * @throws GridNioException If exception occurred during handshake.
+     * @throws SSLException If failed to process SSL data
+     */
+    private void renegotiateIfNeeded(SSLEngineResult res) throws IgniteCheckedException, SSLException {
+        if (res.getStatus() != CLOSED && res.getStatus() != BUFFER_UNDERFLOW
+            && res.getHandshakeStatus() != NOT_HANDSHAKING) {
+            // Renegotiation required.
+            handshakeStatus = res.getHandshakeStatus();
+
+            if (log.isDebugEnabled())
+                log.debug("Renegotiation requested [status=" + res.getStatus() + ", handshakeStatus = " +
+                    handshakeStatus + ']');
+
+            handshakeFinished = false;
+
+            handshake();
+        }
+    }
+
+    /**
+     * Allocate application buffer.
+     */
+    private ByteBuffer allocateAppBuff() {
+        int netBufSize = sslEngine.getSession().getPacketBufferSize() + 50;
+
+        int appBufSize = Math.max(sslEngine.getSession().getApplicationBufferSize() + 50, netBufSize * 2);
+
+        return ByteBuffer.allocate(appBufSize);
+    }
+
+    /**
+     * Read data from net buffer.
+     */
+    private void readFromNet() {
+        try {
+            inNetBuf.clear();
+
+            ch.read(inNetBuf);
+        }
+        catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 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 {
+        try {
+            ch.write(outNetBuf);
+        }
+        catch (IOException e) {
+            throw new IgniteCheckedException("Failed to write byte to socket.", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 be8a4e8..a05135f 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
@@ -393,6 +393,8 @@ public class GridNioSslFilter extends GridNioFilterAdapter {
     public static ByteBuffer expandBuffer(ByteBuffer original, int cap) {
         ByteBuffer res = ByteBuffer.allocate(cap);
 
+        res.order(ByteOrder.nativeOrder());
+
         original.flip();
 
         res.put(original);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 ac22d74..dc3d870 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
@@ -29,6 +29,7 @@ import java.util.concurrent.locks.*;
 import static javax.net.ssl.SSLEngineResult.*;
 import static javax.net.ssl.SSLEngineResult.HandshakeStatus.*;
 import static javax.net.ssl.SSLEngineResult.Status.*;
+import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*;
 import static org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter.*;
 
 /**
@@ -96,7 +97,14 @@ class GridNioSslHandler extends ReentrantLock {
 
         sslEngine = engine;
 
-        sslEngine.beginHandshake();
+        if (ses.meta(SSL_ENGINE.ordinal()) == null)
+            sslEngine.beginHandshake();
+        else {
+            sslEngine = ses.meta(SSL_ENGINE.ordinal());
+
+            handshakeFinished = true;
+            initHandshakeComplete = true;
+        }
 
         handshakeStatus = sslEngine.getHandshakeStatus();
 
@@ -114,6 +122,8 @@ class GridNioSslHandler extends ReentrantLock {
 
         appBuf = ByteBuffer.allocate(appBufSize);
 
+        appBuf.order(ByteOrder.nativeOrder());
+
         if (log.isDebugEnabled())
             log.debug("Started SSL session [netBufSize=" + netBufSize + ", appBufSize=" + appBufSize + ']');
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 4ca2995..b72299e 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
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.util.ipc.*;
 import org.apache.ignite.internal.util.ipc.shmem.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.nio.*;
+import org.apache.ignite.internal.util.nio.ssl.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.util.worker.*;
@@ -41,6 +42,7 @@ import org.apache.ignite.thread.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
+import javax.net.ssl.*;
 import java.io.*;
 import java.net.*;
 import java.nio.*;
@@ -747,6 +749,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
     };
 
     /**
+     * @return {@code True} if ssl enabled.
+     */
+    private boolean isSslEnabled() {
+        return ignite.configuration().getSslContextFactory() != null;
+    }
+
+    /**
      * Sets address resolver.
      *
      * @param addrRslvr Address resolver.
@@ -1465,6 +1474,26 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     } :
                     null;
 
+                GridNioFilter[] filters;
+
+                if (isSslEnabled()) {
+                    GridNioSslFilter sslFilter =
+                        new GridNioSslFilter(ignite.configuration().getSslContextFactory().create(), log);
+
+                    sslFilter.directMode(true);
+
+                    filters = new GridNioFilter[] {
+                        new GridNioCodecFilter(parser, log, true),
+                        new GridConnectionBytesVerifyFilter(log),
+                        sslFilter
+                    };
+                }
+                else
+                    filters = new GridNioFilter[] {
+                        new GridNioCodecFilter(parser, log, true),
+                        new GridConnectionBytesVerifyFilter(log)
+                    };
+
                 GridNioServer<Message> srvr =
                     GridNioServer.<Message>builder()
                         .address(locHost)
@@ -1482,8 +1511,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         .directMode(true)
                         .metricsListener(metricsLsnr)
                         .writeTimeout(sockWriteTimeout)
-                        .filters(new GridNioCodecFilter(parser, log, true),
-                            new GridConnectionBytesVerifyFilter(log))
+                        .filters(filters)
                         .messageFormatter(msgFormatter)
                         .skipRecoveryPredicate(skipRecoveryPred)
                         .messageQueueSizeListener(queueSizeMonitor)
@@ -1501,6 +1529,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 return srvr;
             }
             catch (IgniteCheckedException e) {
+                if (X.hasCause(e, SSLException.class))
+                    throw new IgniteSpiException("Failed to create SSL context. SSL factory: "
+                        + ignite.configuration().getSslContextFactory() + '.', e);
+
                 lastEx = e;
 
                 if (log.isDebugEnabled())
@@ -1872,7 +1904,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
             }
 
             try {
-                safeHandshake(client, null, node.id(), connTimeout0);
+                safeHandshake(client, null, node.id(), connTimeout0, null);
             }
             catch (HandshakeTimeoutException e) {
                 if (log.isDebugEnabled())
@@ -2019,10 +2051,11 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                     long rcvCnt = -1;
 
+                    GridTuple<SSLEngine> ssl = new GridTuple<>();
                     try {
                         ch.socket().connect(addr, (int)connTimeout);
 
-                        rcvCnt = safeHandshake(ch, recoveryDesc, node.id(), connTimeout0);
+                        rcvCnt = safeHandshake(ch, recoveryDesc, node.id(), connTimeout0, ssl);
 
                         if (rcvCnt == -1)
                             return null;
@@ -2037,6 +2070,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                         meta.put(NODE_ID_META, node.id());
 
+                        if (isSslEnabled()) {
+                            assert ssl != null;
+                            assert ssl.get() != null;
+
+                            meta.put(GridNioSessionMetaKey.SSL_ENGINE.ordinal(), ssl.get());
+                        }
                         if (recoveryDesc != null) {
                             recoveryDesc.onHandshake(rcvCnt);
 
@@ -2161,6 +2200,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      * @param recovery Recovery descriptor if use recovery handshake, otherwise {@code null}.
      * @param rmtNodeId Remote node.
      * @param timeout Timeout for handshake.
+     * @param ssl SSL engine if used cryptography, otherwise {@code null}.
      * @throws IgniteCheckedException If handshake failed or wasn't completed withing timeout.
      * @return Handshake response.
      */
@@ -2169,7 +2209,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         T client,
         @Nullable GridNioRecoveryDescriptor recovery,
         UUID rmtNodeId,
-        long timeout
+        long timeout,
+        @Nullable GridTuple<SSLEngine> ssl
     ) throws IgniteCheckedException {
         HandshakeTimeoutObject<T> obj = new HandshakeTimeoutObject<>(client, U.currentTimeMillis() + timeout);
 
@@ -2186,15 +2227,53 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 boolean success = false;
 
                 try {
-                    ByteBuffer buf = ByteBuffer.allocate(17);
+                    BlockingSslHandler sslHnd = null;
+
+                    ByteBuffer buf;
+
+                    if (isSslEnabled()) {
+                        GridFutureAdapter<ByteBuffer> handFut = new GridFutureAdapter<>();
 
-                    for (int i = 0; i < 17; ) {
-                        int read = ch.read(buf);
+                        SSLEngine sslEngine = ignite.configuration().getSslContextFactory()
+                            .create().createSSLEngine();
 
-                        if (read == -1)
-                            throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
+                        sslEngine.setUseClientMode(true);
 
-                        i += read;
+                        sslHnd = new BlockingSslHandler(sslEngine, ch, handFut, log);
+
+                        if (!sslHnd.handshake())
+                            throw new IgniteCheckedException("SSL handshake isn't completed.");
+
+                        ssl.set(sslEngine);
+
+                        ByteBuffer handBuff = handFut.get();
+
+                        if (handBuff.limit() < 17) {
+                            buf = ByteBuffer.allocate(1000);
+
+                            int read = ch.read(buf);
+
+                            if (read == -1)
+                                throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
+
+                            buf.flip();
+
+                            buf = sslHnd.decode(buf);
+                        }
+                        else
+                            buf = handBuff;
+                    }
+                    else {
+                        buf = ByteBuffer.allocate(17);
+
+                        for (int i = 0; i < 17; ) {
+                            int read = ch.read(buf);
+
+                            if (read == -1)
+                                throw new IgniteCheckedException("Failed to read remote node ID (connection closed).");
+
+                            i += read;
+                        }
                     }
 
                     UUID rmtNodeId0 = U.bytesToUuid(buf.array(), 1);
@@ -2205,7 +2284,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     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(),
@@ -2225,30 +2310,61 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
 
                         buf.flip();
 
-                        ch.write(buf);
+                        if (isSslEnabled()) {
+                            assert sslHnd != null;
+
+                            ch.write(sslHnd.encrypt(buf));
+                        }
+                        else
+                            ch.write(buf);
+                    }
+                    else {
+                        if (isSslEnabled()) {
+                            assert sslHnd != null;
+
+                            ch.write(sslHnd.encrypt(ByteBuffer.wrap(nodeIdMsg.nodeIdBytesWithType)));
+                        }
+                        else
+                            ch.write(ByteBuffer.wrap(nodeIdMsg.nodeIdBytesWithType));
                     }
-                    else
-                        ch.write(ByteBuffer.wrap(nodeIdMsg.nodeIdBytesWithType));
 
                     if (recovery != null) {
                         if (log.isDebugEnabled())
                             log.debug("Waiting for handshake [rmtNode=" + rmtNodeId + ']');
 
-                        buf = ByteBuffer.allocate(9);
+                        if (isSslEnabled()) {
+                            assert sslHnd != null;
 
-                        buf.order(ByteOrder.nativeOrder());
+                            buf = ByteBuffer.allocate(1000);
+
+                            buf.order(ByteOrder.nativeOrder());
 
-                        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).");
 
-                            i += read;
-                        }
+                            buf.flip();
 
-                        rcvCnt = buf.getLong(1);
+                            rcvCnt = sslHnd.decode(buf).getLong(1);
+                        } else {
+                            buf = ByteBuffer.allocate(9);
+
+                            buf.order(ByteOrder.nativeOrder());
+
+                            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).");
+
+                                i += read;
+                            }
+
+                            rcvCnt = buf.getLong(1);
+                        }
 
                         if (log.isDebugEnabled())
                             log.debug("Received handshake message [rmtNode=" + rmtNodeId + ", rcvCnt=" + rcvCnt + ']');

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 a5ae5a9..97e910a 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
@@ -3975,7 +3975,10 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             for (port = spi.locPort; port < spi.locPort + spi.locPortRange; port++) {
                 try {
-                    srvrSock = new ServerSocket(port, 0, spi.locHost);
+                    if (spi.isSslEnabled())
+                        srvrSock = spi.sslSrvSocketFactory.createServerSocket(port, 0, spi.locHost);
+                    else
+                        srvrSock = new ServerSocket(port, 0, spi.locHost);
 
                     break;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 7663fe6..b627010 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
@@ -40,6 +40,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.spi.discovery.tcp.messages.*;
 import org.jetbrains.annotations.*;
 
+import javax.net.ssl.*;
 import java.io.*;
 import java.net.*;
 import java.util.*;
@@ -305,6 +306,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     /** Node authenticator. */
     protected DiscoverySpiNodeAuthenticator nodeAuth;
 
+    /** SSL server socket factory. */
+    protected SSLServerSocketFactory sslSrvSocketFactory;
+
+    /** SSL socket factory. */
+    protected SSLSocketFactory sslSocketFactory;
+
     /** Context initialization latch. */
     @GridToStringExclude
     private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
@@ -1106,7 +1113,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         assert addr != null;
 
-        Socket sock = new Socket();
+        Socket sock;
+
+        if (isSslEnabled())
+            sock = sslSocketFactory.createSocket();
+        else
+            sock = new Socket();
 
         sock.bind(new InetSocketAddress(locHost, 0));
 
@@ -1578,6 +1590,19 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         assertParameter(threadPri > 0, "threadPri > 0");
         assertParameter(statsPrintFreq >= 0, "statsPrintFreq >= 0");
 
+        if (isSslEnabled()) {
+            try {
+                SSLContext sslCtx = ignite().configuration().getSslContextFactory().create();
+
+                sslSocketFactory = sslCtx.getSocketFactory();
+                sslSrvSocketFactory = sslCtx.getServerSocketFactory();
+            }
+            catch (IgniteException e) {
+                throw new IgniteSpiException("Failed to create SSL context. SSL factory: "
+                    + ignite.configuration().getSslContextFactory(), e);
+            }
+        }
+
         try {
             locHost = U.resolveLocalHost(locAddr);
         }
@@ -1695,6 +1720,13 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     }
 
     /**
+     * @return {@code True} if ssl enabled.
+     */
+    boolean isSslEnabled() {
+        return ignite().configuration().getSslContextFactory() != null;
+    }
+
+    /**
      * <strong>FOR TEST ONLY!!!</strong>
      */
     public int clientWorkerCount() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java b/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
new file mode 100644
index 0000000..bf09541
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/ssl/SslContextFactory.java
@@ -0,0 +1,455 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ssl;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import javax.cache.configuration.*;
+import javax.net.ssl.*;
+import java.io.*;
+import java.security.*;
+import java.security.cert.*;
+import java.util.*;
+
+/**
+ * This SSL context factory that provides ssl context configuration with specified key
+ * and trust stores.
+ * <p>
+ * In some cases it is useful to disable certificate validation of client side (e.g. when connecting
+ * to a server with self-signed certificate). This can be achieved by setting a disabled trust manager
+ * to this factory, which can be obtained by {@link #getDisabledTrustManager()} method:
+ * <pre>
+ *     SslContextFactory factory = new SslContextFactory();
+ *     factory.setTrustManagers(SslContextFactory.getDisabledTrustManager());
+ *     // Rest of initialization.
+ * </pre>
+ */
+public class SslContextFactory implements Factory<SSLContext> {
+    /** Default key store type. */
+    public static final String DFLT_STORE_TYPE = "JKS";
+
+    /** Default SSL protocol. */
+    public static final String DFLT_SSL_PROTOCOL = "TLS";
+
+    /** Default key manager algorithm. */
+    public static final String DFLT_KEY_ALGORITHM = "SunX509";
+
+    /** SSL protocol. */
+    private String proto = DFLT_SSL_PROTOCOL;
+
+    /** Key manager algorithm. */
+    private String keyAlgorithm = DFLT_KEY_ALGORITHM;
+
+    /** Key store type. */
+    private String keyStoreType = DFLT_STORE_TYPE;
+
+    /** Path to key store file */
+    private String keyStoreFilePath;
+
+    /** Key store password */
+    private char[] keyStorePwd;
+
+    /** Trust store type. */
+    private String trustStoreType = DFLT_STORE_TYPE;
+
+    /** Path to trust store. */
+    private String trustStoreFilePath;
+
+    /** Trust store password */
+    private char[] trustStorePwd;
+
+    /** Trust managers. */
+    private TrustManager[] trustMgrs;
+
+    /**
+     * Gets key store type used for context creation.
+     *
+     * @return Key store type.
+     */
+    public String getKeyStoreType() {
+        return keyStoreType;
+    }
+
+    /**
+     * Sets key store type used in context initialization. If not provided, {@link #DFLT_STORE_TYPE} will
+     * be used.
+     *
+     * @param keyStoreType Key store type.
+     */
+    public void setKeyStoreType(String keyStoreType) {
+        A.notNull(keyStoreType, "keyStoreType");
+
+        this.keyStoreType = keyStoreType;
+    }
+
+    /**
+     * Gets trust store type used for context creation.
+     *
+     * @return trust store type.
+     */
+    public String getTrustStoreType() {
+        return trustStoreType;
+    }
+
+    /**
+     * Sets trust store type used in context initialization. If not provided, {@link #DFLT_STORE_TYPE} will
+     * be used.
+     *
+     * @param trustStoreType Trust store type.
+     */
+    public void setTrustStoreType(String trustStoreType) {
+        A.notNull(trustStoreType, "trustStoreType");
+
+        this.trustStoreType = trustStoreType;
+    }
+
+    /**
+     * Gets protocol for secure transport.
+     *
+     * @return SSL protocol name.
+     */
+    public String getProtocol() {
+        return proto;
+    }
+
+    /**
+     * Sets protocol for secure transport. If not specified, {@link #DFLT_SSL_PROTOCOL} will be used.
+     *
+     * @param proto SSL protocol name.
+     */
+    public void setProtocol(String proto) {
+        A.notNull(proto, "proto");
+
+        this.proto = proto;
+    }
+
+    /**
+     * Gets algorithm that will be used to create a key manager. If not specified, {@link #DFLT_KEY_ALGORITHM}
+     * will be used.
+     *
+     * @return Key manager algorithm.
+     */
+    public String getKeyAlgorithm() {
+        return keyAlgorithm;
+    }
+
+    /**
+     * Sets key manager algorithm that will be used to create a key manager. Notice that in most cased default value
+     * suites well, however, on Android platform this value need to be set to <tt>X509<tt/>.
+     *
+     * @param keyAlgorithm Key algorithm name.
+     */
+    public void setKeyAlgorithm(String keyAlgorithm) {
+        A.notNull(keyAlgorithm, "keyAlgorithm");
+
+        this.keyAlgorithm = keyAlgorithm;
+    }
+
+    /**
+     * Gets path to the key store file.
+     *
+     * @return Path to key store file.
+     */
+    public String getKeyStoreFilePath() {
+        return keyStoreFilePath;
+    }
+
+    /**
+     * Sets path to the key store file. This is a mandatory parameter since
+     * ssl context could not be initialized without key manager.
+     *
+     * @param keyStoreFilePath Path to key store file.
+     */
+    public void setKeyStoreFilePath(String keyStoreFilePath) {
+        A.notNull(keyStoreFilePath, "keyStoreFilePath");
+
+        this.keyStoreFilePath = keyStoreFilePath;
+    }
+
+    /**
+     * Gets key store password.
+     *
+     * @return Key store password.
+     */
+    public char[] getKeyStorePassword() {
+        return keyStorePwd;
+    }
+
+    /**
+     * Sets key store password.
+     *
+     * @param keyStorePwd Key store password.
+     */
+    public void setKeyStorePassword(char[] keyStorePwd) {
+        A.notNull(keyStorePwd, "keyStorePwd");
+
+        this.keyStorePwd = keyStorePwd;
+    }
+
+    /**
+     * Gets path to the trust store file.
+     *
+     * @return Path to the trust store file.
+     */
+    public String getTrustStoreFilePath() {
+        return trustStoreFilePath;
+    }
+
+    /**
+     * Sets path to the trust store file. This is an optional parameter,
+     * however one of the {@code setTrustStoreFilePath(String)}, {@link #setTrustManagers(TrustManager[])}
+     * properties must be set.
+     *
+     * @param trustStoreFilePath Path to the trust store file.
+     */
+    public void setTrustStoreFilePath(String trustStoreFilePath) {
+        this.trustStoreFilePath = trustStoreFilePath;
+    }
+
+    /**
+     * Gets trust store password.
+     *
+     * @return Trust store password.
+     */
+    public char[] getTrustStorePassword() {
+        return trustStorePwd;
+    }
+
+    /**
+     * Sets trust store password.
+     *
+     * @param trustStorePwd Trust store password.
+     */
+    public void setTrustStorePassword(char[] trustStorePwd) {
+        this.trustStorePwd = trustStorePwd;
+    }
+
+    /**
+     * Gets pre-configured trust managers.
+     *
+     * @return Trust managers.
+     */
+    public TrustManager[] getTrustManagers() {
+        return trustMgrs;
+    }
+
+    /**
+     * Sets pre-configured trust managers. This is an optional parameter,
+     * however one of the {@link #setTrustStoreFilePath(String)}, {@code #setTrustManagers(TrustManager[])}
+     *
+     * @param trustMgrs Pre-configured trust managers.
+     */
+    public void setTrustManagers(TrustManager... trustMgrs) {
+        this.trustMgrs = trustMgrs;
+    }
+
+    /**
+     * Returns an instance of trust manager that will always succeed regardless of certificate provided.
+     *
+     * @return Trust manager instance.
+     */
+    public static TrustManager getDisabledTrustManager() {
+        return new DisabledX509TrustManager();
+    }
+
+    /**
+     * Creates SSL context based on factory settings.
+     *
+     * @return Initialized SSL context.
+     * @throws SSLException If SSL context could not be created.
+     */
+    private SSLContext createSslContext() throws SSLException {
+        checkParameters();
+
+        try {
+            KeyManagerFactory keyMgrFactory = KeyManagerFactory.getInstance(keyAlgorithm);
+
+            KeyStore keyStore = loadKeyStore(keyStoreType, keyStoreFilePath, keyStorePwd);
+
+            keyMgrFactory.init(keyStore, keyStorePwd);
+
+            TrustManager[] mgrs = trustMgrs;
+
+            if (mgrs == null) {
+                TrustManagerFactory trustMgrFactory = TrustManagerFactory.getInstance(keyAlgorithm);
+
+                KeyStore trustStore = loadKeyStore(trustStoreType, trustStoreFilePath, trustStorePwd);
+
+                trustMgrFactory.init(trustStore);
+
+                mgrs = trustMgrFactory.getTrustManagers();
+            }
+
+            SSLContext ctx = SSLContext.getInstance(proto);
+
+            ctx.init(keyMgrFactory.getKeyManagers(), mgrs, null);
+
+            return ctx;
+        }
+        catch (GeneralSecurityException e) {
+            throw new SSLException("Failed to initialize SSL context " + parameters(), e);
+        }
+    }
+
+    /**
+     * Builds human-readable string with factory parameters.
+     *
+     * @return Parameters string.
+     */
+    private String parameters() {
+        StringBuilder buf = new StringBuilder("[keyStoreType=").append(keyStoreType);
+
+        buf.append(", proto=").append(proto).append(", keyStoreFile=").append(keyStoreFilePath);
+
+        if (trustMgrs != null)
+            buf.append(", trustMgrs=").append(Arrays.toString(trustMgrs));
+        else
+            buf.append(", trustStoreFile=").append(trustStoreFilePath);
+
+        buf.append(']');
+
+        return buf.toString();
+    }
+
+    /**
+     * Checks that all required parameters are set.
+     *
+     * @throws SSLException If any of required parameters is missing.
+     */
+    private void checkParameters() throws SSLException {
+        assert keyStoreType != null;
+        assert proto != null;
+
+        checkNullParameter(keyStoreFilePath, "keyStoreFilePath");
+        checkNullParameter(keyStorePwd, "keyStorePwd");
+
+        if (trustMgrs == null) {
+            if (trustStoreFilePath == null)
+                throw new SSLException("Failed to initialize SSL context (either trustStoreFilePath or " +
+                    "trustManagers must be provided)");
+            else
+                checkNullParameter(trustStorePwd, "trustStorePwd");
+        }
+    }
+
+    /**
+     * @param param Value.
+     * @param name Name.
+     * @throws SSLException If {@code null}.
+     */
+    private void checkNullParameter(Object param, String name) throws SSLException {
+        if (param == null)
+            throw new SSLException("Failed to initialize SSL context (parameter cannot be null): " + name);
+    }
+
+    /**
+     * By default, this method simply opens a raw file input stream. Subclasses may override this method
+     * if some specific location should be handled (this may be a case for Android users).
+     *
+     * @param filePath Path to the file.
+     * @return Opened input stream.
+     * @throws IOException If stream could not be opened.
+     */
+    protected InputStream openFileInputStream(String filePath) throws IOException {
+        return new FileInputStream(filePath);
+    }
+
+    /**
+     * Loads key store with configured parameters.
+     *
+     * @param keyStoreType Type of key store.
+     * @param storeFilePath Path to key store file.
+     * @param keyStorePwd Store password.
+     * @return Initialized key store.
+     * @throws SSLException If key store could not be initialized.
+     */
+    private KeyStore loadKeyStore(String keyStoreType, String storeFilePath, char[] keyStorePwd) throws SSLException {
+        InputStream input = null;
+
+        try {
+            KeyStore keyStore = KeyStore.getInstance(keyStoreType);
+
+            input = openFileInputStream(storeFilePath);
+
+            keyStore.load(input, keyStorePwd);
+
+            return keyStore;
+        }
+        catch (GeneralSecurityException e) {
+            throw new SSLException("Failed to initialize key store (security exception occurred) [type=" +
+                keyStoreType + ", keyStorePath=" + storeFilePath + ']', e);
+        }
+        catch (FileNotFoundException e) {
+            throw new SSLException("Failed to initialize key store (key store file was not found): [path=" +
+                storeFilePath + ", msg=" + e.getMessage() + ']');
+        }
+        catch (IOException e) {
+            throw new SSLException("Failed to initialize key store (I/O error occurred): " + storeFilePath, e);
+        }
+        finally {
+            if (input != null) {
+                try {
+                    input.close();
+                }
+                catch (IOException ignored) {
+                }
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    public String toString() {
+        return getClass().getSimpleName() + parameters();
+    }
+
+    /**
+     * Disabled trust manager, will skip all certificate checks.
+     */
+    private static class DisabledX509TrustManager implements X509TrustManager {
+        /** Empty certificate array. */
+        private static final X509Certificate[] CERTS = new X509Certificate[0];
+
+        /** {@inheritDoc} */
+        @Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s)
+            throws CertificateException {
+            // No-op, all clients are trusted.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s)
+            throws CertificateException {
+            // No-op, all servers are trusted.
+        }
+
+        /** {@inheritDoc} */
+        @Override public X509Certificate[] getAcceptedIssuers() {
+            return CERTS;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public SSLContext create() {
+        try {
+            return createSslContext();
+        }
+        catch (SSLException e) {
+            throw new IgniteException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/main/java/org/apache/ignite/ssl/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/ssl/package-info.java b/modules/core/src/main/java/org/apache/ignite/ssl/package-info.java
new file mode 100644
index 0000000..7be1910
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/ssl/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 classes for working with SSL.
+ */
+package org.apache.ignite.ssl;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
index bfed977..13ed880 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.spi.communication;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -59,6 +60,9 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
     /** */
     private static final Object mux = new Object();
 
+    /** */
+    protected boolean useSsl = false;
+
     /**
      *
      */
@@ -299,6 +303,15 @@ public abstract class GridAbstractCommunicationSelfTest<T extends CommunicationS
 
             rsrcs.inject(spi);
 
+            if (useSsl) {
+                IgniteMock ignite = GridTestUtils.getFieldValue(spi, IgniteSpiAdapter.class, "ignite");
+
+                IgniteConfiguration cfg = ignite.configuration()
+                    .setSslContextFactory(GridTestUtils.sslFactory());
+
+                ignite.setStaticCfg(cfg);
+            }
+
             spi.setListener(new MessageListener(rsrcs.getNodeId()));
 
             node.setAttributes(spi.getNodeAttributes());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiSslSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiSslSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiSslSelfTest.java
new file mode 100644
index 0000000..e5f8bb3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiSslSelfTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.communication.tcp;
+
+import org.apache.ignite.testframework.junits.spi.*;
+
+/**
+ *
+ */
+@GridSpiTest(spi = TcpCommunicationSpi.class, group = "Communication SPI")
+public class GridTcpCommunicationSpiSslSelfTest extends GridTcpCommunicationSpiAbstractTest {
+    /** */
+    public GridTcpCommunicationSpiSslSelfTest() {
+        super(false);
+
+        this.useSsl = true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean tcpNoDelay() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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..4bdcf0a 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
@@ -19,6 +19,7 @@ package org.apache.ignite.spi.discovery;
 
 import mx4j.tools.adaptor.http.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.spi.*;
@@ -58,6 +59,9 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
     private static final String TEST_ATTRIBUTE_NAME = "test.node.prop";
 
     /** */
+    protected boolean useSsl = false;
+
+    /** */
     protected AbstractDiscoverySelfTest() {
         super(false);
     }
@@ -394,6 +398,15 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
 
                 GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "spiCtx", ctx);
 
+                if (useSsl) {
+                    IgniteMock ignite = GridTestUtils.getFieldValue(spi, IgniteSpiAdapter.class, "ignite");
+
+                    IgniteConfiguration cfg = ignite.configuration()
+                        .setSslContextFactory(GridTestUtils.sslFactory());
+
+                    ignite.setStaticCfg(cfg);
+                }
+
                 spi.spiStart(getTestGridName() + i);
 
                 spis.add(spi);

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSelfTest.java
new file mode 100644
index 0000000..314ca01
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSelfTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.discovery.tcp;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.testframework.*;
+
+/**
+ * Test for {@link TcpDiscoverySpi} with SSL.
+ */
+public class TcpDiscoverySslSelfTest extends TcpDiscoverySelfTest {
+    /**
+     * @throws Exception If fails.
+     */
+    public TcpDiscoverySslSelfTest() throws Exception {
+        super();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setSslContextFactory(GridTestUtils.sslFactory());
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index d03d327..964f680 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -32,10 +32,12 @@ import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.ssl.*;
 import org.apache.ignite.testframework.config.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.*;
+import javax.cache.configuration.*;
 import javax.net.ssl.*;
 import java.io.*;
 import java.lang.annotation.*;
@@ -1338,6 +1340,24 @@ public final class GridTestUtils {
         return factory;
     }
 
+
+    /**
+     * Creates test-purposed SSL context factory from test key store with disabled trust manager.
+     *
+     * @return SSL context factory used in test.
+     */
+    public static Factory<SSLContext> sslFactory() {
+        SslContextFactory factory = new SslContextFactory();
+
+        factory.setKeyStoreFilePath(
+            U.resolveIgnitePath(GridTestProperties.getProperty("ssl.keystore.path")).getAbsolutePath());
+        factory.setKeyStorePassword(GridTestProperties.getProperty("ssl.keystore.password").toCharArray());
+
+        factory.setTrustManagers(GridSslBasicContextFactory.getDisabledTrustManager());
+
+        return factory;
+    }
+
     /**
      * @param o1 Object 1.
      * @param o2 Object 2.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index 2451f59..1471faa 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -52,6 +52,9 @@ public class IgniteMock implements Ignite {
     /** */
     private final String home;
 
+    /** */
+    private IgniteConfiguration staticCfg;
+
     /**
      * Mock values
      *
@@ -84,6 +87,9 @@ public class IgniteMock implements Ignite {
 
     /** {@inheritDoc} */
     @Override public IgniteConfiguration configuration() {
+        if (staticCfg != null)
+            return staticCfg;
+
         IgniteConfiguration cfg = new IgniteConfiguration();
 
         cfg.setMarshaller(marshaller);
@@ -298,4 +304,11 @@ public class IgniteMock implements Ignite {
     @Override public <K> Affinity<K> affinity(String cacheName) {
         return null;
     }
+
+    /**
+     * @param staticCfg Configuration.
+     */
+    public void setStaticCfg(IgniteConfiguration staticCfg) {
+        this.staticCfg = staticCfg;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1fd31892/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 6f59f14..15797aa 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
@@ -60,6 +60,9 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(TcpDiscoveryRestartTest.class));
         suite.addTest(new TestSuite(TcpDiscoveryMultiThreadedTest.class));
 
+        // SSL.
+        suite.addTest(new TestSuite(TcpDiscoverySslSelfTest.class));
+
         return suite;
     }
 }


[15/39] incubator-ignite git commit: minor

Posted by ak...@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-gg-10576
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. -->


[27/39] incubator-ignite git commit: Moved changes from mater for test with 150 clients.

Posted by ak...@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-gg-10576
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);


[30/39] incubator-ignite git commit: Added byteOrder and directBuffer flag to GridNioSslHandler.

Posted by ak...@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-gg-10576
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();


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

Posted by ak...@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-gg-10576
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
----------------------------------------------------------------------


[12/39] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-1.3.3' into ignite-1.3.3

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

Branch: refs/heads/ignite-gg-10576
Commit: a749ed80a669c1d770e918f982ec183097eb7783
Parents: f6b3b3d 960164a
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jul 22 13:22:08 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jul 22 13:22:08 2015 +0300

----------------------------------------------------------------------
 modules/core/src/main/java/org/apache/ignite/Ignite.java      | 2 +-
 .../internal/managers/discovery/GridDiscoveryManager.java     | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[25/39] incubator-ignite git commit: review

Posted by ak...@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-gg-10576
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();