You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/05/14 21:54:39 UTC

[01/47] incubator-ignite git commit: # ignite-10151 Change FlatSpec to FunSpec in scalatests.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-889 41f5bb0b5 -> 93ba805a2


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
index 320a6bb..db07543 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala
@@ -34,7 +34,7 @@ import scala.collection._
 /**
  * Unit test for 'tasks' command.
  */
-class VisorTasksCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAll {
+class VisorTasksCommandSpec extends FunSpec with Matchers with BeforeAndAfterAll {
     /**
      * Open visor and execute several tasks before all tests.
      */
@@ -103,78 +103,78 @@ class VisorTasksCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAl
         Ignition.stopAll(false)
     }
 
-    behavior of "A 'tasks' visor command"
-
-    it should "print tasks when called w/o arguments" in {
-        visor.tasks()
-    }
+    describe("A 'tasks' visor command") {
+        it("should print tasks when called w/o arguments") {
+            visor.tasks()
+        }
 
-    it should "print error message with incorrect argument" in {
-        visor.tasks("-xx")
-    }
+        it("should print error message with incorrect argument") {
+            visor.tasks("-xx")
+        }
 
-    it should "print task summary when called for specific task" in {
-        visor.tasks("-n=@t1")
-    }
+        it("should print task summary when called for specific task") {
+            visor.tasks("-n=@t1")
+        }
 
-    it should "print execution when called for specific execution" in {
-        visor.tasks("-e=@e1")
-    }
+        it("should print execution when called for specific execution") {
+            visor.tasks("-e=@e1")
+        }
 
-    it should "print all tasks" in {
-        visor.tasks("-l")
-    }
+        it("should print all tasks") {
+            visor.tasks("-l")
+        }
 
-    it should "print all tasks and executions" in {
-        visor.tasks("-l -a")
-    }
+        it("should print all tasks and executions") {
+            visor.tasks("-l -a")
+        }
 
-    it should "print tasks that started during last 5 seconds" in {
-        visor.tasks("-l -t=5s")
-    }
+        it("should print tasks that started during last 5 seconds") {
+            visor.tasks("-l -t=5s")
+        }
 
-    it should "print error message about invalid time period" in {
-        visor.tasks("-l -t=x2s")
-    }
+        it("should print error message about invalid time period") {
+            visor.tasks("-l -t=x2s")
+        }
 
-    it should "print error message about negative time period" in {
-        visor.tasks("-l -t=-10s")
-    }
+        it("should print error message about negative time period") {
+            visor.tasks("-l -t=-10s")
+        }
 
-    it should "print error message about invalid time period specification" in {
-        visor.tasks("-l -t=10x")
-    }
+        it("should print error message about invalid time period specification") {
+            visor.tasks("-l -t=10x")
+        }
 
-    it should "print task summary for the first task" in {
-        visor.tasks("-n=TestTask1")
-    }
+        it("should print task summary for the first task") {
+            visor.tasks("-n=TestTask1")
+        }
 
-    it should "print task summary and executions for the first task" in {
-        visor.tasks("-n=TestTask1 -a")
-    }
+        it("should print task summary and executions for the first task") {
+            visor.tasks("-n=TestTask1 -a")
+        }
 
-    it should "print list of tasks grouped by nodes" in {
-        visor.tasks("-g")
-    }
+        it("should print list of tasks grouped by nodes") {
+            visor.tasks("-g")
+        }
 
-    it should "print list of tasks that started during last 5 minutes grouped by nodes" in {
-        visor.tasks("-g -t=5m")
-    }
+        it("should print list of tasks that started during last 5 minutes grouped by nodes") {
+            visor.tasks("-g -t=5m")
+        }
 
-    it should "print list of tasks grouped by hosts" in {
-        visor.tasks("-h")
-    }
+        it("should print list of tasks grouped by hosts") {
+            visor.tasks("-h")
+        }
 
-    it should "print list of tasks that started during last 5 minutes grouped by hosts" in {
-        visor.tasks("-h -t=5m")
-    }
+        it("should print list of tasks that started during last 5 minutes grouped by hosts") {
+            visor.tasks("-h -t=5m")
+        }
 
-    it should "print list of tasks filtered by substring" in {
-        visor.tasks("-s=TestTask")
-    }
+        it("should print list of tasks filtered by substring") {
+            visor.tasks("-s=TestTask")
+        }
 
-    it should "print list of tasks and executions filtered by substring" in {
-        visor.tasks("-s=TestTask -a")
+        it("should print list of tasks and executions filtered by substring") {
+            visor.tasks("-s=TestTask -a")
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala
index 3a3b6e5..515cf67 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommandSpec.scala
@@ -24,39 +24,39 @@ import org.apache.ignite.visor.commands.top.VisorTopologyCommand._
  * Unit test for topology commands.
  */
 class VisorTopologyCommandSpec extends VisorRuntimeBaseSpec(2) {
-    behavior of "A 'top' visor command"
+    describe("A 'top' visor command") {
+        it("should advise to connect") {
+            closeVisorQuiet()
 
-    it should "advise to connect" in {
-        closeVisorQuiet()
+            visor.top()
+        }
 
-        visor.top()
-    }
-
-    it should "print error message" in {
-        visor.top("-cc=eq1x")
-    }
+        it("should print error message") {
+            visor.top("-cc=eq1x")
+        }
 
-    it should "print full topology" in {
-        visor.top()
-    }
+        it("should print full topology") {
+            visor.top()
+        }
 
-    it should "print nodes with idle time greater than 12000ms" in {
-        visor.top("-it=gt12000")
-    }
+        it("should print nodes with idle time greater than 12000ms") {
+            visor.top("-it=gt12000")
+        }
 
-    it should "print nodes with idle time greater than 12sec" in {
-        visor.top("-it=gt12s")
-    }
+        it("should print nodes with idle time greater than 12sec") {
+            visor.top("-it=gt12s")
+        }
 
-    it should "print full information about all nodes" in {
-        visor.top("-a")
-    }
+        it("should print full information about all nodes") {
+            visor.top("-a")
+        }
 
-    it should "print information about nodes on localhost" in {
-        visor.top("-h=192.168.1.100")
-    }
+        it("should print information about nodes on localhost") {
+            visor.top("-h=192.168.1.100")
+        }
 
-    it should "print full information about nodes on localhost" in {
-        visor.top("-h=localhost")
+        it("should print full information about nodes on localhost") {
+            visor.top("-h=localhost")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala
index 969fb94..1a4bc3e 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommandSpec.scala
@@ -25,22 +25,22 @@ import org.apache.ignite.visor.commands.vvm.VisorVvmCommand._
 /**
  * Unit test for 'vvm' command.
  */
-class VisorVvmCommandSpec extends FlatSpec with Matchers {
-    behavior of "A 'vvm' visor command"
+class VisorVvmCommandSpec extends FunSpec with Matchers {
+    describe("A 'vvm' visor command") {
+        it("should print error message when not connected") {
+            visor.vvm()
+        }
 
-    it should "print error message when not connected" in {
-        visor.vvm()
-    }
-
-    it should "open VisualVM connected to all nodes skipping ones with disabled JMX" in {
-        visor.open("-d")
-        visor.vvm()
-        visor.close()
-    }
+        it("should open VisualVM connected to all nodes skipping ones with disabled JMX") {
+            visor.open("-d")
+            visor.vvm()
+            visor.close()
+        }
 
-    it should "open VisualVM connected to first node if it has JMX enabled" in {
-        visor.open("-d")
-        visor.vvm("-id8=@n1")
-        visor.close()
+        it("should open VisualVM connected to first node if it has JMX enabled") {
+            visor.open("-d")
+            visor.vvm("-id8=@n1")
+            visor.close()
+        }
     }
 }


[38/47] incubator-ignite git commit: # IGNITE-894 Move @InjectRecursively to private package.

Posted by ag...@apache.org.
# IGNITE-894 Move @InjectRecursively to private package.


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

Branch: refs/heads/ignite-889
Commit: 27b559e3aace024f19b411a8b377858c9e0456ab
Parents: 3abd25e
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 19:10:03 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 19:10:03 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsJobImpl.java   |  1 +
 .../processors/resource/GridResourceIoc.java    |  1 -
 .../processors/resource/InjectRecursively.java  | 30 ++++++++++++++++++++
 .../ignite/resources/InjectRecursively.java     | 30 --------------------
 4 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index b5a336e..8f2cfd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.igfs.mapreduce.*;
+import org.apache.ignite.internal.processors.resource.*;
 import org.apache.ignite.resources.*;
 
 import java.io.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index 55c0d3b..ce19664 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.resources.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
new file mode 100644
index 0000000..383ee03
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.resource;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that resource injection should be performed for field value too.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface InjectRecursively {
+    // No-op.
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/27b559e3/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
deleted file mode 100644
index 60d1bd7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.resources;
-
-import java.lang.annotation.*;
-
-/**
- * Indicates that resource injection should be performed for field value too.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface InjectRecursively {
-    // No-op.
-}


[33/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-894

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-894


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

Branch: refs/heads/ignite-889
Commit: 34a9b315b2dc09b771e924e0970ecd9b1696144c
Parents: 9ea2dbd 8246788
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 17:20:26 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 17:20:26 2015 +0300

----------------------------------------------------------------------
 bin/include/functions.sh                        |    2 +-
 .../processors/cache/GridCacheMvccManager.java  |    4 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |    9 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   32 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   27 +
 .../cache/distributed/dht/GridDhtTxMapping.java |    2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   81 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   25 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |    4 +-
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 .../distributed/near/GridNearLockFuture.java    |    5 -
 .../near/GridNearOptimisticTxPrepareFuture.java |  779 +++++++++++++
 .../GridNearPessimisticTxPrepareFuture.java     |  349 ++++++
 .../cache/distributed/near/GridNearTxLocal.java |   84 +-
 .../near/GridNearTxPrepareFuture.java           | 1050 ------------------
 .../near/GridNearTxPrepareFutureAdapter.java    |  226 ++++
 .../cache/transactions/IgniteInternalTx.java    |    4 +-
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../cache/transactions/IgniteTxHandler.java     |   68 +-
 .../transactions/IgniteTxLocalAdapter.java      |    2 +-
 .../cache/transactions/IgniteTxManager.java     |   12 +-
 .../GridCacheAbstractFailoverSelfTest.java      |    8 +-
 .../GridCacheAbstractNodeRestartSelfTest.java   |   11 +-
 .../distributed/GridCacheLockAbstractTest.java  |    2 -
 .../distributed/IgniteTxGetAfterStopTest.java   |  131 +++
 ...achePartitionedNearDisabledLockSelfTest.java |   47 +
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |    4 +-
 ...idCacheAtomicReplicatedFailoverSelfTest.java |    6 +
 .../GridCachePartitionedTxSalvageSelfTest.java  |   25 +-
 .../GridCacheReplicatedFailoverSelfTest.java    |    6 +
 .../GridCacheReplicatedLockSelfTest.java        |    5 +
 .../GridCacheReplicatedNodeRestartSelfTest.java |   80 ++
 .../discovery/tcp/TcpDiscoveryRestartTest.java  |  199 ++++
 .../IgniteCacheFailoverTestSuite.java           |   10 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |    8 +-
 .../testsuites/IgniteCacheTestSuite2.java       |    1 +
 .../testsuites/IgniteCacheTestSuite3.java       |    2 +
 37 files changed, 2029 insertions(+), 1287 deletions(-)
----------------------------------------------------------------------



[41/47] incubator-ignite git commit: # ignite-sprint-5 - fixed comment.

Posted by ag...@apache.org.
# ignite-sprint-5 - fixed comment.


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

Branch: refs/heads/ignite-889
Commit: 7e599b61d57754623de46aa4dd8407871a36f08c
Parents: d21bc30
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Wed May 13 16:55:45 2015 -0700
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Wed May 13 16:55:45 2015 -0700

----------------------------------------------------------------------
 bin/ignite.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e599b61/bin/ignite.sh
----------------------------------------------------------------------
diff --git a/bin/ignite.sh b/bin/ignite.sh
index ee92d27..660a80f 100755
--- a/bin/ignite.sh
+++ b/bin/ignite.sh
@@ -58,7 +58,7 @@ fi
 # Set IGNITE_LIBS.
 #
 . "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
 CP="${IGNITE_LIBS}"
 
 RANDOM_NUMBER=$("$JAVA" -cp "${CP}" org.apache.ignite.startup.cmdline.CommandLineRandomNumberGenerator)


[27/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-835

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-835


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

Branch: refs/heads/ignite-889
Commit: 96ff8f2fc6521f55300ab634584f8f25c6edfdf2
Parents: 9e670b8 bbc21a6
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 11:23:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 11:23:20 2015 +0300

----------------------------------------------------------------------
 bin/include/functions.sh                        |    2 +-
 .../internal/direct/DirectByteBufferStream.java |    4 +-
 .../eventstorage/GridEventStorageManager.java   |    5 +-
 .../processors/cache/GridCacheMvccManager.java  |    4 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   32 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   27 +
 .../cache/distributed/dht/GridDhtTxMapping.java |    2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   81 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   25 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |    4 +-
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 .../distributed/near/GridNearLockFuture.java    |    5 -
 .../near/GridNearOptimisticTxPrepareFuture.java |  779 +++++++++++++
 .../GridNearPessimisticTxPrepareFuture.java     |  349 ++++++
 .../cache/distributed/near/GridNearTxLocal.java |   84 +-
 .../near/GridNearTxPrepareFuture.java           | 1050 ------------------
 .../near/GridNearTxPrepareFutureAdapter.java    |  226 ++++
 .../cache/transactions/IgniteInternalTx.java    |    4 +-
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../cache/transactions/IgniteTxHandler.java     |   68 +-
 .../transactions/IgniteTxLocalAdapter.java      |    2 +-
 .../cache/transactions/IgniteTxManager.java     |   12 +-
 .../ignite/internal/util/IgniteUtils.java       |    4 +-
 .../GridCacheAbstractFailoverSelfTest.java      |    8 +-
 .../GridCacheAbstractNodeRestartSelfTest.java   |   11 +-
 .../distributed/IgniteTxGetAfterStopTest.java   |  131 +++
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |    4 +-
 ...idCacheAtomicReplicatedFailoverSelfTest.java |    6 +
 .../GridCacheReplicatedFailoverSelfTest.java    |    6 +
 .../GridCacheReplicatedNodeRestartSelfTest.java |   80 ++
 .../IgniteCacheFailoverTestSuite.java           |   10 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |    8 +-
 .../testsuites/IgniteCacheTestSuite3.java       |    2 +
 33 files changed, 1765 insertions(+), 1276 deletions(-)
----------------------------------------------------------------------



[23/47] incubator-ignite git commit: IGNITE-894 Add @InjectRecursively.

Posted by ag...@apache.org.
IGNITE-894 Add @InjectRecursively.


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

Branch: refs/heads/ignite-889
Commit: a1ce1ce4b749f2fc12a803052bf0df21eb42f675
Parents: 96ad5a8
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 19:15:56 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 19:15:56 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridInternalWrapper.java    | 30 ------
 .../closure/GridClosureProcessor.java           | 25 ++---
 .../internal/processors/igfs/IgfsJobImpl.java   |  9 +-
 .../processors/resource/GridResourceIoc.java    | 34 +++----
 .../resource/GridResourceProcessor.java         | 22 +----
 .../processors/resource/GridResourceUtils.java  | 15 ---
 .../util/lang/GridComputeJobWrapper.java        | 96 --------------------
 .../ignite/resources/InjectRecursively.java     | 22 +++++
 8 files changed, 48 insertions(+), 205 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
deleted file mode 100644
index 76563e7..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-/**
- * Internal wrapper interface for custom resource injection logic.
- */
-public interface GridInternalWrapper<T> {
-    /**
-     * Get user object where resources must be injected.
-     *
-     * @return User object.
-     */
-    public T userObject();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 658557e..8f5afbf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1584,12 +1584,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    private static class C1<T, R> implements ComputeJob, Externalizable, GridNoImplicitInjection,
-        GridInternalWrapper<IgniteClosure> {
+    private static class C1<T, R> implements ComputeJob, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
+        @InjectRecursively
         protected IgniteClosure<T, R> job;
 
         /** */
@@ -1635,11 +1635,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteClosure userObject() {
-            return job;
-        }
-
-        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C1.class, this);
         }
@@ -1681,11 +1676,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    private static class C2<R> implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Callable> {
+    private static class C2<R> implements ComputeJob, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
+        @InjectRecursively
         protected Callable<R> c;
 
         /**
@@ -1728,11 +1724,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public Callable userObject() {
-            return c;
-        }
-
-        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C2.class, this);
         }
@@ -1772,11 +1763,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
     /**
      */
-    private static class C4 implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
+    private static class C4 implements ComputeJob, Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
+        @InjectRecursively
         protected Runnable r;
 
         /**
@@ -1816,11 +1808,6 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public Runnable userObject() {
-            return r;
-        }
-
-        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C4.class, this);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index fa90e21..b5a336e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.internal.*;
 import org.apache.ignite.resources.*;
 
 import java.io.*;
@@ -29,11 +28,12 @@ import java.io.*;
 /**
  * IGFS job implementation.
  */
-public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
+public class IgfsJobImpl implements ComputeJob {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** IGFS job. */
+    @InjectRecursively
     private IgfsJob job;
 
     /** IGFS name. */
@@ -109,9 +109,4 @@ public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
     @Override public void cancel() {
         job.cancel();
     }
-
-    /** {@inheritDoc} */
-    @Override public IgfsJob userObject() {
-        return job;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index 3d853d6..a2ffa55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.resources.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
@@ -272,27 +273,26 @@ class GridResourceIoc {
 
             for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
                 for (Field field : cls0.getDeclaredFields()) {
-                    Annotation[] fieldAnns = field.getAnnotations();
+                    InjectRecursively injectRecursively = field.getAnnotation(InjectRecursively.class);
 
-                    for (Annotation ann : fieldAnns) {
-                        T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
-
-                        if (t2 == null) {
-                            t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
-                                new ArrayList<GridResourceField>(),
-                                new ArrayList<GridResourceMethod>());
+                    if (injectRecursively != null
+                        || (allowImplicitInjection && field.getName().startsWith("this$")
+                            || field.getName().startsWith("val$")))
+                        recursiveFieldsList.add(field);
+                    else {
+                        for (Annotation ann : field.getAnnotations()) {
+                            T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
 
-                            annMap.put(ann.annotationType(), t2);
-                        }
+                            if (t2 == null) {
+                                t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+                                    new ArrayList<GridResourceField>(),
+                                    new ArrayList<GridResourceMethod>());
 
-                        t2.get1().add(new GridResourceField(field, ann));
-                    }
+                                annMap.put(ann.annotationType(), t2);
+                            }
 
-                    if (allowImplicitInjection
-                        && fieldAnns.length == 0
-                        && GridResourceUtils.mayRequireResources(field)) {
-                        // Account for anonymous inner classes.
-                        recursiveFieldsList.add(field);
+                            t2.get1().add(new GridResourceField(field, ann));
+                        }
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
index cb4149b..5b51592 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
@@ -278,16 +278,9 @@ public class GridResourceProcessor extends GridProcessorAdapter {
             log.debug("Injecting resources: " + job);
 
         // Unwrap Proxy object.
-        Object obj = unwrapTarget(unwrapJob(job));
+        Object obj = unwrapTarget(job);
 
         injectToJob(dep, taskCls, obj, ses, jobCtx);
-
-        if (obj instanceof GridInternalWrapper) {
-            Object usrObj = ((GridInternalWrapper)obj).userObject();
-
-            if (usrObj != null)
-                injectToJob(dep, taskCls, usrObj, ses, jobCtx);
-        }
     }
 
     /**
@@ -329,19 +322,6 @@ public class GridResourceProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * Gets rid of job wrapper, if any.
-     *
-     * @param job Job to unwrap.
-     * @return Unwrapped job.
-     */
-    private ComputeJob unwrapJob(ComputeJob job) {
-        if (job instanceof GridComputeJobWrapper)
-            return ((GridComputeJobWrapper)job).wrappedJob();
-
-        return job;
-    }
-
-    /**
      * Injects held resources into given grid task.
      *
      * @param dep Deployed class.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
index 660d6ba..254f171 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
@@ -88,19 +88,4 @@ final class GridResourceUtils {
                 ", target=" + target + ", rsrc=" + rsrc + ']', e);
         }
     }
-
-    /**
-     * Checks if specified field requires recursive inspection to find resource annotations.
-     *
-     * @param f Field.
-     * @return {@code true} if requires, {@code false} if doesn't.
-     */
-    static boolean mayRequireResources(Field f) {
-        assert f != null;
-
-        // Need to inspect anonymous classes, callable and runnable instances.
-        return f.getName().startsWith("this$") || f.getName().startsWith("val$") ||
-            Callable.class.isAssignableFrom(f.getType()) || Runnable.class.isAssignableFrom(f.getType()) ||
-            IgniteClosure.class.isAssignableFrom(f.getType());
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
deleted file mode 100644
index 82c0078..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridComputeJobWrapper.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.util.lang;
-
-import org.apache.ignite.compute.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.util.concurrent.*;
-
-/**
- * Convenient wrapper for grid job. It allows to create a job clone in cases when the same
- * job needs to be cloned to multiple grid nodes during mapping phase of task execution.
- */
-public class GridComputeJobWrapper implements ComputeJob, Callable<Object>,
-    GridPeerDeployAware {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private final ComputeJob job;
-
-    /** Peer deploy aware class. */
-    private transient volatile GridPeerDeployAware p;
-
-    /**
-     * Creates a wrapper with given grid {@code job}.
-     *
-     * @param job Job to wrap.
-     */
-    public GridComputeJobWrapper(ComputeJob job) {
-        A.notNull(job, "job");
-
-        this.job = job;
-    }
-
-    /**
-     * Gets wrapped job.
-     *
-     * @return Wrapped job.
-     */
-    public ComputeJob wrappedJob() {
-        return job;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public final Object call() throws Exception {
-        return execute();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Class<?> deployClass() {
-        if (p == null)
-            p = U.detectPeerDeployAware(this);
-
-        return p.deployClass();
-    }
-
-    /** {@inheritDoc} */
-    @Override public ClassLoader classLoader() {
-        if (p == null)
-            p = U.detectPeerDeployAware(this);
-
-        return p.classLoader();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void cancel() {
-        job.cancel();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object execute() {
-        return job.execute();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridComputeJobWrapper.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a1ce1ce4/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
new file mode 100644
index 0000000..6cf8c8a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
@@ -0,0 +1,22 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.resources;
+
+import java.lang.annotation.*;
+
+/**
+ * Indicates that resource injection should be performed for field value too.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface InjectRecursively {
+    // No-op.
+}


[30/47] incubator-ignite git commit: IGNITE-894 Fix file header.

Posted by ag...@apache.org.
IGNITE-894 Fix file header.


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

Branch: refs/heads/ignite-889
Commit: 3e59d23c18facc9be0663dc494d58de2fd94ac54
Parents: a1ce1ce
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 14:54:15 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 14:54:15 2015 +0300

----------------------------------------------------------------------
 .../ignite/resources/InjectRecursively.java     | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e59d23c/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
index 6cf8c8a..60d1bd7 100644
--- a/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
+++ b/modules/core/src/main/java/org/apache/ignite/resources/InjectRecursively.java
@@ -1,10 +1,18 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.ignite.resources;


[11/47] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-157' into ignite-157

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


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

Branch: refs/heads/ignite-889
Commit: 41d1a143548b4ab09aa1b97bca0d7cdf9f3e4a59
Parents: b3dcbf1 fcb45bb
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 11:33:51 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 11:33:51 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                      |  2 +-
 modules/aop/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 +-
 .../testsuites/IgniteCacheRestartTestSuite.java       |  4 ++--
 modules/extdata/p2p/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/log4j/pom.xml                                 |  2 +-
 modules/rest-http/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/spring/pom.xml                                |  2 +-
 modules/ssh/pom.xml                                   |  2 +-
 modules/tools/pom.xml                                 |  2 +-
 modules/urideploy/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 +-
 pom.xml                                               | 14 ++++----------
 32 files changed, 36 insertions(+), 42 deletions(-)
----------------------------------------------------------------------



[42/47] incubator-ignite git commit: # ignite-sprint-5 - Fixed comment.

Posted by ag...@apache.org.
# ignite-sprint-5 - Fixed comment.


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

Branch: refs/heads/ignite-889
Commit: 9e25c2a32f36964c553075e680de4517e34c541a
Parents: 7e599b6
Author: Andrey <an...@gridgain.com>
Authored: Thu May 14 15:14:59 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu May 14 15:14:59 2015 +0700

----------------------------------------------------------------------
 bin/ignite-schema-import.bat | 2 +-
 bin/ignite-schema-import.sh  | 2 +-
 bin/ignite.bat               | 2 +-
 bin/ignitevisorcmd.bat       | 2 +-
 bin/ignitevisorcmd.sh        | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
index d48234c..a4ec86b 100644
--- a/bin/ignite-schema-import.bat
+++ b/bin/ignite-schema-import.bat
@@ -91,7 +91,7 @@ if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run
 :: Set IGNITE_LIBS
 ::
 call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
 set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*;%IGNITE_LIBS%
 
 ::

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
index 8f2a8d5..1029882 100755
--- a/bin/ignite-schema-import.sh
+++ b/bin/ignite-schema-import.sh
@@ -57,7 +57,7 @@ setIgniteHome
 # Set IGNITE_LIBS.
 #
 . "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
 CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*${SEP}${IGNITE_LIBS}"
 
 #

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignite.bat
----------------------------------------------------------------------
diff --git a/bin/ignite.bat b/bin/ignite.bat
index 20836c0..1a4a58c 100644
--- a/bin/ignite.bat
+++ b/bin/ignite.bat
@@ -102,7 +102,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
 :: Set IGNITE_LIBS
 ::
 call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
 set CP=%IGNITE_LIBS%
 
 ::

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignitevisorcmd.bat
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.bat b/bin/ignitevisorcmd.bat
index fe06530..4a1aafd 100644
--- a/bin/ignitevisorcmd.bat
+++ b/bin/ignitevisorcmd.bat
@@ -100,7 +100,7 @@ if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
 :: Set IGNITE_LIBS
 ::
 call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in release.
+call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
 set CP=%IGNITE_HOME%\bin\include\visor-common\*;%IGNITE_HOME%\bin\include\visorcmd\*;%IGNITE_LIBS%
 
 ::

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e25c2a3/bin/ignitevisorcmd.sh
----------------------------------------------------------------------
diff --git a/bin/ignitevisorcmd.sh b/bin/ignitevisorcmd.sh
index 91d6c5a..fe74f6a 100755
--- a/bin/ignitevisorcmd.sh
+++ b/bin/ignitevisorcmd.sh
@@ -53,7 +53,7 @@ setIgniteHome
 # Set IGNITE_LIBS.
 #
 . "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in release.
+. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
 CP="${IGNITE_HOME}/bin/include/visor-common/*${SEP}${IGNITE_HOME}/bin/include/visorcmd/*${SEP}${IGNITE_LIBS}"
 
 #


[26/47] incubator-ignite git commit: # ignite-835

Posted by ag...@apache.org.
# ignite-835


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

Branch: refs/heads/ignite-889
Commit: 9e670b8f59dc8b758dc8944885adf739d847e9c9
Parents: ade75f9
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 11:22:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 11:22:12 2015 +0300

----------------------------------------------------------------------
 ...achePartitionedNearDisabledLockSelfTest.java | 47 ++++++++++++++++++++
 .../GridCacheReplicatedLockSelfTest.java        |  5 +++
 .../testsuites/IgniteCacheTestSuite2.java       |  1 +
 3 files changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e670b8f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java
new file mode 100644
index 0000000..69c7909
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledLockSelfTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ *
+ */
+public class GridCachePartitionedNearDisabledLockSelfTest extends GridCachePartitionedLockSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration() {
+        CacheConfiguration ccfg = super.cacheConfiguration();
+
+        assertNotNull(ccfg.getNearConfiguration());
+
+        ccfg.setNearConfiguration(null);
+
+        return ccfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isPartitioned() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testLockReentrancy() throws Throwable {
+        fail("https://issues.apache.org/jira/browse/IGNITE-835");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e670b8f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
index 97df1f0..510fa0c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedLockSelfTest.java
@@ -30,4 +30,9 @@ public class GridCacheReplicatedLockSelfTest extends GridCacheLockAbstractTest {
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }
+
+    /** {@inheritDoc} */
+    @Override public void testLockReentrancy() throws Throwable {
+        fail("https://issues.apache.org/jira/browse/IGNITE-835");
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e670b8f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index dfd88a8..dc3a2c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -76,6 +76,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
         suite.addTest(new TestSuite(GridCachePartitionedNearDisabledBasicStoreMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedEventSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedLockSelfTest.class));
+        suite.addTest(new TestSuite(GridCachePartitionedNearDisabledLockSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedMultiNodeLockSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(GridCachePartitionedMultiThreadedPutGetSelfTest.class));


[36/47] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-5' into ignite-sprint-5

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-5' into ignite-sprint-5


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

Branch: refs/heads/ignite-889
Commit: ba0caa1fcf032c0a6c8690043c3508bef05ef72d
Parents: 87e5a3f d87f6d6
Author: avinogradov <av...@gridgain.com>
Authored: Wed May 13 18:56:39 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Wed May 13 18:56:39 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |   7 +
 .../processors/cache/GridCacheMapEntry.java     |  70 ++++---
 .../distributed/dht/GridDhtCacheAdapter.java    |  16 +-
 .../dht/GridDhtOffHeapCacheEntry.java           |  63 ++++++
 .../dht/GridDhtTransactionalCacheAdapter.java   |   9 +-
 .../distributed/dht/GridNoStorageCacheMap.java  |   4 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   3 +
 .../atomic/GridDhtAtomicOffHeapCacheEntry.java  |  63 ++++++
 .../dht/colocated/GridDhtColocatedCache.java    |   5 +-
 .../GridDhtColocatedOffHeapCacheEntry.java      |  63 ++++++
 .../distributed/near/GridNearCacheAdapter.java  |   3 +
 .../near/GridNearOffHeapCacheEntry.java         |  60 ++++++
 .../cache/local/GridLocalCacheEntry.java        |  18 ++
 .../cache/CacheOffheapMapEntrySelfTest.java     | 168 ++++++++++++++++
 .../distributed/GridCacheLockAbstractTest.java  |   2 -
 ...achePartitionedNearDisabledLockSelfTest.java |  47 +++++
 .../GridCacheReplicatedLockSelfTest.java        |   5 +
 .../discovery/tcp/TcpDiscoveryRestartTest.java  | 199 +++++++++++++++++++
 .../testsuites/IgniteCacheTestSuite2.java       |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   2 +
 20 files changed, 770 insertions(+), 38 deletions(-)
----------------------------------------------------------------------



[05/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: dff3fc683214f8036e8e0db8d0ed497a4fe729e4
Parents: a238ce3
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 7 17:01:32 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 7 17:01:32 2015 +0300

----------------------------------------------------------------------
 .../near/GridNearTxPrepareFuture.java           | 1044 ------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java |    2 +-
 2 files changed, 1 insertion(+), 1045 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dff3fc68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
deleted file mode 100644
index 9cf4aca..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ /dev/null
@@ -1,1044 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.cluster.*;
-import org.apache.ignite.internal.processors.affinity.*;
-import org.apache.ignite.internal.processors.cache.*;
-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.colocated.*;
-import org.apache.ignite.internal.processors.cache.transactions.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.transactions.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.future.*;
-import org.apache.ignite.internal.util.lang.*;
-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.transactions.*;
-import org.jetbrains.annotations.*;
-import org.jsr166.*;
-
-import javax.cache.expiry.*;
-import java.util.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
-import static org.apache.ignite.transactions.TransactionState.*;
-
-/**
- *
- */
-public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFuture<IgniteInternalTx>
-    implements GridCacheMvccFuture<IgniteInternalTx> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Logger reference. */
-    private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
-    /** Logger. */
-    private static IgniteLogger log;
-
-    /** Context. */
-    private GridCacheSharedContext<K, V> cctx;
-
-    /** Future ID. */
-    private IgniteUuid futId;
-
-    /** Transaction. */
-    @GridToStringInclude
-    private GridNearTxLocal tx;
-
-    /** Error. */
-    @GridToStringExclude
-    private AtomicReference<Throwable> err = new AtomicReference<>(null);
-
-    /** Trackable flag. */
-    private boolean trackable = true;
-
-    /** Full information about transaction nodes mapping. */
-    private GridDhtTxMapping txMapping;
-
-    /** */
-    private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
-
-    /**
-     * @param cctx Context.
-     * @param tx Transaction.
-     */
-    public GridNearTxPrepareFuture(GridCacheSharedContext<K, V> cctx, final GridNearTxLocal tx) {
-        super(cctx.kernalContext(), new IgniteReducer<IgniteInternalTx, IgniteInternalTx>() {
-            @Override public boolean collect(IgniteInternalTx e) {
-                return true;
-            }
-
-            @Override public IgniteInternalTx reduce() {
-                // Nothing to aggregate.
-                return tx;
-            }
-        });
-
-        assert cctx != null;
-        assert tx != null;
-
-        this.cctx = cctx;
-        this.tx = tx;
-
-        futId = IgniteUuid.randomUuid();
-
-        if (log == null)
-            log = U.logger(cctx.kernalContext(), logRef, GridNearTxPrepareFuture.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteUuid futureId() {
-        return futId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion version() {
-        return tx.xidVersion();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner) {
-        if (log.isDebugEnabled())
-            log.debug("Transaction future received owner changed callback: " + entry);
-
-        if (tx.optimistic()) {
-            if ((entry.context().isNear() || entry.context().isLocal()) && owner != null && tx.hasWriteKey(entry.txKey())) {
-                lockKeys.remove(entry.txKey());
-
-                // This will check for locks.
-                onDone();
-
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * @return Involved nodes.
-     */
-    @Override public Collection<? extends ClusterNode> nodes() {
-        return
-            F.viewReadOnly(futures(), new IgniteClosure<IgniteInternalFuture<?>, ClusterNode>() {
-                @Nullable @Override public ClusterNode apply(IgniteInternalFuture<?> f) {
-                    if (isMini(f))
-                        return ((MiniFuture)f).node();
-
-                    return cctx.discovery().localNode();
-                }
-            });
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean trackable() {
-        return trackable;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void markNotTrackable() {
-        trackable = false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onNodeLeft(UUID nodeId) {
-        boolean found = false;
-
-        for (IgniteInternalFuture<?> fut : futures())
-            if (isMini(fut)) {
-                MiniFuture f = (MiniFuture)fut;
-
-                if (f.node().id().equals(nodeId)) {
-                    f.onResult(new ClusterTopologyCheckedException("Remote node left grid: " + nodeId));
-
-                    found = true;
-                }
-            }
-
-        return found;
-    }
-
-    /**
-     * @param nodeId Failed node ID.
-     * @param mappings Remaining mappings.
-     * @param e Error.
-     */
-    void onError(@Nullable UUID nodeId, @Nullable Iterable<GridDistributedTxMapping> mappings, Throwable e) {
-        if (err.compareAndSet(null, e)) {
-            boolean marked = tx.setRollbackOnly();
-
-            if (e instanceof IgniteTxOptimisticCheckedException) {
-                assert nodeId != null : "Missing node ID for optimistic failure exception: " + e;
-
-                tx.removeKeysMapping(nodeId, mappings);
-            }
-
-            if (e instanceof IgniteTxRollbackCheckedException) {
-                if (marked) {
-                    try {
-                        tx.rollback();
-                    }
-                    catch (IgniteCheckedException ex) {
-                        U.error(log, "Failed to automatically rollback transaction: " + tx, ex);
-                    }
-                }
-            }
-
-            onComplete();
-        }
-    }
-
-    /**
-     * @return {@code True} if all locks are owned.
-     */
-    private boolean checkLocks() {
-        boolean locked = lockKeys.isEmpty();
-
-        if (locked) {
-            if (log.isDebugEnabled())
-                log.debug("All locks are acquired for near prepare future: " + this);
-        }
-        else {
-            if (log.isDebugEnabled())
-                log.debug("Still waiting for locks [fut=" + this + ", keys=" + lockKeys + ']');
-        }
-
-        return locked;
-    }
-
-    /**
-     * @param e Error.
-     */
-    void onError(Throwable e) {
-        onError(null, null, e);
-    }
-
-    /**
-     * @param nodeId Sender.
-     * @param res Result.
-     */
-    public void onResult(UUID nodeId, GridNearTxPrepareResponse res) {
-        if (!isDone()) {
-            for (IgniteInternalFuture<IgniteInternalTx> fut : pending()) {
-                if (isMini(fut)) {
-                    MiniFuture f = (MiniFuture)fut;
-
-                    if (f.futureId().equals(res.miniId())) {
-                        assert f.node().id().equals(nodeId);
-
-                        f.onResult(nodeId, res);
-                    }
-                }
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean onDone(IgniteInternalTx t, Throwable err) {
-        // If locks were not acquired yet, delay completion.
-        if (isDone() || (err == null && !checkLocks()))
-            return false;
-
-        this.err.compareAndSet(null, err);
-
-        if (err == null)
-            tx.state(PREPARED);
-
-        if (super.onDone(tx, err)) {
-            // Don't forget to clean up.
-            cctx.mvcc().removeFuture(this);
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * @param f Future.
-     * @return {@code True} if mini-future.
-     */
-    private boolean isMini(IgniteInternalFuture<?> f) {
-        return f.getClass().equals(MiniFuture.class);
-    }
-
-    /**
-     * Completeness callback.
-     */
-    private void onComplete() {
-        if (super.onDone(tx, err.get()))
-            // Don't forget to clean up.
-            cctx.mvcc().removeFuture(this);
-    }
-
-    /**
-     * Completes this future.
-     */
-    void complete() {
-        onComplete();
-    }
-
-    /**
-     * Waits for topology exchange future to be ready and then prepares user transaction.
-     */
-    public void prepare() {
-        if (tx.optimistic()) {
-            // Obtain the topology version to use.
-            AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(Thread.currentThread().getId());
-
-            if (topVer != null) {
-                tx.topologyVersion(topVer);
-
-                prepare0();
-
-                return;
-            }
-
-            prepareOnTopology();
-
-        }
-        else
-            preparePessimistic();
-    }
-
-    /**
-     *
-     */
-    private void prepareOnTopology() {
-        GridDhtTopologyFuture topFut = topologyReadLock();
-
-        try {
-            if (topFut == null) {
-                assert isDone();
-
-                return;
-            }
-
-            if (topFut.isDone()) {
-                StringBuilder invalidCaches = new StringBuilder();
-                Boolean cacheInvalid = false;
-                for (GridCacheContext ctx : cctx.cacheContexts()) {
-                    if (tx.activeCacheIds().contains(ctx.cacheId()) && !topFut.isCacheTopologyValid(ctx)) {
-                        if (cacheInvalid)
-                            invalidCaches.append(", ");
-
-                        invalidCaches.append(U.maskName(ctx.name()));
-
-                        cacheInvalid = true;
-                    }
-                }
-
-                if (cacheInvalid) {
-                    onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
-                        invalidCaches.toString()));
-
-                    return;
-                }
-
-                tx.topologyVersion(topFut.topologyVersion());
-
-                prepare0();
-            }
-            else {
-                topFut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
-                    @Override
-                    public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
-                        cctx.kernalContext().closure().runLocalSafe(new GridPlainRunnable() {
-                            @Override
-                            public void run() {
-                                prepareOnTopology();
-                            }
-                        });
-                    }
-                });
-            }
-        }
-        finally {
-            topologyReadUnlock();
-        }
-    }
-
-    /**
-     * Acquires topology read lock.
-     *
-     * @return Topology ready future.
-     */
-    private GridDhtTopologyFuture topologyReadLock() {
-        if (tx.activeCacheIds().isEmpty())
-            return cctx.exchange().lastTopologyFuture();
-
-        GridCacheContext<K, V> nonLocCtx = null;
-
-        for (int cacheId : tx.activeCacheIds()) {
-            GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
-
-            if (!cacheCtx.isLocal()) {
-                nonLocCtx = cacheCtx;
-
-                break;
-            }
-        }
-
-        if (nonLocCtx == null)
-            return cctx.exchange().lastTopologyFuture();
-
-        nonLocCtx.topology().readLock();
-
-        if (nonLocCtx.topology().stopping()) {
-            onDone(new IgniteCheckedException("Failed to perform cache operation (cache is stopped): " +
-                nonLocCtx.name()));
-
-            return null;
-        }
-
-        return nonLocCtx.topology().topologyVersionFuture();
-    }
-
-    /**
-     * Releases topology read lock.
-     */
-    private void topologyReadUnlock() {
-        if (!tx.activeCacheIds().isEmpty()) {
-            GridCacheContext<K, V> nonLocalCtx = null;
-
-            for (int cacheId : tx.activeCacheIds()) {
-                GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
-
-                if (!cacheCtx.isLocal()) {
-                    nonLocalCtx = cacheCtx;
-
-                    break;
-                }
-            }
-
-            if (nonLocalCtx != null)
-                nonLocalCtx.topology().readUnlock();
-        }
-    }
-
-    /**
-     * Initializes future.
-     */
-    private void prepare0() {
-        assert tx.optimistic();
-
-        try {
-            if (!tx.state(PREPARING)) {
-                if (tx.setRollbackOnly()) {
-                    if (tx.timedOut())
-                        onError(null, null, new IgniteTxTimeoutCheckedException("Transaction timed out and " +
-                            "was rolled back: " + this));
-                    else
-                        onError(null, null, new IgniteCheckedException("Invalid transaction state for prepare " +
-                            "[state=" + tx.state() + ", tx=" + this + ']'));
-                }
-                else
-                    onError(null, null, new IgniteTxRollbackCheckedException("Invalid transaction state for " +
-                        "prepare [state=" + tx.state() + ", tx=" + this + ']'));
-
-                return;
-            }
-
-            // Make sure to add future before calling prepare.
-            cctx.mvcc().addFuture(this);
-
-            prepare(
-                tx.optimistic() && tx.serializable() ? tx.readEntries() : Collections.<IgniteTxEntry>emptyList(),
-                tx.writeEntries());
-
-            markInitialized();
-        }
-        catch (TransactionTimeoutException | TransactionOptimisticException e) {
-            onError(cctx.localNodeId(), null, e);
-        }
-        catch (IgniteCheckedException e) {
-            onDone(e);
-        }
-    }
-
-    /**
-     * @param reads Read entries.
-     * @param writes Write entries.
-     * @throws IgniteCheckedException If transaction is group-lock and some key was mapped to to the local node.
-     */
-    private void prepare(
-        Iterable<IgniteTxEntry> reads,
-        Iterable<IgniteTxEntry> writes
-    ) throws IgniteCheckedException {
-        assert tx.optimistic();
-
-        AffinityTopologyVersion topVer = tx.topologyVersion();
-
-        assert topVer.topologyVersion() > 0;
-
-        txMapping = new GridDhtTxMapping();
-
-        ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings =
-            new ConcurrentLinkedDeque8<>();
-
-        if (!F.isEmpty(reads) || !F.isEmpty(writes)) {
-            for (int cacheId : tx.activeCacheIds()) {
-                GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
-
-                if (CU.affinityNodes(cacheCtx, topVer).isEmpty()) {
-                    onDone(new ClusterTopologyCheckedException("Failed to map keys for cache (all " +
-                        "partition nodes left the grid): " + cacheCtx.name()));
-
-                    return;
-                }
-            }
-        }
-
-        // Assign keys to primary nodes.
-        GridDistributedTxMapping cur = null;
-
-        for (IgniteTxEntry read : reads) {
-            GridDistributedTxMapping updated = map(read, topVer, cur, false);
-
-            if (cur != updated) {
-                mappings.offer(updated);
-
-                if (updated.node().isLocal()) {
-                    if (read.context().isNear())
-                        tx.nearLocallyMapped(true);
-                    else if (read.context().isColocated())
-                        tx.colocatedLocallyMapped(true);
-                }
-
-                cur = updated;
-            }
-        }
-
-        for (IgniteTxEntry write : writes) {
-            GridDistributedTxMapping updated = map(write, topVer, cur, true);
-
-            if (cur != updated) {
-                mappings.offer(updated);
-
-                if (updated.node().isLocal()) {
-                    if (write.context().isNear())
-                        tx.nearLocallyMapped(true);
-                    else if (write.context().isColocated())
-                        tx.colocatedLocallyMapped(true);
-                }
-
-                cur = updated;
-            }
-        }
-
-        if (isDone()) {
-            if (log.isDebugEnabled())
-                log.debug("Abandoning (re)map because future is done: " + this);
-
-            return;
-        }
-
-        tx.addEntryMapping(mappings);
-
-        cctx.mvcc().recheckPendingLocks();
-
-        txMapping.initLast(mappings);
-
-        tx.transactionNodes(txMapping.transactionNodes());
-
-        checkOnePhase();
-
-        proceedPrepare(mappings);
-    }
-
-    /**
-     *
-     */
-    private void preparePessimistic() {
-        Map<IgniteBiTuple<ClusterNode, Boolean>, GridDistributedTxMapping> mappings = new HashMap<>();
-
-        AffinityTopologyVersion topVer = tx.topologyVersion();
-
-        txMapping = new GridDhtTxMapping();
-
-        for (IgniteTxEntry txEntry : tx.allEntries()) {
-            GridCacheContext cacheCtx = txEntry.context();
-
-            List<ClusterNode> nodes = cacheCtx.affinity().nodes(txEntry.key(), topVer);
-
-            ClusterNode primary = F.first(nodes);
-
-            boolean near = cacheCtx.isNear();
-
-            IgniteBiTuple<ClusterNode, Boolean> key = F.t(primary, near);
-
-            GridDistributedTxMapping nodeMapping = mappings.get(key);
-
-            if (nodeMapping == null) {
-                nodeMapping = new GridDistributedTxMapping(primary);
-
-                nodeMapping.near(cacheCtx.isNear());
-
-                mappings.put(key, nodeMapping);
-            }
-
-            txEntry.nodeId(primary.id());
-
-            nodeMapping.add(txEntry);
-
-            txMapping.addMapping(nodes);
-        }
-
-        tx.transactionNodes(txMapping.transactionNodes());
-
-        checkOnePhase();
-
-        for (final GridDistributedTxMapping m : mappings.values()) {
-            final ClusterNode node = m.node();
-
-            GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
-                futId,
-                tx.topologyVersion(),
-                tx,
-                m.reads(),
-                m.writes(),
-                /*grp lock key*/null,
-                /*part lock*/false,
-                m.near(),
-                txMapping.transactionNodes(),
-                true,
-                txMapping.transactionNodes().get(node.id()),
-                tx.onePhaseCommit(),
-                tx.needReturnValue() && tx.implicit(),
-                tx.implicitSingle(),
-                m.explicitLock(),
-                tx.subjectId(),
-                tx.taskNameHash());
-
-            for (IgniteTxEntry txEntry : m.writes()) {
-                if (txEntry.op() == TRANSFORM)
-                    req.addDhtVersion(txEntry.txKey(), null);
-            }
-
-            final MiniFuture fut = new MiniFuture(m, null);
-
-            req.miniId(fut.futureId());
-
-            add(fut);
-
-            if (node.isLocal()) {
-//                cctx.tm().txHandler().prepareTx(node.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
-//                    @Override public void apply(GridNearTxPrepareResponse res) {
-//                        fut.onResult(node.id(), res);
-//                    }
-//                });
-            }
-            else {
-                try {
-                    cctx.io().send(node, req, tx.ioPolicy());
-                }
-                catch (IgniteCheckedException e) {
-                    // Fail the whole thing.
-                    fut.onResult(e);
-                }
-            }
-        }
-
-        markInitialized();
-    }
-
-    /**
-     * Checks if mapped transaction can be committed on one phase.
-     * One-phase commit can be done if transaction maps to one primary node and not more than one backup.
-     */
-    private void checkOnePhase() {
-        if (tx.storeUsed())
-            return;
-
-        Map<UUID, Collection<UUID>> map = txMapping.transactionNodes();
-
-        if (map.size() == 1) {
-            Map.Entry<UUID, Collection<UUID>> entry = F.firstEntry(map);
-
-            assert entry != null;
-
-            Collection<UUID> backups = entry.getValue();
-
-            if (backups.size() <= 1)
-                tx.onePhaseCommit(true);
-        }
-    }
-
-    /**
-     * Continues prepare after previous mapping successfully finished.
-     *
-     * @param mappings Queue of mappings.
-     */
-    private void proceedPrepare(final ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings) {
-        if (isDone())
-            return;
-
-        final GridDistributedTxMapping m = mappings.poll();
-
-        if (m == null)
-            return;
-
-        assert !m.empty();
-
-        final ClusterNode n = m.node();
-
-        GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
-            futId,
-            tx.topologyVersion(),
-            tx,
-            tx.optimistic() && tx.serializable() ? m.reads() : null,
-            m.writes(),
-            tx.groupLockKey(),
-            tx.partitionLock(),
-            m.near(),
-            txMapping.transactionNodes(),
-            m.last(),
-            m.lastBackups(),
-            tx.onePhaseCommit(),
-            tx.needReturnValue() && tx.implicit(),
-            tx.implicitSingle(),
-            m.explicitLock(),
-            tx.subjectId(),
-            tx.taskNameHash());
-
-        for (IgniteTxEntry txEntry : m.writes()) {
-            if (txEntry.op() == TRANSFORM)
-                req.addDhtVersion(txEntry.txKey(), null);
-        }
-
-        // Must lock near entries separately.
-        if (m.near()) {
-            try {
-                tx.optimisticLockEntries(req.writes());
-
-                tx.userPrepare();
-            }
-            catch (IgniteCheckedException e) {
-                onError(null, null, e);
-            }
-        }
-
-        final MiniFuture fut = new MiniFuture(m, mappings);
-
-        req.miniId(fut.futureId());
-
-        add(fut); // Append new future.
-
-        // If this is the primary node for the keys.
-        if (n.isLocal()) {
-            // At this point, if any new node joined, then it is
-            // waiting for this transaction to complete, so
-            // partition reassignments are not possible here.
-//            cctx.tm().txHandler().prepareTx(n.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
-//                @Override public void apply(GridNearTxPrepareResponse res) {
-//                    fut.onResult(n.id(), res);
-//                }
-//            });
-        }
-        else {
-            assert !tx.groupLock() : "Got group lock transaction that is mapped on remote node [tx=" + tx +
-                ", nodeId=" + n.id() + ']';
-
-            try {
-                cctx.io().send(n, req, tx.ioPolicy());
-            }
-            catch (IgniteCheckedException e) {
-                // Fail the whole thing.
-                fut.onResult(e);
-            }
-        }
-    }
-
-    /**
-     * @param entry Transaction entry.
-     * @param topVer Topology version.
-     * @param cur Current mapping.
-     * @throws IgniteCheckedException If transaction is group-lock and local node is not primary for key.
-     * @return Mapping.
-     */
-    private GridDistributedTxMapping map(
-        IgniteTxEntry entry,
-        AffinityTopologyVersion topVer,
-        GridDistributedTxMapping cur,
-        boolean waitLock
-    ) throws IgniteCheckedException {
-        GridCacheContext cacheCtx = entry.context();
-
-        List<ClusterNode> nodes = cacheCtx.affinity().nodes(entry.key(), topVer);
-
-        txMapping.addMapping(nodes);
-
-        ClusterNode primary = F.first(nodes);
-
-        assert primary != null;
-
-        if (log.isDebugEnabled()) {
-            log.debug("Mapped key to primary node [key=" + entry.key() +
-                ", part=" + cacheCtx.affinity().partition(entry.key()) +
-                ", primary=" + U.toShortString(primary) + ", topVer=" + topVer + ']');
-        }
-
-        if (tx.groupLock() && !primary.isLocal())
-            throw new IgniteCheckedException("Failed to prepare group lock transaction (local node is not primary for " +
-                " key)[key=" + entry.key() + ", primaryNodeId=" + primary.id() + ']');
-
-        // Must re-initialize cached entry while holding topology lock.
-        if (cacheCtx.isNear())
-            entry.cached(cacheCtx.nearTx().entryExx(entry.key(), topVer));
-        else if (!cacheCtx.isLocal())
-            entry.cached(cacheCtx.colocated().entryExx(entry.key(), topVer, true));
-        else
-            entry.cached(cacheCtx.local().entryEx(entry.key(), topVer));
-
-        if (cacheCtx.isNear() || cacheCtx.isLocal()) {
-            if (waitLock && entry.explicitVersion() == null) {
-                if (!tx.groupLock() || tx.groupLockKey().equals(entry.txKey()))
-                    lockKeys.add(entry.txKey());
-            }
-        }
-
-        if (cur == null || !cur.node().id().equals(primary.id()) || cur.near() != cacheCtx.isNear()) {
-            cur = new GridDistributedTxMapping(primary);
-
-            // Initialize near flag right away.
-            cur.near(cacheCtx.isNear());
-        }
-
-        cur.add(entry);
-
-        if (entry.explicitVersion() != null) {
-            tx.markExplicit(primary.id());
-
-            cur.markExplicitLock();
-        }
-
-        entry.nodeId(primary.id());
-
-        if (cacheCtx.isNear()) {
-            while (true) {
-                try {
-                    GridNearCacheEntry cached = (GridNearCacheEntry)entry.cached();
-
-                    cached.dhtNodeId(tx.xidVersion(), primary.id());
-
-                    break;
-                }
-                catch (GridCacheEntryRemovedException ignore) {
-                    entry.cached(cacheCtx.near().entryEx(entry.key()));
-                }
-            }
-        }
-
-        return cur;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridNearTxPrepareFuture.class, this, super.toString());
-    }
-
-    /**
-     * Mini-future for get operations. Mini-futures are only waiting on a single
-     * node as opposed to multiple nodes.
-     */
-    private class MiniFuture extends GridFutureAdapter<IgniteInternalTx> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private final IgniteUuid futId = IgniteUuid.randomUuid();
-
-        /** Keys. */
-        @GridToStringInclude
-        private GridDistributedTxMapping m;
-
-        /** Flag to signal some result being processed. */
-        private AtomicBoolean rcvRes = new AtomicBoolean(false);
-
-        /** Mappings to proceed prepare. */
-        private ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings;
-
-        /**
-         * @param m Mapping.
-         * @param mappings Queue of mappings to proceed with.
-         */
-        MiniFuture(
-            GridDistributedTxMapping m,
-            ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings
-        ) {
-            this.m = m;
-            this.mappings = mappings;
-        }
-
-        /**
-         * @return Future ID.
-         */
-        IgniteUuid futureId() {
-            return futId;
-        }
-
-        /**
-         * @return Node ID.
-         */
-        public ClusterNode node() {
-            return m.node();
-        }
-
-        /**
-         * @return Keys.
-         */
-        public GridDistributedTxMapping mapping() {
-            return m;
-        }
-
-        /**
-         * @param e Error.
-         */
-        void onResult(Throwable e) {
-            if (rcvRes.compareAndSet(false, true)) {
-                if (log.isDebugEnabled())
-                    log.debug("Failed to get future result [fut=" + this + ", err=" + e + ']');
-
-                // Fail.
-                onDone(e);
-            }
-            else
-                U.warn(log, "Received error after another result has been processed [fut=" +
-                    GridNearTxPrepareFuture.this + ", mini=" + this + ']', e);
-        }
-
-        /**
-         * @param e Node failure.
-         */
-        void onResult(ClusterTopologyCheckedException e) {
-            if (isDone())
-                return;
-
-            if (rcvRes.compareAndSet(false, true)) {
-                if (log.isDebugEnabled())
-                    log.debug("Remote node left grid while sending or waiting for reply (will not retry): " + this);
-
-                // Fail the whole future (make sure not to remap on different primary node
-                // to prevent multiple lock coordinators).
-                onError(null, null, e);
-            }
-        }
-
-        /**
-         * @param nodeId Failed node ID.
-         * @param res Result callback.
-         */
-        void onResult(UUID nodeId, GridNearTxPrepareResponse res) {
-            if (isDone())
-                return;
-
-            if (rcvRes.compareAndSet(false, true)) {
-                if (res.error() != null) {
-                    // Fail the whole compound future.
-                    onError(nodeId, mappings, res.error());
-                }
-                else {
-                    assert F.isEmpty(res.invalidPartitions());
-
-                    for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : res.ownedValues().entrySet()) {
-                        IgniteTxEntry txEntry = tx.entry(entry.getKey());
-
-                        assert txEntry != null;
-
-                        GridCacheContext cacheCtx = txEntry.context();
-
-                        while (true) {
-                            try {
-                                if (cacheCtx.isNear()) {
-                                    GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
-
-                                    CacheVersionedValue tup = entry.getValue();
-
-                                    nearEntry.resetFromPrimary(tup.value(), tx.xidVersion(),
-                                        tup.version(), m.node().id(), tx.topologyVersion());
-                                }
-                                else if (txEntry.cached().detached()) {
-                                    GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
-
-                                    CacheVersionedValue tup = entry.getValue();
-
-                                    detachedEntry.resetFromPrimary(tup.value(), tx.xidVersion());
-                                }
-
-                                break;
-                            }
-                            catch (GridCacheEntryRemovedException ignored) {
-                                // Retry.
-                            }
-                        }
-                    }
-
-                    tx.implicitSingleResult(res.returnValue());
-
-                    for (IgniteTxKey key : res.filterFailedKeys()) {
-                        IgniteTxEntry txEntry = tx.entry(key);
-
-                        assert txEntry != null : "Missing tx entry for write key: " + key;
-
-                        txEntry.op(NOOP);
-
-                        assert txEntry.context() != null;
-
-                        ExpiryPolicy expiry = txEntry.context().expiryForTxEntry(txEntry);
-
-                        if (expiry != null)
-                            txEntry.ttl(CU.toTtl(expiry.getExpiryForAccess()));
-                    }
-
-                    if (!m.empty()) {
-                        // Register DHT version.
-                        tx.addDhtVersion(m.node().id(), res.dhtVersion());
-
-                        m.dhtVersion(res.dhtVersion());
-
-                        if (m.near())
-                            tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
-                    }
-
-                    // Proceed prepare before finishing mini future.
-                    if (mappings != null)
-                        proceedPrepare(mappings);
-
-                    // Finish this mini future.
-                    onDone(tx);
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dff3fc68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index a346b65..4dc371c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4343,7 +4343,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             assertEquals(val1, cacheSkipStore.invoke(key, new SetValueProcessor(val2)));
             assertEquals(i, map.get(key));
-            assertEquals("For key " + key, val2, cacheSkipStore.get(key));
+            assertEquals(val2, cacheSkipStore.get(key));
         }
 
         for (String key : keys) {


[03/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: 93876df9373c260eaa1e8f8dc9e8edbb82110810
Parents: c3f3dd1
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 7 11:36:38 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 7 11:36:38 2015 +0300

----------------------------------------------------------------------
 .../cache/distributed/dht/GridDhtTxMapping.java |   2 +-
 .../colocated/GridDhtColocatedLockFuture.java   |  25 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |   4 +-
 .../near/GridAbstractNearTxPrepareFuture.java   | 219 ++++++
 .../distributed/near/GridNearCacheEntry.java    |   4 +-
 .../distributed/near/GridNearLockFuture.java    |   5 -
 .../near/GridNearOptimisticTxPrepareFuture.java | 763 +++++++++++++++++++
 .../GridNearPessimisticTxPrepareFuture.java     | 311 ++++++++
 .../cache/distributed/near/GridNearTxLocal.java |  41 +-
 .../near/GridNearTxPrepareFuture.java           |  12 +-
 .../cache/transactions/IgniteTxHandler.java     |   2 +-
 11 files changed, 1313 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
index d207d76..ba2c35f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
@@ -28,7 +28,7 @@ import java.util.*;
 /**
  * DHT transaction mapping.
  */
-public class GridDhtTxMapping<K, V> {
+public class GridDhtTxMapping {
     /** Transaction nodes mapping (primary node -> related backup nodes). */
     private final Map<UUID, Collection<UUID>> txNodes = new GridLeanMap<>();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 5b74b31..7da6346 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -1279,25 +1279,18 @@ public final class GridDhtColocatedLockFuture<K, V> extends GridCompoundIdentity
 
                         GridDhtDetachedCacheEntry entry = (GridDhtDetachedCacheEntry)txEntry.cached();
 
-                        try {
-                            if (res.dhtVersion(i) == null) {
-                                onDone(new IgniteCheckedException("Failed to receive DHT version from remote node " +
-                                    "(will fail the lock): " + res));
-
-                                return;
-                            }
-
-                            // Set value to detached entry.
-                            entry.resetFromPrimary(newVal, dhtVer);
-
-                            if (log.isDebugEnabled())
-                                log.debug("Processed response for entry [res=" + res + ", entry=" + entry + ']');
-                        }
-                        catch (IgniteCheckedException e) {
-                            onDone(e);
+                        if (res.dhtVersion(i) == null) {
+                            onDone(new IgniteCheckedException("Failed to receive DHT version from remote node " +
+                                "(will fail the lock): " + res));
 
                             return;
                         }
+
+                        // Set value to detached entry.
+                        entry.resetFromPrimary(newVal, dhtVer);
+
+                        if (log.isDebugEnabled())
+                            log.debug("Processed response for entry [res=" + res + ", entry=" + entry + ']');
                     }
                     else
                         cctx.mvcc().markExplicitOwner(k, threadId);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
index 5c4dd13..2c84bd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtDetachedCacheEntry.java
@@ -46,10 +46,8 @@ public class GridDhtDetachedCacheEntry extends GridDistributedCacheEntry {
      *
      * @param val Value.
      * @param ver Version.
-     * @throws IgniteCheckedException If value unmarshalling failed.
      */
-    public void resetFromPrimary(CacheObject val, GridCacheVersion ver)
-        throws IgniteCheckedException {
+    public void resetFromPrimary(CacheObject val, GridCacheVersion ver) {
         value(val);
 
         this.ver = ver;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
new file mode 100644
index 0000000..905f018
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+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.colocated.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.util.future.*;
+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 javax.cache.expiry.*;
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
+
+/**
+ * Common code for tx prepare in optimistic and pessimistic modes.
+ */
+public abstract class GridAbstractNearTxPrepareFuture extends GridCompoundIdentityFuture<IgniteInternalTx>
+    implements GridCacheFuture<IgniteInternalTx> {
+    /** Logger reference. */
+    protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+    /** Logger. */
+    protected static IgniteLogger log;
+
+    /** Context. */
+    protected GridCacheSharedContext<?, ?> cctx;
+
+    /** Future ID. */
+    protected IgniteUuid futId;
+
+    /** Transaction. */
+    @GridToStringInclude
+    protected GridNearTxLocal tx;
+
+    /** Error. */
+    @GridToStringExclude
+    protected AtomicReference<Throwable> err = new AtomicReference<>(null);
+
+    /** Trackable flag. */
+    protected boolean trackable = true;
+
+    /** Full information about transaction nodes mapping. */
+    protected GridDhtTxMapping txMapping;
+
+    /**
+     * @param cctx Context.
+     * @param tx Transaction.
+     */
+    public GridAbstractNearTxPrepareFuture(GridCacheSharedContext cctx, final GridNearTxLocal tx) {
+        super(cctx.kernalContext(), new IgniteReducer<IgniteInternalTx, IgniteInternalTx>() {
+            @Override public boolean collect(IgniteInternalTx e) {
+                return true;
+            }
+
+            @Override public IgniteInternalTx reduce() {
+                // Nothing to aggregate.
+                return tx;
+            }
+        });
+
+        assert cctx != null;
+        assert tx != null;
+
+        this.cctx = cctx;
+        this.tx = tx;
+
+        futId = IgniteUuid.randomUuid();
+
+        if (log == null)
+            log = U.logger(cctx.kernalContext(), logRef, GridAbstractNearTxPrepareFuture.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteUuid futureId() {
+        return futId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion version() {
+        return tx.xidVersion();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void markNotTrackable() {
+        trackable = false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean trackable() {
+        return trackable;
+    }
+
+    /**
+     * Prepares transaction.
+     */
+    public abstract void prepare();
+
+    /**
+     * @param nodeId Sender.
+     * @param res Result.
+     */
+    public abstract void onResult(UUID nodeId, GridNearTxPrepareResponse res);
+
+    /**
+     * Checks if mapped transaction can be committed on one phase.
+     * One-phase commit can be done if transaction maps to one primary node and not more than one backup.
+     */
+    protected final void checkOnePhase() {
+        if (tx.storeUsed())
+            return;
+
+        Map<UUID, Collection<UUID>> map = txMapping.transactionNodes();
+
+        if (map.size() == 1) {
+            Map.Entry<UUID, Collection<UUID>> entry = F.firstEntry(map);
+
+            assert entry != null;
+
+            Collection<UUID> backups = entry.getValue();
+
+            if (backups.size() <= 1)
+                tx.onePhaseCommit(true);
+        }
+    }
+
+    /**
+     * @param m Mapping.
+     * @param res Response.
+     */
+    protected final void onPrepareResponse(GridDistributedTxMapping m, GridNearTxPrepareResponse res) {
+        assert res.error() == null : res;
+        assert F.isEmpty(res.invalidPartitions()) : res;
+
+        for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : res.ownedValues().entrySet()) {
+            IgniteTxEntry txEntry = tx.entry(entry.getKey());
+
+            assert txEntry != null;
+
+            GridCacheContext cacheCtx = txEntry.context();
+
+            while (true) {
+                try {
+                    if (cacheCtx.isNear()) {
+                        GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
+
+                        CacheVersionedValue tup = entry.getValue();
+
+                        nearEntry.resetFromPrimary(tup.value(), tx.xidVersion(),
+                            tup.version(), m.node().id(), tx.topologyVersion());
+                    }
+                    else if (txEntry.cached().detached()) {
+                        GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
+
+                        CacheVersionedValue tup = entry.getValue();
+
+                        detachedEntry.resetFromPrimary(tup.value(), tx.xidVersion());
+                    }
+
+                    break;
+                }
+                catch (GridCacheEntryRemovedException ignored) {
+                    // Retry.
+                }
+            }
+        }
+
+        tx.implicitSingleResult(res.returnValue());
+
+        for (IgniteTxKey key : res.filterFailedKeys()) {
+            IgniteTxEntry txEntry = tx.entry(key);
+
+            assert txEntry != null : "Missing tx entry for write key: " + key;
+
+            txEntry.op(NOOP);
+
+            assert txEntry.context() != null;
+
+            ExpiryPolicy expiry = txEntry.context().expiryForTxEntry(txEntry);
+
+            if (expiry != null)
+                txEntry.ttl(CU.toTtl(expiry.getExpiryForAccess()));
+        }
+
+        if (!m.empty()) {
+            // Register DHT version.
+            tx.addDhtVersion(m.node().id(), res.dhtVersion());
+
+            m.dhtVersion(res.dhtVersion());
+
+            if (m.near())
+                tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
index c7fa4ab..797fd32 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -204,15 +204,13 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
      * @param topVer Topology version.
      * @return {@code True} if reset was done.
      * @throws GridCacheEntryRemovedException If obsolete.
-     * @throws IgniteCheckedException If failed.
      */
-    @SuppressWarnings( {"RedundantTypeArguments"})
     public boolean resetFromPrimary(CacheObject val,
         GridCacheVersion ver,
         GridCacheVersion dhtVer,
         UUID primaryNodeId,
         AffinityTopologyVersion topVer)
-        throws GridCacheEntryRemovedException, IgniteCheckedException
+        throws GridCacheEntryRemovedException
     {
         assert dhtVer != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index a427b65..25bd76b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -1450,11 +1450,6 @@ public final class GridNearLockFuture<K, V> extends GridCompoundIdentityFuture<B
                             // Replace old entry with new one.
                             entries.set(i, (GridDistributedCacheEntry)cctx.cache().entryEx(entry.key()));
                         }
-                        catch (IgniteCheckedException e) {
-                            onDone(e);
-
-                            return;
-                        }
                     }
 
                     i++;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
new file mode 100644
index 0000000..2fbca7b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -0,0 +1,763 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.cluster.*;
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.internal.transactions.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.lang.*;
+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.transactions.*;
+import org.jetbrains.annotations.*;
+import org.jsr166.*;
+
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
+import static org.apache.ignite.transactions.TransactionState.*;
+
+/**
+ *
+ */
+public class GridNearOptimisticTxPrepareFuture extends GridAbstractNearTxPrepareFuture
+    implements GridCacheMvccFuture<IgniteInternalTx> {
+    /** */
+    private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
+
+    /**
+     * @param cctx Context.
+     * @param tx Transaction.
+     */
+    public GridNearOptimisticTxPrepareFuture(GridCacheSharedContext cctx, GridNearTxLocal tx) {
+        super(cctx, tx);
+
+        assert tx.optimistic() : tx;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner) {
+        if (log.isDebugEnabled())
+            log.debug("Transaction future received owner changed callback: " + entry);
+
+        if ((entry.context().isNear() || entry.context().isLocal()) && owner != null && tx.hasWriteKey(entry.txKey())) {
+            lockKeys.remove(entry.txKey());
+
+            // This will check for locks.
+            onDone();
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<? extends ClusterNode> nodes() {
+        return F.viewReadOnly(futures(), new IgniteClosure<IgniteInternalFuture<?>, ClusterNode>() {
+            @Nullable @Override public ClusterNode apply(IgniteInternalFuture<?> f) {
+                if (isMini(f))
+                    return ((MiniFuture)f).node();
+
+                return cctx.discovery().localNode();
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onNodeLeft(UUID nodeId) {
+        boolean found = false;
+
+        for (IgniteInternalFuture<?> fut : futures()) {
+            if (isMini(fut)) {
+                MiniFuture f = (MiniFuture) fut;
+
+                if (f.node().id().equals(nodeId)) {
+                    f.onResult(new ClusterTopologyCheckedException("Remote node left grid: " + nodeId));
+
+                    found = true;
+                }
+            }
+        }
+
+        return found;
+    }
+
+    /**
+     * @param nodeId Failed node ID.
+     * @param mappings Remaining mappings.
+     * @param e Error.
+     */
+    void onError(@Nullable UUID nodeId, @Nullable Iterable<GridDistributedTxMapping> mappings, Throwable e) {
+        if (err.compareAndSet(null, e)) {
+            boolean marked = tx.setRollbackOnly();
+
+            if (e instanceof IgniteTxOptimisticCheckedException) {
+                assert nodeId != null : "Missing node ID for optimistic failure exception: " + e;
+
+                tx.removeKeysMapping(nodeId, mappings);
+            }
+
+            if (e instanceof IgniteTxRollbackCheckedException) {
+                if (marked) {
+                    try {
+                        tx.rollback();
+                    }
+                    catch (IgniteCheckedException ex) {
+                        U.error(log, "Failed to automatically rollback transaction: " + tx, ex);
+                    }
+                }
+            }
+
+            onComplete();
+        }
+    }
+
+    /**
+     * @return {@code True} if all locks are owned.
+     */
+    private boolean checkLocks() {
+        boolean locked = lockKeys.isEmpty();
+
+        if (locked) {
+            if (log.isDebugEnabled())
+                log.debug("All locks are acquired for near prepare future: " + this);
+        }
+        else {
+            if (log.isDebugEnabled())
+                log.debug("Still waiting for locks [fut=" + this + ", keys=" + lockKeys + ']');
+        }
+
+        return locked;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) {
+        if (!isDone()) {
+            for (IgniteInternalFuture<IgniteInternalTx> fut : pending()) {
+                if (isMini(fut)) {
+                    MiniFuture f = (MiniFuture)fut;
+
+                    if (f.futureId().equals(res.miniId())) {
+                        assert f.node().id().equals(nodeId);
+
+                        f.onResult(nodeId, res);
+                    }
+                }
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onDone(IgniteInternalTx t, Throwable err) {
+        // If locks were not acquired yet, delay completion.
+        if (isDone() || (err == null && !checkLocks()))
+            return false;
+
+        this.err.compareAndSet(null, err);
+
+        if (err == null)
+            tx.state(PREPARED);
+
+        if (super.onDone(tx, err)) {
+            // Don't forget to clean up.
+            cctx.mvcc().removeFuture(this);
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * @param f Future.
+     * @return {@code True} if mini-future.
+     */
+    private boolean isMini(IgniteInternalFuture<?> f) {
+        return f.getClass().equals(MiniFuture.class);
+    }
+
+    /**
+     * Completeness callback.
+     */
+    private void onComplete() {
+        if (super.onDone(tx, err.get()))
+            // Don't forget to clean up.
+            cctx.mvcc().removeFuture(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepare() {
+        // Obtain the topology version to use.
+        AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(Thread.currentThread().getId());
+
+        if (topVer != null) {
+            tx.topologyVersion(topVer);
+
+            prepare0();
+
+            return;
+        }
+
+        prepareOnTopology();
+    }
+
+    /**
+     *
+     */
+    private void prepareOnTopology() {
+        GridDhtTopologyFuture topFut = topologyReadLock();
+
+        try {
+            if (topFut == null) {
+                assert isDone();
+
+                return;
+            }
+
+            if (topFut.isDone()) {
+                StringBuilder invalidCaches = new StringBuilder();
+
+                boolean cacheInvalid = false;
+
+                for (GridCacheContext ctx : cctx.cacheContexts()) {
+                    if (tx.activeCacheIds().contains(ctx.cacheId()) && !topFut.isCacheTopologyValid(ctx)) {
+                        if (cacheInvalid)
+                            invalidCaches.append(", ");
+
+                        invalidCaches.append(U.maskName(ctx.name()));
+
+                        cacheInvalid = true;
+                    }
+                }
+
+                if (cacheInvalid) {
+                    onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
+                        invalidCaches.toString()));
+
+                    return;
+                }
+
+                tx.topologyVersion(topFut.topologyVersion());
+
+                prepare0();
+            }
+            else {
+                topFut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
+                    @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
+                        cctx.kernalContext().closure().runLocalSafe(new GridPlainRunnable() {
+                            @Override public void run() {
+                                prepareOnTopology();
+                            }
+                        });
+                    }
+                });
+            }
+        }
+        finally {
+            topologyReadUnlock();
+        }
+    }
+
+    /**
+     * Acquires topology read lock.
+     *
+     * @return Topology ready future.
+     */
+    private GridDhtTopologyFuture topologyReadLock() {
+        if (tx.activeCacheIds().isEmpty())
+            return cctx.exchange().lastTopologyFuture();
+
+        GridCacheContext<?, ?> nonLocCtx = null;
+
+        for (int cacheId : tx.activeCacheIds()) {
+            GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId);
+
+            if (!cacheCtx.isLocal()) {
+                nonLocCtx = cacheCtx;
+
+                break;
+            }
+        }
+
+        if (nonLocCtx == null)
+            return cctx.exchange().lastTopologyFuture();
+
+        nonLocCtx.topology().readLock();
+
+        if (nonLocCtx.topology().stopping()) {
+            onDone(new IgniteCheckedException("Failed to perform cache operation (cache is stopped): " +
+                nonLocCtx.name()));
+
+            return null;
+        }
+
+        return nonLocCtx.topology().topologyVersionFuture();
+    }
+
+    /**
+     * Releases topology read lock.
+     */
+    private void topologyReadUnlock() {
+        if (!tx.activeCacheIds().isEmpty()) {
+            GridCacheContext<?, ?> nonLocCtx = null;
+
+            for (int cacheId : tx.activeCacheIds()) {
+                GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId);
+
+                if (!cacheCtx.isLocal()) {
+                    nonLocCtx = cacheCtx;
+
+                    break;
+                }
+            }
+
+            if (nonLocCtx != null)
+                nonLocCtx.topology().readUnlock();
+        }
+    }
+
+    /**
+     * Initializes future.
+     */
+    private void prepare0() {
+        try {
+            if (!tx.state(PREPARING)) {
+                if (tx.setRollbackOnly()) {
+                    if (tx.timedOut())
+                        onError(null, null, new IgniteTxTimeoutCheckedException("Transaction timed out and " +
+                            "was rolled back: " + this));
+                    else
+                        onError(null, null, new IgniteCheckedException("Invalid transaction state for prepare " +
+                            "[state=" + tx.state() + ", tx=" + this + ']'));
+                }
+                else
+                    onError(null, null, new IgniteTxRollbackCheckedException("Invalid transaction state for " +
+                        "prepare [state=" + tx.state() + ", tx=" + this + ']'));
+
+                return;
+            }
+
+            // Make sure to add future before calling prepare.
+            cctx.mvcc().addFuture(this);
+
+            prepare(
+                tx.optimistic() && tx.serializable() ? tx.readEntries() : Collections.<IgniteTxEntry>emptyList(),
+                tx.writeEntries());
+
+            markInitialized();
+        }
+        catch (TransactionTimeoutException | TransactionOptimisticException e) {
+            onError(cctx.localNodeId(), null, e);
+        }
+        catch (IgniteCheckedException e) {
+            onDone(e);
+        }
+    }
+
+    /**
+     * @param reads Read entries.
+     * @param writes Write entries.
+     * @throws IgniteCheckedException If transaction is group-lock and some key was mapped to to the local node.
+     */
+    private void prepare(
+        Iterable<IgniteTxEntry> reads,
+        Iterable<IgniteTxEntry> writes
+    ) throws IgniteCheckedException {
+        AffinityTopologyVersion topVer = tx.topologyVersion();
+
+        assert topVer.topologyVersion() > 0;
+
+        txMapping = new GridDhtTxMapping();
+
+        ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings =
+            new ConcurrentLinkedDeque8<>();
+
+        if (!F.isEmpty(reads) || !F.isEmpty(writes)) {
+            for (int cacheId : tx.activeCacheIds()) {
+                GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId);
+
+                if (CU.affinityNodes(cacheCtx, topVer).isEmpty()) {
+                    onDone(new ClusterTopologyCheckedException("Failed to map keys for cache (all " +
+                        "partition nodes left the grid): " + cacheCtx.name()));
+
+                    return;
+                }
+            }
+        }
+
+        // Assign keys to primary nodes.
+        GridDistributedTxMapping cur = null;
+
+        for (IgniteTxEntry read : reads) {
+            GridDistributedTxMapping updated = map(read, topVer, cur, false);
+
+            if (cur != updated) {
+                mappings.offer(updated);
+
+                if (updated.node().isLocal()) {
+                    if (read.context().isNear())
+                        tx.nearLocallyMapped(true);
+                    else if (read.context().isColocated())
+                        tx.colocatedLocallyMapped(true);
+                }
+
+                cur = updated;
+            }
+        }
+
+        for (IgniteTxEntry write : writes) {
+            GridDistributedTxMapping updated = map(write, topVer, cur, true);
+
+            if (cur != updated) {
+                mappings.offer(updated);
+
+                if (updated.node().isLocal()) {
+                    if (write.context().isNear())
+                        tx.nearLocallyMapped(true);
+                    else if (write.context().isColocated())
+                        tx.colocatedLocallyMapped(true);
+                }
+
+                cur = updated;
+            }
+        }
+
+        if (isDone()) {
+            if (log.isDebugEnabled())
+                log.debug("Abandoning (re)map because future is done: " + this);
+
+            return;
+        }
+
+        tx.addEntryMapping(mappings);
+
+        cctx.mvcc().recheckPendingLocks();
+
+        txMapping.initLast(mappings);
+
+        tx.transactionNodes(txMapping.transactionNodes());
+
+        checkOnePhase();
+
+        proceedPrepare(mappings);
+    }
+
+    /**
+     * Continues prepare after previous mapping successfully finished.
+     *
+     * @param mappings Queue of mappings.
+     */
+    private void proceedPrepare(final ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings) {
+        if (isDone())
+            return;
+
+        final GridDistributedTxMapping m = mappings.poll();
+
+        if (m == null)
+            return;
+
+        assert !m.empty();
+
+        final ClusterNode n = m.node();
+
+        GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
+            futId,
+            tx.topologyVersion(),
+            tx,
+            tx.optimistic() && tx.serializable() ? m.reads() : null,
+            m.writes(),
+            tx.groupLockKey(),
+            tx.partitionLock(),
+            m.near(),
+            txMapping.transactionNodes(),
+            m.last(),
+            m.lastBackups(),
+            tx.onePhaseCommit(),
+            tx.needReturnValue() && tx.implicit(),
+            tx.implicitSingle(),
+            m.explicitLock(),
+            tx.subjectId(),
+            tx.taskNameHash());
+
+        for (IgniteTxEntry txEntry : m.writes()) {
+            if (txEntry.op() == TRANSFORM)
+                req.addDhtVersion(txEntry.txKey(), null);
+        }
+
+        // Must lock near entries separately.
+        if (m.near()) {
+            try {
+                tx.optimisticLockEntries(req.writes());
+
+                tx.userPrepare();
+            }
+            catch (IgniteCheckedException e) {
+                onError(null, null, e);
+            }
+        }
+
+        final MiniFuture fut = new MiniFuture(m, mappings);
+
+        req.miniId(fut.futureId());
+
+        add(fut); // Append new future.
+
+        // If this is the primary node for the keys.
+        if (n.isLocal()) {
+            // At this point, if any new node joined, then it is
+            // waiting for this transaction to complete, so
+            // partition reassignments are not possible here.
+            cctx.tm().txHandler().prepareTx(n.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
+                @Override public void apply(GridNearTxPrepareResponse res) {
+                    fut.onResult(n.id(), res);
+                }
+            });
+        }
+        else {
+            assert !tx.groupLock() : "Got group lock transaction that is mapped on remote node [tx=" + tx +
+                ", nodeId=" + n.id() + ']';
+
+            try {
+                cctx.io().send(n, req, tx.ioPolicy());
+            }
+            catch (IgniteCheckedException e) {
+                // Fail the whole thing.
+                fut.onResult(e);
+            }
+        }
+    }
+
+    /**
+     * @param entry Transaction entry.
+     * @param topVer Topology version.
+     * @param cur Current mapping.
+     * @throws IgniteCheckedException If transaction is group-lock and local node is not primary for key.
+     * @return Mapping.
+     */
+    private GridDistributedTxMapping map(
+        IgniteTxEntry entry,
+        AffinityTopologyVersion topVer,
+        GridDistributedTxMapping cur,
+        boolean waitLock
+    ) throws IgniteCheckedException {
+        GridCacheContext cacheCtx = entry.context();
+
+        List<ClusterNode> nodes = cacheCtx.affinity().nodes(entry.key(), topVer);
+
+        txMapping.addMapping(nodes);
+
+        ClusterNode primary = F.first(nodes);
+
+        assert primary != null;
+
+        if (log.isDebugEnabled()) {
+            log.debug("Mapped key to primary node [key=" + entry.key() +
+                ", part=" + cacheCtx.affinity().partition(entry.key()) +
+                ", primary=" + U.toShortString(primary) + ", topVer=" + topVer + ']');
+        }
+
+        if (tx.groupLock() && !primary.isLocal())
+            throw new IgniteCheckedException("Failed to prepare group lock transaction (local node is not primary for " +
+                " key)[key=" + entry.key() + ", primaryNodeId=" + primary.id() + ']');
+
+        // Must re-initialize cached entry while holding topology lock.
+        if (cacheCtx.isNear())
+            entry.cached(cacheCtx.nearTx().entryExx(entry.key(), topVer));
+        else if (!cacheCtx.isLocal())
+            entry.cached(cacheCtx.colocated().entryExx(entry.key(), topVer, true));
+        else
+            entry.cached(cacheCtx.local().entryEx(entry.key(), topVer));
+
+        if (cacheCtx.isNear() || cacheCtx.isLocal()) {
+            if (waitLock && entry.explicitVersion() == null) {
+                if (!tx.groupLock() || tx.groupLockKey().equals(entry.txKey()))
+                    lockKeys.add(entry.txKey());
+            }
+        }
+
+        if (cur == null || !cur.node().id().equals(primary.id()) || cur.near() != cacheCtx.isNear()) {
+            cur = new GridDistributedTxMapping(primary);
+
+            // Initialize near flag right away.
+            cur.near(cacheCtx.isNear());
+        }
+
+        cur.add(entry);
+
+        if (entry.explicitVersion() != null) {
+            tx.markExplicit(primary.id());
+
+            cur.markExplicitLock();
+        }
+
+        entry.nodeId(primary.id());
+
+        if (cacheCtx.isNear()) {
+            while (true) {
+                try {
+                    GridNearCacheEntry cached = (GridNearCacheEntry)entry.cached();
+
+                    cached.dhtNodeId(tx.xidVersion(), primary.id());
+
+                    break;
+                }
+                catch (GridCacheEntryRemovedException ignore) {
+                    entry.cached(cacheCtx.near().entryEx(entry.key()));
+                }
+            }
+        }
+
+        return cur;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearOptimisticTxPrepareFuture.class, this, super.toString());
+    }
+
+    /**
+     *
+     */
+    private class MiniFuture extends GridFutureAdapter<IgniteInternalTx> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private final IgniteUuid futId = IgniteUuid.randomUuid();
+
+        /** Keys. */
+        @GridToStringInclude
+        private GridDistributedTxMapping m;
+
+        /** Flag to signal some result being processed. */
+        private AtomicBoolean rcvRes = new AtomicBoolean(false);
+
+        /** Mappings to proceed prepare. */
+        private ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings;
+
+        /**
+         * @param m Mapping.
+         * @param mappings Queue of mappings to proceed with.
+         */
+        MiniFuture(
+            GridDistributedTxMapping m,
+            ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings
+        ) {
+            this.m = m;
+            this.mappings = mappings;
+        }
+
+        /**
+         * @return Future ID.
+         */
+        IgniteUuid futureId() {
+            return futId;
+        }
+
+        /**
+         * @return Node ID.
+         */
+        public ClusterNode node() {
+            return m.node();
+        }
+
+        /**
+         * @return Keys.
+         */
+        public GridDistributedTxMapping mapping() {
+            return m;
+        }
+
+        /**
+         * @param e Error.
+         */
+        void onResult(Throwable e) {
+            if (rcvRes.compareAndSet(false, true)) {
+                if (log.isDebugEnabled())
+                    log.debug("Failed to get future result [fut=" + this + ", err=" + e + ']');
+
+                // Fail.
+                onDone(e);
+            }
+            else
+                U.warn(log, "Received error after another result has been processed [fut=" +
+                    GridNearOptimisticTxPrepareFuture.this + ", mini=" + this + ']', e);
+        }
+
+        /**
+         * @param e Node failure.
+         */
+        void onResult(ClusterTopologyCheckedException e) {
+            if (isDone())
+                return;
+
+            if (rcvRes.compareAndSet(false, true)) {
+                if (log.isDebugEnabled())
+                    log.debug("Remote node left grid while sending or waiting for reply (will not retry): " + this);
+
+                // Fail the whole future (make sure not to remap on different primary node
+                // to prevent multiple lock coordinators).
+                onError(null, null, e);
+            }
+        }
+
+        /**
+         * @param nodeId Failed node ID.
+         * @param res Result callback.
+         */
+        void onResult(UUID nodeId, GridNearTxPrepareResponse res) {
+            if (isDone())
+                return;
+
+            if (rcvRes.compareAndSet(false, true)) {
+                if (res.error() != null) {
+                    // Fail the whole compound future.
+                    onError(nodeId, mappings, res.error());
+                }
+                else {
+                    onPrepareResponse(m, res);
+
+                    // Proceed prepare before finishing mini future.
+                    if (mappings != null)
+                        proceedPrepare(mappings);
+
+                    // Finish this mini future.
+                    onDone(tx);
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
new file mode 100644
index 0000000..84a4ab8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.cluster.*;
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.internal.transactions.*;
+import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
+import static org.apache.ignite.transactions.TransactionState.*;
+
+/**
+ *
+ */
+public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepareFuture {
+    /**
+     * @param cctx Context.
+     * @param tx Transaction.
+     */
+    public GridNearPessimisticTxPrepareFuture(GridCacheSharedContext cctx, GridNearTxLocal tx) {
+        super(cctx, tx);
+
+        assert tx.pessimistic() : tx;
+
+        // Should wait for all mini futures completion before finishing tx.
+        ignoreChildFailures(IgniteCheckedException.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<? extends ClusterNode> nodes() {
+        return F.viewReadOnly(futures(), new IgniteClosure<IgniteInternalFuture<?>, ClusterNode>() {
+            @Nullable @Override public ClusterNode apply(IgniteInternalFuture<?> f) {
+                return ((MiniFuture)f).node();
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onNodeLeft(UUID nodeId) {
+        boolean found = false;
+
+        for (IgniteInternalFuture<?> fut : futures()) {
+            MiniFuture f = (MiniFuture)fut;
+
+            if (f.node().id().equals(nodeId)) {
+                f.onError(new ClusterTopologyCheckedException("Remote node left grid: " + nodeId));
+
+                found = true;
+            }
+        }
+
+        return found;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) {
+        if (!isDone()) {
+            for (IgniteInternalFuture<IgniteInternalTx> fut : pending()) {
+                MiniFuture f = (MiniFuture)fut;
+
+                if (f.futureId().equals(res.miniId())) {
+                    assert f.node().id().equals(nodeId);
+
+                    if (log.isDebugEnabled())
+                        log.debug("Remote node left grid while sending or waiting for reply (will not retry): " + f);
+
+                    f.onResult(res);
+                }
+            }
+        }
+    }
+    /** {@inheritDoc} */
+    @Override public void prepare() {
+        if (!tx.state(PREPARING)) {
+            if (tx.setRollbackOnly()) {
+                if (tx.timedOut())
+                    onDone(new IgniteTxTimeoutCheckedException("Transaction timed out and was rolled back: " + tx));
+                else
+                    onDone(new IgniteCheckedException("Invalid transaction state for prepare " +
+                        "[state=" + tx.state() + ", tx=" + this + ']'));
+            }
+            else
+                onDone(new IgniteTxRollbackCheckedException("Invalid transaction state for prepare " +
+                    "[state=" + tx.state() + ", tx=" + this + ']'));
+
+            return;
+        }
+
+        try {
+            tx.userPrepare();
+
+            cctx.mvcc().addFuture(this);
+
+            preparePessimistic();
+        }
+        catch (IgniteCheckedException e) {
+            onDone(e);
+        }
+    }
+
+    /**
+     *
+     */
+    private void preparePessimistic() {
+        Map<IgniteBiTuple<ClusterNode, Boolean>, GridDistributedTxMapping> mappings = new HashMap<>();
+
+        AffinityTopologyVersion topVer = tx.topologyVersion();
+
+        txMapping = new GridDhtTxMapping();
+
+        for (IgniteTxEntry txEntry : tx.allEntries()) {
+            GridCacheContext cacheCtx = txEntry.context();
+
+            List<ClusterNode> nodes = cacheCtx.affinity().nodes(txEntry.key(), topVer);
+
+            ClusterNode primary = F.first(nodes);
+
+            boolean near = cacheCtx.isNear();
+
+            IgniteBiTuple<ClusterNode, Boolean> key = F.t(primary, near);
+
+            GridDistributedTxMapping nodeMapping = mappings.get(key);
+
+            if (nodeMapping == null) {
+                nodeMapping = new GridDistributedTxMapping(primary);
+
+                nodeMapping.near(cacheCtx.isNear());
+
+                mappings.put(key, nodeMapping);
+            }
+
+            txEntry.nodeId(primary.id());
+
+            nodeMapping.add(txEntry);
+
+            txMapping.addMapping(nodes);
+        }
+
+        tx.transactionNodes(txMapping.transactionNodes());
+
+        checkOnePhase();
+
+        for (final GridDistributedTxMapping m : mappings.values()) {
+            final ClusterNode node = m.node();
+
+            GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
+                futId,
+                tx.topologyVersion(),
+                tx,
+                m.reads(),
+                m.writes(),
+                /*grp lock key*/null,
+                /*part lock*/false,
+                m.near(),
+                txMapping.transactionNodes(),
+                true,
+                txMapping.transactionNodes().get(node.id()),
+                tx.onePhaseCommit(),
+                tx.needReturnValue() && tx.implicit(),
+                tx.implicitSingle(),
+                m.explicitLock(),
+                tx.subjectId(),
+                tx.taskNameHash());
+
+            for (IgniteTxEntry txEntry : m.writes()) {
+                if (txEntry.op() == TRANSFORM)
+                    req.addDhtVersion(txEntry.txKey(), null);
+            }
+
+            final MiniFuture fut = new MiniFuture(m);
+
+            req.miniId(fut.futureId());
+
+            add(fut);
+
+            if (node.isLocal()) {
+                cctx.tm().txHandler().prepareTx(node.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
+                    @Override public void apply(GridNearTxPrepareResponse res) {
+                        fut.onResult(res);
+                    }
+                });
+            }
+            else {
+                try {
+                    cctx.io().send(node, req, tx.ioPolicy());
+                }
+                catch (IgniteCheckedException e) {
+                    // Fail the whole thing.
+                    fut.onError(e);
+                }
+            }
+        }
+
+        markInitialized();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean onDone(@Nullable IgniteInternalTx res, @Nullable Throwable err) {
+        if (err != null)
+            this.err.compareAndSet(null, err);
+
+        err = this.err.get();
+
+        if (err == null)
+            tx.state(PREPARED);
+
+        if (super.onDone(res, err)) {
+            cctx.mvcc().removeFuture(this);
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridNearPessimisticTxPrepareFuture.class, this, super.toString());
+    }
+
+    /**
+     *
+     */
+    private class MiniFuture extends GridFutureAdapter<IgniteInternalTx> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private final IgniteUuid futId = IgniteUuid.randomUuid();
+
+        /** */
+        private GridDistributedTxMapping m;
+
+        /**
+         * @param m Mapping.
+         */
+        MiniFuture(GridDistributedTxMapping m) {
+            this.m = m;
+        }
+
+        /**
+         * @return Future ID.
+         */
+        IgniteUuid futureId() {
+            return futId;
+        }
+
+        /**
+         * @return Node ID.
+         */
+        public ClusterNode node() {
+            return m.node();
+        }
+
+        /**
+         * @param res Response.
+         */
+        void onResult(GridNearTxPrepareResponse res) {
+            if (res.error() != null)
+                onError(res.error());
+            else {
+                onPrepareResponse(m, res);
+
+                onDone(tx);
+            }
+        }
+
+        /**
+         * @param e Error.
+         */
+        void onError(Throwable e) {
+            err.compareAndSet(null, e);
+
+            onDone(e);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index c665354..f7a43bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -683,11 +683,12 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<IgniteInternalTx> prepareAsync() {
-        GridNearTxPrepareFuture fut = (GridNearTxPrepareFuture)prepFut.get();
+        GridAbstractNearTxPrepareFuture fut = (GridAbstractNearTxPrepareFuture)prepFut.get();
 
         if (fut == null) {
             // Future must be created before any exception can be thrown.
-            fut = new GridNearTxPrepareFuture<>(cctx, this);
+            fut = optimistic() ? new GridNearOptimisticTxPrepareFuture(cctx, this) :
+                new GridNearPessimisticTxPrepareFuture(cctx, this);
 
             if (!prepFut.compareAndSet(null, fut))
                 return prepFut.get();
@@ -698,41 +699,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
         mapExplicitLocks();
 
-        // For pessimistic mode we don't distribute prepare request and do not lock topology version
-        // as it was fixed on first lock.
-        if (pessimistic()) {
-            if (!state(PREPARING)) {
-                if (setRollbackOnly()) {
-                    if (timedOut())
-                        fut.onError(new IgniteTxTimeoutCheckedException("Transaction timed out and was " +
-                            "rolled back: " + this));
-                    else
-                        fut.onError(new IgniteCheckedException("Invalid transaction state for prepare [state=" +
-                            state() + ", tx=" + this + ']'));
-                }
-                else
-                    fut.onError(new IgniteTxRollbackCheckedException("Invalid transaction state for prepare " +
-                        "[state=" + state() + ", tx=" + this + ']'));
-
-                return fut;
-            }
-
-            try {
-                userPrepare();
-
-                // Make sure to add future before calling prepare.
-                cctx.mvcc().addFuture(fut);
-
-                fut.prepare();
-            }
-            catch (IgniteCheckedException e) {
-                fut.onError(e);
-            }
-        }
-        else {
-            // In optimistic mode we must wait for topology map update.
-            fut.prepare();
-        }
+        fut.prepare();
 
         return fut;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index f573187..962d973 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -79,7 +79,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
     private boolean trackable = true;
 
     /** Full information about transaction nodes mapping. */
-    private GridDhtTxMapping<K, V> txMapping;
+    private GridDhtTxMapping txMapping;
 
     /** */
     private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
@@ -497,7 +497,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
         assert topVer.topologyVersion() > 0;
 
-        txMapping = new GridDhtTxMapping<>();
+        txMapping = new GridDhtTxMapping();
 
         ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings =
             new ConcurrentLinkedDeque8<>();
@@ -580,7 +580,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
         AffinityTopologyVersion topVer = tx.topologyVersion();
 
-        txMapping = new GridDhtTxMapping<>();
+        txMapping = new GridDhtTxMapping();
 
         for (IgniteTxEntry txEntry : tx.allEntries()) {
             GridCacheContext cacheCtx = txEntry.context();
@@ -996,12 +996,6 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
                             catch (GridCacheEntryRemovedException ignored) {
                                 // Retry.
                             }
-                            catch (IgniteCheckedException e) {
-                                // Fail the whole compound future.
-                                onError(nodeId, mappings, e);
-
-                                return;
-                            }
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93876df9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index af75fb8..d98b4ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -362,7 +362,7 @@ public class IgniteTxHandler {
      * @param res Response.
      */
     private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) {
-        GridNearTxPrepareFuture fut = (GridNearTxPrepareFuture)ctx.mvcc()
+        GridAbstractNearTxPrepareFuture fut = (GridAbstractNearTxPrepareFuture)ctx.mvcc()
             .<IgniteInternalTx>future(res.version(), res.futureId());
 
         if (fut == null) {


[25/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-157' into ignite-sprint-5

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-157' into ignite-sprint-5


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

Branch: refs/heads/ignite-889
Commit: bbc21a6acba0193695e8b924b540bae4a647f3b8
Parents: 3861fbd ab1f9dd
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 10:04:14 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 10:04:14 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMvccManager.java  |    4 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   32 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   27 +
 .../cache/distributed/dht/GridDhtTxMapping.java |    2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   81 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   25 +-
 .../colocated/GridDhtDetachedCacheEntry.java    |    4 +-
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 .../distributed/near/GridNearLockFuture.java    |    5 -
 .../near/GridNearOptimisticTxPrepareFuture.java |  779 +++++++++++++
 .../GridNearPessimisticTxPrepareFuture.java     |  349 ++++++
 .../cache/distributed/near/GridNearTxLocal.java |   84 +-
 .../near/GridNearTxPrepareFuture.java           | 1050 ------------------
 .../near/GridNearTxPrepareFutureAdapter.java    |  226 ++++
 .../cache/transactions/IgniteInternalTx.java    |    4 +-
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../cache/transactions/IgniteTxHandler.java     |   68 +-
 .../transactions/IgniteTxLocalAdapter.java      |    2 +-
 .../cache/transactions/IgniteTxManager.java     |   12 +-
 .../GridCacheAbstractFailoverSelfTest.java      |    8 +-
 .../GridCacheAbstractNodeRestartSelfTest.java   |   11 +-
 .../distributed/IgniteTxGetAfterStopTest.java   |  131 +++
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |    4 +-
 ...idCacheAtomicReplicatedFailoverSelfTest.java |    6 +
 .../GridCacheReplicatedFailoverSelfTest.java    |    6 +
 .../GridCacheReplicatedNodeRestartSelfTest.java |   80 ++
 .../IgniteCacheFailoverTestSuite.java           |   10 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |    8 +-
 .../testsuites/IgniteCacheTestSuite3.java       |    2 +
 29 files changed, 1759 insertions(+), 1267 deletions(-)
----------------------------------------------------------------------



[07/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: a2fb8f6e5903356a10ec8c6e17ebeaadaafe552f
Parents: c19402e
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 7 18:01:16 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 7 18:01:16 2015 +0300

----------------------------------------------------------------------
 .../GridCacheReplicatedNodeRestartSelfTest.java | 80 ++++++++++++++++++++
 .../testsuites/IgniteCacheRestartTestSuite.java |  4 +-
 2 files changed, 82 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a2fb8f6e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
index 0023160..8ce96cd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedNodeRestartSelfTest.java
@@ -54,4 +54,84 @@ public class GridCacheReplicatedNodeRestartSelfTest extends GridCacheAbstractNod
 
         return c;
     }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutTwoNodesNoBackups() throws Throwable {
+        super.testRestartWithPutTwoNodesNoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutTwoNodesOneBackup() throws Throwable {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutFourNodesOneBackups() throws Throwable {
+        super.testRestartWithPutFourNodesOneBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutFourNodesNoBackups() throws Throwable {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutSixNodesTwoBackups() throws Throwable {
+        super.testRestartWithPutSixNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutEightNodesTwoBackups() throws Throwable {
+        super.testRestartWithPutEightNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithPutTenNodesTwoBackups() throws Throwable {
+        super.testRestartWithPutTenNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxTwoNodesNoBackups() throws Throwable {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxTwoNodesOneBackup() throws Throwable {
+        super.testRestartWithTxTwoNodesOneBackup();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxFourNodesOneBackups() throws Throwable {
+        super.testRestartWithTxFourNodesOneBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxFourNodesNoBackups() throws Throwable {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxSixNodesTwoBackups() throws Throwable {
+        super.testRestartWithTxSixNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxEightNodesTwoBackups() throws Throwable {
+        super.testRestartWithTxEightNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxTenNodesTwoBackups() throws Throwable {
+        super.testRestartWithTxTenNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxPutAllTenNodesTwoBackups() throws Throwable {
+        super.testRestartWithTxPutAllTenNodesTwoBackups();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testRestartWithTxPutAllFourNodesTwoBackups() throws Throwable {
+        super.testRestartWithTxPutAllFourNodesTwoBackups();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a2fb8f6e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index 983d447..e5372e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -21,7 +21,6 @@ import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * In-Memory Data Grid stability test suite on changing topology.
@@ -38,7 +37,8 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
         suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
-        suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
+        // TODO IGNITE-157.
+        // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
         // suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); // TODO IGNITE-747


[28/47] incubator-ignite git commit: # ignite-sprint-5 minor test change

Posted by ag...@apache.org.
# ignite-sprint-5 minor test change


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

Branch: refs/heads/ignite-889
Commit: 5f8925be6d6e1360ff56ff3c1dfff49811caef82
Parents: bbc21a6
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 12:38:49 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 12:38:49 2015 +0300

----------------------------------------------------------------------
 .../GridCachePartitionedTxSalvageSelfTest.java  | 25 ++++++++++----------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5f8925be/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
index 5072642..6192f39 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.rendezvous.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
@@ -35,6 +34,8 @@ import org.apache.ignite.transactions.*;
 import java.util.*;
 
 import static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
 import static org.apache.ignite.transactions.TransactionConcurrency.*;
 import static org.apache.ignite.transactions.TransactionIsolation.*;
 
@@ -76,10 +77,10 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
 
         CacheConfiguration cc = defaultCacheConfiguration();
 
-        cc.setCacheMode(CacheMode.PARTITIONED);
+        cc.setCacheMode(PARTITIONED);
         cc.setAffinity(new RendezvousAffinityFunction(false, 18));
         cc.setBackups(1);
-        cc.setRebalanceMode(CacheRebalanceMode.SYNC);
+        cc.setRebalanceMode(SYNC);
 
         c.setCacheConfiguration(cc);
 
@@ -109,8 +110,9 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        // Shutwodn the gird.
         stopAllGrids();
+
+        System.gc();
     }
 
     /**
@@ -145,8 +147,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
      * Check whether caches has no transactions after salvage timeout.
      *
      * @param mode Transaction mode (PESSIMISTIC, OPTIMISTIC).
-     * @param prepare Whether to preapre transaction state
-     *                (i.e. call {@link org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx#prepare()}).
+     * @param prepare Whether to prepare transaction state
+     *                (i.e. call {@link IgniteInternalTx#prepare()}).
      * @throws Exception If failed.
      */
     private void checkSalvageAfterTimeout(TransactionConcurrency mode, boolean prepare) throws Exception {
@@ -164,8 +166,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
      * Check whether caches still has all transactions before salvage timeout.
      *
      * @param mode Transaction mode (PESSIMISTIC, OPTIMISTIC).
-     * @param prepare Whether to preapre transaction state
-     *                (i.e. call {@link org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx#prepare()}).
+     * @param prepare Whether to prepare transaction state
+     *                (i.e. call {@link IgniteInternalTx#prepare()}).
      * @throws Exception If failed.
      */
     private void checkSalvageBeforeTimeout(TransactionConcurrency mode, boolean prepare) throws Exception {
@@ -191,8 +193,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
      * Start new transaction on the grid(0) and put some keys to it.
      *
      * @param mode Transaction mode (PESSIMISTIC, OPTIMISTIC).
-     * @param prepare Whether to preapre transaction state
-     *                (i.e. call {@link org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx#prepare()}).
+     * @param prepare Whether to prepare transaction state
+     *                (i.e. call {@link IgniteInternalTx#prepare()}).
      * @throws Exception If failed.
      */
     private void startTxAndPutKeys(final TransactionConcurrency mode, final boolean prepare) throws Exception {
@@ -210,9 +212,8 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
                     for (Integer key : keys)
                         c.put(key, "val" + key);
 
-                    // Unproxy.
                     if (prepare)
-                        U.<IgniteInternalTx>field(tx, "tx").prepare();
+                        ((TransactionProxyImpl)tx).tx().prepare();
                 }
                 catch (IgniteCheckedException e) {
                     info("Failed to put keys to cache: " + e.getMessage());


[39/47] incubator-ignite git commit: # IGNITE-777 Bug fix: don't send message to client twice. (cherry picked from commit cfcd1d9)

Posted by ag...@apache.org.
# IGNITE-777 Bug fix: don't send message to client twice.
(cherry picked from commit cfcd1d9)


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

Branch: refs/heads/ignite-889
Commit: 2b57817a080fc436d81b2c88c2aa437617866ec1
Parents: 27b559e
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 20:12:07 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 20:13:20 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java  | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2b57817a/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 0ebb6cd..1dea37a 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
@@ -2701,8 +2701,6 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov
                             marshalledMsg = marsh.marshal(msg);
 
                         msgClone = marsh.unmarshal(marshalledMsg, null);
-
-                        clientMsgWorker.addMessage(msgClone);
                     }
                     catch (IgniteCheckedException e) {
                         U.error(log, "Failed to marshal message: " + msg, e);


[34/47] incubator-ignite git commit: #ignite-460: Remove valPtr field from GridCacheMapEntry.

Posted by ag...@apache.org.
#ignite-460: Remove valPtr field from GridCacheMapEntry.


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

Branch: refs/heads/ignite-889
Commit: d87f6d61b343e95f90624fb7bf382c58a1f7ff1e
Parents: 8246788
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed May 13 17:45:24 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed May 13 17:45:24 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |   7 +
 .../processors/cache/GridCacheMapEntry.java     |  70 +++++---
 .../distributed/dht/GridDhtCacheAdapter.java    |  16 +-
 .../dht/GridDhtOffHeapCacheEntry.java           |  63 +++++++
 .../distributed/dht/GridNoStorageCacheMap.java  |   4 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   3 +
 .../atomic/GridDhtAtomicOffHeapCacheEntry.java  |  63 +++++++
 .../dht/colocated/GridDhtColocatedCache.java    |   5 +-
 .../GridDhtColocatedOffHeapCacheEntry.java      |  63 +++++++
 .../distributed/near/GridNearCacheAdapter.java  |   3 +
 .../near/GridNearOffHeapCacheEntry.java         |  60 +++++++
 .../cache/local/GridLocalCacheEntry.java        |  18 ++
 .../cache/CacheOffheapMapEntrySelfTest.java     | 168 +++++++++++++++++++
 .../testsuites/IgniteCacheTestSuite4.java       |   2 +
 14 files changed, 514 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 48dcee7..2eeaed6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1655,6 +1655,13 @@ public class GridCacheContext<K, V> implements Externalizable {
     }
 
     /**
+     * @return {@code True} if should use entry with offheap value pointer.
+     */
+    public boolean useOffheapEntry() {
+        return cacheCfg.getMemoryMode() == OFFHEAP_TIERED || cacheCfg.getMemoryMode() == OFFHEAP_VALUES;
+    }
+
+    /**
      * Converts temporary offheap object to heap-based.
      *
      * @param obj Object.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 71858d1..86ed57a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -115,9 +115,6 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
     @GridToStringInclude
     private final int hash;
 
-    /** Off-heap value pointer. */
-    protected long valPtr;
-
     /** Extras */
     @GridToStringInclude
     private GridCacheEntryExtras extras;
@@ -188,7 +185,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         if (cctx.cache().isIgfsDataCache() &&
             cctx.kernalContext().igfsHelper().isIgfsBlockKey(key.value(cctx.cacheObjectContext(), false))) {
             int newSize = valueLength0(val, null);
-            int oldSize = valueLength0(this.val, (this.val == null && valPtr != 0) ? valueBytes0() : null);
+            int oldSize = valueLength0(this.val, (this.val == null && hasOffHeapPointer()) ? valueBytes0() : null);
 
             int delta = newSize - oldSize;
 
@@ -199,7 +196,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         if (!isOffHeapValuesOnly()) {
             this.val = val;
 
-            valPtr = 0;
+            offHeapPointer(0);
         }
         else {
             try {
@@ -227,12 +224,12 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                 if (val != null) {
                     byte type = val.type();
 
-                    valPtr = mem.putOffHeap(valPtr, val.valueBytes(cctx.cacheObjectContext()), type);
+                    offHeapPointer(mem.putOffHeap(offHeapPointer(), val.valueBytes(cctx.cacheObjectContext()), type));
                 }
                 else {
-                    mem.removeOffHeap(valPtr);
+                    mem.removeOffHeap(offHeapPointer());
 
-                    valPtr = 0;
+                    offHeapPointer(0);
                 }
             }
             catch (IgniteCheckedException e) {
@@ -270,7 +267,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
         CacheObject val0 = val;
 
-        if (val0 == null && valPtr != 0) {
+        if (val0 == null && hasOffHeapPointer()) {
             IgniteBiTuple<byte[], Byte> t = valueBytes0();
 
             return cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(), t.get2(), t.get1());
@@ -434,16 +431,16 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
                     if (e != null) {
                         if (e.offheapPointer() > 0) {
-                            valPtr = e.offheapPointer();
+                            offHeapPointer(e.offheapPointer());
 
                             if (needVal) {
-                                CacheObject val = cctx.fromOffheap(valPtr, false);
+                                CacheObject val = cctx.fromOffheap(offHeapPointer(), false);
 
                                 e.value(val);
                             }
                         }
                         else // Read from swap.
-                            valPtr = 0;
+                            offHeapPointer(0);
                     }
                 }
                 else
@@ -468,7 +465,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
                         // Must update valPtr again since update() will reset it.
                         if (cctx.offheapTiered() && e.offheapPointer() > 0)
-                            valPtr = e.offheapPointer();
+                            offHeapPointer(e.offheapPointer());
 
                         return val;
                     }
@@ -495,13 +492,13 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                 if (cctx.offheapTiered()) {
                     cctx.swap().removeOffheap(key);
 
-                    valPtr = 0;
+                    offHeapPointer(0);
                 }
 
                 return;
             }
 
-            if (val == null && cctx.offheapTiered() && valPtr != 0) {
+            if (val == null && cctx.offheapTiered() && hasOffHeapPointer()) {
                 if (log.isDebugEnabled())
                     log.debug("Value did not change, skip write swap entry: " + this);
 
@@ -540,10 +537,10 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
     protected IgniteBiTuple<byte[], Byte> valueBytes0() {
         assert Thread.holdsLock(this);
 
-        if (valPtr != 0) {
+        if (hasOffHeapPointer()) {
             assert isOffHeapValuesOnly() || cctx.offheapTiered();
 
-            return cctx.unsafeMemory().get(valPtr);
+            return cctx.unsafeMemory().get(offHeapPointer());
         }
         else {
             assert val != null;
@@ -672,7 +669,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
             CacheObject val = this.val;
 
-            hasOldBytes = valPtr != 0;
+            hasOldBytes = hasOffHeapPointer();
 
             if ((unmarshal || isOffHeapValuesOnly()) && !expired && val == null && hasOldBytes)
                 val = rawGetOrUnmarshalUnlocked(tmp);
@@ -816,7 +813,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                         // Update indexes before actual write to entry.
                         updateIndex(ret, expTime, nextVer, prevVal);
 
-                    boolean hadValPtr = valPtr != 0;
+                    boolean hadValPtr = hasOffHeapPointer();
 
                     // Don't change version for read-through.
                     update(ret, expTime, ttl, nextVer);
@@ -1164,7 +1161,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
             // can be updated without actually holding entry lock.
             clearIndex(old);
 
-            boolean hadValPtr = valPtr != 0;
+            boolean hadValPtr = hasOffHeapPointer();
 
             update(null, 0, 0, newVer);
 
@@ -1521,7 +1518,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
                     // Must persist inside synchronization in non-tx mode.
                     cctx.store().remove(null, keyValue(false));
 
-                boolean hasValPtr = valPtr != 0;
+                boolean hasValPtr = hasOffHeapPointer();
 
                 // Update index inside synchronization since it can be updated
                 // in load methods without actually holding entry lock.
@@ -2122,7 +2119,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
                 enqueueVer = newVer;
 
-                boolean hasValPtr = valPtr != 0;
+                boolean hasValPtr = hasOffHeapPointer();
 
                 // Clear value on backup. Entry will be removed from cache when it got evicted from queue.
                 update(null, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL, newVer);
@@ -2929,8 +2926,8 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
         if (val != null)
             return val;
 
-        if (valPtr != 0) {
-            CacheObject val0 = cctx.fromOffheap(valPtr, tmp);
+        if (hasOffHeapPointer()) {
+            CacheObject val0 = cctx.fromOffheap(offHeapPointer(), tmp);
 
             if (!tmp && cctx.kernalContext().config().isPeerClassLoadingEnabled())
                 val0.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
@@ -2952,7 +2949,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
     protected boolean hasValueUnlocked() {
         assert Thread.holdsLock(this);
 
-        return val != null || valPtr != 0;
+        return val != null || hasOffHeapPointer();
     }
 
     /** {@inheritDoc} */
@@ -3298,7 +3295,7 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
             synchronized (this) {
                 CacheObject expiredVal = saveValueForIndexUnlocked();
 
-                boolean hasOldBytes = valPtr != 0;
+                boolean hasOldBytes = hasOffHeapPointer();
 
                 boolean expired = checkExpired();
 
@@ -4102,6 +4099,27 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
     }
 
     /**
+     * @return True if entry has off-heap value pointer.
+     */
+    protected boolean hasOffHeapPointer() {
+        return false;
+    }
+
+    /**
+     * @return Off-heap value pointer.
+     */
+    protected long offHeapPointer() {
+        return 0;
+    }
+
+    /**
+     * @param valPtr Off-heap value pointer.
+     */
+    protected void offHeapPointer(long valPtr) {
+        // No-op.
+    }
+
+    /**
      * @return Size of extras object.
      */
     private int extrasSize() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 1c46fd0..23060e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -102,6 +102,9 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
                 GridCacheMapEntry next,
                 int hdrId)
             {
+                if (ctx.useOffheapEntry())
+                    return new GridDhtOffHeapCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
+
                 return new GridDhtCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
             }
         });
@@ -343,17 +346,24 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
     public GridCacheEntryEx entryExx(KeyCacheObject key, AffinityTopologyVersion topVer, boolean allowDetached, boolean touch) {
         try {
             return allowDetached && !ctx.affinity().localNode(key, topVer) ?
-                new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0) :
-                entryEx(key, touch);
+                createEntry(key) : entryEx(key, touch);
         }
         catch (GridDhtInvalidPartitionException e) {
             if (!allowDetached)
                 throw e;
 
-            return new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0);
+            return createEntry(key);
         }
     }
 
+    /**
+     * @param key Key for which entry should be returned.
+     * @return Cache entry.
+     */
+    protected GridDistributedCacheEntry createEntry(KeyCacheObject key) {
+        return new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0);
+    }
+
     /** {@inheritDoc} */
     @Override public void localLoad(Collection<? extends K> keys, final ExpiryPolicy plc)
         throws IgniteCheckedException {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java
new file mode 100644
index 0000000..1191d83
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtOffHeapCacheEntry.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Replicated cache entry for off-heap tiered or off-heap values modes.
+ */
+public class GridDhtOffHeapCacheEntry extends GridDhtCacheEntry {
+    /** Off-heap value pointer. */
+    private long valPtr;
+
+    /**
+     * @param ctx    Cache context.
+     * @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
+     * @param key    Cache key.
+     * @param hash   Key hash value.
+     * @param val    Entry value.
+     * @param next   Next entry in the linked list.
+     * @param hdrId  Header id.
+     */
+    public GridDhtOffHeapCacheEntry(GridCacheContext ctx,
+        AffinityTopologyVersion topVer,
+        KeyCacheObject key,
+        int hash,
+        CacheObject val,
+        GridCacheMapEntry next,
+        int hdrId) {
+        super(ctx, topVer, key, hash, val, next, hdrId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean hasOffHeapPointer() {
+        return valPtr != 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long offHeapPointer() {
+        return valPtr;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void offHeapPointer(long valPtr) {
+        this.valPtr = valPtr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
index 8da4da5..098ec97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
@@ -86,7 +86,9 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
         boolean create)
     {
         if (create) {
-            GridCacheMapEntry entry = new GridDhtCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0);
+            GridCacheMapEntry entry = ctx.useOffheapEntry() ?
+                new GridDhtOffHeapCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0) :
+                new GridDhtCacheEntry(ctx, topVer, key, hash(key.hashCode()), val, null, 0);
 
             return new GridTriple<>(entry, null, null);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 905f7bf..19d88e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -124,6 +124,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                 GridCacheMapEntry next,
                 int hdrId)
             {
+                if (ctx.useOffheapEntry())
+                    return new GridDhtAtomicOffHeapCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
+
                 return new GridDhtAtomicCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java
new file mode 100644
index 0000000..91a8e65
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * DHT atomic cache entry for off-heap tiered or off-heap values modes.
+ */
+public class GridDhtAtomicOffHeapCacheEntry extends GridDhtAtomicCacheEntry {
+    /** Off-heap value pointer. */
+    private long valPtr;
+
+    /**
+     * @param ctx    Cache context.
+     * @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
+     * @param key    Cache key.
+     * @param hash   Key hash value.
+     * @param val    Entry value.
+     * @param next   Next entry in the linked list.
+     * @param hdrId  Header id.
+     */
+    public GridDhtAtomicOffHeapCacheEntry(GridCacheContext ctx,
+        AffinityTopologyVersion topVer,
+        KeyCacheObject key,
+        int hash,
+        CacheObject val,
+        GridCacheMapEntry next,
+        int hdrId) {
+        super(ctx, topVer, key, hash, val, next, hdrId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean hasOffHeapPointer() {
+        return valPtr != 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long offHeapPointer() {
+        return valPtr;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void offHeapPointer(long valPtr) {
+        this.valPtr = valPtr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index c92d9ce..05b3c7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -86,6 +86,9 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
                 GridCacheMapEntry next,
                 int hdrId)
             {
+                if (ctx.useOffheapEntry())
+                    return new GridDhtColocatedOffHeapCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
+
                 return new GridDhtColocatedCacheEntry(ctx, topVer, key, hash, val, next, hdrId);
             }
         });
@@ -126,7 +129,7 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
         boolean allowDetached
     ) {
         return allowDetached && !ctx.affinity().primary(ctx.localNode(), key, topVer) ?
-            new GridDhtDetachedCacheEntry(ctx, key, key.hashCode(), null, null, 0) : entryExx(key, topVer);
+            createEntry(key) : entryExx(key, topVer);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java
new file mode 100644
index 0000000..ed842ad
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedOffHeapCacheEntry.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.colocated;
+
+import org.apache.ignite.internal.processors.affinity.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Cache entry for colocated cache for off-heap tiered or off-heap values modes.
+ */
+public class GridDhtColocatedOffHeapCacheEntry extends GridDhtColocatedCacheEntry {
+    /** Off-heap value pointer. */
+    private long valPtr;
+
+    /**
+     * @param ctx    Cache context.
+     * @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
+     * @param key    Cache key.
+     * @param hash   Key hash value.
+     * @param val    Entry value.
+     * @param next   Next entry in the linked list.
+     * @param hdrId  Header id.
+     */
+    public GridDhtColocatedOffHeapCacheEntry(GridCacheContext ctx,
+        AffinityTopologyVersion topVer,
+        KeyCacheObject key,
+        int hash,
+        CacheObject val,
+        GridCacheMapEntry next,
+        int hdrId) {
+        super(ctx, topVer, key, hash, val, next, hdrId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean hasOffHeapPointer() {
+        return valPtr != 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long offHeapPointer() {
+        return valPtr;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void offHeapPointer(long valPtr) {
+        this.valPtr = valPtr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 145e980..8258b14 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -76,6 +76,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
             ) {
                 // Can't hold any locks here - this method is invoked when
                 // holding write-lock on the whole cache map.
+                if (ctx.useOffheapEntry())
+                    return new GridNearOffHeapCacheEntry(ctx, key, hash, val, next, hdrId);
+
                 return new GridNearCacheEntry(ctx, key, hash, val, next, hdrId);
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java
new file mode 100644
index 0000000..25eb869
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOffHeapCacheEntry.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ * Near cache entry for off-heap tiered or off-heap values modes.
+ */
+public class GridNearOffHeapCacheEntry extends GridNearCacheEntry {
+    /** Off-heap value pointer. */
+    private long valPtr;
+
+    /**
+     * @param ctx   Cache context.
+     * @param key   Cache key.
+     * @param hash  Key hash value.
+     * @param val   Entry value.
+     * @param next  Next entry in the linked list.
+     * @param hdrId Header id.
+     */
+    public GridNearOffHeapCacheEntry(GridCacheContext ctx,
+        KeyCacheObject key,
+        int hash,
+        CacheObject val,
+        GridCacheMapEntry next,
+        int hdrId) {
+        super(ctx, key, hash, val, next, hdrId);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean hasOffHeapPointer() {
+        return valPtr != 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long offHeapPointer() {
+        return valPtr;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void offHeapPointer(long valPtr) {
+        this.valPtr = valPtr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
index 84d4c90..ea59f1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
@@ -29,6 +29,9 @@ import static org.apache.ignite.events.EventType.*;
  */
 @SuppressWarnings({"NonPrivateFieldAccessedInSynchronizedContext", "TooBroadScope"})
 public class GridLocalCacheEntry extends GridCacheMapEntry {
+    /** Off-heap value pointer. */
+    private long valPtr;
+
     /**
      * @param ctx  Cache registry.
      * @param key  Cache key.
@@ -384,4 +387,19 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
 
         return doomed != null;
     }
+
+    /** {@inheritDoc} */
+    @Override protected boolean hasOffHeapPointer() {
+        return valPtr != 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long offHeapPointer() {
+        return valPtr;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void offHeapPointer(long valPtr) {
+        this.valPtr = valPtr;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
new file mode 100644
index 0000000..8c7d33d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.local.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMemoryMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Cache map entry self test.
+ */
+public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        startGrids(1);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        // No-op.
+    }
+
+    /**
+     * @param gridName Grid name.
+     * @param memoryMode Memory mode.
+     * @param atomicityMode Atomicity mode.
+     * @param cacheMode Cache mode.
+     * @param cacheName Cache name.
+     * @return Cache configuration.
+     * @throws Exception If failed.
+     */
+    private CacheConfiguration cacheConfiguration(String gridName,
+        CacheMemoryMode memoryMode,
+        CacheAtomicityMode atomicityMode,
+        CacheMode cacheMode,
+        String cacheName)
+        throws Exception
+    {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setCacheMode(cacheMode);
+        cfg.setAtomicityMode(atomicityMode);
+        cfg.setMemoryMode(memoryMode);
+        cfg.setName(cacheName);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheMapEntry() throws Exception {
+        checkCacheMapEntry(ONHEAP_TIERED, ATOMIC, LOCAL, GridLocalCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_TIERED, ATOMIC, LOCAL, GridLocalCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_VALUES, ATOMIC, LOCAL, GridLocalCacheEntry.class);
+
+        checkCacheMapEntry(ONHEAP_TIERED, TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_TIERED, TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_VALUES, TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class);
+
+        checkCacheMapEntry(ONHEAP_TIERED, ATOMIC, PARTITIONED, GridNearCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_TIERED, ATOMIC, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_VALUES, ATOMIC, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(ONHEAP_TIERED, TRANSACTIONAL, PARTITIONED, GridNearCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_TIERED, TRANSACTIONAL, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_VALUES, TRANSACTIONAL, PARTITIONED, GridNearOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(ONHEAP_TIERED, ATOMIC, REPLICATED, GridDhtAtomicCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_TIERED, ATOMIC, REPLICATED, GridDhtAtomicOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_VALUES, ATOMIC, REPLICATED, GridDhtAtomicOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(ONHEAP_TIERED, TRANSACTIONAL, REPLICATED, GridDhtColocatedCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_TIERED, TRANSACTIONAL, REPLICATED, GridDhtColocatedOffHeapCacheEntry.class);
+
+        checkCacheMapEntry(OFFHEAP_VALUES, TRANSACTIONAL, REPLICATED, GridDhtColocatedOffHeapCacheEntry.class);
+    }
+
+    /**
+     * @param memoryMode Cache memory mode.
+     * @param atomicityMode Cache atomicity mode.
+     * @param cacheMode Cache mode.
+     * @param entryCls Class of cache map entry.
+     * @throws Exception If failed.
+     */
+    private void checkCacheMapEntry(CacheMemoryMode memoryMode,
+        CacheAtomicityMode atomicityMode,
+        CacheMode cacheMode,
+        Class<?> entryCls)
+        throws Exception
+    {
+        log.info("Test cache [memMode=" + memoryMode +
+            ", atomicityMode=" + atomicityMode +
+            ", cacheMode=" + cacheMode + ']');
+
+        CacheConfiguration cfg = cacheConfiguration(grid(0).name(),
+            memoryMode,
+            atomicityMode,
+            cacheMode,
+            "Cache");
+
+        try (IgniteCache jcache = grid(0).getOrCreateCache(cfg)) {
+            GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(0)).internalCache(jcache.getName());
+
+            Integer key = primaryKey(grid(0).cache(null));
+
+            cache.put(key, "val");
+
+            GridCacheEntryEx entry = cache.entryEx(key);
+
+            entry.unswap(true);
+
+            assertNotNull(entry);
+
+            assertEquals(entry.getClass(), entryCls);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d87f6d61/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index f7272d4..8eb0688 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -126,6 +126,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
 
         suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class);
 
+        suite.addTestSuite(CacheOffheapMapEntrySelfTest.class);
+
         return suite;
     }
 }



[47/47] incubator-ignite git commit: IGNITE-889 - Fixed test.

Posted by ag...@apache.org.
IGNITE-889 - Fixed 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/93ba805a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/93ba805a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/93ba805a

Branch: refs/heads/ignite-889
Commit: 93ba805a236a4ec60aeb0abcfa7a1aff5d7ee759
Parents: 72b6ce2
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu May 14 12:54:28 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu May 14 12:54:28 2015 -0700

----------------------------------------------------------------------
 .../cache/integration/IgniteCacheTxStoreSessionTest.java        | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93ba805a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
index 269b9ae..554cbf8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
@@ -66,6 +66,9 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
         testTxPutRemove(null, null);
 
+        // Need to clear cache before next test to trigger store load on get.
+        jcache(0).withSkipStore().removeAll();
+
         for (TransactionConcurrency concurrency : F.asList(PESSIMISTIC)) {
             for (TransactionIsolation isolation : F.asList(REPEATABLE_READ)) {
                 testTxPut(jcache(0), concurrency, isolation);
@@ -136,6 +139,8 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
         try (Transaction tx = startTx(concurrency, isolation)) {
             log.info("Do tx get.");
 
+            expData.add(new ExpectedData(false, "load", new HashMap<>(), cache.getName()));
+
             cache.get(key1);
 
             log.info("Do tx put.");


[40/47] incubator-ignite git commit: Merge branch 'ignite-gg-10151' into ignite-sprint-5

Posted by ag...@apache.org.
Merge branch 'ignite-gg-10151' into ignite-sprint-5


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

Branch: refs/heads/ignite-889
Commit: d21bc307b33ffa944a2e1a33893f18d10f35347c
Parents: 2b57817 0532017
Author: Andrey <an...@gridgain.com>
Authored: Thu May 14 00:33:18 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu May 14 00:33:18 2015 +0700

----------------------------------------------------------------------
 .../scalar/tests/ScalarCacheQueriesSpec.scala   | 154 +++++++++----------
 .../ignite/scalar/tests/ScalarCacheSpec.scala   |  23 +--
 .../scalar/tests/ScalarConversionsSpec.scala    |  43 +++---
 .../scalar/tests/ScalarProjectionSpec.scala     | 128 ++++++++-------
 .../scalar/tests/ScalarReturnableSpec.scala     |  41 ++---
 modules/visor-console/pom.xml                   |   2 +-
 .../ignite/visor/VisorRuntimeBaseSpec.scala     |   2 +-
 .../visor/commands/VisorArgListSpec.scala       |  60 ++++----
 .../commands/VisorFileNameCompleterSpec.scala   |  34 ++--
 .../commands/ack/VisorAckCommandSpec.scala      |  20 +--
 .../commands/alert/VisorAlertCommandSpec.scala  |  68 ++++----
 .../cache/VisorCacheClearCommandSpec.scala      |  48 +++---
 .../commands/cache/VisorCacheCommandSpec.scala  |  66 ++++----
 .../config/VisorConfigurationCommandSpec.scala  |   8 +-
 .../cswap/VisorCacheSwapCommandSpec.scala       |  24 +--
 .../deploy/VisorDeployCommandSpec.scala         |  10 +-
 .../disco/VisorDiscoveryCommandSpec.scala       |  46 +++---
 .../events/VisorEventsCommandSpec.scala         |  28 ++--
 .../visor/commands/gc/VisorGcCommandSpec.scala  |  30 ++--
 .../commands/help/VisorHelpCommandSpec.scala    |  57 +++----
 .../commands/kill/VisorKillCommandSpec.scala    |  58 +++----
 .../commands/log/VisorLogCommandSpec.scala      |  10 +-
 .../commands/mem/VisorMemoryCommandSpec.scala   |  77 +++++-----
 .../commands/node/VisorNodeCommandSpec.scala    |  22 +--
 .../commands/open/VisorOpenCommandSpec.scala    |  16 +-
 .../commands/ping/VisorPingCommandSpec.scala    |  16 +-
 .../commands/start/VisorStartCommandSpec.scala  | 126 +++++++--------
 .../commands/tasks/VisorTasksCommandSpec.scala  | 112 +++++++-------
 .../commands/top/VisorTopologyCommandSpec.scala |  52 +++----
 .../commands/vvm/VisorVvmCommandSpec.scala      |  30 ++--
 30 files changed, 724 insertions(+), 687 deletions(-)
----------------------------------------------------------------------



[08/47] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-4' into ignite-157

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-4' into ignite-157


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

Branch: refs/heads/ignite-889
Commit: 3ddbff9233f8a6e51e3192287881e189b4d97c56
Parents: a2fb8f6 0c13a08
Author: sboikov <se...@inria.fr>
Authored: Thu May 7 22:24:00 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Thu May 7 22:24:00 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml              |  2 +-
 modules/aop/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/extdata/p2p/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/log4j/pom.xml         |  2 +-
 modules/rest-http/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/spring/pom.xml        |  2 +-
 modules/ssh/pom.xml           |  2 +-
 modules/tools/pom.xml         |  2 +-
 modules/urideploy/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 +-
 pom.xml                       | 14 ++++----------
 31 files changed, 34 insertions(+), 40 deletions(-)
----------------------------------------------------------------------



[31/47] incubator-ignite git commit: # ignite-sprint-5 added test for IGNITE-882

Posted by ag...@apache.org.
# ignite-sprint-5 added test for IGNITE-882


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

Branch: refs/heads/ignite-889
Commit: 82467880eb18bbd16a26b92300b5212f37fe3200
Parents: 22341a9
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 16:16:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 16:16:12 2015 +0300

----------------------------------------------------------------------
 .../discovery/tcp/TcpDiscoveryRestartTest.java  | 199 +++++++++++++++++++
 1 file changed, 199 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/82467880/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
new file mode 100644
index 0000000..e6bee4a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryRestartTest.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.eclipse.jetty.util.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.events.EventType.*;
+
+/**
+ *
+ */
+public class TcpDiscoveryRestartTest extends GridCommonAbstractTest {
+    /** */
+    private TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static AtomicReference<String> err;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+        spi.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(spi);
+
+        int[] evts = {EVT_NODE_JOINED, EVT_NODE_FAILED, EVT_NODE_LEFT};
+
+        cfg.setIncludeEventTypes(evts);
+
+        Map<IgnitePredicate<? extends Event>, int[]> lsnrs = new HashMap<>();
+
+        lsnrs.put(new TestEventListener(), evts);
+
+        cfg.setLocalEventListeners(lsnrs);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRestart() throws Exception {
+        err = new AtomicReference<>();
+
+        final int NODE_CNT = 3;
+
+        startGrids(NODE_CNT);
+
+        final ConcurrentHashSet<UUID> nodeIds = new ConcurrentHashSet<>();
+
+        final AtomicInteger id = new AtomicInteger(NODE_CNT);
+
+        final IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                int nodeIdx = id.getAndIncrement();
+
+                for (int i = 0; i < 10 && err.get() == null; i++) {
+                    Ignite ignite = startGrid(nodeIdx);
+
+                    UUID nodeId = ignite.cluster().localNode().id();
+
+                    if (!nodeIds.add(nodeId))
+                        failed("Duplicated node ID: " + nodeId);
+
+                    stopGrid(nodeIdx);
+                }
+
+                return null;
+            }
+        }, 5, "restart-thread");
+
+        IgniteInternalFuture<?> loadFut = GridTestUtils.runMultiThreadedAsync(new Callable<Long>() {
+            @Override public Long call() throws Exception {
+                long dummyRes = 0;
+
+                List<String> list = new ArrayList<>();
+
+                while (!fut.isDone()) {
+                    for (int i = 0; i < 100; i++) {
+                        String str = new String(new byte[i]);
+
+                        list.add(str);
+
+                        dummyRes += str.hashCode();
+                    }
+
+                    if (list.size() > 1000_000) {
+                        list = new ArrayList<>();
+
+                        System.gc();
+                    }
+                }
+
+                return dummyRes;
+            }
+        }, 2, "test-load");
+
+        fut.get();
+
+        loadFut.get();
+
+        assertNull(err.get());
+
+        for (int i = 0; i < NODE_CNT; i++) {
+            Ignite ignite = ignite(i);
+
+            TestEventListener lsnr = (TestEventListener)F.firstKey(ignite.configuration().getLocalEventListeners());
+
+            assertNotNull(lsnr);
+
+            for (UUID nodeId : nodeIds)
+                lsnr.checkEvents(nodeId);
+        }
+    }
+
+
+    /**
+     * @param msg Message.
+     */
+    private void failed(String msg) {
+        info(msg);
+
+        err.compareAndSet(null, msg);
+    }
+
+    /**
+     *
+     */
+    private class TestEventListener implements IgnitePredicate<Event> {
+        /** */
+        private final ConcurrentHashSet<UUID> joinIds = new ConcurrentHashSet<>();
+
+        /** */
+        private final ConcurrentHashSet<UUID> leftIds = new ConcurrentHashSet<>();
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(Event evt) {
+            DiscoveryEvent evt0 = (DiscoveryEvent)evt;
+
+            if (evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT) {
+                if (!leftIds.add(evt0.eventNode().id()))
+                    failed("Duplicated failed node ID: " + evt0.eventNode().id());
+            }
+            else {
+                assertEquals(EVT_NODE_JOINED, evt.type());
+
+                if (!joinIds.add(evt0.eventNode().id()))
+                    failed("Duplicated joined node ID: " + evt0.eventNode().id());
+            }
+
+            return true;
+        }
+
+        /**
+         * @param nodeId Node ID.
+         */
+        void checkEvents(UUID nodeId) {
+            assertTrue("No join event: " + nodeId, joinIds.contains(nodeId));
+
+            assertTrue("No left event: " + nodeId, leftIds.contains(nodeId));
+        }
+    }
+}


[13/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: c54813625103ea98591acfb8fe15d5cb4dea7f1c
Parents: 46dda3d
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 13:31:41 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 13:31:41 2015 +0300

----------------------------------------------------------------------
 .../transactions/IgniteTxLocalAdapter.java      |   2 +-
 .../GridCacheAbstractNodeRestartSelfTest.java   |   6 +-
 .../distributed/IgniteTxGetAfterStopTest.java   | 131 +++++++++++++++++++
 .../testsuites/IgniteCacheRestartTestSuite.java |   4 +-
 4 files changed, 137 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index fc3efba..bd3a4ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1760,7 +1760,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             }
                         }
 
-                        if (!missed.isEmpty() && (cacheCtx.isReplicated() || cacheCtx.isLocal())) {
+                        if (!missed.isEmpty() && cacheCtx.isLocal()) {
                             return checkMissed(cacheCtx,
                                 retMap,
                                 missed,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
index 76020b8..7e65f23 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
@@ -105,9 +105,9 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
 
         disco.setIpFinder(ipFinder);
 
-        disco.setSocketTimeout(10_000);
-        disco.setAckTimeout(10_000);
-        disco.setNetworkTimeout(10_000);
+        disco.setSocketTimeout(30_000);
+        disco.setAckTimeout(30_000);
+        disco.setNetworkTimeout(30_000);
 
         c.setDiscoverySpi(disco);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java
new file mode 100644
index 0000000..469f513
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxGetAfterStopTest.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.transactions.*;
+import org.jetbrains.annotations.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ *
+ */
+public class IgniteTxGetAfterStopTest extends IgniteCacheAbstractTest {
+    /** */
+    private CacheMode cacheMode;
+
+    /** */
+    private NearCacheConfiguration nearCfg;
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return cacheMode;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return nearCfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReplicated() throws Exception {
+        getAfterStop(REPLICATED, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPartitioned() throws Exception {
+        getAfterStop(PARTITIONED, new NearCacheConfiguration());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPartitionedNearDisabled() throws Exception {
+        getAfterStop(PARTITIONED, null);
+    }
+
+    /**
+     * @param cacheMode Cache mode.
+     * @param nearCfg Near cache configuration.
+     * @throws Exception If failed.
+     */
+    private void getAfterStop(CacheMode cacheMode, @Nullable NearCacheConfiguration nearCfg) throws Exception {
+        this.cacheMode = cacheMode;
+        this.nearCfg = nearCfg;
+
+        startGrids();
+
+        IgniteCache<Integer, Integer> cache0 = jcache(0);
+        IgniteCache<Integer, Integer> cache1 = jcache(1);
+
+        Integer key0 = primaryKey(cache0);
+        Integer key1 = primaryKey(cache1);
+
+        try (Transaction tx = ignite(0).transactions().txStart()) {
+            log.info("Put: " + key0);
+
+            cache0.put(key0, key0);
+
+            log.info("Stop node.");
+
+            stopGrid(3);
+
+            log.info("Get: " + key1);
+
+            cache0.get(key1);
+
+            log.info("Commit.");
+
+            tx.commit();
+        }
+
+        assertEquals(key0, cache0.get(key0));
+        assertNull(cache1.get(key1));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5481362/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index e5372e8..983d447 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -21,6 +21,7 @@ import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * In-Memory Data Grid stability test suite on changing topology.
@@ -37,8 +38,7 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
         suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
-        // TODO IGNITE-157.
-        // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
+        suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
         // suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); // TODO IGNITE-747


[24/47] incubator-ignite git commit: Merge branch 'ignite-sprint-5' into ignite-gg-10151

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-5' into ignite-gg-10151


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

Branch: refs/heads/ignite-889
Commit: 05320174665e252be94c4e4b984a408f35800075
Parents: b41fbee 3861fbd
Author: Andrey <an...@gridgain.com>
Authored: Wed May 13 13:05:22 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed May 13 13:05:22 2015 +0700

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   34 +-
 assembly/release-base.xml                       |    6 +-
 assembly/release-schema-import.xml              |   50 +
 bin/ignite-schema-import.bat                    |    2 +-
 bin/ignite-schema-import.sh                     |    2 +-
 bin/ignite.bat                                  |    2 +-
 bin/ignite.sh                                   |    2 +-
 bin/ignitevisorcmd.bat                          |    2 +-
 bin/ignitevisorcmd.sh                           |    2 +-
 bin/include/build-classpath.bat                 |   46 +
 bin/include/build-classpath.sh                  |   71 +
 bin/include/functions.sh                        |    2 +-
 bin/include/target-classpath.bat                |   46 -
 bin/include/target-classpath.sh                 |   71 -
 dev-tools/.gitignore                            |    2 +
 dev-tools/build.gradle                          |   45 +
 dev-tools/src/main/groovy/jiraslurp.groovy      |  146 +
 examples/pom.xml                                |    2 +-
 .../streaming/wordcount/CacheConfig.java        |    5 -
 modules/aop/pom.xml                             |    2 +-
 modules/aws/pom.xml                             |    2 +-
 .../config/grid-client-config.properties        |   50 +-
 modules/clients/pom.xml                         |    2 +-
 .../ClientPropertiesConfigurationSelfTest.java  |   12 +-
 modules/cloud/pom.xml                           |    4 +-
 .../TcpDiscoveryCloudIpFinderSelfTest.java      |    2 -
 modules/codegen/pom.xml                         |    2 +-
 .../ignite/codegen/MessageCodeGenerator.java    |    4 +-
 modules/core/pom.xml                            |    2 +-
 .../java/org/apache/ignite/IgniteCache.java     |    5 +
 .../org/apache/ignite/IgniteJdbcDriver.java     |   81 +-
 .../client/GridClientConfiguration.java         |    2 +-
 .../internal/direct/DirectByteBufferStream.java |    4 +-
 .../managers/communication/GridIoManager.java   |    8 +-
 .../communication/GridIoMessageFactory.java     |    4 +-
 .../eventstorage/GridEventStorageManager.java   |    5 +-
 .../cache/DynamicCacheDescriptor.java           |   16 +-
 .../processors/cache/GridCacheAdapter.java      |  544 +-
 .../cache/GridCacheEvictionManager.java         |    2 +-
 .../processors/cache/GridCacheIoManager.java    |  314 +-
 .../processors/cache/GridCacheMapEntry.java     |   18 +-
 .../processors/cache/GridCacheMessage.java      |    8 +-
 .../GridCachePartitionExchangeManager.java      |    3 +
 .../processors/cache/GridCacheProcessor.java    |  189 +-
 .../processors/cache/GridCacheProxyImpl.java    |   24 -
 .../processors/cache/GridCacheSwapManager.java  |  215 +-
 .../processors/cache/GridCacheTtlManager.java   |  156 +-
 .../processors/cache/GridCacheUtils.java        |    6 +-
 .../processors/cache/IgniteInternalCache.java   |   27 -
 ...ridCacheOptimisticCheckPreparedTxFuture.java |  434 --
 ...idCacheOptimisticCheckPreparedTxRequest.java |  232 -
 ...dCacheOptimisticCheckPreparedTxResponse.java |  179 -
 .../distributed/GridCacheTxRecoveryFuture.java  |  506 ++
 .../distributed/GridCacheTxRecoveryRequest.java |  261 +
 .../GridCacheTxRecoveryResponse.java            |  182 +
 .../GridDistributedTxRemoteAdapter.java         |    2 +-
 .../distributed/dht/GridDhtLocalPartition.java  |    2 +-
 .../dht/GridPartitionedGetFuture.java           |    2 +-
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |    8 +
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |    2 +-
 .../atomic/GridNearAtomicUpdateResponse.java    |   18 +-
 .../colocated/GridDhtColocatedLockFuture.java   |    2 +
 .../dht/preloader/GridDhtForceKeysFuture.java   |    6 +
 .../dht/preloader/GridDhtForceKeysResponse.java |   54 +-
 .../distributed/near/GridNearCacheAdapter.java  |   10 -
 .../distributed/near/GridNearGetResponse.java   |    8 +-
 .../processors/cache/local/GridLocalCache.java  |    8 +-
 .../local/atomic/GridLocalAtomicCache.java      |   27 +-
 .../cache/query/GridCacheQueryManager.java      |   21 +-
 .../cache/query/GridCacheSqlQuery.java          |    2 +-
 .../cache/query/GridCacheTwoStepQuery.java      |   17 +
 .../cache/transactions/IgniteInternalTx.java    |    5 +-
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../cache/transactions/IgniteTxHandler.java     |   38 +-
 .../transactions/IgniteTxLocalAdapter.java      |   14 +-
 .../cache/transactions/IgniteTxManager.java     |  173 +-
 .../datastreamer/DataStreamerImpl.java          |    2 +
 .../processors/igfs/IgfsDataManager.java        |    3 +
 .../processors/igfs/IgfsDeleteWorker.java       |    4 +
 .../processors/igfs/IgfsMetaManager.java        |    2 +-
 .../internal/processors/igfs/IgfsUtils.java     |   11 +-
 .../offheap/GridOffHeapProcessor.java           |   17 +
 .../processors/resource/GridResourceField.java  |   11 +
 .../processors/resource/GridResourceIoc.java    |  387 +-
 .../processors/resource/GridResourceMethod.java |   13 +
 .../resource/GridResourceProcessor.java         |    4 +-
 .../ignite/internal/util/IgniteUtils.java       |   19 +-
 .../util/lang/GridFilteredIterator.java         |    2 +-
 .../ignite/internal/util/lang/GridFunc.java     | 7218 +++++-------------
 .../util/offheap/GridOffHeapPartitionedMap.java |    9 +
 .../unsafe/GridUnsafePartitionedMap.java        |  155 +-
 .../internal/visor/query/VisorQueryArg.java     |   14 +-
 .../internal/visor/query/VisorQueryJob.java     |    2 +
 .../apache/ignite/lang/IgniteAsyncSupport.java  |    4 +-
 .../discovery/tcp/TcpClientDiscoverySpi.java    |    4 -
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   50 +-
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   |    8 +-
 .../resources/META-INF/classnames.properties    |   12 +-
 .../core/src/main/resources/ignite.properties   |    2 +-
 .../internal/GridUpdateNotifierSelfTest.java    |   21 +-
 .../processors/cache/CacheGetFromJobTest.java   |  110 +
 .../GridCacheAbstractFailoverSelfTest.java      |    4 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  227 +-
 .../cache/GridCacheAbstractSelfTest.java        |    4 +-
 .../cache/GridCacheSwapReloadSelfTest.java      |   20 +-
 .../IgniteCacheEntryListenerAbstractTest.java   |    4 +-
 .../IgniteCacheP2pUnmarshallingErrorTest.java   |  189 +
 ...gniteCacheP2pUnmarshallingNearErrorTest.java |   56 +
 ...CacheP2pUnmarshallingRebalanceErrorTest.java |   80 +
 .../IgniteCacheP2pUnmarshallingTxErrorTest.java |  109 +
 .../cache/IgniteCachePeekModesAbstractTest.java |   15 +-
 .../cache/OffHeapTieredTransactionSelfTest.java |  127 +
 ...CacheLoadingConcurrentGridStartSelfTest.java |  163 +
 .../GridCacheAbstractNodeRestartSelfTest.java   |   94 +-
 ...GridCacheLoadingConcurrentGridStartTest.java |  154 -
 ...xOriginatingNodeFailureAbstractSelfTest.java |    2 +-
 .../dht/GridCacheDhtPreloadSelfTest.java        |    2 +-
 ...icOffHeapTieredMultiNodeFullApiSelfTest.java |   43 +
 ...ionedNearDisabledOffHeapFullApiSelfTest.java |    8 +-
 ...DisabledOffHeapMultiNodeFullApiSelfTest.java |    8 +-
 ...abledOffHeapTieredAtomicFullApiSelfTest.java |   56 +
 ...earDisabledOffHeapTieredFullApiSelfTest.java |   33 +
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |   33 +
 ...rDisabledPrimaryNodeFailureRecoveryTest.java |   31 +
 ...rtitionedPrimaryNodeFailureRecoveryTest.java |   31 +
 ...woBackupsPrimaryNodeFailureRecoveryTest.java |   37 +
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |  533 ++
 ...CacheAtomicOffHeapTieredFullApiSelfTest.java |   32 +
 ...icOffHeapTieredMultiNodeFullApiSelfTest.java |   33 +
 ...yWriteOrderOffHeapTieredFullApiSelfTest.java |   33 +
 ...erOffHeapTieredMultiNodeFullApiSelfTest.java |   33 +
 ...achePartitionedMultiNodeFullApiSelfTest.java |   15 +-
 .../GridCachePartitionedNodeRestartTest.java    |    4 +-
 ...dCachePartitionedOffHeapFullApiSelfTest.java |    8 +-
 ...titionedOffHeapMultiNodeFullApiSelfTest.java |    8 +-
 ...PartitionedOffHeapTieredFullApiSelfTest.java |   32 +
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |   72 +
 ...ePartitionedOptimisticTxNodeRestartTest.java |    4 +-
 .../GridCacheReplicatedNodeRestartSelfTest.java |    2 +
 ...idCacheReplicatedOffHeapFullApiSelfTest.java |    8 +-
 ...plicatedOffHeapMultiNodeFullApiSelfTest.java |    8 +-
 ...eReplicatedOffHeapTieredFullApiSelfTest.java |   33 +
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |   33 +
 .../IgniteCacheExpiryPolicyAbstractTest.java    |    2 +-
 .../IgniteCacheExpiryPolicyTestSuite.java       |    2 +
 .../expiry/IgniteCacheTtlCleanupSelfTest.java   |   85 +
 ...LocalAtomicOffHeapTieredFullApiSelfTest.java |   32 +
 .../GridCacheLocalOffHeapFullApiSelfTest.java   |    6 +-
 ...dCacheLocalOffHeapTieredFullApiSelfTest.java |   32 +
 .../igfs/IgfsClientCacheSelfTest.java           |  132 +
 .../processors/igfs/IgfsOneClientNodeTest.java  |  133 +
 .../processors/igfs/IgfsStreamsSelfTest.java    |    2 +-
 ...idFileSwapSpaceSpiMultithreadedLoadTest.java |    4 +-
 .../tcp/TcpClientDiscoverySelfTest.java         |    8 +
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   65 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |    2 +
 .../IgniteCacheFullApiSelfTestSuite.java        |   18 +
 ...gniteCacheP2pUnmarshallingErrorTestSuit.java |   41 +
 .../testsuites/IgniteCacheRestartTestSuite.java |    5 +-
 .../ignite/testsuites/IgniteCacheTestSuite.java |  296 -
 .../testsuites/IgniteCacheTestSuite2.java       |  141 +
 .../testsuites/IgniteCacheTestSuite3.java       |  140 +
 .../testsuites/IgniteCacheTestSuite4.java       |  131 +
 .../IgniteCacheTxRecoverySelfTestSuite.java     |    4 +
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |    3 +
 modules/extdata/p2p/pom.xml                     |    2 +-
 modules/extdata/uri/pom.xml                     |    2 +-
 modules/gce/pom.xml                             |    4 +-
 modules/geospatial/pom.xml                      |    2 +-
 modules/hadoop/pom.xml                          |    2 +-
 modules/hibernate/pom.xml                       |    2 +-
 modules/indexing/pom.xml                        |    2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |    4 +
 .../processors/query/h2/sql/GridSqlQuery.java   |   20 +
 .../query/h2/sql/GridSqlQueryParser.java        |   10 +-
 .../query/h2/sql/GridSqlQuerySplitter.java      |   11 +-
 .../processors/query/h2/sql/GridSqlSelect.java  |    2 +-
 .../processors/query/h2/sql/GridSqlUnion.java   |    2 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |    3 +
 .../h2/twostep/GridReduceQueryExecutor.java     |  119 +-
 .../cache/GridCacheOffHeapAndSwapSelfTest.java  |   11 +-
 .../cache/GridCacheOffHeapSelfTest.java         |   11 +-
 .../cache/GridCacheOffheapIndexGetSelfTest.java |  111 +
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |   21 +
 ...niteCacheP2pUnmarshallingQueryErrorTest.java |   56 +
 ...eQueryMultiThreadedOffHeapTiredSelfTest.java |   37 +
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |   29 +-
 .../IgniteCacheQuerySelfTestSuite.java          |    4 +
 .../IgniteCacheWithIndexingTestSuite.java       |    2 +
 modules/jcl/pom.xml                             |    2 +-
 modules/jta/pom.xml                             |    2 +-
 modules/log4j/pom.xml                           |    2 +-
 modules/rest-http/pom.xml                       |    2 +-
 modules/scalar/pom.xml                          |    2 +-
 .../ignite/scalar/ScalarConversions.scala       |    8 -
 modules/schedule/pom.xml                        |    2 +-
 modules/schema-import/pom.xml                   |    8 +-
 .../ignite/schema/generator/CodeGenerator.java  |   47 +-
 modules/slf4j/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/pom.xml                   |    2 +-
 .../commands/cache/VisorCacheScanCommand.scala  |    2 +-
 modules/visor-plugins/pom.xml                   |    2 +-
 modules/web/pom.xml                             |    2 +-
 modules/yardstick/pom.xml                       |    2 +-
 parent/pom.xml                                  |    2 +
 pom.xml                                         |  286 +-
 210 files changed, 8627 insertions(+), 8480 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/05320174/modules/visor-console/pom.xml
----------------------------------------------------------------------


[10/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: b3dcbf18407318e7c824a7260fed8c1ec3d3d844
Parents: a2fb8f6
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 10:20:30 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 11:31:51 2015 +0300

----------------------------------------------------------------------
 .../near/GridAbstractNearTxPrepareFuture.java   | 222 ------------------
 .../near/GridNearOptimisticTxPrepareFuture.java |  15 +-
 .../GridNearPessimisticTxPrepareFuture.java     |  39 +++-
 .../cache/distributed/near/GridNearTxLocal.java |   2 +-
 .../near/GridNearTxPrepareFutureAdapter.java    | 226 +++++++++++++++++++
 .../cache/transactions/IgniteTxHandler.java     |   3 +-
 .../GridCacheAbstractFailoverSelfTest.java      |   7 +
 .../IgniteCacheFailoverTestSuite.java           |   8 +-
 8 files changed, 283 insertions(+), 239 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
deleted file mode 100644
index 6f94f21..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.*;
-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.colocated.*;
-import org.apache.ignite.internal.processors.cache.transactions.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.util.future.*;
-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 javax.cache.expiry.*;
-import java.util.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
-
-/**
- * Common code for tx prepare in optimistic and pessimistic modes.
- */
-public abstract class GridAbstractNearTxPrepareFuture extends GridCompoundIdentityFuture<IgniteInternalTx>
-    implements GridCacheFuture<IgniteInternalTx> {
-    /** Logger reference. */
-    protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
-    /** Logger. */
-    protected static IgniteLogger log;
-
-    /** Context. */
-    protected GridCacheSharedContext<?, ?> cctx;
-
-    /** Future ID. */
-    protected IgniteUuid futId;
-
-    /** Transaction. */
-    @GridToStringInclude
-    protected GridNearTxLocal tx;
-
-    /** Error. */
-    @GridToStringExclude
-    protected AtomicReference<Throwable> err = new AtomicReference<>(null);
-
-    /** Trackable flag. */
-    protected boolean trackable = true;
-
-    /** Full information about transaction nodes mapping. */
-    protected GridDhtTxMapping txMapping;
-
-    /**
-     * @param cctx Context.
-     * @param tx Transaction.
-     */
-    public GridAbstractNearTxPrepareFuture(GridCacheSharedContext cctx, final GridNearTxLocal tx) {
-        super(cctx.kernalContext(), new IgniteReducer<IgniteInternalTx, IgniteInternalTx>() {
-            @Override public boolean collect(IgniteInternalTx e) {
-                return true;
-            }
-
-            @Override public IgniteInternalTx reduce() {
-                // Nothing to aggregate.
-                return tx;
-            }
-        });
-
-        assert cctx != null;
-        assert tx != null;
-
-        this.cctx = cctx;
-        this.tx = tx;
-
-        futId = IgniteUuid.randomUuid();
-
-        if (log == null)
-            log = U.logger(cctx.kernalContext(), logRef, GridAbstractNearTxPrepareFuture.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteUuid futureId() {
-        return futId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion version() {
-        return tx.xidVersion();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void markNotTrackable() {
-        trackable = false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean trackable() {
-        return trackable;
-    }
-
-    /**
-     * Prepares transaction.
-     */
-    public abstract void prepare();
-
-    /**
-     * @param nodeId Sender.
-     * @param res Result.
-     */
-    public abstract void onResult(UUID nodeId, GridNearTxPrepareResponse res);
-
-    /**
-     * Checks if mapped transaction can be committed on one phase.
-     * One-phase commit can be done if transaction maps to one primary node and not more than one backup.
-     */
-    protected final void checkOnePhase() {
-        if (tx.storeUsed())
-            return;
-
-        Map<UUID, Collection<UUID>> map = txMapping.transactionNodes();
-
-        if (map.size() == 1) {
-            Map.Entry<UUID, Collection<UUID>> entry = F.firstEntry(map);
-
-            assert entry != null;
-
-            Collection<UUID> backups = entry.getValue();
-
-            if (backups.size() <= 1)
-                tx.onePhaseCommit(true);
-        }
-    }
-
-    /**
-     * @param m Mapping.
-     * @param res Response.
-     */
-    protected final void onPrepareResponse(GridDistributedTxMapping m, GridNearTxPrepareResponse res) {
-        if (res == null)
-            return;
-
-        assert res.error() == null : res;
-        assert F.isEmpty(res.invalidPartitions()) : res;
-
-        for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : res.ownedValues().entrySet()) {
-            IgniteTxEntry txEntry = tx.entry(entry.getKey());
-
-            assert txEntry != null;
-
-            GridCacheContext cacheCtx = txEntry.context();
-
-            while (true) {
-                try {
-                    if (cacheCtx.isNear()) {
-                        GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
-
-                        CacheVersionedValue tup = entry.getValue();
-
-                        nearEntry.resetFromPrimary(tup.value(), tx.xidVersion(),
-                            tup.version(), m.node().id(), tx.topologyVersion());
-                    }
-                    else if (txEntry.cached().detached()) {
-                        GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
-
-                        CacheVersionedValue tup = entry.getValue();
-
-                        detachedEntry.resetFromPrimary(tup.value(), tx.xidVersion());
-                    }
-
-                    break;
-                }
-                catch (GridCacheEntryRemovedException ignored) {
-                    // Retry.
-                }
-            }
-        }
-
-        tx.implicitSingleResult(res.returnValue());
-
-        for (IgniteTxKey key : res.filterFailedKeys()) {
-            IgniteTxEntry txEntry = tx.entry(key);
-
-            assert txEntry != null : "Missing tx entry for write key: " + key;
-
-            txEntry.op(NOOP);
-
-            assert txEntry.context() != null;
-
-            ExpiryPolicy expiry = txEntry.context().expiryForTxEntry(txEntry);
-
-            if (expiry != null)
-                txEntry.ttl(CU.toTtl(expiry.getExpiryForAccess()));
-        }
-
-        if (!m.empty()) {
-            // Register DHT version.
-            tx.addDhtVersion(m.node().id(), res.dhtVersion());
-
-            m.dhtVersion(res.dhtVersion());
-
-            if (m.near())
-                tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 110cca4..1f2c439 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -47,7 +47,7 @@ import static org.apache.ignite.transactions.TransactionState.*;
 /**
  *
  */
-public class GridNearOptimisticTxPrepareFuture extends GridAbstractNearTxPrepareFuture
+public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAdapter
     implements GridCacheMvccFuture<IgniteInternalTx> {
     /** */
     private Collection<IgniteTxKey> lockKeys = new GridConcurrentHashSet<>();
@@ -397,8 +397,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridAbstractNearTxPrepare
 
         txMapping = new GridDhtTxMapping();
 
-        ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings =
-            new ConcurrentLinkedDeque8<>();
+        ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings = new ConcurrentLinkedDeque8<>();
 
         if (!F.isEmpty(reads) || !F.isEmpty(writes)) {
             for (int cacheId : tx.activeCacheIds()) {
@@ -647,7 +646,15 @@ public class GridNearOptimisticTxPrepareFuture extends GridAbstractNearTxPrepare
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return S.toString(GridNearOptimisticTxPrepareFuture.class, this, super.toString());
+        Collection<String> pendingFuts = F.viewReadOnly(pending(), new C1<IgniteInternalFuture<?>, String>() {
+            @Override public String apply(IgniteInternalFuture<?> f) {
+                return "[node=" + ((MiniFuture)f).node().id() + ", loc=" + ((MiniFuture)f).node().isLocal() + "]";
+            }
+        });
+
+        return S.toString(GridNearOptimisticTxPrepareFuture.class, this,
+            "pendingFuts", pendingFuts,
+            "super", super.toString());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index e3f24f5..ba8b92c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -41,7 +41,7 @@ import static org.apache.ignite.transactions.TransactionState.*;
 /**
  *
  */
-public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepareFuture {
+public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureAdapter {
     /**
      * @param cctx Context.
      * @param tx Transaction.
@@ -72,7 +72,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepar
             MiniFuture f = (MiniFuture)fut;
 
             if (f.node().id().equals(nodeId)) {
-                f.onError(new ClusterTopologyCheckedException("Remote node left grid: " + nodeId));
+                f.onNodeLeft(new ClusterTopologyCheckedException("Remote node left grid: " + nodeId));
 
                 found = true;
             }
@@ -222,8 +222,10 @@ public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepar
                 try {
                     cctx.io().send(node, req, tx.ioPolicy());
                 }
+                catch (ClusterTopologyCheckedException e) {
+                    fut.onNodeLeft(e);
+                }
                 catch (IgniteCheckedException e) {
-                    // Fail the whole thing.
                     fut.onError(e);
                 }
             }
@@ -242,7 +244,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepar
         if (err == null)
             tx.state(PREPARED);
 
-        if (super.onDone(res, err)) {
+        if (super.onDone(tx, err)) {
             cctx.mvcc().removeFuture(this);
 
             return true;
@@ -253,7 +255,15 @@ public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepar
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return S.toString(GridNearPessimisticTxPrepareFuture.class, this, super.toString());
+        Collection<String> pendingFuts = F.viewReadOnly(pending(), new C1<IgniteInternalFuture<?>, String>() {
+            @Override public String apply(IgniteInternalFuture<?> f) {
+                return "[node=" + ((MiniFuture)f).node().id() + ", loc=" + ((MiniFuture)f).node().isLocal() + "]";
+            }
+        });
+
+        return S.toString(GridNearPessimisticTxPrepareFuture.class, this,
+            "pendingFuts", pendingFuts,
+            "super", super.toString());
     }
 
     /**
@@ -306,8 +316,25 @@ public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepar
         /**
          * @param e Error.
          */
+        void onNodeLeft(ClusterTopologyCheckedException e) {
+            onError(e);
+        }
+
+        /**
+         * @param e Error.
+         */
         void onError(Throwable e) {
-            err.compareAndSet(null, e);
+            if (isDone()) {
+                U.warn(log, "Received error when future is done [fut=" + this + ", err=" + e + ", tx=" + tx + ']');
+
+                return;
+            }
+
+            if (log.isDebugEnabled())
+                log.debug("Error on tx prepare [fut=" + this + ", err=" + e + ", tx=" + tx +  ']');
+
+            if (err.compareAndSet(null, e))
+                tx.setRollbackOnly();
 
             onDone(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index a003d19..50d3f3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -682,7 +682,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
     /** {@inheritDoc} */
     @Override public IgniteInternalFuture<?> prepareAsync() {
-        GridAbstractNearTxPrepareFuture fut = (GridAbstractNearTxPrepareFuture)prepFut.get();
+        GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)prepFut.get();
 
         if (fut == null) {
             // Future must be created before any exception can be thrown.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
new file mode 100644
index 0000000..60b918c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.cache.*;
+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.colocated.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.util.future.*;
+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 javax.cache.expiry.*;
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
+
+/**
+ * Common code for tx prepare in optimistic and pessimistic modes.
+ */
+public abstract class GridNearTxPrepareFutureAdapter extends GridCompoundIdentityFuture<IgniteInternalTx>
+    implements GridCacheFuture<IgniteInternalTx> {
+    /** Logger reference. */
+    protected static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+    /** */
+    private static final IgniteReducer<IgniteInternalTx, IgniteInternalTx> REDUCER =
+        new IgniteReducer<IgniteInternalTx, IgniteInternalTx>() {
+            @Override public boolean collect(IgniteInternalTx e) {
+                return true;
+            }
+
+            @Override public IgniteInternalTx reduce() {
+                // Nothing to aggregate.
+                return null;
+            }
+        };
+
+    /** Logger. */
+    protected static IgniteLogger log;
+
+    /** Context. */
+    protected GridCacheSharedContext<?, ?> cctx;
+
+    /** Future ID. */
+    protected IgniteUuid futId;
+
+    /** Transaction. */
+    @GridToStringInclude
+    protected GridNearTxLocal tx;
+
+    /** Error. */
+    @GridToStringExclude
+    protected AtomicReference<Throwable> err = new AtomicReference<>(null);
+
+    /** Trackable flag. */
+    protected boolean trackable = true;
+
+    /** Full information about transaction nodes mapping. */
+    protected GridDhtTxMapping txMapping;
+
+    /**
+     * @param cctx Context.
+     * @param tx Transaction.
+     */
+    public GridNearTxPrepareFutureAdapter(GridCacheSharedContext cctx, final GridNearTxLocal tx) {
+        super(cctx.kernalContext(), REDUCER);
+
+        assert cctx != null;
+        assert tx != null;
+
+        this.cctx = cctx;
+        this.tx = tx;
+
+        futId = IgniteUuid.randomUuid();
+
+        if (log == null)
+            log = U.logger(cctx.kernalContext(), logRef, GridNearTxPrepareFutureAdapter.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteUuid futureId() {
+        return futId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheVersion version() {
+        return tx.xidVersion();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void markNotTrackable() {
+        trackable = false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean trackable() {
+        return trackable;
+    }
+
+    /**
+     * Prepares transaction.
+     */
+    public abstract void prepare();
+
+    /**
+     * @param nodeId Sender.
+     * @param res Result.
+     */
+    public abstract void onResult(UUID nodeId, GridNearTxPrepareResponse res);
+
+    /**
+     * Checks if mapped transaction can be committed on one phase.
+     * One-phase commit can be done if transaction maps to one primary node and not more than one backup.
+     */
+    protected final void checkOnePhase() {
+        if (tx.storeUsed())
+            return;
+
+        Map<UUID, Collection<UUID>> map = txMapping.transactionNodes();
+
+        if (map.size() == 1) {
+            Map.Entry<UUID, Collection<UUID>> entry = F.firstEntry(map);
+
+            assert entry != null;
+
+            Collection<UUID> backups = entry.getValue();
+
+            if (backups.size() <= 1)
+                tx.onePhaseCommit(true);
+        }
+    }
+
+    /**
+     * @param m Mapping.
+     * @param res Response.
+     */
+    protected final void onPrepareResponse(GridDistributedTxMapping m, GridNearTxPrepareResponse res) {
+        if (res == null)
+            return;
+
+        assert res.error() == null : res;
+        assert F.isEmpty(res.invalidPartitions()) : res;
+
+        for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : res.ownedValues().entrySet()) {
+            IgniteTxEntry txEntry = tx.entry(entry.getKey());
+
+            assert txEntry != null;
+
+            GridCacheContext cacheCtx = txEntry.context();
+
+            while (true) {
+                try {
+                    if (cacheCtx.isNear()) {
+                        GridNearCacheEntry nearEntry = (GridNearCacheEntry)txEntry.cached();
+
+                        CacheVersionedValue tup = entry.getValue();
+
+                        nearEntry.resetFromPrimary(tup.value(), tx.xidVersion(),
+                            tup.version(), m.node().id(), tx.topologyVersion());
+                    }
+                    else if (txEntry.cached().detached()) {
+                        GridDhtDetachedCacheEntry detachedEntry = (GridDhtDetachedCacheEntry)txEntry.cached();
+
+                        CacheVersionedValue tup = entry.getValue();
+
+                        detachedEntry.resetFromPrimary(tup.value(), tx.xidVersion());
+                    }
+
+                    break;
+                }
+                catch (GridCacheEntryRemovedException ignored) {
+                    // Retry.
+                }
+            }
+        }
+
+        tx.implicitSingleResult(res.returnValue());
+
+        for (IgniteTxKey key : res.filterFailedKeys()) {
+            IgniteTxEntry txEntry = tx.entry(key);
+
+            assert txEntry != null : "Missing tx entry for write key: " + key;
+
+            txEntry.op(NOOP);
+
+            assert txEntry.context() != null;
+
+            ExpiryPolicy expiry = txEntry.context().expiryForTxEntry(txEntry);
+
+            if (expiry != null)
+                txEntry.ttl(CU.toTtl(expiry.getExpiryForAccess()));
+        }
+
+        if (!m.empty()) {
+            // Register DHT version.
+            tx.addDhtVersion(m.node().id(), res.dhtVersion());
+
+            m.dhtVersion(res.dhtVersion());
+
+            if (m.near())
+                tx.readyNearLocks(m, res.pending(), res.committedVersions(), res.rolledbackVersions());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index a403f28..826f392 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -31,7 +31,6 @@ import org.apache.ignite.internal.util.future.*;
 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.jetbrains.annotations.*;
 
 import java.util.*;
@@ -350,7 +349,7 @@ public class IgniteTxHandler {
      * @param res Response.
      */
     private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) {
-        GridAbstractNearTxPrepareFuture fut = (GridAbstractNearTxPrepareFuture)ctx.mvcc()
+        GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)ctx.mvcc()
             .<IgniteInternalTx>future(res.version(), res.futureId());
 
         if (fut == null) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 5389ef9..6f6355a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.cluster.*;
 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.spi.discovery.tcp.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
@@ -70,6 +71,12 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
 
         cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
 
+        TcpDiscoverySpi discoSpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+
+        discoSpi.setSocketTimeout(10_000);
+        discoSpi.setAckTimeout(10_000);
+        discoSpi.setNetworkTimeout(10_000);
+
         return cfg;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b3dcbf18/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 2acd6a3..2cc6a5a 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
@@ -54,10 +54,6 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.class);
         suite.addTestSuite(GridCacheAtomicReplicatedFailoverSelfTest.class);
 
-        suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);
-        suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class);
-        suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class);
-
         suite.addTestSuite(IgniteCacheAtomicNodeJoinTest.class);
         suite.addTestSuite(IgniteCacheTxNodeJoinTest.class);
         suite.addTestSuite(IgniteCacheTxFairAffinityNodeJoinTest.class);
@@ -65,6 +61,10 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheTxNearDisabledPutGetRestartTest.class);
         suite.addTestSuite(IgniteCacheTxNearDisabledFairAffinityPutGetRestartTest.class);
 
+        suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);
+        suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class);
+        suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class);
+
         return suite;
     }
 }


[32/47] incubator-ignite git commit: IGNITE-894 Add missing field.setAccessible(true);

Posted by ag...@apache.org.
IGNITE-894 Add missing field.setAccessible(true);


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

Branch: refs/heads/ignite-889
Commit: 9ea2dbdd9c5d89e3da3950ac40bf2aa2a16e283b
Parents: 3e59d23
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 17:16:19 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 17:16:19 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/resource/GridResourceIoc.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ea2dbdd/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index a2ffa55..55c0d3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -277,8 +277,11 @@ class GridResourceIoc {
 
                     if (injectRecursively != null
                         || (allowImplicitInjection && field.getName().startsWith("this$")
-                            || field.getName().startsWith("val$")))
+                            || field.getName().startsWith("val$"))) {
+                        field.setAccessible(true);
+
                         recursiveFieldsList.add(field);
+                    }
                     else {
                         for (Annotation ann : field.getAnnotations()) {
                             T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());


[45/47] incubator-ignite git commit: # IGNITE-894 Revert adding @InjectRecursively.

Posted by ag...@apache.org.
# IGNITE-894 Revert adding @InjectRecursively.


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

Branch: refs/heads/ignite-889
Commit: 56e67e8f7ce808c190346d9228987f25b54b4e6f
Parents: 593e3ee
Author: sevdokimov <se...@gridgain.com>
Authored: Thu May 14 16:38:45 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu May 14 16:40:00 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridInternalWrapper.java    | 30 ++++++++++++++++
 .../closure/GridClosureProcessor.java           | 25 ++++++++++----
 .../internal/processors/igfs/IgfsJobImpl.java   | 10 ++++--
 .../processors/resource/GridResourceIoc.java    | 36 ++++++++++----------
 .../resource/GridResourceProcessor.java         |  8 ++++-
 .../processors/resource/GridResourceUtils.java  | 15 ++++++++
 .../processors/resource/InjectRecursively.java  | 30 ----------------
 .../resources/META-INF/classnames.properties    |  1 -
 8 files changed, 96 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
new file mode 100644
index 0000000..76563e7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridInternalWrapper.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+/**
+ * Internal wrapper interface for custom resource injection logic.
+ */
+public interface GridInternalWrapper<T> {
+    /**
+     * Get user object where resources must be injected.
+     *
+     * @return User object.
+     */
+    public T userObject();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 8f5afbf..658557e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -1584,12 +1584,12 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    private static class C1<T, R> implements ComputeJob, Externalizable {
+    private static class C1<T, R> implements ComputeJob, Externalizable, GridNoImplicitInjection,
+        GridInternalWrapper<IgniteClosure> {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @InjectRecursively
         protected IgniteClosure<T, R> job;
 
         /** */
@@ -1635,6 +1635,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
+        @Override public IgniteClosure userObject() {
+            return job;
+        }
+
+        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C1.class, this);
         }
@@ -1676,12 +1681,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     /**
      *
      */
-    private static class C2<R> implements ComputeJob, Externalizable {
+    private static class C2<R> implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Callable> {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @InjectRecursively
         protected Callable<R> c;
 
         /**
@@ -1724,6 +1728,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
+        @Override public Callable userObject() {
+            return c;
+        }
+
+        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C2.class, this);
         }
@@ -1763,12 +1772,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
 
     /**
      */
-    private static class C4 implements ComputeJob, Externalizable {
+    private static class C4 implements ComputeJob, Externalizable, GridNoImplicitInjection, GridInternalWrapper<Runnable> {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @InjectRecursively
         protected Runnable r;
 
         /**
@@ -1808,6 +1816,11 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
+        @Override public Runnable userObject() {
+            return r;
+        }
+
+        /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(C4.class, this);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
index 8f2cfd2..fa90e21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsJobImpl.java
@@ -21,7 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.internal.processors.resource.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.resources.*;
 
 import java.io.*;
@@ -29,12 +29,11 @@ import java.io.*;
 /**
  * IGFS job implementation.
  */
-public class IgfsJobImpl implements ComputeJob {
+public class IgfsJobImpl implements ComputeJob, GridInternalWrapper<IgfsJob> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** IGFS job. */
-    @InjectRecursively
     private IgfsJob job;
 
     /** IGFS name. */
@@ -110,4 +109,9 @@ public class IgfsJobImpl implements ComputeJob {
     @Override public void cancel() {
         job.cancel();
     }
+
+    /** {@inheritDoc} */
+    @Override public IgfsJob userObject() {
+        return job;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index ce19664..1e85ecd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -272,29 +272,29 @@ class GridResourceIoc {
 
             for (Class cls0 = cls; !cls0.equals(Object.class); cls0 = cls0.getSuperclass()) {
                 for (Field field : cls0.getDeclaredFields()) {
-                    InjectRecursively injectRecursively = field.getAnnotation(InjectRecursively.class);
+                    Annotation[] fieldAnns = field.getAnnotations();
 
-                    if (injectRecursively != null
-                        || (allowImplicitInjection && field.getName().startsWith("this$")
-                            || field.getName().startsWith("val$"))) {
-                        field.setAccessible(true);
+                    for (Annotation ann : fieldAnns) {
+                        T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
 
-                        recursiveFieldsList.add(field);
-                    }
-                    else {
-                        for (Annotation ann : field.getAnnotations()) {
-                            T2<List<GridResourceField>, List<GridResourceMethod>> t2 = annMap.get(ann.annotationType());
+                        if (t2 == null) {
+                            t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
+                                new ArrayList<GridResourceField>(),
+                                new ArrayList<GridResourceMethod>());
 
-                            if (t2 == null) {
-                                t2 = new T2<List<GridResourceField>, List<GridResourceMethod>>(
-                                    new ArrayList<GridResourceField>(),
-                                    new ArrayList<GridResourceMethod>());
+                            annMap.put(ann.annotationType(), t2);
+                        }
 
-                                annMap.put(ann.annotationType(), t2);
-                            }
+                        t2.get1().add(new GridResourceField(field, ann));
+                    }
 
-                            t2.get1().add(new GridResourceField(field, ann));
-                        }
+                    if (allowImplicitInjection
+                        && fieldAnns.length == 0
+                        && GridResourceUtils.mayRequireResources(field)) {
+                        field.setAccessible(true);
+
+                        // Account for anonymous inner classes.
+                        recursiveFieldsList.add(field);
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
index 5b51592..f5ba492 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceProcessor.java
@@ -23,7 +23,6 @@ import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.processors.*;
-import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lifecycle.*;
 import org.apache.ignite.resources.*;
@@ -281,6 +280,13 @@ public class GridResourceProcessor extends GridProcessorAdapter {
         Object obj = unwrapTarget(job);
 
         injectToJob(dep, taskCls, obj, ses, jobCtx);
+
+        if (obj instanceof GridInternalWrapper) {
+            Object usrObj = ((GridInternalWrapper)obj).userObject();
+
+            if (usrObj != null)
+                injectToJob(dep, taskCls, usrObj, ses, jobCtx);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
index 254f171..660d6ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceUtils.java
@@ -88,4 +88,19 @@ final class GridResourceUtils {
                 ", target=" + target + ", rsrc=" + rsrc + ']', e);
         }
     }
+
+    /**
+     * Checks if specified field requires recursive inspection to find resource annotations.
+     *
+     * @param f Field.
+     * @return {@code true} if requires, {@code false} if doesn't.
+     */
+    static boolean mayRequireResources(Field f) {
+        assert f != null;
+
+        // Need to inspect anonymous classes, callable and runnable instances.
+        return f.getName().startsWith("this$") || f.getName().startsWith("val$") ||
+            Callable.class.isAssignableFrom(f.getType()) || Runnable.class.isAssignableFrom(f.getType()) ||
+            IgniteClosure.class.isAssignableFrom(f.getType());
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
deleted file mode 100644
index 383ee03..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/InjectRecursively.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.resource;
-
-import java.lang.annotation.*;
-
-/**
- * Indicates that resource injection should be performed for field value too.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface InjectRecursively {
-    // No-op.
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/56e67e8f/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index f130840..b3eed46 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1140,7 +1140,6 @@ org.apache.ignite.internal.util.lang.GridAbsClosure
 org.apache.ignite.internal.util.lang.GridAbsClosureX
 org.apache.ignite.internal.util.lang.GridCloseableIterator
 org.apache.ignite.internal.util.lang.GridClosureException
-org.apache.ignite.internal.util.lang.GridComputeJobWrapper
 org.apache.ignite.internal.util.lang.GridFunc$1
 org.apache.ignite.internal.util.lang.GridFunc$10
 org.apache.ignite.internal.util.lang.GridFunc$100


[21/47] incubator-ignite git commit: # ignite-835

Posted by ag...@apache.org.
# ignite-835


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

Branch: refs/heads/ignite-889
Commit: ade75f94f1bb63b13cd3cb997cc7820541994858
Parents: 08360c9
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 12 16:55:43 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue May 12 16:55:43 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtTransactionalCacheAdapter.java   | 9 ++++-----
 .../cache/distributed/GridCacheLockAbstractTest.java        | 2 --
 2 files changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ade75f94/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 87026f3..068e8b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -174,7 +174,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
 
                         // Invalidate key in near cache, if any.
                         if (isNearEnabled(cacheCfg))
-                            obsoleteNearEntry(key, req.version());
+                            obsoleteNearEntry(key);
 
                         break;
                     }
@@ -291,7 +291,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
 
                     // Invalidate key in near cache, if any.
                     if (isNearEnabled(cacheCfg))
-                        obsoleteNearEntry(key, req.version());
+                        obsoleteNearEntry(key);
 
                     if (tx != null) {
                         tx.clearEntry(txKey);
@@ -1481,12 +1481,11 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
 
     /**
      * @param key Key
-     * @param ver Version.
      */
-    private void obsoleteNearEntry(KeyCacheObject key, GridCacheVersion ver) {
+    private void obsoleteNearEntry(KeyCacheObject key) {
         GridCacheEntryEx nearEntry = near().peekEx(key);
 
         if (nearEntry != null)
-            nearEntry.markObsolete(ver);
+            nearEntry.markObsolete(ctx.versions().next());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ade75f94/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
index ab0f7d0..2fe76e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -501,8 +501,6 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
      * @throws Throwable If failed.
      */
     public void testLockReentrancy() throws Throwable {
-        fail("https://issues.apache.org/jira/browse/IGNITE-835");
-
         Affinity<Integer> aff = ignite1.affinity(null);
 
         for (int i = 10; i < 100; i++) {


[06/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: c19402e0d6085e88da4164cbb9b838e886849c6b
Parents: dff3fc6
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 7 17:43:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 7 17:43:57 2015 +0300

----------------------------------------------------------------------
 .../ignite/testsuites/IgniteCacheRestartTestSuite.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c19402e0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index a449cfc..983d447 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -21,6 +21,7 @@ import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * In-Memory Data Grid stability test suite on changing topology.
@@ -35,10 +36,9 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class);
 
-        // TODO: IGNITE-157.
-        // suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
-        // suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
-        // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
+        suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
+        suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
         // suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); // TODO IGNITE-747


[04/47] incubator-ignite git commit: # ignite-157-1

Posted by ag...@apache.org.
# ignite-157-1


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

Branch: refs/heads/ignite-889
Commit: a238ce357fb0cb0c5378fbfc64341c3167843db5
Parents: 93876df
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 7 14:49:33 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 7 16:19:26 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMvccManager.java  |  4 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   | 32 ++++----
 .../distributed/dht/GridDhtTxLocalAdapter.java  | 27 +++++++
 .../distributed/dht/GridDhtTxPrepareFuture.java | 81 ++++++++++----------
 .../near/GridAbstractNearTxPrepareFuture.java   |  3 +
 .../near/GridNearOptimisticTxPrepareFuture.java | 13 +++-
 .../GridNearPessimisticTxPrepareFuture.java     | 15 +++-
 .../cache/distributed/near/GridNearTxLocal.java | 43 +++++------
 .../near/GridNearTxPrepareFuture.java           | 20 ++---
 .../cache/transactions/IgniteInternalTx.java    |  4 +-
 .../cache/transactions/IgniteTxAdapter.java     |  2 +-
 .../cache/transactions/IgniteTxHandler.java     | 65 +++++++---------
 .../cache/transactions/IgniteTxManager.java     | 12 +--
 .../cache/GridCacheAbstractFullApiSelfTest.java |  2 +-
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |  4 +-
 .../IgniteCacheFailoverTestSuite.java           |  7 +-
 16 files changed, 178 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index 0bb97a9..c05e4b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -510,7 +510,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
      * @return Future.
      */
     @SuppressWarnings({"unchecked"})
-    @Nullable public <T> GridCacheFuture<T> future(GridCacheVersion ver, IgniteUuid futId) {
+    @Nullable public GridCacheFuture future(GridCacheVersion ver, IgniteUuid futId) {
         Collection<? extends GridCacheFuture> futs = this.futs.get(ver);
 
         if (futs != null)
@@ -519,7 +519,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
                     if (log.isDebugEnabled())
                         log.debug("Found future in futures map: " + fut);
 
-                    return (GridCacheFuture<T>)fut;
+                    return fut;
                 }
 
         if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 07ced0d..614f520 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -284,7 +284,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<IgniteInternalTx> prepareAsync() {
+    @Override public IgniteInternalFuture<?> prepareAsync() {
         if (optimistic()) {
             assert isSystemInvalidate();
 
@@ -296,7 +296,6 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
                 nearMiniId,
                 null,
                 true,
-                null,
                 null);
         }
 
@@ -305,14 +304,13 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
 
         if (fut == null) {
             // Future must be created before any exception can be thrown.
-            if (!prepFut.compareAndSet(null, fut = new GridDhtTxPrepareFuture<>(
+            if (!prepFut.compareAndSet(null, fut = new GridDhtTxPrepareFuture(
                 cctx,
                 this,
                 nearMiniId,
                 Collections.<IgniteTxKey, GridCacheVersion>emptyMap(),
                 true,
                 needReturnValue(),
-                null,
                 null)))
                 return prepFut.get();
         }
@@ -371,7 +369,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
      * @param lastBackups IDs of backup nodes receiving last prepare request.
      * @return Future that will be completed when locks are acquired.
      */
-    public IgniteInternalFuture<IgniteInternalTx> prepareAsync(
+    public IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsync(
         @Nullable Iterable<IgniteTxEntry> reads,
         @Nullable Iterable<IgniteTxEntry> writes,
         Map<IgniteTxKey, GridCacheVersion> verMap,
@@ -379,8 +377,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
         IgniteUuid nearMiniId,
         Map<UUID, Collection<UUID>> txNodes,
         boolean last,
-        Collection<UUID> lastBackups,
-        IgniteInClosure<GridNearTxPrepareResponse> completeCb
+        Collection<UUID> lastBackups
     ) {
         // In optimistic mode prepare still can be called explicitly from salvageTx.
         GridDhtTxPrepareFuture fut = prepFut.get();
@@ -389,21 +386,20 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
             init();
 
             // Future must be created before any exception can be thrown.
-            if (!prepFut.compareAndSet(null, fut = new GridDhtTxPrepareFuture<>(
+            if (!prepFut.compareAndSet(null, fut = new GridDhtTxPrepareFuture(
                 cctx,
                 this,
                 nearMiniId,
                 verMap,
                 last,
                 needReturnValue(),
-                lastBackups,
-                completeCb))) {
+                lastBackups))) {
                 GridDhtTxPrepareFuture f = prepFut.get();
 
                 assert f.nearMiniId().equals(nearMiniId) : "Wrong near mini id on existing future " +
                     "[futMiniId=" + f.nearMiniId() + ", miniId=" + nearMiniId + ", fut=" + f + ']';
 
-                return f;
+                return chainOnePhasePrepare(f);
             }
         }
         else {
@@ -411,7 +407,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
                 "[futMiniId=" + fut.nearMiniId() + ", miniId=" + nearMiniId + ", fut=" + fut + ']';
 
             // Prepare was called explicitly.
-            return fut;
+            return chainOnePhasePrepare(fut);
         }
 
         if (state() != PREPARING) {
@@ -475,7 +471,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
             }
         }
 
-        return fut;
+        return chainOnePhasePrepare(fut);
     }
 
     /** {@inheritDoc} */
@@ -517,8 +513,8 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
                 }
             }
             else
-                prep.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                    @Override public void apply(IgniteInternalFuture<IgniteInternalTx> f) {
+                prep.listen(new CI1<IgniteInternalFuture<?>>() {
+                    @Override public void apply(IgniteInternalFuture<?> f) {
                         try {
                             f.get(); // Check for errors of a parent future.
 
@@ -605,8 +601,8 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
         else {
             prepFut.complete();
 
-            prepFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public void apply(IgniteInternalFuture<IgniteInternalTx> f) {
+            prepFut.listen(new CI1<IgniteInternalFuture<?>>() {
+                @Override public void apply(IgniteInternalFuture<?> f) {
                     try {
                         f.get(); // Check for errors of a parent future.
                     }
@@ -686,7 +682,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Nullable @Override public IgniteInternalFuture<IgniteInternalTx> currentPrepareFuture() {
+    @Nullable @Override public IgniteInternalFuture<?> currentPrepareFuture() {
         return prepFut.get();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 08fcaf6..d886989 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.util.*;
@@ -885,6 +886,32 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
      */
     protected abstract void clearPrepareFuture(GridDhtTxPrepareFuture fut);
 
+    /**
+     * @return {@code True} if transaction if finished on prepare step.
+     */
+    protected final boolean commitOnPrepare() {
+        return onePhaseCommit() && !near();
+    }
+
+    /**
+     * @param prepFut Prepare future.
+     * @return If transaction if finished on prepare step returns future which is completed after transaction finish.
+     */
+    protected final IgniteInternalFuture<GridNearTxPrepareResponse> chainOnePhasePrepare(
+        final GridDhtTxPrepareFuture prepFut) {
+        if (commitOnPrepare()) {
+            return finishFuture().chain(new CX1<IgniteInternalFuture<IgniteInternalTx>, GridNearTxPrepareResponse>() {
+                @Override public GridNearTxPrepareResponse applyx(IgniteInternalFuture<IgniteInternalTx> finishFut)
+                    throws IgniteCheckedException
+                {
+                    return prepFut.get();
+                }
+            });
+        }
+
+        return prepFut;
+    }
+
     /** {@inheritDoc} */
     @Override public void rollback() throws IgniteCheckedException {
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 3a1a80a..0e64726 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -50,19 +50,32 @@ import static org.apache.ignite.transactions.TransactionState.*;
  *
  */
 @SuppressWarnings("unchecked")
-public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFuture<IgniteInternalTx>
-    implements GridCacheMvccFuture<IgniteInternalTx> {
+public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInternalTx, GridNearTxPrepareResponse>
+    implements GridCacheMvccFuture<GridNearTxPrepareResponse> {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** Logger reference. */
     private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
 
+    /** */
+    private static final IgniteReducer<IgniteInternalTx, GridNearTxPrepareResponse> REDUCER =
+        new IgniteReducer<IgniteInternalTx, GridNearTxPrepareResponse>() {
+            @Override public boolean collect(IgniteInternalTx e) {
+                return true;
+            }
+
+            @Override public GridNearTxPrepareResponse reduce() {
+                // Nothing to aggregate.
+                return null;
+            }
+        };
+
     /** Logger. */
     private static IgniteLogger log;
 
     /** Context. */
-    private GridCacheSharedContext<K, V> cctx;
+    private GridCacheSharedContext<?, ?> cctx;
 
     /** Future ID. */
     private IgniteUuid futId;
@@ -128,15 +141,13 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
     /** */
     private boolean invoke;
 
-    /** */
-    private IgniteInClosure<GridNearTxPrepareResponse> completeCb;
-
     /**
      * @param cctx Context.
      * @param tx Transaction.
      * @param nearMiniId Near mini future id.
      * @param dhtVerMap DHT versions map.
      * @param last {@code True} if this is last prepare operation for node.
+     * @param retVal Return value flag.
      * @param lastBackups IDs of backup nodes receiving last prepare request during this prepare.
      */
     public GridDhtTxPrepareFuture(
@@ -146,19 +157,9 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         Map<IgniteTxKey, GridCacheVersion> dhtVerMap,
         boolean last,
         boolean retVal,
-        Collection<UUID> lastBackups,
-        IgniteInClosure<GridNearTxPrepareResponse> completeCb
+        Collection<UUID> lastBackups
     ) {
-        super(cctx.kernalContext(), new IgniteReducer<IgniteInternalTx, IgniteInternalTx>() {
-            @Override public boolean collect(IgniteInternalTx e) {
-                return true;
-            }
-
-            @Override public IgniteInternalTx reduce() {
-                // Nothing to aggregate.
-                return tx;
-            }
-        });
+        super(REDUCER);
 
         this.cctx = cctx;
         this.tx = tx;
@@ -178,8 +179,6 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
 
         this.retVal = retVal;
 
-        this.completeCb = completeCb;
-
         assert dhtMap != null;
         assert nearMap != null;
     }
@@ -382,7 +381,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
      * @param t Error.
      */
     public void onError(Throwable t) {
-        onDone(tx, t);
+        onDone(null, t);
     }
 
     /**
@@ -479,7 +478,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
     }
 
     /** {@inheritDoc} */
-    @Override public boolean onDone(IgniteInternalTx tx0, Throwable err) {
+    @Override public boolean onDone(GridNearTxPrepareResponse res0, Throwable err) {
         assert err != null || (initialized() && !hasPending()) : "On done called for prepare future that has " +
             "pending mini futures: " + this;
 
@@ -495,16 +494,15 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
             // Must create prepare response before transaction is committed to grab correct return value.
             final GridNearTxPrepareResponse res = createPrepareResponse();
 
-            onComplete();
+            onComplete(res);
 
-            if (!tx.near()) {
+            if (tx.commitOnPrepare()) {
                 if (tx.markFinalizing(IgniteInternalTx.FinalizationStatus.USER_FINISH)) {
                     IgniteInternalFuture<IgniteInternalTx> fut = this.err.get() == null ?
                         tx.commitAsync() : tx.rollbackAsync();
 
                     fut.listen(new CIX1<IgniteInternalFuture<IgniteInternalTx>>() {
-                        @Override
-                        public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) {
+                        @Override public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) {
                             try {
                                 if (replied.compareAndSet(false, true))
                                     sendPrepareResponse(res);
@@ -530,15 +528,17 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         }
         else {
             if (replied.compareAndSet(false, true)) {
+                GridNearTxPrepareResponse res = createPrepareResponse();
+
                 try {
-                    sendPrepareResponse(createPrepareResponse());
+                    sendPrepareResponse(res);
                 }
                 catch (IgniteCheckedException e) {
                     U.error(log, "Failed to send prepare response for transaction: " + tx, e);
                 }
                 finally {
                     // Will call super.onDone().
-                    onComplete();
+                    onComplete(res);
                 }
 
                 return true;
@@ -562,16 +562,12 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
     }
 
     /**
+     * @param res Response.
      * @throws IgniteCheckedException If failed to send response.
      */
     private void sendPrepareResponse(GridNearTxPrepareResponse res) throws IgniteCheckedException {
         if (!tx.nearNodeId().equals(cctx.localNodeId()))
             cctx.io().send(tx.nearNodeId(), res, tx.ioPolicy());
-        else {
-            assert completeCb != null;
-
-            completeCb.apply(res);
-        }
     }
 
     /**
@@ -616,10 +612,10 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
             for (IgniteTxEntry e : writes) {
                 IgniteTxEntry txEntry = tx.entry(e.txKey());
 
-                GridCacheContext cacheCtx = txEntry.context();
-
                 assert txEntry != null : "Missing tx entry for key [tx=" + tx + ", key=" + e.txKey() + ']';
 
+                GridCacheContext cacheCtx = txEntry.context();
+
                 while (true) {
                     try {
                         GridCacheEntryEx entry = txEntry.cached();
@@ -682,13 +678,14 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
     /**
      * Completeness callback.
      *
+     * @param res Response.
      * @return {@code True} if {@code done} flag was changed as a result of this call.
      */
-    private boolean onComplete() {
+    private boolean onComplete(@Nullable GridNearTxPrepareResponse res) {
         if (last || tx.isSystemInvalidate())
             tx.state(PREPARED);
 
-        if (super.onDone(tx, err.get())) {
+        if (super.onDone(res, err.get())) {
             // Don't forget to clean up.
             cctx.mvcc().removeFuture(this);
 
@@ -702,7 +699,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
      * Completes this future.
      */
     public void complete() {
-        onComplete();
+        onComplete(null);
     }
 
     /**
@@ -717,7 +714,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         if (tx.empty()) {
             tx.setRollbackOnly();
 
-            onDone(tx);
+            onDone((GridNearTxPrepareResponse)null);
         }
 
         this.reads = reads;
@@ -821,7 +818,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
                         try {
                             GridDhtCacheEntry cached = (GridDhtCacheEntry)entry.cached();
 
-                            GridCacheContext<K, V> cacheCtx = cached.context();
+                            GridCacheContext<?, ?> cacheCtx = cached.context();
 
                             if (entry.explicitVersion() == null) {
                                 GridCacheMvccCandidate added = cached.candidate(version());
@@ -977,7 +974,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
 
         GridCacheContext cacheCtx = entry.context();
 
-        GridDhtCacheAdapter<K, V> dht = cacheCtx.isNear() ? cacheCtx.near().dht() : cacheCtx.dht();
+        GridDhtCacheAdapter<?, ?> dht = cacheCtx.isNear() ? cacheCtx.near().dht() : cacheCtx.dht();
 
         ExpiryPolicy expiry = cacheCtx.expiryForTxEntry(entry);
 
@@ -1234,7 +1231,7 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
                 boolean rec = cctx.gridEvents().isRecordable(EVT_CACHE_REBALANCE_OBJECT_LOADED);
 
                 for (GridCacheEntryInfo info : res.preloadEntries()) {
-                    GridCacheContext<K, V> cacheCtx = cctx.cacheContext(info.cacheId());
+                    GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(info.cacheId());
 
                     while (true) {
                         GridCacheEntryEx entry = cacheCtx.cache().entryEx(info.key());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
index 905f018..6f94f21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridAbstractNearTxPrepareFuture.java
@@ -153,6 +153,9 @@ public abstract class GridAbstractNearTxPrepareFuture extends GridCompoundIdenti
      * @param res Response.
      */
     protected final void onPrepareResponse(GridDistributedTxMapping m, GridNearTxPrepareResponse res) {
+        if (res == null)
+            return;
+
         assert res.error() == null : res;
         assert F.isEmpty(res.invalidPartitions()) : res;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 2fbca7b..110cca4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -535,9 +535,16 @@ public class GridNearOptimisticTxPrepareFuture extends GridAbstractNearTxPrepare
             // At this point, if any new node joined, then it is
             // waiting for this transaction to complete, so
             // partition reassignments are not possible here.
-            cctx.tm().txHandler().prepareTx(n.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
-                @Override public void apply(GridNearTxPrepareResponse res) {
-                    fut.onResult(n.id(), res);
+            IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = cctx.tm().txHandler().prepareTx(n.id(), tx, req);
+
+            prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+                @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
+                    try {
+                        fut.onResult(n.id(), prepFut.get());
+                    }
+                    catch (IgniteCheckedException e) {
+                        fut.onResult(e);
+                    }
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index 84a4ab8..e3f24f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -203,9 +203,18 @@ public class GridNearPessimisticTxPrepareFuture extends GridAbstractNearTxPrepar
             add(fut);
 
             if (node.isLocal()) {
-                cctx.tm().txHandler().prepareTx(node.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
-                    @Override public void apply(GridNearTxPrepareResponse res) {
-                        fut.onResult(res);
+                IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = cctx.tm().txHandler().prepareTx(node.id(),
+                    tx,
+                    req);
+
+                prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+                    @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
+                        try {
+                            fut.onResult(prepFut.get());
+                        }
+                        catch (IgniteCheckedException e) {
+                            fut.onError(e);
+                        }
                     }
                 });
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index f7a43bb..a003d19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -61,8 +61,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
     /** Future. */
     @GridToStringExclude
-    private final AtomicReference<IgniteInternalFuture<IgniteInternalTx>> prepFut =
-        new AtomicReference<>();
+    private final AtomicReference<IgniteInternalFuture<?>> prepFut = new AtomicReference<>();
 
     /** */
     @GridToStringExclude
@@ -682,7 +681,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<IgniteInternalTx> prepareAsync() {
+    @Override public IgniteInternalFuture<?> prepareAsync() {
         GridAbstractNearTxPrepareFuture fut = (GridAbstractNearTxPrepareFuture)prepFut.get();
 
         if (fut == null) {
@@ -719,10 +718,10 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
         cctx.mvcc().addFuture(fut);
 
-        IgniteInternalFuture<IgniteInternalTx> prepareFut = prepFut.get();
+        IgniteInternalFuture<?> prepareFut = prepFut.get();
 
-        prepareFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-            @Override public void apply(IgniteInternalFuture<IgniteInternalTx> f) {
+        prepareFut.listen(new CI1<IgniteInternalFuture<?>>() {
+            @Override public void apply(IgniteInternalFuture<?> f) {
                 GridNearTxFinishFuture fut0 = commitFut.get();
 
                 try {
@@ -766,7 +765,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
         cctx.mvcc().addFuture(fut);
 
-        IgniteInternalFuture<IgniteInternalTx> prepFut = this.prepFut.get();
+        IgniteInternalFuture<?> prepFut = this.prepFut.get();
 
         if (prepFut == null || prepFut.isDone()) {
             try {
@@ -790,8 +789,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
             }
         }
         else {
-            prepFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public void apply(IgniteInternalFuture<IgniteInternalTx> f) {
+            prepFut.listen(new CI1<IgniteInternalFuture<?>>() {
+                @Override public void apply(IgniteInternalFuture<?> f) {
                     try {
                         // Check for errors in prepare future.
                         f.get();
@@ -834,12 +833,11 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
      * @return Future that will be completed when locks are acquired.
      */
     @SuppressWarnings("TypeMayBeWeakened")
-    public IgniteInternalFuture<IgniteInternalTx> prepareAsyncLocal(
+    public IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsyncLocal(
         @Nullable Collection<IgniteTxEntry> reads,
         @Nullable Collection<IgniteTxEntry> writes,
         Map<UUID, Collection<UUID>> txNodes, boolean last,
-        Collection<UUID> lastBackups,
-        IgniteInClosure<GridNearTxPrepareResponse> completeCb
+        Collection<UUID> lastBackups
     ) {
         if (state() != PREPARING) {
             if (timedOut())
@@ -854,15 +852,14 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
         init();
 
-        GridDhtTxPrepareFuture fut = new GridDhtTxPrepareFuture<>(
+        GridDhtTxPrepareFuture fut = new GridDhtTxPrepareFuture(
             cctx,
             this,
             IgniteUuid.randomUuid(),
             Collections.<IgniteTxKey, GridCacheVersion>emptyMap(),
             last,
             needReturnValue() && implicit(),
-            lastBackups,
-            completeCb);
+            lastBackups);
 
         try {
             // At this point all the entries passed in must be enlisted in transaction because this is an
@@ -901,7 +898,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
             }
         }
 
-        return fut;
+        return chainOnePhasePrepare(fut);
     }
 
     /**
@@ -917,7 +914,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
         if (pessimistic())
             prepareAsync();
 
-        IgniteInternalFuture<IgniteInternalTx> prep = prepFut.get();
+        IgniteInternalFuture<?> prep = prepFut.get();
 
         // Do not create finish future if there are no remote nodes.
         if (F.isEmpty(dhtMap) && F.isEmpty(nearMap)) {
@@ -953,8 +950,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
             }
         }
         else
-            prep.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public void apply(IgniteInternalFuture<IgniteInternalTx> f) {
+            prep.listen(new CI1<IgniteInternalFuture<?>>() {
+                @Override public void apply(IgniteInternalFuture<?> f) {
                     try {
                         f.get(); // Check for errors of a parent future.
 
@@ -990,7 +987,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
         cctx.mvcc().addFuture(fut);
 
-        IgniteInternalFuture<IgniteInternalTx> prep = prepFut.get();
+        IgniteInternalFuture<?> prep = prepFut.get();
 
         if (prep == null || prep.isDone()) {
             try {
@@ -1006,8 +1003,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
             fut.finish();
         }
         else
-            prep.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public void apply(IgniteInternalFuture<IgniteInternalTx> f) {
+            prep.listen(new CI1<IgniteInternalFuture<?>>() {
+                @Override public void apply(IgniteInternalFuture<?> f) {
                     try {
                         f.get(); // Check for errors of a parent future.
                     }
@@ -1200,7 +1197,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Nullable @Override public IgniteInternalFuture<IgniteInternalTx> currentPrepareFuture() {
+    @Nullable @Override public IgniteInternalFuture<?> currentPrepareFuture() {
         return prepFut.get();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 962d973..9cf4aca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -648,11 +648,11 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
             add(fut);
 
             if (node.isLocal()) {
-                cctx.tm().txHandler().prepareTx(node.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
-                    @Override public void apply(GridNearTxPrepareResponse res) {
-                        fut.onResult(node.id(), res);
-                    }
-                });
+//                cctx.tm().txHandler().prepareTx(node.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
+//                    @Override public void apply(GridNearTxPrepareResponse res) {
+//                        fut.onResult(node.id(), res);
+//                    }
+//                });
             }
             else {
                 try {
@@ -755,11 +755,11 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
             // At this point, if any new node joined, then it is
             // waiting for this transaction to complete, so
             // partition reassignments are not possible here.
-            cctx.tm().txHandler().prepareTx(n.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
-                @Override public void apply(GridNearTxPrepareResponse res) {
-                    fut.onResult(n.id(), res);
-                }
-            });
+//            cctx.tm().txHandler().prepareTx(n.id(), tx, req, new CI1<GridNearTxPrepareResponse>() {
+//                @Override public void apply(GridNearTxPrepareResponse res) {
+//                    fut.onResult(n.id(), res);
+//                }
+//            });
         }
         else {
             assert !tx.groupLock() : "Got group lock transaction that is mapped on remote node [tx=" + tx +

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
index 8dc07cc..2bed843 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
@@ -551,7 +551,7 @@ public interface IgniteInternalTx extends AutoCloseable, GridTimeoutObject {
      *
      * @return Future for prepare step.
      */
-    public IgniteInternalFuture<IgniteInternalTx> prepareAsync();
+    public IgniteInternalFuture<?> prepareAsync();
 
     /**
      * @param endVer End version (a.k.a. <tt>'tnc'</tt> or <tt>'transaction number counter'</tt>)
@@ -580,7 +580,7 @@ public interface IgniteInternalTx extends AutoCloseable, GridTimeoutObject {
     /**
      * @return Future for transaction prepare if prepare is in progress.
      */
-    @Nullable public IgniteInternalFuture<IgniteInternalTx> currentPrepareFuture();
+    @Nullable public IgniteInternalFuture<?> currentPrepareFuture();
 
     /**
      * @param state Transaction state.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 82d68b3..64cc77f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1008,7 +1008,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public IgniteInternalFuture<IgniteInternalTx> currentPrepareFuture() {
+    @Nullable @Override public IgniteInternalFuture<?> currentPrepareFuture() {
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index d98b4ff..a403f28 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -58,9 +58,9 @@ public class IgniteTxHandler {
      * @param req Request.
      * @return Prepare future.
      */
-    public IgniteInternalFuture<IgniteInternalTx> processNearTxPrepareRequest(final UUID nearNodeId,
+    public IgniteInternalFuture<?> processNearTxPrepareRequest(final UUID nearNodeId,
         final GridNearTxPrepareRequest req) {
-        return prepareTx(nearNodeId, null, req, null);
+        return prepareTx(nearNodeId, null, req);
     }
 
     /**
@@ -138,32 +138,28 @@ public class IgniteTxHandler {
      * @param nearNodeId Near node ID that initiated transaction.
      * @param locTx Optional local transaction.
      * @param req Near prepare request.
-     * @param completeCb Completion callback.
      * @return Future for transaction.
      */
-    public IgniteInternalFuture<IgniteInternalTx> prepareTx(
+    public IgniteInternalFuture<GridNearTxPrepareResponse> prepareTx(
         UUID nearNodeId,
         @Nullable GridNearTxLocal locTx,
-        GridNearTxPrepareRequest req,
-        @Nullable IgniteInClosure<GridNearTxPrepareResponse> completeCb
+        GridNearTxPrepareRequest req
     ) {
         assert nearNodeId != null;
         assert req != null;
 
         if (locTx != null) {
-            assert completeCb != null;
-
             if (req.near()) {
                 // Make sure not to provide Near entries to DHT cache.
                 req.cloneEntries();
 
-                return prepareNearTx(nearNodeId, req, completeCb);
+                return prepareNearTx(nearNodeId, req);
             }
             else
-                return prepareColocatedTx(locTx, req, completeCb);
+                return prepareColocatedTx(locTx, req);
         }
         else
-            return prepareNearTx(nearNodeId, req, null);
+            return prepareNearTx(nearNodeId, req);
     }
 
     /**
@@ -171,30 +167,27 @@ public class IgniteTxHandler {
      *
      * @param locTx Local transaction.
      * @param req Near prepare request.
-     * @param completeCb Completion callback.
      * @return Prepare future.
      */
-    private IgniteInternalFuture<IgniteInternalTx> prepareColocatedTx(
+    private IgniteInternalFuture<GridNearTxPrepareResponse> prepareColocatedTx(
         final GridNearTxLocal locTx,
-        final GridNearTxPrepareRequest req,
-        final IgniteInClosure<GridNearTxPrepareResponse> completeCb
+        final GridNearTxPrepareRequest req
     ) {
         IgniteInternalFuture<Object> fut = new GridFinishedFuture<>(); // TODO force preload keys.
 
         return new GridEmbeddedFuture<>(
             fut,
-            new C2<Object, Exception, IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public IgniteInternalFuture<IgniteInternalTx> apply(Object o, Exception ex) {
+            new C2<Object, Exception, IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+                @Override public IgniteInternalFuture<GridNearTxPrepareResponse> apply(Object o, Exception ex) {
                     if (ex != null)
                         throw new GridClosureException(ex);
 
-                    IgniteInternalFuture<IgniteInternalTx> fut = locTx.prepareAsyncLocal(
+                    IgniteInternalFuture<GridNearTxPrepareResponse> fut = locTx.prepareAsyncLocal(
                         req.reads(),
                         req.writes(),
                         req.transactionNodes(),
                         req.last(),
-                        req.lastBackups(),
-                        completeCb);
+                        req.lastBackups());
 
                     if (locTx.isRollbackOnly())
                         locTx.rollbackAsync();
@@ -202,18 +195,16 @@ public class IgniteTxHandler {
                     return fut;
                 }
             },
-            new C2<IgniteInternalTx, Exception, IgniteInternalTx>() {
-                @Nullable @Override public IgniteInternalTx apply(IgniteInternalTx tx, Exception e) {
+            new C2<GridNearTxPrepareResponse, Exception, GridNearTxPrepareResponse>() {
+                @Nullable @Override public GridNearTxPrepareResponse apply(GridNearTxPrepareResponse res, Exception e) {
                     if (e != null) {
-                        // tx can be null of exception occurred.
-                        if (tx != null)
-                            tx.setRollbackOnly(); // Just in case.
+                        locTx.setRollbackOnly(); // Just in case.
 
                         if (!(e instanceof IgniteTxOptimisticCheckedException))
-                            U.error(log, "Failed to prepare DHT transaction: " + tx, e);
+                            U.error(log, "Failed to prepare transaction: " + locTx, e);
                     }
 
-                    return tx;
+                    return res;
                 }
             }
         );
@@ -224,13 +215,11 @@ public class IgniteTxHandler {
      *
      * @param nearNodeId Near node ID that initiated transaction.
      * @param req Near prepare request.
-     * @param completeCb Completion callback.
      * @return Prepare future.
      */
-    private IgniteInternalFuture<IgniteInternalTx> prepareNearTx(
+    private IgniteInternalFuture<GridNearTxPrepareResponse> prepareNearTx(
         final UUID nearNodeId,
-        final GridNearTxPrepareRequest req,
-        IgniteInClosure<GridNearTxPrepareResponse> completeCb
+        final GridNearTxPrepareRequest req
     ) {
         ClusterNode nearNode = ctx.node(nearNodeId);
 
@@ -315,7 +304,7 @@ public class IgniteTxHandler {
             if (req.returnValue())
                 tx.needReturnValue(true);
 
-            IgniteInternalFuture<IgniteInternalTx> fut = tx.prepareAsync(
+            IgniteInternalFuture<GridNearTxPrepareResponse> fut = tx.prepareAsync(
                 req.reads(),
                 req.writes(),
                 req.dhtVersions(),
@@ -323,8 +312,7 @@ public class IgniteTxHandler {
                 req.miniId(),
                 req.transactionNodes(),
                 req.last(),
-                req.lastBackups(),
-                completeCb);
+                req.lastBackups());
 
             if (tx.isRollbackOnly()) {
                 try {
@@ -337,8 +325,8 @@ public class IgniteTxHandler {
 
             final GridDhtTxLocal tx0 = tx;
 
-            fut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                @Override public void apply(IgniteInternalFuture<IgniteInternalTx> txFut) {
+            fut.listen(new CI1<IgniteInternalFuture<?>>() {
+                @Override public void apply(IgniteInternalFuture<?> txFut) {
                     try {
                         txFut.get();
                     }
@@ -354,7 +342,7 @@ public class IgniteTxHandler {
             return fut;
         }
         else
-            return new GridFinishedFuture<>((IgniteInternalTx)null);
+            return new GridFinishedFuture<>((GridNearTxPrepareResponse)null);
     }
 
     /**
@@ -399,8 +387,7 @@ public class IgniteTxHandler {
      * @param res Response.
      */
     private void processDhtTxPrepareResponse(UUID nodeId, GridDhtTxPrepareResponse res) {
-        GridDhtTxPrepareFuture fut = (GridDhtTxPrepareFuture)ctx.mvcc().
-            <IgniteInternalTx>future(res.version(), res.futureId());
+        GridDhtTxPrepareFuture fut = (GridDhtTxPrepareFuture)ctx.mvcc().future(res.version(), res.futureId());
 
         if (fut == null) {
             if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 8a1d490..2122602 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -1816,7 +1816,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             if (nearVer.equals(tx.nearXidVersion())) {
                 TransactionState state = tx.state();
 
-                IgniteInternalFuture<IgniteInternalTx> prepFut = tx.currentPrepareFuture();
+                IgniteInternalFuture<?> prepFut = tx.currentPrepareFuture();
 
                 if (prepFut != null && !prepFut.isDone()) {
                     if (log.isDebugEnabled())
@@ -1828,8 +1828,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
 
                     final Collection<GridCacheVersion> processedVers0 = processedVers;
 
-                    prepFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                        @Override public void apply(IgniteInternalFuture<IgniteInternalTx> prepFut) {
+                    prepFut.listen(new CI1<IgniteInternalFuture<?>>() {
+                        @Override public void apply(IgniteInternalFuture<?> prepFut) {
                             if (log.isDebugEnabled())
                                 log.debug("Transaction prepare future finished: " + tx);
 
@@ -2029,11 +2029,11 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                             if (tx.state() == PREPARED)
                                 commitIfPrepared(tx);
                             else {
-                                IgniteInternalFuture<IgniteInternalTx> prepFut = tx.currentPrepareFuture();
+                                IgniteInternalFuture<?> prepFut = tx.currentPrepareFuture();
 
                                 if (prepFut != null) {
-                                    prepFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
-                                        @Override public void apply(IgniteInternalFuture<IgniteInternalTx> fut) {
+                                    prepFut.listen(new CI1<IgniteInternalFuture<?>>() {
+                                        @Override public void apply(IgniteInternalFuture<?> fut) {
                                             if (tx.state() == PREPARED)
                                                 commitIfPrepared(tx);
                                             else if (tx.setRollbackOnly())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 4dc371c..a346b65 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -4343,7 +4343,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             assertEquals(val1, cacheSkipStore.invoke(key, new SetValueProcessor(val2)));
             assertEquals(i, map.get(key));
-            assertEquals(val2, cacheSkipStore.get(key));
+            assertEquals("For key " + key, val2, cacheSkipStore.get(key));
         }
 
         for (String key : keys) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
index ee2f16b..f996877 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
@@ -199,7 +199,7 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
 
             commSpi.blockMessages(ignite(2).cluster().localNode().id()); // Do not allow to finish prepare for key2.
 
-            IgniteInternalFuture<IgniteInternalTx> prepFut = txEx.prepareAsync();
+            IgniteInternalFuture<?> prepFut = txEx.prepareAsync();
 
             waitPrepared(ignite(1));
 
@@ -360,7 +360,7 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
 
         commSpi.blockMessages(ignite(2).cluster().localNode().id()); // Do not allow to finish prepare for key2.
 
-        IgniteInternalFuture<IgniteInternalTx> prepFut = txEx.prepareAsync();
+        IgniteInternalFuture<?> prepFut = txEx.prepareAsync();
 
         waitPrepared(ignite(1));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a238ce35/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 529bd23..2acd6a3 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
@@ -54,10 +54,9 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFailoverSelfTest.class);
         suite.addTestSuite(GridCacheAtomicReplicatedFailoverSelfTest.class);
 
-        // TODO IGNITE-157.
-        // suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);
-        // suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class);
-        // suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class);
+        suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);
+        suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class);
+        suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeJoinTest.class);
         suite.addTestSuite(IgniteCacheTxNodeJoinTest.class);


[19/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: 250dd8ea6ec9c3298eed28f0f2d5c9e40508c8f9
Parents: d245dc8
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 15:35:40 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 15:35:40 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/distributed/dht/GridDhtTxLocalAdapter.java    | 2 +-
 .../processors/cache/GridCacheAbstractFailoverSelfTest.java        | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/250dd8ea/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index d886989..444085f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -887,7 +887,7 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     protected abstract void clearPrepareFuture(GridDhtTxPrepareFuture fut);
 
     /**
-     * @return {@code True} if transaction if finished on prepare step.
+     * @return {@code True} if transaction is finished on prepare step.
      */
     protected final boolean commitOnPrepare() {
         return onePhaseCommit() && !near();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/250dd8ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 6f6355a..5d9ad35 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -31,7 +31,6 @@ import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.*;
-import java.util.*;
 import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.cache.CacheRebalanceMode.*;


[09/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: fcb45bb50533802a5299f67419bd76bfba4e2db7
Parents: 3ddbff9
Author: sboikov <se...@inria.fr>
Authored: Thu May 7 22:26:33 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Thu May 7 22:26:33 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/testsuites/IgniteCacheRestartTestSuite.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcb45bb5/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index e5372e8..a8f15dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -35,9 +35,9 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class);
 
-        suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
-        suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
         // TODO IGNITE-157.
+        //suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        //suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
         // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);


[12/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: 46dda3dd4c893c811f51e3e491e459422c0ddf06
Parents: 41d1a14
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 12:12:30 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 12:15:51 2015 +0300

----------------------------------------------------------------------
 .../GridCacheAbstractNodeRestartSelfTest.java            | 11 +++++++----
 .../GridCacheAtomicReplicatedFailoverSelfTest.java       |  6 ++++++
 .../replicated/GridCacheReplicatedFailoverSelfTest.java  |  6 ++++++
 .../ignite/testsuites/IgniteCacheRestartTestSuite.java   |  4 ++--
 4 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/46dda3dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
index 85e2c7c..76020b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractNodeRestartSelfTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.distributed;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
-import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -106,6 +105,10 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
 
         disco.setIpFinder(ipFinder);
 
+        disco.setSocketTimeout(10_000);
+        disco.setAckTimeout(10_000);
+        disco.setNetworkTimeout(10_000);
+
         c.setDiscoverySpi(disco);
 
         return c;
@@ -512,7 +515,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                                 try {
                                     cache.put(key, Integer.toString(key));
                                 }
-                                catch (TransactionRollbackException | ClusterTopologyException | CacheException ignored) {
+                                catch (IgniteException | CacheException ignored) {
                                     // It is ok if primary node leaves grid.
                                 }
 
@@ -668,7 +671,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
                                         tx.commit();
                                     }
                                 }
-                                catch (ClusterTopologyException | CacheException ignored) {
+                                catch (IgniteException | CacheException ignored) {
                                     // It is ok if primary node leaves grid.
                                 }
 
@@ -814,7 +817,7 @@ public abstract class GridCacheAbstractNodeRestartSelfTest extends GridCommonAbs
 
                                     tx.commit();
                                 }
-                                catch (ClusterTopologyException | CacheException ignored) {
+                                catch (IgniteException | CacheException ignored) {
                                     // It is ok if primary node leaves grid.
                                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/46dda3dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicReplicatedFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicReplicatedFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicReplicatedFailoverSelfTest.java
index 0a2781b..1e57c09 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicReplicatedFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicReplicatedFailoverSelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
 
 import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
 
 import static org.apache.ignite.cache.CacheMode.*;
 
@@ -29,4 +30,9 @@ public class GridCacheAtomicReplicatedFailoverSelfTest extends GridCacheAtomicFa
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/46dda3dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
index 326f57d..3461dd4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFailoverSelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.distributed.replicated;
 
 import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.processors.cache.*;
 
 import static org.apache.ignite.cache.CacheMode.*;
@@ -30,4 +31,9 @@ public class GridCacheReplicatedFailoverSelfTest extends GridCacheAbstractFailov
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/46dda3dd/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index a8f15dc..e5372e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -35,9 +35,9 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class);
 
+        suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
         // TODO IGNITE-157.
-        //suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
-        //suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
         // suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);


[22/47] incubator-ignite git commit: # IGNITE-894 Code cleanup.

Posted by ag...@apache.org.
# IGNITE-894 Code cleanup.


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

Branch: refs/heads/ignite-889
Commit: 96ad5a8605b54e02057253ad7d330f2726ddd687
Parents: f027ac5
Author: sevdokimov <se...@gridgain.com>
Authored: Tue May 12 18:39:37 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue May 12 18:39:37 2015 +0300

----------------------------------------------------------------------
 .../processors/resource/GridResourceField.java    |  5 +----
 .../processors/resource/GridResourceIoc.java      | 18 ++++++++++--------
 .../apache/ignite/internal/util/IgniteUtils.java  |  3 +++
 3 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
index 162de1c..fed7ebd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceField.java
@@ -44,10 +44,7 @@ class GridResourceField {
      * @param field Field where resource should be injected.
      * @param ann Resource annotation.
      */
-    GridResourceField(Field field, @Nullable Annotation ann) {
-        assert field != null;
-        assert ann != null || GridResourceUtils.mayRequireResources(field);
-
+    GridResourceField(@NotNull Field field, @NotNull Annotation ann) {
         this.field = field;
         this.ann = ann;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
index c2ef116..3d853d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridResourceIoc.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
@@ -142,9 +143,9 @@ class GridResourceIoc {
 
         boolean injected = false;
 
-        for (GridResourceField field : descr.recursiveFields()) {
+        for (Field field : descr.recursiveFields()) {
             try {
-                Object obj = field.getField().get(target);
+                Object obj = field.get(target);
 
                 if (obj != null) {
                     assert checkedObjs != null;
@@ -153,7 +154,7 @@ class GridResourceIoc {
                 }
             }
             catch (IllegalAccessException e) {
-                throw new IgniteCheckedException("Failed to inject resource [field=" + field.getField().getName() +
+                throw new IgniteCheckedException("Failed to inject resource [field=" + field.getName() +
                     ", target=" + target + ']', e);
             }
         }
@@ -253,7 +254,7 @@ class GridResourceIoc {
      */
     private static class ClassDescriptor {
         /** */
-        private final GridResourceField[] recursiveFields;
+        private final Field[] recursiveFields;
 
         /** */
         private final Map<Class<? extends Annotation>, T2<GridResourceField[], GridResourceMethod[]>> annMap;
@@ -265,7 +266,7 @@ class GridResourceIoc {
             Map<Class<? extends Annotation>, T2<List<GridResourceField>, List<GridResourceMethod>>> annMap
                 = new HashMap<>();
 
-            Collection<GridResourceField> recursiveFieldsList = new ArrayList<>();
+            List<Field> recursiveFieldsList = new ArrayList<>();
 
             boolean allowImplicitInjection = !GridNoImplicitInjection.class.isAssignableFrom(cls);
 
@@ -291,7 +292,7 @@ class GridResourceIoc {
                         && fieldAnns.length == 0
                         && GridResourceUtils.mayRequireResources(field)) {
                         // Account for anonymous inner classes.
-                        recursiveFieldsList.add(new GridResourceField(field, null));
+                        recursiveFieldsList.add(field);
                     }
                 }
 
@@ -312,7 +313,8 @@ class GridResourceIoc {
                 }
             }
 
-            recursiveFields = GridResourceField.toArray(recursiveFieldsList);
+            recursiveFields = recursiveFieldsList.isEmpty() ? U.EMPTY_FIELDS
+                : recursiveFieldsList.toArray(new Field[recursiveFieldsList.size()]);
 
             this.annMap = IgniteUtils.limitedMap(annMap.size());
 
@@ -328,7 +330,7 @@ class GridResourceIoc {
         /**
          * @return Recursive fields.
          */
-        public GridResourceField[] recursiveFields() {
+        public Field[] recursiveFields() {
             return recursiveFields;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96ad5a86/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 ffb4e99..673287d 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
@@ -113,6 +113,9 @@ public abstract class IgniteUtils {
     /** Empty  longs. */
     public static final long[] EMPTY_LONGS = new long[0];
 
+    /** Empty  longs. */
+    public static final Field[] EMPTY_FIELDS = new Field[0];
+
     /** System line separator. */
     private static final String NL = System.getProperty("line.separator");
 


[20/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157


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

Branch: refs/heads/ignite-889
Commit: ab1f9dd278a1c1e42cf36b21a2bedcd2f7e4129e
Parents: 250dd8e f6012f1
Author: sboikov <sb...@gridgain.com>
Authored: Tue May 12 09:05:47 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue May 12 09:05:47 2015 +0300

----------------------------------------------------------------------
 .../processors/resource/GridResourceField.java  |  11 +
 .../processors/resource/GridResourceIoc.java    | 387 ++++++-------------
 .../processors/resource/GridResourceMethod.java |  13 +
 .../resource/GridResourceProcessor.java         |   4 +-
 .../ignite/internal/util/IgniteUtils.java       |  15 +
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  24 +-
 parent/pom.xml                                  |   2 +
 pom.xml                                         |  33 --
 8 files changed, 193 insertions(+), 296 deletions(-)
----------------------------------------------------------------------



[16/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: 50ec7f34c4f3b9527bb2eb068b4662042a376856
Parents: 30d306a
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 15:11:30 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 15:11:30 2015 +0300

----------------------------------------------------------------------
 .../distributed/near/GridNearOptimisticTxPrepareFuture.java  | 8 +++++---
 .../distributed/near/GridNearPessimisticTxPrepareFuture.java | 8 +++++---
 .../ignite/testsuites/IgniteCacheRestartTestSuite.java       | 8 ++++----
 3 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/50ec7f34/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 1f2c439..51c7ccd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -646,14 +646,16 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        Collection<String> pendingFuts = F.viewReadOnly(pending(), new C1<IgniteInternalFuture<?>, String>() {
+        Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
             @Override public String apply(IgniteInternalFuture<?> f) {
-                return "[node=" + ((MiniFuture)f).node().id() + ", loc=" + ((MiniFuture)f).node().isLocal() + "]";
+                return "[node=" + ((MiniFuture)f).node().id() +
+                    ", loc=" + ((MiniFuture)f).node().isLocal() +
+                    ", done=" + f.isDone() + "]";
             }
         });
 
         return S.toString(GridNearOptimisticTxPrepareFuture.class, this,
-            "pendingFuts", pendingFuts,
+            "futs", futs,
             "super", super.toString());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/50ec7f34/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index ba8b92c..998df9e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -255,14 +255,16 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        Collection<String> pendingFuts = F.viewReadOnly(pending(), new C1<IgniteInternalFuture<?>, String>() {
+        Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
             @Override public String apply(IgniteInternalFuture<?> f) {
-                return "[node=" + ((MiniFuture)f).node().id() + ", loc=" + ((MiniFuture)f).node().isLocal() + "]";
+                return "[node=" + ((MiniFuture)f).node().id() +
+                    ", loc=" + ((MiniFuture)f).node().isLocal() +
+                    ", done=" + f.isDone() + "]";
             }
         });
 
         return S.toString(GridNearPessimisticTxPrepareFuture.class, this,
-            "pendingFuts", pendingFuts,
+            "futs", futs,
             "super", super.toString());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/50ec7f34/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index 983d447..24945dd 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -21,7 +21,6 @@ import junit.framework.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * In-Memory Data Grid stability test suite on changing topology.
@@ -36,9 +35,10 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCachePartitionedTxSalvageSelfTest.class);
 
-        suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
-        suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
-        suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
+        // TODO IGNITE-882.
+        //suite.addTestSuite(GridCachePartitionedNodeRestartTest.class);
+        //suite.addTestSuite(GridCachePartitionedOptimisticTxNodeRestartTest.class);
+        //suite.addTestSuite(GridCacheReplicatedNodeRestartSelfTest.class);
 
         suite.addTestSuite(IgniteCacheAtomicNodeRestartTest.class);
         // suite.addTestSuite(IgniteCacheAtomicReplicatedNodeRestartSelfTest.class); // TODO IGNITE-747


[15/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: 30d306a4a14e42fe93047947f7346271c81bf98f
Parents: 4dd6a63
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 13:36:26 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 13:36:26 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java   | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30d306a4/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index 2e56b7a..574680a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -138,6 +138,8 @@ public class IgniteCacheTestSuite3 extends TestSuite {
         // Cache interceptor tests.
         suite.addTest(IgniteCacheInterceptorSelfTestSuite.suite());
 
+        suite.addTestSuite(IgniteTxGetAfterStopTest.class);
+
         return suite;
     }
 }


[35/47] incubator-ignite git commit: ignite-768 to be fixed test improved

Posted by ag...@apache.org.
ignite-768 to be fixed test improved


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

Branch: refs/heads/ignite-889
Commit: 87e5a3f9f81f5c06abaca66dce33c9f83e632f4d
Parents: 5f8925b
Author: avinogradov <av...@gridgain.com>
Authored: Wed May 13 18:56:08 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Wed May 13 18:56:08 2015 +0300

----------------------------------------------------------------------
 .../GridCacheLocalIsolatedNodesSelfTest.java      | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/87e5a3f9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
index dbfdc86..ee42ddb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIsolatedNodesSelfTest.java
@@ -40,7 +40,7 @@ public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        startGrids(2);
+        startGrids(3);
     }
 
     /** {@inheritDoc} */
@@ -59,7 +59,11 @@ public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest
         Ignite g2 = grid(1);
         UUID nid2 = g2.cluster().localNode().id();
 
+        Ignite g3 = grid(2);
+        UUID nid3 = g3.cluster().localNode().id();
+
         assert !nid1.equals(nid2);
+        assert !nid1.equals(nid3);
 
         // Local cache on first node only.
         CacheConfiguration<String, String> ccfg1 = new CacheConfiguration<>("A");
@@ -77,8 +81,20 @@ public class GridCacheLocalIsolatedNodesSelfTest extends GridCommonAbstractTest
         IgniteCache<String, String> c2 = g2.createCache(ccfg2);
         c2.put("g2", "c2");
 
+        // Local cache on third node only.
+        CacheConfiguration<String, String> ccfg3 = new CacheConfiguration<>("A");
+        ccfg3.setCacheMode(LOCAL);
+        ccfg3.setNodeFilter(new NodeIdFilter(nid3));
+
+        IgniteCache<String, String> c3 = g3.createCache(ccfg3);
+        c3.put("g3", "c3");
+
         assertNull(c1.get("g2"));
+        assertNull(c1.get("g3"));
         assertNull(c2.get("g1"));
+        assertNull(c2.get("g3"));
+        assertNull(c3.get("g1"));
+        assertNull(c3.get("g2"));
     }
 
     /** Filter by node ID. */


[17/47] incubator-ignite git commit: # ignite-157

Posted by ag...@apache.org.
# ignite-157


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

Branch: refs/heads/ignite-889
Commit: f9c5fbec3e4cf36c720320e4ee7ef0b91d9f014b
Parents: 50ec7f3
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 15:20:27 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 15:20:27 2015 +0300

----------------------------------------------------------------------
 .../ignite/testsuites/IgniteCacheFailoverTestSuite.java       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f9c5fbec/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 2cc6a5a..dd3ce27 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
@@ -61,9 +61,10 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheTxNearDisabledPutGetRestartTest.class);
         suite.addTestSuite(IgniteCacheTxNearDisabledFairAffinityPutGetRestartTest.class);
 
-        suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);
-        suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class);
-        suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class);
+        // TODO IGNITE-882.
+        //suite.addTestSuite(GridCachePartitionedFailoverSelfTest.class);
+        //suite.addTestSuite(GridCacheColocatedFailoverSelfTest.class);
+        //suite.addTestSuite(GridCacheReplicatedFailoverSelfTest.class);
 
         return suite;
     }


[37/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-894' into ignite-sprint-5

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-894' into ignite-sprint-5


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

Branch: refs/heads/ignite-889
Commit: 3abd25e4e46a3fe8a77bd84570ff41fcdacb1e82
Parents: ba0caa1 34a9b31
Author: sevdokimov <se...@gridgain.com>
Authored: Wed May 13 19:03:47 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed May 13 19:03:47 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/GridInternalWrapper.java    | 30 ------
 .../closure/GridClosureProcessor.java           | 25 ++---
 .../internal/processors/igfs/IgfsJobImpl.java   |  9 +-
 .../processors/resource/GridResourceField.java  |  5 +-
 .../processors/resource/GridResourceIoc.java    | 51 ++++++-----
 .../resource/GridResourceProcessor.java         | 22 +----
 .../processors/resource/GridResourceUtils.java  | 15 ---
 .../ignite/internal/util/IgniteUtils.java       |  3 +
 .../util/lang/GridComputeJobWrapper.java        | 96 --------------------
 .../ignite/resources/InjectRecursively.java     | 30 ++++++
 10 files changed, 71 insertions(+), 215 deletions(-)
----------------------------------------------------------------------



[29/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-835' into ignite-sprint-5

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-835' into ignite-sprint-5


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

Branch: refs/heads/ignite-889
Commit: 22341a9ad6e0c7627ffab26ba63c3f8ed3ace9c0
Parents: 5f8925b 96ff8f2
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 13 13:50:48 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 13 13:50:48 2015 +0300

----------------------------------------------------------------------
 .../dht/GridDhtTransactionalCacheAdapter.java   |  9 ++--
 .../distributed/GridCacheLockAbstractTest.java  |  2 -
 ...achePartitionedNearDisabledLockSelfTest.java | 47 ++++++++++++++++++++
 .../GridCacheReplicatedLockSelfTest.java        |  5 +++
 .../testsuites/IgniteCacheTestSuite2.java       |  1 +
 5 files changed, 57 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[18/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157


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

Branch: refs/heads/ignite-889
Commit: d245dc818d18f9474854cd9550e60efc87732ce0
Parents: f9c5fbe 2361640
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 15:21:01 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 15:21:01 2015 +0300

----------------------------------------------------------------------
 examples/pom.xml                                |   2 +-
 modules/aop/pom.xml                             |   2 +-
 modules/aws/pom.xml                             |   2 +-
 modules/clients/pom.xml                         |   2 +-
 modules/cloud/pom.xml                           |   2 +-
 .../TcpDiscoveryCloudIpFinderSelfTest.java      |   2 -
 modules/codegen/pom.xml                         |   2 +-
 modules/core/pom.xml                            |   2 +-
 .../processors/cache/GridCacheAdapter.java      |  26 ++-
 .../cache/GridCacheEvictionManager.java         |   2 +-
 .../processors/cache/GridCacheProxyImpl.java    |  24 --
 .../processors/cache/GridCacheSwapManager.java  | 215 +++++++++++++-----
 .../processors/cache/IgniteInternalCache.java   |  27 ---
 .../colocated/GridDhtColocatedLockFuture.java   |   2 +
 .../distributed/near/GridNearCacheAdapter.java  |  10 -
 .../processors/cache/local/GridLocalCache.java  |   8 +-
 .../local/atomic/GridLocalAtomicCache.java      |  27 ++-
 .../cache/query/GridCacheQueryManager.java      |  21 +-
 .../transactions/IgniteTxLocalAdapter.java      |  12 +-
 .../processors/igfs/IgfsDeleteWorker.java       |   4 +
 .../offheap/GridOffHeapProcessor.java           |  17 ++
 .../util/offheap/GridOffHeapPartitionedMap.java |   9 +
 .../unsafe/GridUnsafePartitionedMap.java        | 155 ++++++-------
 .../core/src/main/resources/ignite.properties   |   2 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java | 227 +++++++++++--------
 .../cache/GridCacheAbstractSelfTest.java        |   4 +-
 .../cache/OffHeapTieredTransactionSelfTest.java | 127 +++++++++++
 ...icOffHeapTieredMultiNodeFullApiSelfTest.java |  43 ++++
 ...ionedNearDisabledOffHeapFullApiSelfTest.java |   8 +-
 ...DisabledOffHeapMultiNodeFullApiSelfTest.java |   8 +-
 ...abledOffHeapTieredAtomicFullApiSelfTest.java |  56 +++++
 ...earDisabledOffHeapTieredFullApiSelfTest.java |  33 +++
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |  33 +++
 ...CacheAtomicOffHeapTieredFullApiSelfTest.java |  32 +++
 ...icOffHeapTieredMultiNodeFullApiSelfTest.java |  33 +++
 ...yWriteOrderOffHeapTieredFullApiSelfTest.java |  33 +++
 ...erOffHeapTieredMultiNodeFullApiSelfTest.java |  33 +++
 ...achePartitionedMultiNodeFullApiSelfTest.java |  15 +-
 ...dCachePartitionedOffHeapFullApiSelfTest.java |   8 +-
 ...titionedOffHeapMultiNodeFullApiSelfTest.java |   8 +-
 ...PartitionedOffHeapTieredFullApiSelfTest.java |  32 +++
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |  72 ++++++
 ...idCacheReplicatedOffHeapFullApiSelfTest.java |   8 +-
 ...plicatedOffHeapMultiNodeFullApiSelfTest.java |   8 +-
 ...eReplicatedOffHeapTieredFullApiSelfTest.java |  33 +++
 ...edOffHeapTieredMultiNodeFullApiSelfTest.java |  33 +++
 ...LocalAtomicOffHeapTieredFullApiSelfTest.java |  32 +++
 .../GridCacheLocalOffHeapFullApiSelfTest.java   |   6 +-
 ...dCacheLocalOffHeapTieredFullApiSelfTest.java |  32 +++
 .../ignite/testsuites/IgniteBasicTestSuite.java |   1 +
 .../IgniteCacheFullApiSelfTestSuite.java        |  18 ++
 .../testsuites/IgniteCacheTestSuite3.java       |   3 -
 modules/extdata/p2p/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 +-
 ...eQueryMultiThreadedOffHeapTiredSelfTest.java |  37 +++
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |  29 ++-
 .../IgniteCacheQuerySelfTestSuite.java          |   1 +
 modules/jcl/pom.xml                             |   2 +-
 modules/jta/pom.xml                             |   2 +-
 modules/log4j/pom.xml                           |   2 +-
 modules/rest-http/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/spring/pom.xml                          |   2 +-
 modules/ssh/pom.xml                             |   2 +-
 modules/tools/pom.xml                           |   2 +-
 modules/urideploy/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 +-
 pom.xml                                         |   6 +-
 79 files changed, 1269 insertions(+), 406 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d245dc81/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d245dc81/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------

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


[43/47] incubator-ignite git commit: # IGNITE-709 Bug fix: partition exchange timeout occurs many times if no caches are configured. (cherry picked from commit 816da0a)

Posted by ag...@apache.org.
# IGNITE-709 Bug fix: partition exchange timeout occurs many times if no caches are configured.
(cherry picked from commit 816da0a)


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

Branch: refs/heads/ignite-889
Commit: 7c91389c4927c257d6af0ed54e7489a2d015588e
Parents: 9e25c2a
Author: sevdokimov <se...@gridgain.com>
Authored: Thu May 14 13:18:34 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu May 14 13:42:39 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c91389c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 45d332c..4b8db00 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1252,7 +1252,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                 cctx.kernalContext().timeout().removeTimeoutObject(old);
 
             GridTimeoutObject timeoutObj = new GridTimeoutObjectAdapter(
-                cctx.gridConfig().getNetworkTimeout() * cctx.gridConfig().getCacheConfiguration().length) {
+                cctx.gridConfig().getNetworkTimeout() * Math.max(1, cctx.gridConfig().getCacheConfiguration().length)) {
                 @Override public void onTimeout() {
                     if (isDone())
                         return;


[14/47] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-5' into ignite-157


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

Branch: refs/heads/ignite-889
Commit: 4dd6a63ba0e63d9f6b72264983807ab577900b8f
Parents: c548136 17bf271
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 8 13:32:05 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 8 13:32:05 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |   32 +-
 dev-tools/.gitignore                            |    2 +
 dev-tools/build.gradle                          |   45 +
 dev-tools/src/main/groovy/jiraslurp.groovy      |  146 +
 modules/cloud/pom.xml                           |    2 +-
 .../processors/cache/GridCacheIoManager.java    |  314 +-
 .../processors/cache/GridCacheMessage.java      |    8 +-
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |    8 +
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |    2 +-
 .../atomic/GridNearAtomicUpdateResponse.java    |   18 +-
 .../dht/preloader/GridDhtForceKeysFuture.java   |    6 +
 .../dht/preloader/GridDhtForceKeysResponse.java |   54 +-
 .../distributed/near/GridNearGetResponse.java   |    8 +-
 .../util/lang/GridFilteredIterator.java         |    2 +-
 .../ignite/internal/util/lang/GridFunc.java     | 7218 +++++-------------
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   22 +-
 .../cache/GridCacheSwapReloadSelfTest.java      |   20 +-
 .../IgniteCacheP2pUnmarshallingErrorTest.java   |  189 +
 ...gniteCacheP2pUnmarshallingNearErrorTest.java |   56 +
 ...CacheP2pUnmarshallingRebalanceErrorTest.java |   80 +
 .../IgniteCacheP2pUnmarshallingTxErrorTest.java |  109 +
 .../cache/IgniteCachePeekModesAbstractTest.java |   15 +-
 ...CacheLoadingConcurrentGridStartSelfTest.java |   49 +-
 ...idFileSwapSpaceSpiMultithreadedLoadTest.java |    4 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   65 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |    1 +
 ...gniteCacheP2pUnmarshallingErrorTestSuit.java |   41 +
 .../ignite/testsuites/IgniteCacheTestSuite.java |  293 -
 .../testsuites/IgniteCacheTestSuite2.java       |  141 +
 .../testsuites/IgniteCacheTestSuite3.java       |  143 +
 .../testsuites/IgniteCacheTestSuite4.java       |  131 +
 modules/gce/pom.xml                             |    2 +-
 .../cache/GridCacheOffHeapAndSwapSelfTest.java  |   11 +-
 .../cache/GridCacheOffHeapSelfTest.java         |   11 +-
 ...niteCacheP2pUnmarshallingQueryErrorTest.java |   56 +
 .../IgniteCacheQuerySelfTestSuite.java          |    3 +
 .../ignite/scalar/ScalarConversions.scala       |    8 -
 .../ignite/schema/generator/CodeGenerator.java  |    6 +-
 pom.xml                                         |   22 +-
 39 files changed, 3469 insertions(+), 5874 deletions(-)
----------------------------------------------------------------------



[46/47] incubator-ignite git commit: Merge branch 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-889

Posted by ag...@apache.org.
Merge branch 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-889


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

Branch: refs/heads/ignite-889
Commit: 72b6ce26eed6c577ac21f6e6bfb5a7e958979342
Parents: 41f5bb0 56e67e8
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu May 14 12:41:19 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu May 14 12:41:19 2015 -0700

----------------------------------------------------------------------
 bin/ignite-schema-import.bat                    |    2 +-
 bin/ignite-schema-import.sh                     |    2 +-
 bin/ignite.bat                                  |    2 +-
 bin/ignite.sh                                   |    2 +-
 bin/ignitevisorcmd.bat                          |    2 +-
 bin/ignitevisorcmd.sh                           |    2 +-
 .../processors/cache/GridCacheAdapter.java      |  119 +-
 .../processors/cache/GridCacheContext.java      |    7 +
 .../processors/cache/GridCacheMapEntry.java     |   70 +-
 .../processors/cache/GridCacheMvccManager.java  |    4 +-
 .../GridDistributedCacheAdapter.java            |  210 ++--
 .../distributed/dht/GridDhtCacheAdapter.java    |   16 +-
 .../dht/GridDhtOffHeapCacheEntry.java           |   63 ++
 .../dht/GridDhtTransactionalCacheAdapter.java   |    9 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   32 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   27 +
 .../cache/distributed/dht/GridDhtTxMapping.java |    2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   81 +-
 .../distributed/dht/GridNoStorageCacheMap.java  |    4 +-
 .../dht/atomic/GridDhtAtomicCache.java          |    3 +
 .../atomic/GridDhtAtomicOffHeapCacheEntry.java  |   63 ++
 .../dht/colocated/GridDhtColocatedCache.java    |    5 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   25 +-
 .../GridDhtColocatedOffHeapCacheEntry.java      |   63 ++
 .../colocated/GridDhtDetachedCacheEntry.java    |    4 +-
 .../GridDhtPartitionsExchangeFuture.java        |    2 +-
 .../distributed/near/GridNearCacheAdapter.java  |    3 +
 .../distributed/near/GridNearCacheEntry.java    |    4 +-
 .../distributed/near/GridNearLockFuture.java    |    5 -
 .../near/GridNearOffHeapCacheEntry.java         |   60 +
 .../near/GridNearOptimisticTxPrepareFuture.java |  779 +++++++++++++
 .../GridNearPessimisticTxPrepareFuture.java     |  349 ++++++
 .../cache/distributed/near/GridNearTxLocal.java |   84 +-
 .../near/GridNearTxPrepareFuture.java           | 1050 ------------------
 .../near/GridNearTxPrepareFutureAdapter.java    |  226 ++++
 .../cache/local/GridLocalCacheEntry.java        |   18 +
 .../cache/transactions/IgniteInternalTx.java    |    4 +-
 .../cache/transactions/IgniteTxAdapter.java     |    2 +-
 .../cache/transactions/IgniteTxHandler.java     |   68 +-
 .../transactions/IgniteTxLocalAdapter.java      |    2 +-
 .../cache/transactions/IgniteTxManager.java     |   12 +-
 .../processors/resource/GridResourceField.java  |    5 +-
 .../processors/resource/GridResourceIoc.java    |   20 +-
 .../resource/GridResourceProcessor.java         |   16 +-
 .../ignite/internal/util/IgniteUtils.java       |    3 +
 .../util/lang/GridComputeJobWrapper.java        |   96 --
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |    2 -
 .../resources/META-INF/classnames.properties    |    1 -
 .../cache/CacheOffheapMapEntrySelfTest.java     |  168 +++
 .../cache/CacheRemoveAllSelfTest.java           |   81 ++
 .../GridCacheAbstractFailoverSelfTest.java      |    8 +-
 .../GridCacheAbstractNodeRestartSelfTest.java   |   11 +-
 .../distributed/GridCacheLockAbstractTest.java  |    2 -
 .../distributed/IgniteTxGetAfterStopTest.java   |  131 +++
 ...achePartitionedNearDisabledLockSelfTest.java |   47 +
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |    4 +-
 ...idCacheAtomicReplicatedFailoverSelfTest.java |    6 +
 .../GridCachePartitionedTxSalvageSelfTest.java  |   25 +-
 .../near/NoneRebalanceModeSelfTest.java         |   67 ++
 .../GridCacheReplicatedFailoverSelfTest.java    |    6 +
 .../GridCacheReplicatedLockSelfTest.java        |    5 +
 .../GridCacheReplicatedNodeRestartSelfTest.java |   80 ++
 .../GridCacheLocalIsolatedNodesSelfTest.java    |   18 +-
 .../discovery/tcp/TcpDiscoveryRestartTest.java  |  199 ++++
 .../IgniteCacheFailoverTestSuite.java           |   10 +-
 .../testsuites/IgniteCacheRestartTestSuite.java |    8 +-
 .../testsuites/IgniteCacheTestSuite2.java       |    2 +
 .../testsuites/IgniteCacheTestSuite3.java       |    2 +
 .../testsuites/IgniteCacheTestSuite4.java       |    4 +
 .../scalar/tests/ScalarCacheQueriesSpec.scala   |  154 +--
 .../ignite/scalar/tests/ScalarCacheSpec.scala   |   23 +-
 .../scalar/tests/ScalarConversionsSpec.scala    |   43 +-
 .../scalar/tests/ScalarProjectionSpec.scala     |  128 ++-
 .../scalar/tests/ScalarReturnableSpec.scala     |   41 +-
 modules/visor-console/pom.xml                   |    2 +-
 .../ignite/visor/VisorRuntimeBaseSpec.scala     |    2 +-
 .../visor/commands/VisorArgListSpec.scala       |   60 +-
 .../commands/VisorFileNameCompleterSpec.scala   |   34 +-
 .../commands/ack/VisorAckCommandSpec.scala      |   20 +-
 .../commands/alert/VisorAlertCommandSpec.scala  |   68 +-
 .../cache/VisorCacheClearCommandSpec.scala      |   48 +-
 .../commands/cache/VisorCacheCommandSpec.scala  |   66 +-
 .../config/VisorConfigurationCommandSpec.scala  |    8 +-
 .../cswap/VisorCacheSwapCommandSpec.scala       |   24 +-
 .../deploy/VisorDeployCommandSpec.scala         |   10 +-
 .../disco/VisorDiscoveryCommandSpec.scala       |   46 +-
 .../events/VisorEventsCommandSpec.scala         |   28 +-
 .../visor/commands/gc/VisorGcCommandSpec.scala  |   30 +-
 .../commands/help/VisorHelpCommandSpec.scala    |   57 +-
 .../commands/kill/VisorKillCommandSpec.scala    |   58 +-
 .../commands/log/VisorLogCommandSpec.scala      |   10 +-
 .../commands/mem/VisorMemoryCommandSpec.scala   |   77 +-
 .../commands/node/VisorNodeCommandSpec.scala    |   22 +-
 .../commands/open/VisorOpenCommandSpec.scala    |   16 +-
 .../commands/ping/VisorPingCommandSpec.scala    |   16 +-
 .../commands/start/VisorStartCommandSpec.scala  |  126 +--
 .../commands/tasks/VisorTasksCommandSpec.scala  |  112 +-
 .../commands/top/VisorTopologyCommandSpec.scala |   52 +-
 .../commands/vvm/VisorVvmCommandSpec.scala      |   30 +-
 99 files changed, 3645 insertions(+), 2280 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72b6ce26/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72b6ce26/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72b6ce26/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------


[44/47] incubator-ignite git commit: #ignite-373: Cache is not empty after removeAll.

Posted by ag...@apache.org.
#ignite-373: Cache is not empty after removeAll.


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

Branch: refs/heads/ignite-889
Commit: 593e3eeeb0d4965b1c1a83d4f68a9d18e6615632
Parents: 7c91389
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu May 14 15:35:27 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu May 14 15:35:27 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 119 +++++------
 .../GridDistributedCacheAdapter.java            | 210 ++++++++++++-------
 .../cache/CacheRemoveAllSelfTest.java           |  81 +++++++
 .../near/NoneRebalanceModeSelfTest.java         |  67 ++++++
 .../testsuites/IgniteCacheTestSuite2.java       |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   2 +
 6 files changed, 338 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/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 3826bfa..4106cb0 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
@@ -1133,7 +1133,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
             ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
 
-            ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null).get();
+            ctx.kernalContext().task().execute(
+                new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null).get();
         }
     }
 
@@ -1152,7 +1153,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         if (!nodes.isEmpty()) {
             ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
 
-            return ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null);
+            return ctx.kernalContext().task().execute(
+                new ClearTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys), null);
         }
         else
             return new GridFinishedFuture<>();
@@ -3571,7 +3573,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
 
-        return ctx.kernalContext().task().execute(new SizeTask(ctx, peekModes), null);
+        return ctx.kernalContext().task().execute(
+            new SizeTask(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), null);
     }
 
     /** {@inheritDoc} */
@@ -4827,13 +4830,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         private static final long serialVersionUID = 0L;
 
         /**
-         * Empty constructor for serialization.
-         */
-        public GlobalClearAllJob() {
-            // No-op.
-        }
-
-        /**
          * @param cacheName Cache name.
          * @param topVer Affinity topology version.
          */
@@ -4859,14 +4855,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         private static final long serialVersionUID = 0L;
 
         /** Keys to remove. */
-        private Set<? extends K> keys;
-
-        /**
-         * Empty constructor for serialization.
-         */
-        public GlobalClearKeySetJob() {
-            // No-op.
-        }
+        private final Set<? extends K> keys;
 
         /**
          * @param cacheName Cache name.
@@ -4897,14 +4886,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         private static final long serialVersionUID = 0L;
 
         /** Peek modes. */
-        private CachePeekMode[] peekModes;
-
-        /**
-         * Required by {@link Externalizable}.
-         */
-        public SizeJob() {
-            // No-op.
-        }
+        private final CachePeekMode[] peekModes;
 
         /**
          * @param cacheName Cache name.
@@ -5514,17 +5496,10 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         protected Ignite ignite;
 
         /** Affinity topology version. */
-        protected AffinityTopologyVersion topVer;
+        protected final AffinityTopologyVersion topVer;
 
         /** Cache name. */
-        protected String cacheName;
-
-        /**
-         * Empty constructor for serialization.
-         */
-        public TopologyVersionAwareJob() {
-            // No-op.
-        }
+        protected final String cacheName;
 
         /**
          * @param cacheName Cache name.
@@ -5583,24 +5558,23 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** */
         private static final long serialVersionUID = 0L;
 
-        /** Cache context. */
-        private GridCacheContext ctx;
+        /** Cache name. */
+        private final String cacheName;
 
-        /** Peek modes. */
-        private CachePeekMode[] peekModes;
+        /** Affinity topology version. */
+        private final AffinityTopologyVersion topVer;
 
-        /**
-         * Empty constructor for serialization.
-         */
-        public SizeTask() {
-            // No-op.
-        }
+        /** Peek modes. */
+        private final CachePeekMode[] peekModes;
 
         /**
-         * @param ctx Cache context.
+         * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
+         * @param peekModes Cache peek modes.
          */
-        public SizeTask(GridCacheContext ctx, CachePeekMode[] peekModes) {
-            this.ctx = ctx;
+        public SizeTask(String cacheName, AffinityTopologyVersion topVer, CachePeekMode[] peekModes) {
+            this.cacheName = cacheName;
+            this.topVer = topVer;
             this.peekModes = peekModes;
         }
 
@@ -5610,13 +5584,22 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             Map<ComputeJob, ClusterNode> jobs = new HashMap();
 
             for (ClusterNode node : subgrid)
-                jobs.put(new SizeJob(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), node);
+                jobs.put(new SizeJob(cacheName, topVer, peekModes), node);
 
             return jobs;
         }
 
         /** {@inheritDoc} */
         @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+            IgniteException e = res.getException();
+
+            if (e != null) {
+                if (e instanceof ClusterTopologyException)
+                    return ComputeJobResultPolicy.WAIT;
+
+                throw new IgniteException("Remote job threw exception.", e);
+            }
+
             return ComputeJobResultPolicy.WAIT;
         }
 
@@ -5640,25 +5623,23 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         /** */
         private static final long serialVersionUID = 0L;
 
-        /** Cache context. */
-        private GridCacheContext ctx;
+        /** Cache name. */
+        private final String cacheName;
 
-        /** Keys to clear. */
-        private Set<? extends K> keys;
+        /** Affinity topology version. */
+        private final AffinityTopologyVersion topVer;
 
-        /**
-         * Empty constructor for serialization.
-         */
-        public ClearTask() {
-            // No-op.
-        }
+        /** Keys to clear. */
+        private final Set<? extends K> keys;
 
         /**
-         * @param ctx Cache context.
+         * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
          * @param keys Keys to clear.
          */
-        public ClearTask(GridCacheContext ctx, Set<? extends K> keys) {
-            this.ctx = ctx;
+        public ClearTask(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
+            this.cacheName = cacheName;
+            this.topVer = topVer;
             this.keys = keys;
         }
 
@@ -5668,9 +5649,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
             Map<ComputeJob, ClusterNode> jobs = new HashMap();
 
             for (ClusterNode node : subgrid) {
-                jobs.put(keys == null ?
-                        new GlobalClearAllJob(ctx.name(), ctx.affinity().affinityTopologyVersion()) :
-                        new GlobalClearKeySetJob<K>(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys),
+                jobs.put(keys == null ? new GlobalClearAllJob(cacheName, topVer) :
+                        new GlobalClearKeySetJob<K>(cacheName, topVer, keys),
                     node);
             }
 
@@ -5679,6 +5659,15 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         /** {@inheritDoc} */
         @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+            IgniteException e = res.getException();
+
+            if (e != null) {
+                if (e instanceof ClusterTopologyException)
+                    return ComputeJobResultPolicy.WAIT;
+
+                throw new IgniteException("Remote job threw exception.", e);
+            }
+
             return ComputeJobResultPolicy.WAIT;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
index 3a685cc..c5ef22f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.distributed;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.processors.affinity.*;
@@ -30,17 +31,17 @@ import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.processors.datastreamer.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
 import org.apache.ignite.transactions.*;
 import org.jetbrains.annotations.*;
 
 import java.io.*;
 import java.util.*;
-import java.util.concurrent.*;
 
-import static org.apache.ignite.internal.GridClosureCallMode.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.*;
+import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.*;
 
 /**
  * Distributed cache implementation.
@@ -142,21 +143,28 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
         try {
             AffinityTopologyVersion topVer;
 
+            boolean retry;
+
+            CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+            boolean skipStore = opCtx != null && opCtx.skipStore();
+
             do {
+                retry = false;
+
                 topVer = ctx.affinity().affinityTopologyVersion();
 
                 // Send job to all data nodes.
                 Collection<ClusterNode> nodes = ctx.grid().cluster().forDataNodes(name()).nodes();
 
                 if (!nodes.isEmpty()) {
-                    CacheOperationContext opCtx = ctx.operationContextPerCall();
+                    ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
 
-                    ctx.closures().callAsyncNoFailover(BROADCAST,
-                        new GlobalRemoveAllCallable<>(name(), topVer, opCtx != null && opCtx.skipStore()), nodes,
-                        true).get();
+                    retry = !ctx.kernalContext().task().execute(
+                        new RemoveAllTask(ctx.name(), topVer, skipStore), null).get();
                 }
             }
-            while (ctx.affinity().affinityTopologyVersion().compareTo(topVer) > 0);
+            while (ctx.affinity().affinityTopologyVersion().compareTo(topVer) != 0 || retry);
         }
         catch (ClusterGroupEmptyCheckedException ignore) {
             if (log.isDebugEnabled())
@@ -170,7 +178,11 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
 
         AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
 
-        removeAllAsync(opFut, topVer);
+        CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+        boolean skipStore = opCtx != null && opCtx.skipStore();
+
+        removeAllAsync(opFut, topVer, skipStore);
 
         return opFut;
     }
@@ -178,27 +190,29 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
     /**
      * @param opFut Future.
      * @param topVer Topology version.
+     * @param skipStore Skip store flag.
      */
-    private void removeAllAsync(final GridFutureAdapter<Void> opFut, final AffinityTopologyVersion topVer) {
+    private void removeAllAsync(final GridFutureAdapter<Void> opFut, final AffinityTopologyVersion topVer,
+        final boolean skipStore) {
         Collection<ClusterNode> nodes = ctx.grid().cluster().forDataNodes(name()).nodes();
 
         if (!nodes.isEmpty()) {
-            CacheOperationContext opCtx = ctx.operationContextPerCall();
+            ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
 
-            IgniteInternalFuture<?> rmvFut = ctx.closures().callAsyncNoFailover(BROADCAST,
-                    new GlobalRemoveAllCallable<>(name(), topVer, opCtx != null && opCtx.skipStore()), nodes, true);
+            IgniteInternalFuture<Boolean> rmvAll = ctx.kernalContext().task().execute(
+                new RemoveAllTask(ctx.name(), topVer, skipStore), null);
 
-            rmvFut.listen(new IgniteInClosure<IgniteInternalFuture<?>>() {
-                @Override public void apply(IgniteInternalFuture<?> fut) {
+            rmvAll.listen(new IgniteInClosure<IgniteInternalFuture<Boolean>>() {
+                @Override public void apply(IgniteInternalFuture<Boolean> fut) {
                     try {
-                        fut.get();
+                        boolean retry = !fut.get();
 
                         AffinityTopologyVersion topVer0 = ctx.affinity().affinityTopologyVersion();
 
-                        if (topVer0.equals(topVer))
+                        if (topVer0.equals(topVer) && !retry)
                             opFut.onDone();
                         else
-                            removeAllAsync(opFut, topVer0);
+                            removeAllAsync(opFut, topVer0, skipStore);
                     }
                     catch (ClusterGroupEmptyCheckedException ignore) {
                         if (log.isDebugEnabled())
@@ -227,97 +241,150 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
     }
 
     /**
-     * Internal callable which performs remove all primary key mappings
-     * operation on a cache with the given name.
+     * Remove task.
      */
     @GridInternal
-    private static class GlobalRemoveAllCallable<K,V> implements Callable<Object>, Externalizable {
+    private static class RemoveAllTask extends ComputeTaskAdapter<Object, Boolean> {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** Cache name. */
-        private String cacheName;
+        private final String cacheName;
 
-        /** Topology version. */
-        private AffinityTopologyVersion topVer;
+        /** Affinity topology version. */
+        private final AffinityTopologyVersion topVer;
 
         /** Skip store flag. */
-        private boolean skipStore;
-
-        /** Injected grid instance. */
-        @IgniteInstanceResource
-        private Ignite ignite;
+        private final boolean skipStore;
 
         /**
-         * Empty constructor for serialization.
+         * @param cacheName Cache name.
+         * @param topVer Affinity topology version.
+         * @param skipStore Skip store flag.
          */
-        public GlobalRemoveAllCallable() {
-            // No-op.
+        public RemoveAllTask(String cacheName, AffinityTopologyVersion topVer, boolean skipStore) {
+            this.cacheName = cacheName;
+            this.topVer = topVer;
+            this.skipStore = skipStore;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+            @Nullable Object arg) throws IgniteException {
+            Map<ComputeJob, ClusterNode> jobs = new HashMap();
+
+            for (ClusterNode node : subgrid)
+                jobs.put(new GlobalRemoveAllJob(cacheName, topVer, skipStore), node);
+
+            return jobs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+            IgniteException e = res.getException();
+
+            if (e != null) {
+                if (e instanceof ClusterTopologyException)
+                    return ComputeJobResultPolicy.WAIT;
+
+                throw new IgniteException("Remote job threw exception.", e);
+            }
+
+            return ComputeJobResultPolicy.WAIT;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Boolean reduce(List<ComputeJobResult> results) throws IgniteException {
+            for (ComputeJobResult locRes : results) {
+                if (locRes != null && (locRes.getException() != null || !locRes.<Boolean>getData()))
+                    return false;
+            }
+
+            return true;
         }
+    }
+    /**
+     * Internal job which performs remove all primary key mappings
+     * operation on a cache with the given name.
+     */
+    @GridInternal
+    private static class GlobalRemoveAllJob<K,V>  extends TopologyVersionAwareJob {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Skip store flag. */
+        private final boolean skipStore;
 
         /**
          * @param cacheName Cache name.
          * @param topVer Topology version.
          * @param skipStore Skip store flag.
          */
-        private GlobalRemoveAllCallable(String cacheName, @NotNull AffinityTopologyVersion topVer, boolean skipStore) {
-            this.cacheName = cacheName;
-            this.topVer = topVer;
+        private GlobalRemoveAllJob(String cacheName, @NotNull AffinityTopologyVersion topVer, boolean skipStore) {
+            super(cacheName, topVer);
+
             this.skipStore = skipStore;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        @Override public Object call() throws Exception {
-            GridCacheAdapter<K, V> cacheAdapter = ((IgniteKernal)ignite).context().cache().internalCache(cacheName);
+        /** {@inheritDoc} */
+        @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache0) {
+            GridCacheAdapter cache = ((IgniteKernal) ignite).context().cache().internalCache(cacheName);
 
-            final GridCacheContext<K, V> ctx = cacheAdapter.context();
+            if (cache == null)
+                return true;
 
-            ctx.affinity().affinityReadyFuture(topVer).get();
+            final GridCacheContext<K, V> ctx = cache.context();
 
             ctx.gate().enter();
 
             try {
                 if (!ctx.affinity().affinityTopologyVersion().equals(topVer))
-                    return null; // Ignore this remove request because remove request will be sent again.
+                    return false; // Ignore this remove request because remove request will be sent again.
 
                 GridDhtCacheAdapter<K, V> dht;
                 GridNearCacheAdapter<K, V> near = null;
 
-                if (cacheAdapter instanceof GridNearCacheAdapter) {
-                    near = ((GridNearCacheAdapter<K, V>)cacheAdapter);
+                if (cache instanceof GridNearCacheAdapter) {
+                    near = ((GridNearCacheAdapter<K, V>) cache);
                     dht = near.dht();
                 }
                 else
-                    dht = (GridDhtCacheAdapter<K, V>)cacheAdapter;
+                    dht = (GridDhtCacheAdapter<K, V>) cache;
 
                 try (DataStreamerImpl<KeyCacheObject, Object> dataLdr =
-                         (DataStreamerImpl)ignite.dataStreamer(cacheName)) {
-                    ((DataStreamerImpl)dataLdr).maxRemapCount(0);
+                         (DataStreamerImpl) ignite.dataStreamer(cacheName)) {
+                    ((DataStreamerImpl) dataLdr).maxRemapCount(0);
 
                     dataLdr.skipStore(skipStore);
 
                     dataLdr.receiver(DataStreamerCacheUpdaters.<KeyCacheObject, Object>batched());
 
-                    for (GridDhtLocalPartition locPart : dht.topology().currentLocalPartitions()) {
-                        if (!locPart.isEmpty() && locPart.primary(topVer)) {
-                            for (GridDhtCacheEntry o : locPart.entries()) {
-                                if (!o.obsoleteOrDeleted())
-                                    dataLdr.removeDataInternal(o.key());
-                            }
-                        }
-                    }
+                    for (int part : ctx.affinity().primaryPartitions(ctx.localNodeId(), topVer)) {
+                        GridDhtLocalPartition locPart = dht.topology().localPartition(part, topVer, false);
 
-                    Iterator<KeyCacheObject> it = dht.context().swap().offHeapKeyIterator(true, false, topVer);
+                        if (locPart == null || (ctx.rebalanceEnabled() && locPart.state() != OWNING) || !locPart.reserve())
+                            return false;
 
-                    while (it.hasNext())
-                        dataLdr.removeDataInternal(it.next());
+                        try {
+                            if (!locPart.isEmpty()) {
+                                for (GridDhtCacheEntry o : locPart.entries()) {
+                                    if (!o.obsoleteOrDeleted())
+                                        dataLdr.removeDataInternal(o.key());
+                                }
+                            }
 
-                    it = dht.context().swap().swapKeyIterator(true, false, topVer);
+                            GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>> iter =
+                                dht.context().swap().iterator(part);
 
-                    while (it.hasNext())
-                        dataLdr.removeDataInternal(it.next());
+                            if (iter != null) {
+                                for (Map.Entry<byte[], GridCacheSwapEntry> e : iter)
+                                    dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey()));
+                            }
+                        }
+                        finally {
+                            locPart.release();
+                        }
+                    }
                 }
 
                 if (near != null) {
@@ -329,25 +396,14 @@ public abstract class GridDistributedCacheAdapter<K, V> extends GridCacheAdapter
                     }
                 }
             }
+            catch (IgniteCheckedException e) {
+                throw U.convertException(e);
+            }
             finally {
                 ctx.gate().leave();
             }
 
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            U.writeString(out, cacheName);
-            out.writeObject(topVer);
-            out.writeBoolean(skipStore);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            cacheName = U.readString(in);
-            topVer = (AffinityTopologyVersion)in.readObject();
-            skipStore = in.readBoolean();
+            return true;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
new file mode 100644
index 0000000..f5de96f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.*;
+
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Test remove all method.
+ */
+public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 60000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRemoveAll() throws Exception {
+        IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+        for (int i = 0; i < 10_000; ++i)
+            cache.put(i, "val");
+
+        final AtomicInteger igniteId = new AtomicInteger(gridCount());
+
+        IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                for (int i = 0; i < 2; ++i)
+                    startGrid(igniteId.getAndIncrement());
+
+                return true;
+            }
+        }, 3, "start-node-thread");
+
+        cache.removeAll();
+
+        fut.get();
+
+        U.sleep(5000);
+
+        for (int i = 0; i < igniteId.get(); ++i) {
+            IgniteCache locCache = grid(i).cache(null);
+
+            assertEquals("Local size: " + locCache.localSize() + "\n" +
+                "On heap: " + locCache.localSize(CachePeekMode.ONHEAP) + "\n" +
+                "Off heap: " + locCache.localSize(CachePeekMode.OFFHEAP) + "\n" +
+                "Swap: " + locCache.localSize(CachePeekMode.SWAP) + "\n" +
+                "Primary: " + locCache.localSize(CachePeekMode.PRIMARY) + "\n" +
+                "Backup: " + locCache.localSize(CachePeekMode.BACKUP),
+                0, locCache.localSize());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
new file mode 100644
index 0000000..d61ddcc
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.*;
+
+/**
+ * Test none rebalance mode.
+ */
+public class NoneRebalanceModeSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @SuppressWarnings({"ConstantConditions"})
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        CacheConfiguration cc = defaultCacheConfiguration();
+
+        cc.setRebalanceMode(NONE);
+
+        c.setCacheConfiguration(cc);
+
+        return c;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid(0);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRemoveAll() throws Exception {
+        GridNearTransactionalCache cache = (GridNearTransactionalCache)((IgniteKernal)grid(0)).internalCache(null);
+
+        for (GridDhtLocalPartition part : cache.dht().topology().localPartitions())
+            assertEquals(MOVING, part.state());
+
+        grid(0).cache(null).removeAll();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index dc3a2c0..5738778 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -58,6 +58,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
         suite.addTestSuite(GridCachePartitionedGetSelfTest.class);
         suite.addTest(new TestSuite(GridCachePartitionedBasicApiTest.class));
         suite.addTest(new TestSuite(GridCacheNearMultiGetSelfTest.class));
+        suite.addTest(new TestSuite(NoneRebalanceModeSelfTest.class));
         suite.addTest(new TestSuite(GridCacheNearJobExecutionSelfTest.class));
         suite.addTest(new TestSuite(GridCacheNearOneNodeSelfTest.class));
         suite.addTest(new TestSuite(GridCacheNearMultiNodeSelfTest.class));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/593e3eee/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 8eb0688..aaf7e5b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -126,6 +126,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
 
         suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class);
 
+        suite.addTestSuite(CacheRemoveAllSelfTest.class);
+
         suite.addTestSuite(CacheOffheapMapEntrySelfTest.class);
 
         return suite;


[02/47] incubator-ignite git commit: # ignite-10151 Change FlatSpec to FunSpec in scalatests.

Posted by ag...@apache.org.
# ignite-10151 Change FlatSpec to FunSpec in scalatests.


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

Branch: refs/heads/ignite-889
Commit: b41fbeef4c93cec98afddc436d146e7380590f62
Parents: 2f24ee3
Author: Andrey <an...@gridgain.com>
Authored: Thu Apr 30 16:46:43 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Apr 30 16:46:43 2015 +0700

----------------------------------------------------------------------
 .../scalar/tests/ScalarCacheQueriesSpec.scala   | 154 +++++++++----------
 .../ignite/scalar/tests/ScalarCacheSpec.scala   |  23 +--
 .../scalar/tests/ScalarConversionsSpec.scala    |  43 +++---
 .../scalar/tests/ScalarProjectionSpec.scala     | 128 ++++++++-------
 .../scalar/tests/ScalarReturnableSpec.scala     |  41 ++---
 modules/visor-console/pom.xml                   |   2 +-
 .../ignite/visor/VisorRuntimeBaseSpec.scala     |   2 +-
 .../visor/commands/VisorArgListSpec.scala       |  60 ++++----
 .../commands/VisorFileNameCompleterSpec.scala   |  34 ++--
 .../commands/ack/VisorAckCommandSpec.scala      |  20 +--
 .../commands/alert/VisorAlertCommandSpec.scala  |  68 ++++----
 .../cache/VisorCacheClearCommandSpec.scala      |  48 +++---
 .../commands/cache/VisorCacheCommandSpec.scala  |  66 ++++----
 .../config/VisorConfigurationCommandSpec.scala  |   8 +-
 .../cswap/VisorCacheSwapCommandSpec.scala       |  24 +--
 .../deploy/VisorDeployCommandSpec.scala         |  10 +-
 .../disco/VisorDiscoveryCommandSpec.scala       |  46 +++---
 .../events/VisorEventsCommandSpec.scala         |  28 ++--
 .../visor/commands/gc/VisorGcCommandSpec.scala  |  30 ++--
 .../commands/help/VisorHelpCommandSpec.scala    |  57 +++----
 .../commands/kill/VisorKillCommandSpec.scala    |  58 +++----
 .../commands/log/VisorLogCommandSpec.scala      |  10 +-
 .../commands/mem/VisorMemoryCommandSpec.scala   |  77 +++++-----
 .../commands/node/VisorNodeCommandSpec.scala    |  22 +--
 .../commands/open/VisorOpenCommandSpec.scala    |  16 +-
 .../commands/ping/VisorPingCommandSpec.scala    |  16 +-
 .../commands/start/VisorStartCommandSpec.scala  | 126 +++++++--------
 .../commands/tasks/VisorTasksCommandSpec.scala  | 112 +++++++-------
 .../commands/top/VisorTopologyCommandSpec.scala |  52 +++----
 .../commands/vvm/VisorVvmCommandSpec.scala      |  30 ++--
 30 files changed, 724 insertions(+), 687 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
index 8d91fdc..2a11e5e 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
@@ -31,7 +31,7 @@ import scala.collection.JavaConversions._
  * Tests for Scalar cache queries API.
  */
 @RunWith(classOf[JUnitRunner])
-class ScalarCacheQueriesSpec extends FlatSpec with ShouldMatchers with BeforeAndAfterAll {
+class ScalarCacheQueriesSpec extends FunSpec with ShouldMatchers with BeforeAndAfterAll {
     /** Entries count. */
     private val ENTRY_CNT = 10
 
@@ -67,142 +67,142 @@ class ScalarCacheQueriesSpec extends FlatSpec with ShouldMatchers with BeforeAnd
         stop()
     }
 
-    behavior of "Scalar cache queries API"
+    describe("Scalar cache queries API") {
+        it("should correctly execute SCAN queries") {
+            var res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
 
-    it should "correctly execute SCAN queries" in {
-        var res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
+            assert(res.size == 2)
 
-        assert(res.size == 2)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
+            res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
 
-        res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
+            assert(res.size == 2)
 
-        assert(res.size == 2)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
+            res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
 
-        res = c.scan(classOf[ObjectValue], (k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
+            assert(res.size == 2)
 
-        assert(res.size == 2)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
+            res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
 
-        res = c.scan((k: Int, v: ObjectValue) => k > 5 && v.intVal < 8).getAll
+            assert(res.size == 2)
 
-        assert(res.size == 2)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
+        }
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey < 8 && t.getKey == t.getValue.intVal))
-    }
+        it("should correctly execute SQL queries") {
+            var res = c.sql(classOf[ObjectValue], "intVal > 5").getAll
 
-    it should "correctly execute SQL queries" in {
-        var res = c.sql(classOf[ObjectValue], "intVal > 5").getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql(classOf[ObjectValue], "intVal > ?", 5).getAll
 
-        res = c.sql(classOf[ObjectValue], "intVal > ?", 5).getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql("intVal > 5").getAll
 
-        res = c.sql("intVal > 5").getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql("intVal > ?", 5).getAll
 
-        res = c.sql("intVal > ?", 5).getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql(classOf[ObjectValue], "intVal > 5").getAll
 
-        res = c.sql(classOf[ObjectValue], "intVal > 5").getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql(classOf[ObjectValue], "intVal > ?", 5).getAll
 
-        res = c.sql(classOf[ObjectValue], "intVal > ?", 5).getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql("intVal > 5").getAll
 
-        res = c.sql("intVal > 5").getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+            res = c.sql("intVal > ?", 5).getAll
 
-        res = c.sql("intVal > ?", 5).getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
+        }
 
-        res.foreach(t => assert(t.getKey > 5 && t.getKey == t.getValue.intVal))
-    }
+        it("should correctly execute TEXT queries") {
+            var res = c.text(classOf[ObjectValue], "str").getAll
 
-    it should "correctly execute TEXT queries" in {
-        var res = c.text(classOf[ObjectValue], "str").getAll
+            assert(res.size == ENTRY_CNT)
 
-        assert(res.size == ENTRY_CNT)
+            res = c.text(classOf[ObjectValue], "five").getAll
 
-        res = c.text(classOf[ObjectValue], "five").getAll
+            assert(res.size == 1)
+            assert(res.head.getKey == 5)
 
-        assert(res.size == 1)
-        assert(res.head.getKey == 5)
+            res = c.text("str").getAll
 
-        res = c.text("str").getAll
+            assert(res.size == ENTRY_CNT)
 
-        assert(res.size == ENTRY_CNT)
+            res = c.text("five").getAll
 
-        res = c.text("five").getAll
+            assert(res.size == 1)
+            assert(res.head.getKey == 5)
 
-        assert(res.size == 1)
-        assert(res.head.getKey == 5)
+            res = c.text(classOf[ObjectValue], "str").getAll
 
-        res = c.text(classOf[ObjectValue], "str").getAll
+            assert(res.size == ENTRY_CNT)
 
-        assert(res.size == ENTRY_CNT)
+            res = c.text(classOf[ObjectValue], "five").getAll
 
-        res = c.text(classOf[ObjectValue], "five").getAll
+            assert(res.size == 1)
+            assert(res.head.getKey == 5)
 
-        assert(res.size == 1)
-        assert(res.head.getKey == 5)
+            res = c.text("str").getAll
 
-        res = c.text("str").getAll
+            assert(res.size == ENTRY_CNT)
 
-        assert(res.size == ENTRY_CNT)
+            res = c.text("five").getAll
 
-        res = c.text("five").getAll
+            assert(res.size == 1)
+            assert(res.head.getKey == 5)
+        }
 
-        assert(res.size == 1)
-        assert(res.head.getKey == 5)
-    }
+        it("should correctly execute fields queries") {
+            var res = c.sqlFields("select intVal from ObjectValue where intVal > 5").getAll
 
-    it should "correctly execute fields queries" in {
-        var res = c.sqlFields("select intVal from ObjectValue where intVal > 5").getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
+            res.foreach(t => assert(t.size == 1 && t.head.asInstanceOf[Int] > 5))
 
-        res.foreach(t => assert(t.size == 1 && t.head.asInstanceOf[Int] > 5))
+            res = c.sqlFields("select intVal from ObjectValue where intVal > ?", 5).getAll
 
-        res = c.sqlFields("select intVal from ObjectValue where intVal > ?", 5).getAll
+            assert(res.size == ENTRY_CNT - 5)
 
-        assert(res.size == ENTRY_CNT - 5)
-
-        res.foreach(t => assert(t.size == 1 && t.head.asInstanceOf[Int] > 5))
-    }
+            res.foreach(t => assert(t.size == 1 && t.head.asInstanceOf[Int] > 5))
+        }
 
-    it should "correctly execute queries with multiple arguments" in {
-        val res = c.sql("from ObjectValue where intVal in (?, ?, ?)", 1, 2, 3).getAll
+        it("should correctly execute queries with multiple arguments") {
+            val res = c.sql("from ObjectValue where intVal in (?, ?, ?)", 1, 2, 3).getAll
 
-        assert(res.size == 3)
+            assert(res.size == 3)
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
index 0fde48f..853cc16 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheSpec.scala
@@ -22,32 +22,35 @@ import org.apache.ignite.events.EventType._
 import org.apache.ignite.lang.IgnitePredicate
 import org.apache.ignite.scalar.scalar
 import org.apache.ignite.scalar.scalar._
+
 import org.junit.runner.RunWith
 import org.scalatest._
 import org.scalatest.junit.JUnitRunner
+
 import scala.collection.JavaConversions._
 
 /**
  * Scalar cache test.
  */
 @RunWith(classOf[JUnitRunner])
-class ScalarCacheSpec extends FlatSpec with ShouldMatchers {
+class ScalarCacheSpec extends FunSpec with ShouldMatchers {
     private val CFG = "modules/scalar/src/test/resources/spring-cache.xml"
 
-    behavior of "Scalar cache"
+    describe("Scalar cache") {
 
-    it should "work properly via Java APIs" in {
-        scalar(CFG) {
-            registerListener()
+        it("should work properly via Java APIs") {
+            scalar(CFG) {
+                registerListener()
 
-            val c = cache$[Int, Int]("partitioned").get
+                val c = cache$[Int, Int]("partitioned").get
 
-            c.put(1, 1)
-            c.put(2, 2)
+                c.put(1, 1)
+                c.put(2, 2)
 
-            c.iterator() foreach println
+                c.iterator() foreach println
 
-            println("Size is: " + c.size())
+                println("Size is: " + c.size())
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarConversionsSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarConversionsSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarConversionsSpec.scala
index b20c755..c766422 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarConversionsSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarConversionsSpec.scala
@@ -21,7 +21,7 @@ import org.apache.ignite.internal.util.lang._
 import org.apache.ignite.lang._
 import org.apache.ignite.scalar.scalar._
 import org.junit.runner.RunWith
-import org.scalatest.FlatSpec
+import org.scalatest._
 import org.scalatest.junit.JUnitRunner
 import org.scalatest.matchers.ShouldMatchers
 
@@ -31,10 +31,10 @@ import java.util.concurrent.atomic._
  *
  */
 @RunWith(classOf[JUnitRunner])
-class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
-    behavior of "Scalar mixin"
+class ScalarConversionsSpec extends FunSpec with ShouldMatchers {
+    describe("Scalar mixin") {
 
-    it should "convert reducer" in {
+    it("should convert reducer") {
         val r = new IgniteReducer[Int, Int] {
             var sum = 0
 
@@ -52,7 +52,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(r.scala.apply(Seq(1, 2, 3)) == 6)
     }
 
-    it should "convert reducer 2" in {
+    it("should convert reducer 2") {
         val r = new IgniteReducer2[Int, Int, Int] {
             var sum = 0
 
@@ -70,7 +70,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(r.scala.apply(Seq(1, 2), Seq(3, 4)) == 21)
     }
 
-    it should "convert reducer 3" in {
+    it("should convert reducer 3") {
         val r = new IgniteReducer3[Int, Int, Int, Int] {
             var sum = 0
 
@@ -88,14 +88,14 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(r.scala.apply(Seq(1, 2), Seq(1, 2), Seq(1, 2)) == 27)
     }
 
-    it should "convert tuple 2" in {
+    it("should convert tuple 2") {
         val t = new IgniteBiTuple[Int, Int](1, 2)
 
         assert(t.scala._1 == 1)
         assert(t.scala._2 == 2)
     }
 
-    it should "convert tuple 3" in {
+    it("should convert tuple 3") {
         val t = new GridTuple3[Int, Int, Int](1, 2, 3)
 
         assert(t.scala._1 == 1)
@@ -103,7 +103,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(t.scala._3 == 3)
     }
 
-    it should "convert tuple 4" in {
+    it("should convert tuple 4") {
         val t = new GridTuple4[Int, Int, Int, Int](1, 2, 3, 4)
 
         assert(t.scala._1 == 1)
@@ -112,7 +112,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(t.scala._4 == 4)
     }
 
-    it should "convert tuple 5" in {
+    it("should convert tuple 5") {
         val t = new GridTuple5[Int, Int, Int, Int, Int](1, 2, 3, 4, 5)
 
         assert(t.scala._1 == 1)
@@ -122,7 +122,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(t.scala._5 == 5)
     }
 
-    it should "convert in closure" in {
+    it("should convert in closure") {
         val i = new AtomicInteger()
 
         val f = new IgniteInClosure[Int] {
@@ -136,7 +136,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(i.get == 9)
     }
 
-    it should "convert in closure 2" in {
+    it("should convert in closure 2") {
         val i = new AtomicInteger()
 
         val f = new IgniteBiInClosure[Int, Int] {
@@ -150,7 +150,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(i.get == 6)
     }
 
-    it should "convert in closure 3" in {
+    it("should convert in closure 3") {
         val i = new AtomicInteger()
 
         val f = new GridInClosure3[Int, Int, Int] {
@@ -164,7 +164,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(i.get == 9)
     }
 
-    it should "convert absolute closure" in {
+    it("should convert absolute closure") {
         val i = new AtomicInteger()
 
         val f = new GridAbsClosure {
@@ -178,7 +178,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(i.get == 3)
     }
 
-    it should "convert absolute predicate" in {
+    it("should convert absolute predicate") {
         val i = new AtomicInteger()
 
         val p = new GridAbsPredicate {
@@ -195,7 +195,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(p.scala.apply())
     }
 
-    it should "convert predicate" in {
+    it("should convert predicate") {
         val p = new IgnitePredicate[Int] {
             override def apply(e: Int): Boolean =
                 e > 5
@@ -205,7 +205,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(p.scala.apply(6))
     }
 
-    it should "convert predicate 2" in {
+    it("should convert predicate 2") {
         val p = new IgniteBiPredicate[Int, Int] {
             override def apply(e1: Int, e2: Int): Boolean =
                 e1 + e2 > 5
@@ -215,7 +215,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(p.scala.apply(3, 3))
     }
 
-    it should "convert predicate 3" in {
+    it("should convert predicate 3") {
         val p = new GridPredicate3[Int, Int, Int] {
             override def apply(e1: Int, e2: Int, e3: Int): Boolean =
                 e1 + e2 + e3 > 5
@@ -225,7 +225,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(p.scala.apply(2, 2, 2))
     }
 
-    it should "convert closure" in {
+    it("should convert closure") {
         val f = new IgniteClosure[Int, Int] {
             override def apply(e: Int): Int =
                 e * 3
@@ -234,7 +234,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(f.scala.apply(3) == 9)
     }
 
-    it should "convert closure 2" in {
+    it("should convert closure 2") {
         val f = new IgniteBiClosure[Int, Int, Int] {
             override def apply(e1: Int, e2: Int): Int =
                 e1 + e2
@@ -243,7 +243,7 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
         assert(f.scala.apply(3, 3) == 6)
     }
 
-    it should "convert closure 3" in {
+    it("should convert closure 3") {
         val f = new GridClosure3[Int, Int, Int, Int] {
             override def apply(e1: Int, e2: Int, e3: Int): Int =
                 e1 + e2 + e3
@@ -251,4 +251,5 @@ class ScalarConversionsSpec extends FlatSpec with ShouldMatchers {
 
         assert(f.scala.apply(3, 3, 3) == 9)
     }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarProjectionSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarProjectionSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarProjectionSpec.scala
index a035550..ecb1e5a 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarProjectionSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarProjectionSpec.scala
@@ -23,6 +23,7 @@ import org.apache.ignite.configuration.IgniteConfiguration
 import org.apache.ignite.messaging.MessagingListenActor
 import org.apache.ignite.scalar.scalar
 import org.apache.ignite.scalar.scalar._
+
 import org.junit.runner.RunWith
 import org.scalatest._
 import org.scalatest.junit.JUnitRunner
@@ -35,7 +36,7 @@ import scala.collection.JavaConversions._
  * Scalar cache test.
  */
 @RunWith(classOf[JUnitRunner])
-class ScalarProjectionSpec extends FlatSpec with ShouldMatchers with BeforeAndAfterAll {
+class ScalarProjectionSpec extends FunSpec with ShouldMatchers with BeforeAndAfterAll {
     /**
      *
      */
@@ -68,82 +69,95 @@ class ScalarProjectionSpec extends FlatSpec with ShouldMatchers with BeforeAndAf
         cfg
     }
 
-    behavior of "ScalarProjectionPimp class"
-
-    it should "return all nodes" in scalar(gridConfig("node-scalar", true)) {
-        assertResult(3) {
-            ignite$("node-scalar").get.cluster().nodes().size
+    describe("ScalarProjectionPimp class") {
+        it("should return all nodes") {
+            scalar(gridConfig("node-scalar", true)) {
+                assertResult(3)(ignite$("node-scalar").get.cluster().nodes().size)
+            }
         }
-    }
-
-    it should "return shown nodes" in  scalar(gridConfig("node-scalar", true)) {
-        assert(ignite$("node-scalar").get.nodes$((node: ClusterNode) => node.attribute[Boolean]("shown")).size == 2)
-    }
 
-    it should "return all remote nodes" in scalar(gridConfig("node-scalar", true)) {
-        assertResult(2) {
-            ignite$("node-scalar").get.remoteNodes$().size
+        it("should return shown nodes") {
+            scalar(gridConfig("node-scalar", true)) {
+                assert(ignite$("node-scalar").get.nodes$(
+                    (node: ClusterNode) => node.attribute[Boolean]("shown")).size == 2)
+            }
         }
-    }
-
-    it should "return shown remote nodes" in  scalar(gridConfig("node-scalar", true)) {
-        assert(ignite$("node-scalar").get.remoteNodes$((node: ClusterNode) =>
-            node.attribute[Boolean]("shown")).size == 1)
-    }
-
-    it should "correctly send messages" in scalar(gridConfig("node-scalar", true)) {
 
-        ignite$("node-1").get.message().remoteListen(null, new MessagingListenActor[Any]() {
-            def receive(nodeId: UUID, msg: Any) {
-                println("node-1 received " + msg)
+        it("should return all remote nodes") {
+            scalar(gridConfig("node-scalar", true)) {
+                assertResult(2)(ignite$("node-scalar").get.remoteNodes$().size)
             }
-        })
+        }
 
-        ignite$("node-2").get.message().remoteListen(null, new MessagingListenActor[Any]() {
-            def receive(nodeId: UUID, msg: Any) {
-                println("node-2 received " + msg)
+        it("should return shown remote nodes") {
+            scalar(gridConfig("node-scalar", true)) {
+                assert(ignite$("node-scalar").get.remoteNodes$((node: ClusterNode) =>
+                    node.attribute[Boolean]("shown")).size == 1)
             }
-        })
+        }
 
-        ignite$("node-scalar").get !< ("Message", null)
-        ignite$("node-scalar").get !< (Seq("Message1", "Message2"), null)
-    }
+        it("should correctly send messages") {
+            scalar(gridConfig("node-scalar", true)) {
+                ignite$("node-1").get.message().remoteListen(null, new MessagingListenActor[Any]() {
+                    def receive(nodeId: UUID, msg: Any) {
+                        println("node-1 received " + msg)
+                    }
+                })
+
+                ignite$("node-2").get.message().remoteListen(null, new MessagingListenActor[Any]() {
+                    def receive(nodeId: UUID, msg: Any) {
+                        println("node-2 received " + msg)
+                    }
+                })
+
+                ignite$("node-scalar").get !<("Message", null)
+                ignite$("node-scalar").get !<(Seq("Message1", "Message2"), null)
+            }
+        }
 
-    it should "correctly make calls" in scalar(gridConfig("node-scalar", true)) {
-        println("CALL RESULT: " + ignite$("node-scalar").get #< (() => "Message", null))
+        it("should correctly make calls") {
+            scalar(gridConfig("node-scalar", true)) {
+                println("CALL RESULT: " + ignite$("node-scalar").get #<(() => "Message", null))
 
-        println("ASYNC CALL RESULT: " + ignite$("node-scalar").get.callAsync$[String](() => "Message", null).get)
+                println("ASYNC CALL RESULT: " + ignite$("node-scalar").get.callAsync$[String](() => "Message", null).get)
 
-        val call1: () => String = () => "Message1"
-        val call2: () => String = () => "Message2"
+                val call1: () => String = () => "Message1"
+                val call2: () => String = () => "Message2"
 
-        println("MULTIPLE CALL RESULT: " + ignite$("node-scalar").get #< (Seq(call1, call2), null))
+                println("MULTIPLE CALL RESULT: " + ignite$("node-scalar").get #<(Seq(call1, call2), null))
 
-        println("MULTIPLE ASYNC CALL RESULT: " +
-            (ignite$("node-scalar").get #? (Seq(call1, call2), null)).get)
-    }
+                println("MULTIPLE ASYNC CALL RESULT: " +
+                    (ignite$("node-scalar").get #?(Seq(call1, call2), null)).get)
+            }
+        }
 
-    it should "correctly make runs" in scalar(gridConfig("node-scalar", true)) {
-        ignite$("node-scalar").get *< (() => println("RUN RESULT: Message"), null)
+        it("should correctly make runs") {
+            scalar(gridConfig("node-scalar", true)) {
+                ignite$("node-scalar").get *<(() => println("RUN RESULT: Message"), null)
 
-        (ignite$("node-scalar").get *? (() => println("ASYNC RUN RESULT: Message"), null)).get
+                (ignite$("node-scalar").get *?(() => println("ASYNC RUN RESULT: Message"), null)).get
 
-        val run1: () => Unit = () => println("RUN 1 RESULT: Message1")
-        val run2: () => Unit = () => println("RUN 2 RESULT: Message2")
+                val run1: () => Unit = () => println("RUN 1 RESULT: Message1")
+                val run2: () => Unit = () => println("RUN 2 RESULT: Message2")
 
-        ignite$("node-scalar").get *< (Seq(run1, run2), null)
+                ignite$("node-scalar").get *<(Seq(run1, run2), null)
 
-        val runAsync1: () => Unit = () => println("ASYNC RUN 1 RESULT: Message1")
-        val runAsync2: () => Unit = () => println("ASYNC RUN 2 RESULT: Message2")
+                val runAsync1: () => Unit = () => println("ASYNC RUN 1 RESULT: Message1")
+                val runAsync2: () => Unit = () => println("ASYNC RUN 2 RESULT: Message2")
 
-        (ignite$("node-scalar").get *? (Seq(runAsync1, runAsync2), null)).get
-    }
+                (ignite$("node-scalar").get *?(Seq(runAsync1, runAsync2), null)).get
+            }
+        }
 
-    it should "correctly reduce" in scalar(gridConfig("node-scalar", true)) {
-        val call1: () => Int = () => 15
-        val call2: () => Int = () => 82
+        it("should correctly reduce") {
+            scalar(gridConfig("node-scalar", true)) {
+                val call1: () => Int = () => 15
+                val call2: () => Int = () => 82
 
-        assert(ignite$("node-scalar").get @< (Seq(call1, call2), (n: Seq[Int]) => n.sum, null) == 97)
-        assert(ignite$("node-scalar").get.reduceAsync$(Seq(call1, call2), (n: Seq[Int]) => n.sum, null).get == 97)
+                assert(ignite$("node-scalar").get @<(Seq(call1, call2), (n: Seq[Int]) => n.sum, null) == 97)
+                assert(ignite$("node-scalar").get.reduceAsync$(Seq(call1, call2), (
+                    n: Seq[Int]) => n.sum, null).get == 97)
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarReturnableSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarReturnableSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarReturnableSpec.scala
index 21e8cef..2927dd7 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarReturnableSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarReturnableSpec.scala
@@ -18,6 +18,7 @@
 package org.apache.ignite.scalar.tests
 
 import org.apache.ignite.scalar.scalar._
+
 import org.junit.runner.RunWith
 import org.scalatest._
 import org.scalatest.junit.JUnitRunner
@@ -28,30 +29,32 @@ import scala.util.control.Breaks._
  *
  */
 @RunWith(classOf[JUnitRunner])
-class ScalarReturnableSpec extends FlatSpec with ShouldMatchers {
-    "Scalar '^^'" should "work" in {
-        var i = 0
+class ScalarReturnableSpec extends FunSpec with ShouldMatchers {
+    describe("Scalar '^^'") {
+        it("should work") {
+            var i = 0
+
+            breakable {
+                while (true) {
+                    if (i == 0)
+                        println("Only once!") ^^
+
+                    i += 1
+                }
+            }
 
-        breakable {
-            while (true) {
-                if (i == 0)
-                    println("Only once!") ^^
+            assert(i == 0)
+        }
 
-                i += 1
+        // Ignore exception below.
+        def test() = breakable {
+            while (true) {
+                println("Only once!") ^^
             }
         }
 
-        assert(i == 0)
-    }
-
-    "Scalar '^^'" should "also work" in {
-        test()
-    }
-
-    // Ignore exception below.
-    def test() = breakable {
-        while (true) {
-            println("Only once!") ^^
+        it("should also work") {
+            test()
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index 7abd896..4ef04fb 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -100,7 +100,7 @@
         <dependency>
             <groupId>org.scalatest</groupId>
             <artifactId>scalatest_2.11</artifactId>
-            <version>2.2.2</version>
+            <version>2.2.4</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala
index aa6ab84..f27bae3 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/VisorRuntimeBaseSpec.scala
@@ -24,7 +24,7 @@ import org.scalatest._
 /**
  * Base abstract class for unit tests requiring Visor runtime.
  */
-abstract class VisorRuntimeBaseSpec(private[this] val num: Int) extends FlatSpec with Matchers
+abstract class VisorRuntimeBaseSpec(private[this] val num: Int) extends FunSpec with Matchers
     with BeforeAndAfterAll with BeforeAndAfterEach {
     assert(num >= 1)
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala
index 8b71918..a581899 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorArgListSpec.scala
@@ -25,48 +25,48 @@ import visor._
 /**
  * Test for visor's argument list parsing.
  */
-class VisorArgListSpec extends FlatSpec with ShouldMatchers {
-    behavior of "A visor argument list"
+class VisorArgListSpec extends FunSpec with ShouldMatchers {
+    describe("A visor argument list") {
+        it("should properly parse 'null' arguments") {
+            val v = parseArgs(null)
 
-    it should "properly parse 'null' arguments" in {
-        val v = parseArgs(null)
+            assert(v.isEmpty)
+        }
 
-        assert(v.isEmpty)
-    }
-
-    it should "properly parse non-empty arguments" in {
-        val v = parseArgs("-a=b c d -minus -d=")
+        it("should properly parse non-empty arguments") {
+            val v = parseArgs("-a=b c d -minus -d=")
 
-        assert(v.size == 5)
+            assert(v.size == 5)
 
-        assert(v(0)._1 == "a")
-        assert(v(0)._2 == "b")
+            assert(v(0)._1 == "a")
+            assert(v(0)._2 == "b")
 
-        assert(v(1)._1 == null)
-        assert(v(1)._2 == "c")
+            assert(v(1)._1 == null)
+            assert(v(1)._2 == "c")
 
-        assert(v(2)._1 == null)
-        assert(v(2)._2 == "d")
+            assert(v(2)._1 == null)
+            assert(v(2)._2 == "d")
 
-        assert(v(3)._1 == "minus")
-        assert(v(3)._2 == null)
+            assert(v(3)._1 == "minus")
+            assert(v(3)._2 == null)
 
-        assert(v(4)._1 == "d")
-        assert(v(4)._2 == "")
-    }
+            assert(v(4)._1 == "d")
+            assert(v(4)._2 == "")
+        }
 
-    it should "properly parse quoted arguments" in {
-        val v = parseArgs("-a='b 'c' d' -minus -d=")
+        it("should properly parse quoted arguments") {
+            val v = parseArgs("-a='b 'c' d' -minus -d=")
 
-        assert(v.size == 3)
+            assert(v.size == 3)
 
-        assert(v(0)._1 == "a")
-        assert(v(0)._2 == "b 'c' d")
+            assert(v(0)._1 == "a")
+            assert(v(0)._2 == "b 'c' d")
 
-        assert(v(1)._1 == "minus")
-        assert(v(1)._2 == null)
+            assert(v(1)._1 == "minus")
+            assert(v(1)._2 == null)
 
-        assert(v(2)._1 == "d")
-        assert(v(2)._2 == "")
+            assert(v(2)._1 == "d")
+            assert(v(2)._2 == "")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala
index 9767fc4..e7333c6 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/VisorFileNameCompleterSpec.scala
@@ -25,34 +25,34 @@ import java.util
 /**
  * Test for visor's file name completer.
  */
-class VisorFileNameCompleterSpec extends FlatSpec with ShouldMatchers {
-    behavior of "A visor file name completer"
+class VisorFileNameCompleterSpec extends FunSpec with ShouldMatchers {
+    describe("A visor file name completer") {
+        it("should properly parse empty path") {
+            val c = new VisorFileNameCompleter()
 
-    it should "properly parse empty path" in {
-        val c = new VisorFileNameCompleter()
+            val res = new util.ArrayList[CharSequence]()
 
-        val res = new util.ArrayList[CharSequence]()
+            c.complete("", 0, res)
 
-        c.complete("", 0, res)
+            assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
 
-        assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
+            res.clear()
 
-        res.clear()
+            c.complete(null, 0, res)
 
-        c.complete(null, 0, res)
+            assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
 
-        assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
+            res.clear()
 
-        res.clear()
+            c.complete("    ", 2, res)
 
-        c.complete("    ", 2, res)
+            assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
 
-        assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
+            res.clear()
 
-        res.clear()
+            c.complete("help ", 5, res)
 
-        c.complete("help ", 5, res)
-
-        assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
+            assertResult(new File("").getAbsoluteFile.listFiles().length)(res.size)
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala
index 6c6c829..b6a9608 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ack/VisorAckCommandSpec.scala
@@ -24,17 +24,17 @@ import org.apache.ignite.visor.commands.ack.VisorAckCommand._
  * Unit test for 'ack' command.
  */
 class VisorAckCommandSpec extends VisorRuntimeBaseSpec(2) {
-    behavior of "A 'ack' visor command"
+    describe("A 'ack' visor command") {
+        it("should properly execute w/o arguments"){
+            visor ack()
+        }
 
-    it should "properly execute w/o arguments" in {
-        visor ack()
-    }
-
-    it should "properly execute with arguments" in {
-        visor ack "Broadcasting!"
-    }
+        it("should properly execute with arguments") {
+            visor ack "Broadcasting!"
+        }
 
-    it should "print error message when not connected" in {
-        visor ack()
+        it("should print error message when not connected") {
+            visor ack()
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala
index 0a3a011..ec7d1b5 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommandSpec.scala
@@ -100,54 +100,54 @@ class VisorAlertCommandSpec extends VisorRuntimeBaseSpec(1) {
         }
     }
 
-    behavior of "An 'alert' visor command"
+    describe("An 'alert' visor command") {
+        it("should print not connected error message") {
+            visor.close()
 
-    it should "print not connected error message" in {
-        visor.close()
+            checkOut(visor.alert("-r -t=5 -cc=gte4"), "Visor is disconnected.")
 
-        checkOut(visor.alert("-r -t=5 -cc=gte4"), "Visor is disconnected.")
-
-        checkOut(visor.alert(), "No alerts are registered.")
-    }
-
-    it should "register new alert" in {
-        try {
             checkOut(visor.alert(), "No alerts are registered.")
+        }
 
-            matchOut(visor.alert("-r -t=5 -cc=gte4"), "Alert.+registered.")
+        it("should register new alert") {
+            try {
+                checkOut(visor.alert(), "No alerts are registered.")
 
-            checkOut(visor.alert(), "No alerts are registered.", false)
-        }
-        finally {
-            visor.alert("-u -a")
+                matchOut(visor.alert("-r -t=5 -cc=gte4"), "Alert.+registered.")
+
+                checkOut(visor.alert(), "No alerts are registered.", false)
+            }
+            finally {
+                visor.alert("-u -a")
+            }
         }
-    }
 
-    it should "print error messages on incorrect alerts" in {
-        try {
-            matchOut(visor.alert("-r -t=5"), "Alert.+registered.")
+        it("should print error messages on incorrect alerts") {
+            try {
+                matchOut(visor.alert("-r -t=5"), "Alert.+registered.")
 
-            checkOut(visor.alert("-r -UNKNOWN_KEY=lt20"), "Invalid argument")
+                checkOut(visor.alert("-r -UNKNOWN_KEY=lt20"), "Invalid argument")
 
-            checkOut(visor.alert("-r -cc=UNKNOWN_OPERATION20"), "Invalid expression")
-        }
-        finally {
-            visor.alert("-u -a")
+                checkOut(visor.alert("-r -cc=UNKNOWN_OPERATION20"), "Invalid expression")
+            }
+            finally {
+                visor.alert("-u -a")
+            }
         }
-    }
 
-    it should "write alert to log" in {
-        try {
-            matchOut(visor.alert("-r -nc=gte1"), "Alert.+registered.")
+        it("should write alert to log") {
+            try {
+                matchOut(visor.alert("-r -nc=gte1"), "Alert.+registered.")
 
-            Ignition.start(config("node-2"))
+                Ignition.start(config("node-2"))
 
-            Ignition.stop("node-2", false)
+                Ignition.stop("node-2", false)
 
-            checkOut(visor.alert(), "No alerts are registered.", false)
-        }
-        finally {
-            visor.alert("-u -a")
+                checkOut(visor.alert(), "No alerts are registered.", false)
+            }
+            finally {
+                visor.alert("-u -a")
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
index 2e51698..6bb4993 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
@@ -75,43 +75,43 @@ class VisorCacheClearCommandSpec extends VisorRuntimeBaseSpec(2) {
         cfg
     }
 
-    behavior of "An 'cclear' visor command"
+    describe("An 'cclear' visor command") {
+        it("should show correct result for default cache") {
+            Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
 
-    it should "show correct result for default cache" in {
-        Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
+            val lock = Ignition.ignite("node-1").cache[Int, Int](null).lock(1)
 
-        val lock = Ignition.ignite("node-1").cache[Int, Int](null).lock(1)
+            lock.lock()
 
-        lock.lock()
+            VisorCacheClearCommand().clear(Nil, None)
 
-        VisorCacheClearCommand().clear(Nil, None)
+            lock.unlock()
 
-        lock.unlock()
+            VisorCacheClearCommand().clear(Nil, None)
+        }
 
-        VisorCacheClearCommand().clear(Nil, None)
-    }
-
-    it should "show correct result for named cache" in {
-        Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
+        it("should show correct result for named cache") {
+            Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
 
-        val lock = Ignition.ignite("node-1").cache[Int, Int]("cache").lock(1)
+            val lock = Ignition.ignite("node-1").cache[Int, Int]("cache").lock(1)
 
-        lock.lock()
+            lock.lock()
 
-        visor.cache("-clear -c=cache")
+            visor.cache("-clear -c=cache")
 
-        lock.unlock()
+            lock.unlock()
 
-        visor.cache("-clear -c=cache")
-    }
+            visor.cache("-clear -c=cache")
+        }
 
-    it should "show correct help" in {
-        VisorCacheCommand
+        it("should show correct help") {
+            VisorCacheCommand
 
-        visor.help("cache")
-    }
+            visor.help("cache")
+        }
 
-    it should "show empty projection error message" in {
-        visor.cache("-clear -c=wrong")
+        it("should show empty projection error message") {
+            visor.cache("-clear -c=wrong")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
index 4724006..4859a8f 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
@@ -36,7 +36,6 @@ import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
  * Unit test for 'events' command.
  */
 class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
-    behavior of "A 'cache' visor command"
 
     /** IP finder. */
     val ipFinder = new TcpDiscoveryVmIpFinder(true)
@@ -54,7 +53,7 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
 
         val arr = Seq(classOf[JavaInt], classOf[Foo]).toArray
 
-        cfg.setIndexedTypes(arr:_*)
+        cfg.setIndexedTypes(arr: _*)
 
         cfg
     }
@@ -65,7 +64,8 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
      * @param name Grid name.
      * @return Grid configuration.
      */
-    override def config(name: String): IgniteConfiguration = {
+    override def config(name: String): IgniteConfiguration =
+    {
         val cfg = new IgniteConfiguration
 
         cfg.setGridName(name)
@@ -81,49 +81,51 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
         cfg
     }
 
-    it should "put/get some values to/from cache and display information about caches" in {
-        val c = Ignition.ignite("node-1").cache[String, String]("replicated")
+    describe("A 'cache' visor command") {
+        it("should put/get some values to/from cache and display information about caches") {
+            val c = Ignition.ignite("node-1").cache[String, String]("replicated")
 
-        for (i <- 0 to 3) {
-            val kv = "" + i
+            for (i <- 0 to 3) {
+                val kv = "" + i
 
-            c.put(kv, kv)
+                c.put(kv, kv)
 
-            c.get(kv)
-        }
+                c.get(kv)
+            }
 
-        visor.cache()
-    }
+            visor.cache()
+        }
 
-    it should "run query and display information about caches" in {
-        val g = Ignition.ignite("node-1")
+        it("should run query and display information about caches") {
+            val g = Ignition.ignite("node-1")
 
-        val c = g.cache[JavaInt, Foo]("replicated")
+            val c = g.cache[JavaInt, Foo]("replicated")
 
-        c.put(0, Foo(20))
-        c.put(1, Foo(100))
-        c.put(2, Foo(101))
-        c.put(3, Foo(150))
+            c.put(0, Foo(20))
+            c.put(1, Foo(100))
+            c.put(2, Foo(101))
+            c.put(3, Foo(150))
 
-        // Create and execute query that mast return 2 rows.
-        val q1 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(JavaInt.valueOf(1))).getAll()
+            // Create and execute query that mast return 2 rows.
+            val q1 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(JavaInt.valueOf(1))).getAll
 
-        assert(q1.size() == 2)
+            assert(q1.size() == 2)
 
-        // Create and execute query that mast return 0 rows.
-        val q2 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(JavaInt.valueOf(100))).getAll()
+            // Create and execute query that mast return 0 rows.
+            val q2 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(JavaInt.valueOf(100))).getAll
 
-        assert(q2.size() == 0)
+            assert(q2.size() == 0)
 
-        visor cache "-a"
-    }
+            visor cache "-a"
+        }
 
-    it should "display correct information for 'replicated' cache only" in {
-        visor cache "-n=replicated -a"
-    }
+        it("should display correct information for 'replicated' cache only") {
+            visor cache "-n=replicated -a"
+        }
 
-    it should "display correct information for all caches" in {
-        visor cache "-a"
+        it("should display correct information for all caches") {
+            visor cache "-a"
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala
index 6b1b62d..72642f7 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommandSpec.scala
@@ -42,9 +42,9 @@ class VisorConfigurationCommandSpec extends VisorRuntimeBaseSpec(1) {
         cfg
     }
 
-    behavior of "A 'config' visor command"
-
-    it should "print configuration for first node" in {
-        visor.config("-id8=@n0")
+    describe("A 'config' visor command") {
+        it("should print configuration for first node") {
+            visor.config("-id8=@n0")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
index f5af1d3..8a0b0c8 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cswap/VisorCacheSwapCommandSpec.scala
@@ -69,21 +69,21 @@ class VisorCacheSwapCommandSpec extends VisorRuntimeBaseSpec(2) {
         cfg
     }
 
-    behavior of "An 'cswap' visor command"
+    describe("An 'cswap' visor command") {
+        it("should show correct result for default cache") {
+            Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
 
-    it should "show correct result for default cache" in {
-        Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
+            visor.cache("-swap -c=<default>")
+        }
 
-        visor.cache("-swap -c=<default>")
-    }
-
-    it should "show correct result for named cache" in {
-        Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
+        it("should show correct result for named cache") {
+            Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
 
-        visor.cache("-swap -c=cache")
-    }
+            visor.cache("-swap -c=cache")
+        }
 
-    it should "show empty projection error message" in {
-        visor.cache("-swap -c=wrong")
+        it("should show empty projection error message") {
+            visor.cache("-swap -c=wrong")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala
index 6003119..b80ff1d 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommandSpec.scala
@@ -25,10 +25,10 @@ import org.apache.ignite.visor.commands.deploy.VisorDeployCommand._
 /**
  * Unit test for 'deploy' command.
  */
-class VisorDeployCommandSpec extends FlatSpec with Matchers {
-    behavior of "A 'deploy' visor command"
-
-    it should "copy folder" in {
-        visor.deploy("-h=uname:passwd@localhost -s=/home/uname/test -d=dir")
+class VisorDeployCommandSpec extends FunSpec with Matchers {
+    describe("A 'deploy' visor command") {
+        it("should copy folder") {
+            visor.deploy("-h=uname:passwd@localhost -s=/home/uname/test -d=dir")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala
index 64f0e0f..335a048 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommandSpec.scala
@@ -51,35 +51,35 @@ class VisorDiscoveryCommandSpec extends VisorRuntimeBaseSpec(4) {
         cfg
     }
 
-    behavior of  "A 'disco' visor command"
+    describe("A 'disco' visor command") {
+        it("should advise to connect") {
+            closeVisorQuiet()
 
-    it should "advise to connect" in  {
-        closeVisorQuiet()
+            visor.disco()
+        }
 
-        visor.disco()
-    }
+        it("should show all discovery events") {
+            visor.disco()
+        }
 
-    it should "show all discovery events" in  {
-        visor.disco()
-    }
+        it("should show all discovery events in reversed order") {
+            visor.disco("-r")
+        }
 
-    it should "show all discovery events in reversed order" in  {
-        visor.disco("-r")
-    }
+        it("should show discovery events from last two minutes") {
+            visor.disco("-t=2m")
+        }
 
-    it should "show discovery events from last two minutes" in {
-        visor.disco("-t=2m")
-    }
+        it("should show discovery events from last two minutes in reversed order ") {
+            visor.disco("-t=2m -r")
+        }
 
-    it should "show discovery events from last two minutes in reversed order " in {
-        visor.disco("-t=2m -r")
-    }
-
-    it should "show top 3 discovery events" in  {
-        visor.disco("-c=3")
-    }
+        it("should show top 3 discovery events") {
+            visor.disco("-c=3")
+        }
 
-    it should "print error message with invalid count" in {
-        visor.disco("-c=x")
+        it("should print error message with invalid count") {
+            visor.disco("-c=x")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala
index 365032e..5b18590 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/events/VisorEventsCommandSpec.scala
@@ -40,23 +40,23 @@ class VisorEventsCommandSpec extends VisorRuntimeBaseSpec(1) {
         cfg
     }
 
-    behavior of "A 'events' visor command"
+    describe("A 'events' visor command") {
+        it("should print error message when not connected") {
+            closeVisorQuiet()
 
-    it should "print error message when not connected" in {
-        closeVisorQuiet()
+            visor.events()
+        }
 
-        visor.events()
-    }
-
-    it should "display all events from remote node" in {
-        visor.events("-id8=@n0")
-    }
+        it("should display all events from remote node") {
+            visor.events("-id8=@n0")
+        }
 
-    it should "display top 3 events from remote node" in {
-        visor.events("-id8=@n0 -c=3")
-    }
+        it("should display top 3 events from remote node") {
+            visor.events("-id8=@n0 -c=3")
+        }
 
-    it should "print error message with invalid count" in {
-        visor.events("-id8=@n0 -c=x")
+        it("should print error message with invalid count") {
+            visor.events("-id8=@n0 -c=x")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
index 678aaf4..b467687 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
@@ -25,15 +25,14 @@ import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
  * Unit test for 'gc' command.
  */
 class VisorGcCommandSpec extends VisorRuntimeBaseSpec(1) {
-    behavior of "A 'gc' visor command"
-
     /**
      * Creates grid configuration for provided grid host.
      *
      * @param name Grid name.
      * @return Grid configuration.
      */
-    override def config(name: String): IgniteConfiguration = {
+    override def config(name: String): IgniteConfiguration =
+    {
         val cfg = new IgniteConfiguration
 
         cfg.setGridName(name)
@@ -41,19 +40,22 @@ class VisorGcCommandSpec extends VisorRuntimeBaseSpec(1) {
         cfg
     }
 
-    it should "run GC on all nodes" in {
-        visor.gc()
-    }
+    describe("'gc' visor command") {
+        it("should run GC on all nodes") {
+            visor.gc()
+        }
 
-    it should "run GC on first node" in {
-        visor.gc("-id8=@n0")
-    }
+        it("should run GC on first node") {
+            visor.gc("-id8=@n0")
+        }
 
-    it should "run GC and DGC on all nodes" in {
-        visor.gc("-c")
-    }
+        it("should run GC and DGC on all nodes") {
+            visor.gc("-c")
+        }
+
+        it("should run GC and DGC on first node") {
+            visor.gc("-id8=@n0 -c")
+        }
 
-    it should "run GC and DGC on first node" in {
-        visor.gc("-id8=@n0 -c")
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala
index b97cb85..43c6f52 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/help/VisorHelpCommandSpec.scala
@@ -23,7 +23,7 @@ import org.scalatest._
 /**
  * Unit test for 'help' command.
  */
-class VisorHelpCommandSpec extends FlatSpec with Matchers {
+class VisorHelpCommandSpec extends FunSpec with Matchers {
     // Pre-initialize command so that help can be registered.
     commands.ack.VisorAckCommand
     commands.ping.VisorPingCommand
@@ -40,29 +40,34 @@ class VisorHelpCommandSpec extends FlatSpec with Matchers {
     commands.deploy.VisorDeployCommand
     commands.start.VisorStartCommand
 
-    "General help" should "properly execute via alias" in { visor.help() }
-    "General help" should "properly execute w/o alias" in { visor.help() }
-    "Help for 'start' command" should "properly execute" in { visor.help("start") }
-    "Help for 'deploy' command" should "properly execute" in { visor.help("deploy") }
-    "Help for 'events' command" should "properly execute" in { visor.help("events") }
-    "Help for 'mclear' command" should "properly execute" in { visor.help("mclear") }
-    "Help for 'cache' command" should "properly execute" in { visor.help("cache") }
-    "Help for 'disco' command" should "properly execute" in { visor.help("disco") }
-    "Help for 'alert' command" should "properly execute" in { visor.help("alert") }
-    "Help for 'node' command" should "properly execute" in { visor.help("node") }
-    "Help for 'vvm' command" should "properly execute" in { visor.help("vvm") }
-    "Help for 'kill' command" should "properly execute" in { visor.help("kill") }
-    "Help for 'top' command" should "properly execute" in { visor.help("top") }
-    "Help for 'config' command" should "properly execute" in { visor.help("config") }
-    "Help for 'ack' command" should "properly execute" in { visor.help("ack") }
-    "Help for 'ping' command" should "properly execute" in { visor.help("ping") }
-    "Help for 'close' command" should "properly execute" in { visor.help("close") }
-    "Help for 'open' command" should "properly execute" in { visor.help("open") }
-    "Help for 'status' command" should "properly execute" in { visor.help("status") }
-    "Help for 'mset' command" should "properly execute" in { visor.help("mset") }
-    "Help for 'mget' command" should "properly execute" in { visor.help("mget") }
-    "Help for 'mlist' command" should "properly execute" in { visor.help("mlist") }
-    "Help for 'help' command" should "properly execute" in { visor.help("help") }
-    "Help for 'log' command" should "properly execute" in { visor.help("log") }
-    "Help for 'dash' command" should "properly execute" in { visor.help("dash") }
+
+    describe("General help") {
+        it ("should properly execute via alias") { visor.searchCmd("?").get.emptyArgs }
+        it ("should properly execute w/o alias") { visor.searchCmd("help").get.emptyArgs }
+    }
+
+    describe("Help for command") {
+        it ("should properly execute for 'start' command") { visor.help("start") }
+        it ("should properly execute for 'deploy' command") { visor.help("deploy") }
+        it ("should properly execute for 'events' command") { visor.help("events") }
+        it ("should properly execute for 'mclear' command") { visor.help("mclear") }
+        it ("should properly execute for 'cache' command") { visor.help("cache") }
+        it ("should properly execute for 'disco' command") { visor.help("disco") }
+        it ("should properly execute for 'alert' command") { visor.help("alert") }
+        it ("should properly execute for 'node' command") { visor.help("node") }
+        it ("should properly execute for 'vvm' command") { visor.help("vvm") }
+        it ("should properly execute for 'kill' command") { visor.help("kill") }
+        it ("should properly execute for 'top' command") { visor.help("top") }
+        it ("should properly execute for 'config' command") { visor.help("config") }
+        it ("should properly execute for 'ack' command") { visor.help("ack") }
+        it ("should properly execute for 'ping' command") { visor.help("ping") }
+        it ("should properly execute for 'close' command") { visor.help("close") }
+        it ("should properly execute for 'open' command") { visor.help("open") }
+        it ("should properly execute for 'start' status") { visor.help("status") }
+        it ("should properly execute for 'start' mset") { visor.help("mset") }
+        it ("should properly execute for 'start' mget") { visor.help("mget") }
+        it ("should properly execute for 'start' mlist") { visor.help("mlist") }
+        it ("should properly execute for 'start' log") { visor.help("log") }
+        it ("should properly execute for 'start' dash") { visor.help("dash") }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala
index 43ef313..2c659b5 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/kill/VisorKillCommandSpec.scala
@@ -25,34 +25,34 @@ import org.apache.ignite.visor.commands.kill.VisorKillCommand._
 /**
  * Unit test for 'kill' command.
  */
-class VisorKillCommandSpec extends FlatSpec with Matchers {
-    behavior of "A 'kill' visor command"
-
-    it should "print error message with null argument" in {
-        visor.open("-d")
-        visor.kill(null)
-        visor.close()
-    }
-
-    it should "print error message if both kill and restart specified" in {
-        visor.open("-d")
-        visor.kill("-k -r")
-        visor.close()
-    }
-
-    it should "print error message if not connected" in {
-        visor.kill("-k")
-    }
-
-    it should "restart node" in {
-        visor.open("-d")
-        visor.kill("-r -id8=@n1")
-        visor.close()
-    }
-
-    it should "print error message" in {
-        visor.open("-d")
-        visor.kill("-r -id=xxx")
-        visor.close()
+class VisorKillCommandSpec extends FunSpec with Matchers {
+    describe("A 'kill' visor command") {
+        it("should print error message with null argument") {
+            visor.open("-d")
+            visor.kill(null)
+            visor.close()
+        }
+
+        it("should print error message if both kill and restart specified") {
+            visor.open("-d")
+            visor.kill("-k -r")
+            visor.close()
+        }
+
+        it("should print error message if not connected") {
+            visor.kill("-k")
+        }
+
+        it("should restart node") {
+            visor.open("-d")
+            visor.kill("-r -id8=@n1")
+            visor.close()
+        }
+
+        it("should print error message") {
+            visor.open("-d")
+            visor.kill("-r -id=xxx")
+            visor.close()
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala
index dcf7aae..ddb84ea 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/log/VisorLogCommandSpec.scala
@@ -23,10 +23,10 @@ import org.scalatest._
 /**
 * Unit test for 'log' command.
 */
-class VisorLogCommandSpec extends FlatSpec with Matchers {
-    behavior of "A 'log' visor command"
-
-    it should "print log status" in {
-        visor.log()
+class VisorLogCommandSpec extends FunSpec with Matchers {
+    describe("A 'log' visor command") {
+        it("should print log status") {
+            visor.log()
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala
index 744d93b..27eaa94 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/mem/VisorMemoryCommandSpec.scala
@@ -23,53 +23,60 @@ import org.scalatest._
 /**
  * Unit test for memory commands.
  */
-class VisorMemoryCommandSpec extends FlatSpec with Matchers {
-    "A 'mget' visor command" should "get correct value" in {
-        visor.mset("key", "value")
+class VisorMemoryCommandSpec extends FunSpec with Matchers {
+    describe("A 'mget' visor command") {
+        it("should get correct value") {
+            visor.mset("key", "value")
 
-        assertResult(Option("value"))(visor.mgetOpt("key"))
+            assertResult(Option("value"))(visor.mgetOpt("key"))
 
-        visor.mclear()
+            visor.mclear()
+        }
     }
 
-    "A 'mlist' visor command" should "list all variables" in {
-        visor.mset("key1", "value1")
-        visor.mset("key2", "value2")
-        visor.mset("key3", "value3")
+    describe("A 'mlist' visor command") {
+        it("should list all variables") {
+            visor.mset("key1", "value1")
+            visor.mset("key2", "value2")
+            visor.mset("key3", "value3")
 
-        visor.mlist()
-        visor.mclear()
-    }
+            visor.mlist()
+            visor.mclear()
+        }
 
-    "A 'mlist' visor command" should "list ax and cx variables" in {
-        visor.mset("a1", "1")
-        visor.mset("a2", "2")
-        visor.mset("b1", "3")
-        visor.mset("b2", "4")
-        visor.mset("c1", "5")
-        visor.mset("c2", "6")
+        it("should list ax and cx variables") {
+            visor.mset("a1", "1")
+            visor.mset("a2", "2")
+            visor.mset("b1", "3")
+            visor.mset("b2", "4")
+            visor.mset("c1", "5")
+            visor.mset("c2", "6")
 
-        visor.mlist("ac")
-        visor.mclear()
+            visor.mlist("ac")
+            visor.mclear()
+        }
     }
 
-    "A 'mclear' visor command" should "remove first two variables" in {
-        visor.mset("key1", "value1")
-        visor.mset("key2", "value2")
-        visor.mset("key3", "value3")
+    describe("A 'mclear' visor command") {
+        it("should remove first two variables") {
+            visor.mset("key1", "value1")
+            visor.mset("key2", "value2")
+            visor.mset("key3", "value3")
 
-        visor mclear "key1 key2"
+            visor mclear "key1 key2"
 
-        visor.mlist()
-        visor.mclear()
-    }
+            visor.mlist()
+            visor.mclear()
+
+        }
 
-    "A 'mclear' visor command" should "remove all variables" in {
-        visor.mset("key1", "value1")
-        visor.mset("key2", "value2")
-        visor.mset("key3", "value3")
+        it("should remove all variables") {
+            visor.mset("key1", "value1")
+            visor.mset("key2", "value2")
+            visor.mset("key3", "value3")
 
-        visor.mclear()
-        visor.mlist()
+            visor.mclear()
+            visor.mlist()
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala
index 992ff7f..c0983c0 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/node/VisorNodeCommandSpec.scala
@@ -24,19 +24,19 @@ import org.apache.ignite.visor.commands.node.VisorNodeCommand._
  * Unit test for 'node' command.
  */
 class VisorNodeCommandSpec extends VisorRuntimeBaseSpec(1) {
-    behavior of "A 'node' visor command"
+    describe("A 'node' visor command") {
+        it("should properly execute with valid node ID") {
+            visor.node("-id8=@n1")
+        }
 
-    it should "properly execute with valid node ID" in {
-        visor.node("-id8=@n1")
-    }
-
-    it should "print the error message for invalid node ID" in {
-        visor.node("-id8=zeee")
-    }
+        it("should print the error message for invalid node ID") {
+            visor.node("-id8=zeee")
+        }
 
-    it should "print error message when not connected" in {
-        closeVisorQuiet()
+        it("should print error message when not connected") {
+            closeVisorQuiet()
 
-        visor.node("") // Arguments are ignored.
+            visor.node("") // Arguments are ignored.
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala
index 786d04e..4cf2204 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/open/VisorOpenCommandSpec.scala
@@ -24,15 +24,15 @@ import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
  * Unit test for 'open' command.
  */
 class VisorOpenCommandSpec extends VisorRuntimeBaseSpec(3) {
-    behavior of "A 'open' visor command"
-
-    it should "properly connect using default configuration" in {
-        visor.mlist()
-    }
+    describe("A 'open' visor command") {
+        it("should properly connect using default configuration") {
+            visor.mlist()
+        }
 
-    it should "print error message when already connected" in {
-        intercept[IgniteException] {
-            openVisor()
+        it("should print error message when already connected") {
+            intercept[IgniteException] {
+                openVisor()
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala
index dde5f18..06e3a22 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/ping/VisorPingCommandSpec.scala
@@ -24,15 +24,15 @@ import org.apache.ignite.visor.commands.ping.VisorPingCommand._
  * Unit test for 'ping' command.
  */
 class VisorPingCommandSpec extends VisorRuntimeBaseSpec(2) {
-    behavior of "A 'ping' visor command"
+    describe("A 'ping' visor command") {
+        it("should properly execute") {
+            visor.ping()
+        }
 
-    it should "properly execute" in {
-        visor.ping()
-    }
-
-    it should "print error message when not connected" in {
-        closeVisorQuiet()
+        it("should print error message when not connected") {
+            closeVisorQuiet()
 
-        visor.ping()
+            visor.ping()
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b41fbeef/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala
index 1a451c4..c6404b5 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/start/VisorStartCommandSpec.scala
@@ -26,7 +26,7 @@ import org.apache.ignite.visor.commands.top.VisorTopologyCommand._
 /**
  * Unit test for 'start' command.
  */
-class VisorStartCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAll {
+class VisorStartCommandSpec extends FunSpec with Matchers with BeforeAndAfterAll {
     override def beforeAll() {
         visor.open("-d")
     }
@@ -35,89 +35,89 @@ class VisorStartCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAl
         visor.close()
     }
 
-    behavior of "A 'start' visor command"
+    describe("A 'start' visor command") {
+        it("should should start one new node") {
+            visor.start("-h=192.168.1.103 -r -p=password")
+        }
 
-    it should "should start one new node" in {
-        visor.start("-h=192.168.1.103 -r -p=password")
-    }
+        it("should should start two nodes") {
+            visor.start("-h=uname:passwd@localhost -n=2")
+        }
 
-    it should "should start two nodes" in {
-        visor.start("-h=uname:passwd@localhost -n=2")
-    }
+        it("should print error message with invalid port number") {
+            visor.start("-h=localhost:x -p=passwd")
+        }
 
-    it should "print error message with invalid port number" in {
-        visor.start("-h=localhost:x -p=passwd")
-    }
+        it("should print error message with zero port number") {
+            visor.start("-h=localhost:0 -p=passwd")
+        }
 
-    it should "print error message with zero port number" in {
-        visor.start("-h=localhost:0 -p=passwd")
-    }
+        it("should print error message with negative port number") {
+            visor.start("-h=localhost:-1 -p=passwd")
+        }
 
-    it should "print error message with negative port number" in {
-        visor.start("-h=localhost:-1 -p=passwd")
-    }
+        it("should print error message with invalid nodes count") {
+            visor.start("-h=localhost#x -p=passwd")
+        }
 
-    it should "print error message with invalid nodes count" in {
-        visor.start("-h=localhost#x -p=passwd")
-    }
+        it("should print error message with zero nodes count") {
+            visor.start("-h=localhost#0 -p=passwd")
+        }
 
-    it should "print error message with zero nodes count" in {
-        visor.start("-h=localhost#0 -p=passwd")
-    }
+        it("should print error message with negative nodes count") {
+            visor.start("-h=localhost#-1 -p=passwd")
+        }
 
-    it should "print error message with negative nodes count" in {
-        visor.start("-h=localhost#-1 -p=passwd")
-    }
+        it("should print error message with incorrect host") {
+            visor.start("-h=incorrect -p=passwd")
+        }
 
-    it should "print error message with incorrect host" in {
-        visor.start("-h=incorrect -p=passwd")
-    }
+        it("should print error message with incorrect username") {
+            visor.start("-h=incorrect@localhost -p=passwd")
+        }
 
-    it should "print error message with incorrect username" in {
-        visor.start("-h=incorrect@localhost -p=passwd")
-    }
+        it("should print error message with incorrect password") {
+            visor.start("-h=uname:incorrect@localhost")
+        }
 
-    it should "print error message with incorrect password" in {
-        visor.start("-h=uname:incorrect@localhost")
-    }
+        it("should print error message with nonexistent script path") {
+            visor.start("-h=uname:passwd@localhost -s=incorrect")
+        }
 
-    it should "print error message with nonexistent script path" in {
-        visor.start("-h=uname:passwd@localhost -s=incorrect")
-    }
+        it("should print error message with incorrect script path") {
+            visor.start("-h=uname:passwd@localhost -s=bin/readme.txt")
+        }
 
-    it should "print error message with incorrect script path" in {
-        visor.start("-h=uname:passwd@localhost -s=bin/readme.txt")
-    }
+        it("should print error message with nonexistent config path") {
+            visor.start("-h=uname:passwd@localhost -c=incorrect")
+        }
 
-    it should "print error message with nonexistent config path" in {
-        visor.start("-h=uname:passwd@localhost -c=incorrect")
-    }
+        it("should print error message with incorrect config path") {
+            visor.start("-h=uname:passwd@localhost -c=bin/readme.txt")
+        }
 
-    it should "print error message with incorrect config path" in {
-        visor.start("-h=uname:passwd@localhost -c=bin/readme.txt")
-    }
+        it("should start one node") {
+            visor.start("-h=uname:passwd@localhost")
 
-    it should "start one node" in {
-        visor.start("-h=uname:passwd@localhost")
+            visor.top()
+        }
 
-        visor.top()
-    }
-
-    it should "start one node on host identified by IP" in {
-        visor.start("-h=uname:passwd@127.0.0.1")
+        it("should start one node on host identified by IP") {
+            visor.start("-h=uname:passwd@127.0.0.1")
 
-        visor.top()
-    }
+            visor.top()
+        }
 
-    it should "start two nodes" in {
-        visor.start("-h=uname:passwd@localhost#2")
+        it("should start two nodes") {
+            visor.start("-h=uname:passwd@localhost#2")
 
-        visor.top()
-    }
+            visor.top()
+        }
 
-    it should "restart 4 nodes" in {
-        visor.start("-h=uname:passwd@localhost#4 -r")
+        it("should restart 4 nodes") {
+            visor.start("-h=uname:passwd@localhost#4 -r")
 
-        visor.top()
+            visor.top()
+        }
     }
 }