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 2017/04/26 13:58:17 UTC
ignite git commit: ignite-2.0 - Fixed offheap RWLock tests
Repository: ignite
Updated Branches:
refs/heads/ignite-2.0 6998785a8 -> 760cf952d
ignite-2.0 - Fixed offheap RWLock tests
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/760cf952
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/760cf952
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/760cf952
Branch: refs/heads/ignite-2.0
Commit: 760cf952d20dc302a208ee1a57abd874c7f8ad7b
Parents: 6998785
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Apr 26 16:58:53 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 26 16:58:53 2017 +0300
----------------------------------------------------------------------
.../utils/IgniteOffheapReadWriteLockSelfTest.java | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/760cf952/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
index 4d81a3d..7a38548 100644
--- a/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
@@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("BusyWait")
public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
/** */
- private static final int TAG_0 = 0;
+ private static final int TAG_0 = 1;
/**
* @throws Exception if failed.
@@ -334,7 +334,7 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
final long ptr = GridUnsafe.allocateMemory(OffheapReadWriteLock.LOCK_SIZE);
- lock.init(ptr, 0);
+ lock.init(ptr, TAG_0);
final AtomicInteger reads = new AtomicInteger();
final AtomicInteger writes = new AtomicInteger();
@@ -350,7 +350,7 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
try {
ThreadLocalRandom rnd = ThreadLocalRandom.current();
- int tag = 0;
+ int tag = TAG_0;
long lastSwitch = System.currentTimeMillis();
@@ -381,7 +381,12 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
if (switched && waitBeforeSwitch)
info("Switching...");
- lock.writeUnlock(ptr, (tag + (switched ? 1 : 0)) & 0xFFFF);
+ int tag1 = (tag + (switched ? 1 : 0)) & 0xFFFF;
+
+ if (tag1 == 0)
+ tag1 = 1;
+
+ lock.writeUnlock(ptr, tag1);
}
writes.incrementAndGet();
@@ -422,7 +427,10 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
tag = (tag + 1) & 0xFFFF;
- if (waitBeforeSwitch || (!waitBeforeSwitch && tag == 0))
+ if (tag == 0)
+ tag = 1;
+
+ if (waitBeforeSwitch || (!waitBeforeSwitch && tag == 1))
info("Switch to a new tag: " + tag);
if (done.get()) {