Ignite-1.5 - Minor modification in a failing test and example javadoc fix.

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

Branch: refs/heads/ignite-1.5.1
Commit: 39b2c2f4693c4b4ecad57e4b81b8ec8b7a35a8f8
Parents: be60351
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Mon Dec 14 17:11:54 2015 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Mon Dec 14 17:14:26 2015 +0300

----------------------------------------------------------------------
 .../CacheClientBinaryPutGetExample.java         |  6 +--
 .../datagrid/CacheClientBinaryQueryExample.java |  7 ++-
 .../IgniteTxExceptionAbstractSelfTest.java      | 57 +++++++++++++++-----
 3 files changed, 53 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/39b2c2f4/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
index 9883b14..b6fc455 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
@@ -41,11 +41,11 @@ import org.apache.ignite.binary.BinaryObject;
  * it demonstrates how binary object can be retrieved in fully-deserialized 
form or in binary object
  * format using special cache projection.
  * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the binary marshaller: {@code 'ignite.{sh|bat} 
examples/config/example-ignite.xml'}.
+ * Remote nodes should always be started with the following command:
+ * {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}
  * <p>
  * Alternatively you can run {@link 
org.apache.ignite.examples.ExampleNodeStartup} in another JVM which will
- * start node with {@code examples/config/example-ignite.xml} configuration.
+ * start a node with {@code examples/config/example-ignite.xml} configuration.
  */
 @SuppressWarnings("TypeMayBeWeakened")
 public class CacheClientBinaryPutGetExample {

http://git-wip-us.apache.org/repos/asf/ignite/blob/39b2c2f4/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
----------------------------------------------------------------------
diff --git 
a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
index 7cc95b5..b05cbb5 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
@@ -45,8 +45,11 @@ import org.apache.ignite.binary.BinaryObject;
  * This example demonstrates use of binary objects with cache queries.
  * The example populates cache with sample data and runs several SQL and full 
text queries over this data.
  * <p>
- * Remote nodes should always be started with {@link 
org.apache.ignite.examples.ExampleNodeStartup} which starts
- * a node with {@code examples/config/example-ignite.xml} configuration.
+ * Remote nodes should always be started with the following command:
+ * {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}
+ * <p>
+ * Alternatively you can run {@link 
org.apache.ignite.examples.ExampleNodeStartup} in another JVM which will
+ * start a node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheClientBinaryQueryExample {
     /** Organization cache name. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/39b2c2f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
index 07e7a98..4826c68 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteKernal;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import 
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
+import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.indexing.IndexingQueryFilter;
@@ -386,25 +387,57 @@ public abstract class IgniteTxExceptionAbstractSelfTest 
extends GridCacheAbstrac
         info("Check key: " + key);
 
         for (int i = 0; i < gridCount(); i++) {
-            IgniteKernal grid = (IgniteKernal)grid(i);
+            final int idx = i;
 
-            GridCacheAdapter cache = grid.internalCache(null);
+            GridTestUtils.waitForCondition(new PA() {
+                @Override public boolean apply() {
+                    IgniteKernal grid = (IgniteKernal)grid(idx);
 
-            GridCacheEntryEx entry = cache.peekEx(key);
+                    GridCacheAdapter cache = grid.internalCache(null);
 
-            log.info("Entry: " + entry);
+                    GridCacheEntryEx entry = cache.peekEx(key);
 
-            if (entry != null)
-                assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + 
entry + ']', entry.lockedByAny());
+                    log.info("Entry: " + entry);
 
-            if (cache.isNear()) {
-                entry = ((GridNearCacheAdapter)cache).dht().peekEx(key);
+                    if (entry != null) {
+                        try {
+                            boolean locked = entry.lockedByAny();
 
-                log.info("Dht entry: " + entry);
+                            if (locked) {
+                                info("Unexpected entry for grid [i=" + idx + 
", entry=" + entry + ']');
 
-                if (entry != null)
-                    assertFalse("Unexpected entry for grid [i=" + i + ", 
entry=" + entry + ']', entry.lockedByAny());
-            }
+                                return false;
+                            }
+                        }
+                        catch (GridCacheEntryRemovedException ignore) {
+                            // Obsolete entry cannot be locked.
+                        }
+                    }
+
+                    if (cache.isNear()) {
+                        entry = 
((GridNearCacheAdapter)cache).dht().peekEx(key);
+
+                        log.info("Dht entry: " + entry);
+
+                        if (entry != null) {
+                            try {
+                                boolean locked = entry.lockedByAny();
+
+                                if (locked) {
+                                    info("Unexpected entry for grid [i=" + idx 
+ ", entry=" + entry + ']');
+
+                                    return false;
+                                }
+                            }
+                            catch (GridCacheEntryRemovedException ignore) {
+                                // Obsolete entry cannot be locked.
+                            }
+                        }
+                    }
+
+                    return true;
+                }
+            }, getTestTimeout());
         }
     }
 

Reply via email to