Skip to content

Commit

Permalink
Java 21 virtual thread
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu committed Oct 8, 2023
1 parent 973f1c7 commit 456a878
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejstests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
java-version: ['17', '19', '20', '21']
java-version: ['21']
node-version: ['20.x']
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
java-version: ['17', '19', '20', '21']
java-version: ['21']
node-version: ['20.x']
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '19'
java-version: '21'
- name: Release
run: |
sbt scalafmtCheck stage assembly createDistribution
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repotests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
java-version: ['17', '19', '20', '21']
java-version: ['21']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ Compile / doc / scalacOptions ++= Seq("-doc-title", "atom apidocs", "-doc-versio
ThisBuild / scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"--release",
"17",
"21",
)

ThisBuild / compile / javacOptions ++= Seq(
"-g", // debug symbols
"-Xlint",
"--release=17"
"--release=21"
) ++ {
// fail early if users with JDK11 try to run this
val javaVersion = sys.props("java.specification.version").toFloat
assert(javaVersion.toInt >= 17, s"this build requires JDK17+ - you're using $javaVersion")
assert(javaVersion.toInt >= 21, s"this build requires JDK21+ - you're using $javaVersion")
Nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object DataFlowGraph {

private def DF_EDGES =
Set(EdgeTypes.REACHING_DEF, EdgeTypes.CALL, EdgeTypes.REF)
val exec: ExecutorService = Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors / 2)
val exec: ExecutorService = Executors.newVirtualThreadPerTaskExecutor()

def buildFromSlice(slice: DataFlowSlice): DataFlowGraph = {
val dfNodes = slice.nodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import scala.collection.concurrent.TrieMap
object DataFlowSlicing {

implicit val resolver: ICallResolver = NoResolve
val exec: ExecutorService = Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors() / 2)
val exec: ExecutorService = Executors.newVirtualThreadPerTaskExecutor()
private val excludeOperatorCalls = new AtomicBoolean(true)
private val nodeCache = new TrieMap[Long, SliceNode]()
private var language: Option[String] = _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.util.concurrent.*
object UsageSlicing {

private val resolver = NoResolve
val exec: ExecutorService = Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors() / 2)
val exec: ExecutorService = Executors.newVirtualThreadPerTaskExecutor()
private val constructorTypeMatcher = Pattern.compile(".*new (\\w+)\\(.*")
private val excludeOperatorCalls = new AtomicBoolean(true)

Expand Down

0 comments on commit 456a878

Please sign in to comment.