Skip to content

Commit

Permalink
feature: Support JDK21 release version (#3223)
Browse files Browse the repository at this point in the history
  • Loading branch information
xerial authored Sep 23, 2023
1 parent b905253 commit cb29204
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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 {
Expand Down

0 comments on commit cb29204

Please sign in to comment.