On Mon, 24 Nov 2025 17:34:21 GMT, Viktor Klang <[email protected]> wrote:

>> Adds the patch by @DougLea
>
> test/jdk/java/util/concurrent/BlockingQueue/MissedPoll.java line 46:
> 
>> 44:         try (var pool = Executors.newCachedThreadPool()) {
>> 45:             var futures = new ArrayList<Future<Integer>>();
>> 46:             var phaser = new Phaser(4);
> 
> @DougLea Would it make sense to do the following, and then only keep a single 
> `phaser.arriveAndAwaitAdvance();` ? (and skip the explicit q.clear())
> 
> Suggestion:
> 
>             var phaser = new Phaser(4) {
>                 @Override
>                 protected boolean onAdvance(int phase, int registeredParties) 
> {
>                     q.clear();
>                     return super.onAdvance(phase, registeredParties);
>                 }
>             };

Sure. I was just trying to minimally adapt the submitter's bug report as test, 
so left this as-is.

> test/jdk/java/util/concurrent/BlockingQueue/MissedPoll.java line 68:
> 
>> 66:                 if (future.get() != 0)
>> 67:                     throw new Error();
>> 68:             }
> 
> @DougLea It might make sense to assert/verify that the queue is empty at the 
> end of the test?

OK, except that it would need further adjustment to force test to fail rather 
than getting stuck.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28479#discussion_r2559764751
PR Review Comment: https://git.openjdk.org/jdk/pull/28479#discussion_r2559772952

Reply via email to