Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ void allAnd() {
.extracting("specs", LIST)
.hasSize(2);
depth1.first().isInstanceOf(Equals.class);
depth1
var depth2 =
depth1.element(1).isInstanceOf(Conjunction.class).extracting("specs", LIST).hasSize(2);
depth2.first().isInstanceOf(Equals.class);
depth2
.element(1)
.isInstanceOf(Conjunction.class)
.extracting("specs", LIST)
Expand Down Expand Up @@ -389,7 +392,7 @@ public static class NestedAnd {
@AllArgsConstructor
public static class NestedInNestedAnd {

@NestedSpec String name;
@Spec String name;
}

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Collection;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
Expand All @@ -49,17 +50,28 @@ void fireOnlyOnce() {

assertThat(databind).hasSize(5);

var numberOfThreads = 1;
// Release every thread at the same instant so multiple threads race into
// getFieldValue() on the *same* Databind instances and genuinely contend on
// the AtomicBoolean CAS + CountDownLatch dedup.
var numberOfThreads = 32;
var service = newFixedThreadPool(numberOfThreads);
var latch = new CountDownLatch(numberOfThreads);
var startBarrier = new CyclicBarrier(numberOfThreads);
var done = new CountDownLatch(numberOfThreads);
for (int i = 0; i < numberOfThreads; i++) {
service.submit(
() -> {
databind.forEach(Databind::getFieldValue);
latch.countDown();
try {
startBarrier.await();
databind.forEach(Databind::getFieldValue);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
done.countDown();
}
});
}
latch.await();
done.await();
service.shutdown();

databind.forEach(
bind -> {
Expand Down