From 81e7ebe44057be4c91967b18977a71ddd7e989ec Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Fri, 10 Nov 2023 20:55:43 +0000 Subject: [PATCH] Update readme. Includes Java 21 patch Signed-off-by: Prabhu Subramanian --- README.md | 6 +++--- contrib/README.md | 8 ++++++++ contrib/java21.patch | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 contrib/README.md create mode 100644 contrib/java21.patch diff --git a/README.md b/README.md index 92aeb524..39d59e5c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ chen container image has everything needed to get started. ### Jupyter notebook with docker compose -Use the docker compose from this repo to try chennai with Jupyter notebook. +Use the docker compose from this repo to try chennai with Jupyter Notebook. ```shell git clone https://github.com/AppThreat/chen @@ -69,7 +69,7 @@ To download the chen distribution. chen --download ``` -To generate custom graphs and models with atom for data science, download the scientific pack which installs support for PyTorch ecosystem. [conda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) is recommended for best experience. +To generate custom graphs and models with atom for data science, download the scientific pack which installs support for the PyTorch ecosystem. [conda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) is recommended for the best experience. ```shell chen --download --with-science @@ -176,7 +176,7 @@ chennai> help 1 error found ``` -This error is mostly due to missing python .so (linux), .dll (windows) or .dylib (mac) file. Ensure the below environment variables below are set correctly. +This error is mostly due to missing python .so (linux), .dll (windows) or .dylib (mac) file. Ensure the environment variables below are set correctly. - SCALAPY_PYTHON_LIBRARY - Use values such as python3.10, python3.11 based on the version installed. On Windows, there are no dots. python311 - JAVA_TOOL_OPTIONS - jna.library.path must be set to the python lib directory diff --git a/contrib/README.md b/contrib/README.md new file mode 100644 index 00000000..ef8a795c --- /dev/null +++ b/contrib/README.md @@ -0,0 +1,8 @@ +# Introduction + +chen works better under Java 21 with virtual threads. Use the provided patch for Java 21. + +```shell +git apply --ignore-space-change --ignore-whitespace contrib/java21.patch +sbt clean stage createDistribution +``` diff --git a/contrib/java21.patch b/contrib/java21.patch new file mode 100644 index 00000000..3abcceee --- /dev/null +++ b/contrib/java21.patch @@ -0,0 +1,39 @@ +diff --git a/build.sbt b/build.sbt +index 30f005d..16e9759 100644 +--- a/build.sbt ++++ b/build.sbt +@@ -41,18 +41,18 @@ ThisBuild / libraryDependencies ++= Seq( + ThisBuild / compile / javacOptions ++= Seq( + "-g", // debug symbols + "-Xlint", +- "--release=17" ++ "--release=21" + ) ++ { + // fail early if users with JDK8 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 + } + + ThisBuild / scalacOptions ++= Seq( + "-deprecation", // Emit warning and location for usages of deprecated APIs. + "--release", +- "17", ++ "21", + ) + + +diff --git a/dataflowengineoss/src/main/scala/io/appthreat/dataflowengineoss/queryengine/Engine.scala b/dataflowengineoss/src/main/scala/io/appthreat/dataflowengineoss/queryengine/Engine.scala +index 00c4297..97822ab 100644 +--- a/dataflowengineoss/src/main/scala/io/appthreat/dataflowengineoss/queryengine/Engine.scala ++++ b/dataflowengineoss/src/main/scala/io/appthreat/dataflowengineoss/queryengine/Engine.scala +@@ -28,7 +28,7 @@ class Engine(context: EngineContext): + + private val logger: Logger = LoggerFactory.getLogger(this.getClass) + private val executorService: ExecutorService = +- Executors.newWorkStealingPool(2) ++ Executors.newVirtualThreadPerTaskExecutor() + private val completionService = + new ExecutorCompletionService[TaskSummary](executorService) +