diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 50b692a3bf..ba494dbbcc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -103,7 +103,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' - java-version: '21-ea' + java-version: '21' - name: Scala 2.13 + JDK21 test run: ./sbt ++2.13 projectJVM/test - name: Publish Test Report diff --git a/airframe-control/.jvm/src/main/scala/wvlet/airframe/control/Parallel.scala b/airframe-control/.jvm/src/main/scala/wvlet/airframe/control/Parallel.scala index 100ce1d08c..cd1b8c79fa 100644 --- a/airframe-control/.jvm/src/main/scala/wvlet/airframe/control/Parallel.scala +++ b/airframe-control/.jvm/src/main/scala/wvlet/airframe/control/Parallel.scala @@ -138,12 +138,12 @@ object Parallel extends LogSupport { val executionId = UUID.randomUUID.toString trace(s"$executionId - Begin Parallel.iterate (parallelism = ${parallelism})") - val requestQueue = new LinkedBlockingQueue[Worker[T, R]](parallelism) - val resultQueue = new LinkedBlockingQueue[Option[R]]() - val interrupted = new AtomicBoolean(false) + val requestQueue = new LinkedBlockingQueue[Worker[T, R]](parallelism) + val resultQueue = new LinkedBlockingQueue[Option[R]]() + val interruptedFlag = new AtomicBoolean(false) Range(0, parallelism).foreach { i => - val worker = new Worker[T, R](executionId, i.toString, requestQueue, resultQueue, interrupted, f) + val worker = new Worker[T, R](executionId, i.toString, requestQueue, resultQueue, interruptedFlag, f) requestQueue.put(worker) } @@ -154,9 +154,9 @@ object Parallel extends LogSupport { try { // Process all elements of source - while (source.hasNext && !interrupted.get()) { + while (source.hasNext && !interruptedFlag.get()) { val worker = requestQueue.take() - if (!interrupted.get()) { + if (!interruptedFlag.get()) { worker.message.set(source.next()) executor.execute(worker) } else {