From 4a533e951358ba8c2f011745a6555912fbb63ca6 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Thu, 9 Mar 2023 13:00:37 +0000 Subject: [PATCH] Attempt to migrate to Java 19. --- .github/workflows/ci.yml | 3 +- .github/workflows/docker-build-test.yml | 8 +- .github/workflows/docker-build.yml | 5 +- Dockerfile | 6 +- Dockerfile.ci | 4 +- Dockerfile.openj9 | 6 +- Dockerfile.openj9.ci | 4 +- build.gradle | 8 +- .../me/kavin/piped/utils/Multithreading.java | 2 +- testing/docker-compose.yugabytedb.yml | 78 +++++++++---------- 10 files changed, 63 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38ea6e8..5843778 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17 ] + java: [ 19 ] steps: - uses: actions/checkout@v3 @@ -20,7 +20,6 @@ jobs: with: java-version: ${{ matrix.java }} distribution: temurin - check-latest: true cache: "gradle" - name: Run Build run: ./gradlew build diff --git a/.github/workflows/docker-build-test.yml b/.github/workflows/docker-build-test.yml index c068c5d..c6a63a5 100644 --- a/.github/workflows/docker-build-test.yml +++ b/.github/workflows/docker-build-test.yml @@ -21,17 +21,17 @@ jobs: dockerfile: - Dockerfile.ci - Dockerfile.openj9.ci - - Dockerfile.graalvm-jvm.ci + # - Dockerfile.graalvm-jvm.ci + fail-fast: false steps: - uses: actions/checkout@v3 - name: Create Version File run: echo $(git log -1 --date=short --pretty=format:%cd)-$(git rev-parse --short HEAD) > VERSION - - name: set up JDK 17 + - name: set up JDK 19 uses: actions/setup-java@v3 with: - java-version: 17 + java-version: 19 distribution: temurin - check-latest: true cache: "gradle" - name: Run Build run: ./gradlew shadowJar diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 49b8f5c..fcaef6f 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -23,12 +23,11 @@ jobs: - uses: actions/checkout@v3 - name: Create Version File run: echo $(git log -1 --date=short --pretty=format:%cd)-$(git rev-parse --short HEAD) > VERSION - - name: set up JDK 17 + - name: set up JDK 19 uses: actions/setup-java@v3 with: - java-version: 17 + java-version: 19 distribution: temurin - check-latest: true cache: "gradle" - name: Run Build run: ./gradlew shadowJar diff --git a/Dockerfile b/Dockerfile index 61c6ce9..aa7be7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM eclipse-temurin:17-jdk AS build +FROM eclipse-temurin:19-jdk AS build WORKDIR /app/ @@ -7,7 +7,7 @@ COPY . /app/ RUN --mount=type=cache,target=/root/.gradle/caches/ \ ./gradlew shadowJar -FROM eclipse-temurin:17-jre +FROM eclipse-temurin:19-jre WORKDIR /app/ @@ -17,4 +17,4 @@ COPY VERSION . EXPOSE 8080 -CMD java -jar /app/piped.jar +CMD ["java", "--enable-preview", "-jar", "/app/piped.jar"] diff --git a/Dockerfile.ci b/Dockerfile.ci index bc3627b..20d2cb7 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1,4 +1,4 @@ -FROM eclipse-temurin:17-jre +FROM eclipse-temurin:19-jre WORKDIR /app/ @@ -8,4 +8,4 @@ COPY VERSION . EXPOSE 8080 -CMD java -jar /app/piped.jar +CMD ["java", "--enable-preview", "-jar", "/app/piped.jar"] diff --git a/Dockerfile.openj9 b/Dockerfile.openj9 index cb6f262..3af0060 100644 --- a/Dockerfile.openj9 +++ b/Dockerfile.openj9 @@ -1,4 +1,4 @@ -FROM ibm-semeru-runtimes:open-17-jdk AS build +FROM 1337kavin/openj9-19 AS build WORKDIR /app/ @@ -7,7 +7,7 @@ COPY . /app/ RUN --mount=type=cache,target=/root/.gradle/caches/ \ ./gradlew shadowJar -FROM ibm-semeru-runtimes:open-17-jre +FROM 1337kavin/openj9-19:latest-jre WORKDIR /app/ @@ -17,4 +17,4 @@ COPY VERSION . EXPOSE 8080 -CMD java -server -Xmx1G -Xaggressive -XX:+UnlockExperimentalVMOptions -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+IdleTuningGcOnIdle -Xgcpolicy:gencon -Xshareclasses:allowClasspaths -Xtune:virtualized -jar /app/piped.jar +CMD java -server -Xmx1G -Xaggressive -XX:+UnlockExperimentalVMOptions -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+IdleTuningGcOnIdle -Xgcpolicy:gencon -Xshareclasses:allowClasspaths -Xtune:virtualized --enable-preview -jar /app/piped.jar diff --git a/Dockerfile.openj9.ci b/Dockerfile.openj9.ci index 75df08e..2fe02e8 100644 --- a/Dockerfile.openj9.ci +++ b/Dockerfile.openj9.ci @@ -1,4 +1,4 @@ -FROM ibm-semeru-runtimes:open-17-jre +FROM 1337kavin/openj9-19:latest-jre WORKDIR /app/ @@ -8,4 +8,4 @@ COPY VERSION . EXPOSE 8080 -CMD java -server -Xmx1G -Xaggressive -XX:+UnlockExperimentalVMOptions -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+IdleTuningGcOnIdle -Xgcpolicy:gencon -Xshareclasses:allowClasspaths -Xtune:virtualized -jar /app/piped.jar +CMD java -server -Xmx1G -Xaggressive -XX:+UnlockExperimentalVMOptions -XX:+OptimizeStringConcat -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseNUMA -XX:+IdleTuningGcOnIdle -Xgcpolicy:gencon -Xshareclasses:allowClasspaths -Xtune:virtualized --enable-preview -jar /app/piped.jar diff --git a/build.gradle b/build.gradle index 7135482..e61b82d 100644 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,11 @@ jar { } } +tasks.withType(JavaCompile).each { + it.options.compilerArgs.add('--enable-preview') +} + group = 'me.kavin.piped' version = '1.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_19 +targetCompatibility = JavaVersion.VERSION_19 diff --git a/src/main/java/me/kavin/piped/utils/Multithreading.java b/src/main/java/me/kavin/piped/utils/Multithreading.java index 7d8df7c..2b0625a 100644 --- a/src/main/java/me/kavin/piped/utils/Multithreading.java +++ b/src/main/java/me/kavin/piped/utils/Multithreading.java @@ -7,7 +7,7 @@ import java.util.function.Supplier; public class Multithreading { - private static final ExecutorService es = Executors.newCachedThreadPool(); + private static final ExecutorService es = Executors.newVirtualThreadPerTaskExecutor(); private static final ExecutorService esLimited = Executors .newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8); private static final ExecutorService esLimitedPubSub = Executors diff --git a/testing/docker-compose.yugabytedb.yml b/testing/docker-compose.yugabytedb.yml index 2258648..d0f13c0 100644 --- a/testing/docker-compose.yugabytedb.yml +++ b/testing/docker-compose.yugabytedb.yml @@ -1,40 +1,40 @@ services: - piped: - image: 1337kavin/piped:latest - restart: unless-stopped - ports: - - "127.0.0.1:8080:8080" - volumes: - - ./config.yugabytedb.properties:/app/config.properties - depends_on: - - yb-tserver - command: [ "sh", "-c", "sleep 10 && java -jar piped.jar" ] - yb-master: - image: yugabytedb/yugabyte:latest - command: - [ - "/home/yugabyte/bin/yb-master", - "--fs_data_dirs=/mnt/master", - "--master_addresses=yb-master:7100", - "--rpc_bind_addresses=yb-master:7100", - "--replication_factor=1" - ] - environment: - SERVICE_7000_NAME: yb-master - yb-tserver: - image: yugabytedb/yugabyte:latest - command: - [ - "/home/yugabyte/bin/yb-tserver", - "--fs_data_dirs=/mnt/tserver", - "--start_pgsql_proxy", - "--rpc_bind_addresses=yb-tserver:9100", - "--tserver_master_addrs=yb-master:7100" - ] - environment: - SERVICE_5433_NAME: ysql - SERVICE_9042_NAME: ycql - SERVICE_6379_NAME: yedis - SERVICE_9000_NAME: yb-tserver - depends_on: - - yb-master + piped: + image: 1337kavin/piped:latest + restart: unless-stopped + ports: + - "127.0.0.1:8080:8080" + volumes: + - ./config.yugabytedb.properties:/app/config.properties + depends_on: + - yb-tserver + command: [ "sh", "-c", "sleep 10 && java --enable-preview -jar piped.jar" ] + yb-master: + image: yugabytedb/yugabyte:latest + command: + [ + "/home/yugabyte/bin/yb-master", + "--fs_data_dirs=/mnt/master", + "--master_addresses=yb-master:7100", + "--rpc_bind_addresses=yb-master:7100", + "--replication_factor=1" + ] + environment: + SERVICE_7000_NAME: yb-master + yb-tserver: + image: yugabytedb/yugabyte:latest + command: + [ + "/home/yugabyte/bin/yb-tserver", + "--fs_data_dirs=/mnt/tserver", + "--start_pgsql_proxy", + "--rpc_bind_addresses=yb-tserver:9100", + "--tserver_master_addrs=yb-master:7100" + ] + environment: + SERVICE_5433_NAME: ysql + SERVICE_9042_NAME: ycql + SERVICE_6379_NAME: yedis + SERVICE_9000_NAME: yb-tserver + depends_on: + - yb-master