From cb2920448925f5f627a777a94d0d35269e769f67 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Fri, 22 Sep 2023 17:11:53 -0700 Subject: [PATCH] feature: Support JDK21 release version (#3223) --- .github/workflows/test.yml | 2 +- .../main/scala/wvlet/airframe/control/Parallel.scala | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) 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 {