master Fixed hanging test (missed notify)
@@ -313,8 +313,7 @@ public class SegmentedRingByteBufferTest extends TestCase {
final Object mux = new Object();
- IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
- @Override public void run() {
+ IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(() -> {
try {
barrier.await();
}
@@ -335,6 +334,9 @@ public class SegmentedRingByteBufferTest extends TestCase {
synchronized (mux) {
try {
+ if (stop.get())
+ break;
+
mux.wait();
}
catch (InterruptedException e) {
@@ -363,7 +365,6 @@ public class SegmentedRingByteBufferTest extends TestCase {
assertTrue(total <= cap);
}
- }
}, producerCnt, "producer-thread");
long endTime = System.currentTimeMillis() + 60 * 1000L;
@@ -387,9 +388,9 @@ public class SegmentedRingByteBufferTest extends TestCase {
}
}
+ synchronized (mux) {
stop.set(true);
- synchronized (mux) {
mux.notifyAll();
}
@@ -410,8 +411,7 @@ public class SegmentedRingByteBufferTest extends TestCase {
final CyclicBarrier barrier = new CyclicBarrier(producerCnt);
- IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
- @Override public void run() {
+ IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(() -> {
try {
barrier.await();
}
@@ -449,7 +449,6 @@ public class SegmentedRingByteBufferTest extends TestCase {
seg.release();
}
- }
}, producerCnt, "producer-thread");
Random rnd = new Random();
@@ -496,8 +495,7 @@ public class SegmentedRingByteBufferTest extends TestCase {
final Set<TestObject> items = Collections.newSetFromMap(new ConcurrentHashMap<TestObject, Boolean>());
- IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
- @Override public void run() {
+ IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(() -> {
try {
barrier.await();
}
@@ -537,7 +535,6 @@ public class SegmentedRingByteBufferTest extends TestCase {
seg.release();
}
- }
}, producerCnt, "producer-thread");
Random rnd = new Random();
@@ -699,8 +696,9 @@ public class SegmentedRingByteBufferTest extends TestCase {
*/
public TestObject(long id, byte[] arr) {
this.id = id;
- this.len = arr.length;
this.arr = arr;
+
+ len = arr.length;
}
/**
