HHH-17347 Support for JDK which do not support JFR events
This commit is contained in:
parent
afbce7cf8a
commit
9f1f8e6c09
|
@ -561,6 +561,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
private final JpaCompliance jpaCompliance;
|
private final JpaCompliance jpaCompliance;
|
||||||
private static final EmptyJdbcObserver EMPTY_JDBC_OBSERVER = EmptyJdbcObserver.INSTANCE;
|
private static final EmptyJdbcObserver EMPTY_JDBC_OBSERVER = EmptyJdbcObserver.INSTANCE;
|
||||||
TransactionCoordinator transactionCoordinator;
|
TransactionCoordinator transactionCoordinator;
|
||||||
|
private final EmptyEventManager eventManager;
|
||||||
|
|
||||||
public TemporaryJdbcSessionOwner(
|
public TemporaryJdbcSessionOwner(
|
||||||
JdbcConnectionAccess jdbcConnectionAccess,
|
JdbcConnectionAccess jdbcConnectionAccess,
|
||||||
|
@ -590,6 +591,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
.getDefaultConnectionHandlingMode();
|
.getDefaultConnectionHandlingMode();
|
||||||
}
|
}
|
||||||
this.jpaCompliance = new MutableJpaComplianceImpl( Collections.emptyMap(), false );
|
this.jpaCompliance = new MutableJpaComplianceImpl( Collections.emptyMap(), false );
|
||||||
|
this.eventManager = new EmptyEventManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -639,7 +641,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventManager getEventManager() {
|
public EventManager getEventManager() {
|
||||||
return EmptyEventManager.INSTANCE;
|
return eventManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,13 +17,8 @@ import org.hibernate.event.spi.FlushEvent;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
|
||||||
public class EmptyEventManager implements EventManager {
|
public final class EmptyEventManager implements EventManager {
|
||||||
|
|
||||||
public static final EmptyEventManager INSTANCE = new EmptyEventManager();
|
|
||||||
|
|
||||||
private EmptyEventManager(){
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateEvent beginSessionOpenEvent() {
|
public HibernateEvent beginSessionOpenEvent() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -275,7 +275,7 @@ public final class FastSessionServices {
|
||||||
this.batchBuilder = serviceRegistry.getService( BatchBuilder.class );
|
this.batchBuilder = serviceRegistry.getService( BatchBuilder.class );
|
||||||
final Collection<EventManager> eventManagers = classLoaderService.loadJavaServices( EventManager.class );
|
final Collection<EventManager> eventManagers = classLoaderService.loadJavaServices( EventManager.class );
|
||||||
this.eventManager = eventManagers.isEmpty()
|
this.eventManager = eventManagers.isEmpty()
|
||||||
? EmptyEventManager.INSTANCE
|
? new EmptyEventManager()
|
||||||
: eventManagers.iterator().next();
|
: eventManagers.iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ dependencies {
|
||||||
|
|
||||||
// JfrUnit requires JDK 17
|
// JfrUnit requires JDK 17
|
||||||
compileTestJava.onlyIf{
|
compileTestJava.onlyIf{
|
||||||
jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit
|
jdkVersions.test.release.asInt() >= 17
|
||||||
}
|
}
|
||||||
|
|
||||||
test.onlyIf {
|
test.onlyIf {
|
||||||
jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit
|
jdkVersions.test.release.asInt() >= 17
|
||||||
}
|
}
|
Loading…
Reference in New Issue