From 9f1f8e6c09b77333935c65eebc8df5613c3af9f6 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Mon, 13 Nov 2023 13:23:20 +0100 Subject: [PATCH] HHH-17347 Support for JDK which do not support JFR events --- .../engine/jdbc/env/internal/JdbcEnvironmentInitiator.java | 4 +++- .../org/hibernate/event/internal/EmptyEventManager.java | 7 +------ .../java/org/hibernate/internal/FastSessionServices.java | 2 +- hibernate-jfr/hibernate-jfr.gradle | 4 ++-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java index 79f6da6031..c9d04188c1 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java @@ -561,6 +561,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator eventManagers = classLoaderService.loadJavaServices( EventManager.class ); this.eventManager = eventManagers.isEmpty() - ? EmptyEventManager.INSTANCE + ? new EmptyEventManager() : eventManagers.iterator().next(); } diff --git a/hibernate-jfr/hibernate-jfr.gradle b/hibernate-jfr/hibernate-jfr.gradle index de52eac5af..b3c47e306b 100644 --- a/hibernate-jfr/hibernate-jfr.gradle +++ b/hibernate-jfr/hibernate-jfr.gradle @@ -19,9 +19,9 @@ dependencies { // JfrUnit requires JDK 17 compileTestJava.onlyIf{ - jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit + jdkVersions.test.release.asInt() >= 17 } test.onlyIf { - jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit + jdkVersions.test.release.asInt() >= 17 } \ No newline at end of file