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
strategy:
matrix:
java: [ 17 ]
java: [ 21 ]
steps:
- uses: actions/checkout@v4
@ -19,7 +19,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
distribution: zulu
cache: "gradle"
- name: Run Build
run: ./gradlew build

View file

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

View file

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

View file

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

View file

@ -9,11 +9,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
- name: set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
java-version: 21
distribution: zulu
cache: "gradle"
- name: Run Build
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/

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

View file

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

View file

@ -5,7 +5,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