Merge pull request #710 from TeamPiped/java-21

Update to Java 21 and use virtual threads
This commit is contained in:
Kavin 2023-10-10 22:56:59 +01:00 committed by GitHub
commit e8e3ce2804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 23 deletions

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
java: [ 17 ] java: [ 21 ]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -19,7 +19,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
distribution: temurin distribution: zulu
cache: "gradle" cache: "gradle"
- name: Run Build - name: Run Build
run: ./gradlew build run: ./gradlew build

View file

@ -22,9 +22,9 @@ jobs:
- testing/docker-compose.cockroachdb.yml - testing/docker-compose.cockroachdb.yml
- testing/docker-compose.yugabytedb.yml - testing/docker-compose.yugabytedb.yml
dockerfile: dockerfile:
- Dockerfile.ci #- Dockerfile.ci
- Dockerfile.azul.ci - Dockerfile.azul.ci
- Dockerfile.openj9.ci #- Dockerfile.openj9.ci
- Dockerfile.graalvm-jvm.ci - Dockerfile.graalvm-jvm.ci
include: include:
- sleep: 20 - sleep: 20

View file

@ -17,10 +17,10 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- image: 1337kavin/piped:openj9 # - image: 1337kavin/piped:openj9
dockerfile: ./Dockerfile.openj9.ci # dockerfile: ./Dockerfile.openj9.ci
- image: 1337kavin/piped:hotspot # - image: 1337kavin/piped:hotspot
dockerfile: ./Dockerfile.ci # dockerfile: ./Dockerfile.ci
- image: 1337kavin/piped:latest,1337kavin/piped:azul-zulu - image: 1337kavin/piped:latest,1337kavin/piped:azul-zulu
dockerfile: ./Dockerfile.azul.ci dockerfile: ./Dockerfile.azul.ci
- image: 1337kavin/piped:graalvm-jvm - image: 1337kavin/piped:graalvm-jvm

View file

@ -15,11 +15,11 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.base.sha }} ref: ${{ github.event.pull_request.base.sha }}
- name: set up JDK 17 - name: set up JDK 21
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: 17 java-version: 21
distribution: temurin distribution: zulu
cache: "gradle" cache: "gradle"
- name: Run Build - name: Run Build
run: ./gradlew shadowJar run: ./gradlew shadowJar
@ -39,7 +39,7 @@ jobs:
- testing/docker-compose.cockroachdb.yml - testing/docker-compose.cockroachdb.yml
- testing/docker-compose.yugabytedb.yml - testing/docker-compose.yugabytedb.yml
dockerfile: dockerfile:
- Dockerfile.ci - Dockerfile.azul.ci
include: include:
- sleep: 20 - sleep: 20
- docker-compose-file: testing/docker-compose.cockroachdb.yml - docker-compose-file: testing/docker-compose.cockroachdb.yml

View file

@ -9,11 +9,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: set up JDK 17 - name: set up JDK 21
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
java-version: 17 java-version: 21
distribution: temurin distribution: zulu
cache: "gradle" cache: "gradle"
- name: Run Build - name: Run Build
run: ./gradlew shadowJar run: ./gradlew shadowJar

View file

@ -1,4 +1,4 @@
FROM ghcr.io/graalvm/native-image:latest as build FROM container-registry.oracle.com/graalvm/native-image:latest as build
WORKDIR /app/ WORKDIR /app/

View file

@ -1,4 +1,4 @@
FROM ghcr.io/graalvm/native-image:latest as build FROM container-registry.oracle.com/graalvm/native-image:latest as build
RUN jlink \ RUN jlink \
--add-modules java.base,java.logging,java.sql,java.management,java.xml,java.naming,java.desktop,jdk.crypto.ec \ --add-modules java.base,java.logging,java.sql,java.management,java.xml,java.naming,java.desktop,jdk.crypto.ec \

View file

@ -1,7 +1,6 @@
plugins { plugins {
id "com.github.johnrengelman.shadow" version "8.1.1" id "com.github.johnrengelman.shadow" version "8.1.1"
id "java" id "java"
id "io.freefair.lombok" version "8.4"
id "eclipse" id "eclipse"
} }
@ -44,6 +43,8 @@ dependencies {
implementation 'io.sentry:sentry:6.30.0' implementation 'io.sentry:sentry:6.30.0'
implementation 'rocks.kavin:reqwest4j:1.0.12' implementation 'rocks.kavin:reqwest4j:1.0.12'
implementation 'io.minio:minio:8.5.6' implementation 'io.minio:minio:8.5.6'
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'
} }
shadowJar { shadowJar {
@ -60,5 +61,5 @@ jar {
group = 'me.kavin.piped' group = 'me.kavin.piped'
version = '1.0' version = '1.0'
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_21

View file

@ -53,11 +53,11 @@ public class Main {
System.exit(1); System.exit(1);
} }
Multithreading.runAsync(() -> new Thread(new SyncRunner( Multithreading.runAsync(() -> Thread.ofVirtual().start(new SyncRunner(
new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build(), new OkHttpClient.Builder().readTimeout(60, TimeUnit.SECONDS).build(),
MATRIX_SERVER, MATRIX_SERVER,
MatrixHelper.MATRIX_TOKEN) MatrixHelper.MATRIX_TOKEN)
).start()); ));
new Timer().scheduleAtFixedRate(new TimerTask() { new Timer().scheduleAtFixedRate(new TimerTask() {
@Override @Override

View file

@ -5,7 +5,7 @@ import java.util.function.Supplier;
public class Multithreading { public class Multithreading {
private static final ExecutorService es = Executors.newCachedThreadPool(); private static final ExecutorService es = Executors.newVirtualThreadPerTaskExecutor();
private static final ExecutorService esLimited = Executors private static final ExecutorService esLimited = Executors
.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8); .newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8);
private static final ExecutorService esLimitedPubSub = Executors private static final ExecutorService esLimitedPubSub = Executors