Skip to content

Replace synchronized block with ReentrantLock to avoid possible thread pinning with virtual threads (Java 21) #264

Replace synchronized block with ReentrantLock to avoid possible thread pinning with virtual threads (Java 21)

Replace synchronized block with ReentrantLock to avoid possible thread pinning with virtual threads (Java 21) #264

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
env:
DEFAULT_JAVA: 11
SONAR_JAVA: 17
TARGET_JAVA_CLASS_FILE_VERSION: 52 # Java 8
jobs:
test:
name: Test
strategy:
matrix:
java: [11, 17, 21]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # SonarCloud doesn't like shallow clones
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
server-id: sonatype-nexus-snapshots
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
- name: Build with Maven
run: mvn -B clean verify
- name: Verify Java class file version
run: 'javap -verbose target/classes/io/github/mweirauch/micrometer/jvm/extras/ProcessMemoryMetrics.class | grep "major version: ${{ env.TARGET_JAVA_CLASS_FILE_VERSION }}"'
- name: Cache SonarCloud packages
if: env.SONAR_TOKEN != null && matrix.java == env.SONAR_JAVA
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: SonarCloud analysis
if: env.SONAR_TOKEN != null && matrix.java == env.SONAR_JAVA
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B jacoco:report jacoco:report-integration sonar:sonar -Dsonar.organization=mweirauch-github -Dsonar.projectKey=mweirauch_micrometer-jvm-extras -Dsonar.host.url=https://sonarcloud.io
- name: Publish Snapshot
if: env.OSSRH_USERNAME != null && matrix.os == 'ubuntu-latest' && matrix.java == env.DEFAULT_JAVA && github.ref == 'refs/heads/main'
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: mvn -B deploy -DskipTests=true -Dbasepom.check.skip-all=true