HHH-18770 Check if the monitoring event was null

When the JFR partial flush event is disabled (for instance when JFR is
entirely disabled) beginPartialFlushEvent() will return a null event.
This commit is contained in:
gtoison 2024-10-27 08:27:25 +01:00 committed by Andrea Boriero
parent aad5355ad0
commit 46cb14089b
1 changed files with 1 additions and 1 deletions

View File

@ -452,7 +452,7 @@ public class JfrEventManager implements EventManager {
public void completePartialFlushEvent( public void completePartialFlushEvent(
HibernateMonitoringEvent hibernateMonitoringEvent, HibernateMonitoringEvent hibernateMonitoringEvent,
AutoFlushEvent event) { AutoFlushEvent event) {
if ( event != null ) { if ( event != null && hibernateMonitoringEvent != null) {
final PartialFlushEvent flushEvent = (PartialFlushEvent) hibernateMonitoringEvent; final PartialFlushEvent flushEvent = (PartialFlushEvent) hibernateMonitoringEvent;
flushEvent.end(); flushEvent.end();
if ( flushEvent.shouldCommit() ) { if ( flushEvent.shouldCommit() ) {