Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
reactor-core/src/jcstress/java/reactor/core/publisher/SinkManyEmitterProcessorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package reactor.core.publisher; | ||
|
||
import org.openjdk.jcstress.annotations.*; | ||
import org.openjdk.jcstress.infra.results.I_Result; | ||
import org.openjdk.jcstress.infra.results.LI_Result; | ||
|
||
import static org.openjdk.jcstress.annotations.Expect.*; | ||
|
||
public class SinkManyEmitterProcessorTest { | ||
|
||
@JCStressTest | ||
@Outcome(id = {"0"}, expect = ACCEPTABLE, desc = "Queue is empty") | ||
@Outcome(id = {"1"}, expect = ACCEPTABLE_INTERESTING, desc = "Queue is not empty") | ||
@State | ||
public static class ParallelSubscribersStressTest { | ||
|
||
final SinkManyEmitterProcessor<Integer> sink = new SinkManyEmitterProcessor(true, 1); | ||
|
||
@Actor | ||
public void subscribeAndCancel() { | ||
sink.subscribe().dispose(); | ||
} | ||
|
||
@Actor | ||
public void tryEmitNext1(LI_Result r) { | ||
sink.tryEmitNext(1); | ||
} | ||
|
||
@Arbiter | ||
public void arbiter(I_Result result) { | ||
result.r1 = sink.queue.size(); | ||
} | ||
} | ||
} |