HHH-18770 Check if the monitoring event was null
This commit is contained in:
parent
46cb14089b
commit
412bfed842
|
@ -54,10 +54,10 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeSessionOpenEvent(
|
public void completeSessionOpenEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final SessionOpenEvent sessionOpenEvent = (SessionOpenEvent) event;
|
final SessionOpenEvent sessionOpenEvent = (SessionOpenEvent) monitoringEvent;
|
||||||
sessionOpenEvent.end();
|
sessionOpenEvent.end();
|
||||||
if ( sessionOpenEvent.shouldCommit() ) {
|
if ( sessionOpenEvent.shouldCommit() ) {
|
||||||
sessionOpenEvent.sessionIdentifier = getSessionIdentifier( session );
|
sessionOpenEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -80,10 +80,10 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeSessionClosedEvent(
|
public void completeSessionClosedEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final SessionClosedEvent sessionClosedEvent = (SessionClosedEvent) event;
|
final SessionClosedEvent sessionClosedEvent = (SessionClosedEvent) monitoringEvent;
|
||||||
sessionClosedEvent.end();
|
sessionClosedEvent.end();
|
||||||
if ( sessionClosedEvent.shouldCommit() ) {
|
if ( sessionClosedEvent.shouldCommit() ) {
|
||||||
sessionClosedEvent.sessionIdentifier = getSessionIdentifier( session );
|
sessionClosedEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -106,11 +106,11 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcConnectionAcquisitionEvent(
|
public void completeJdbcConnectionAcquisitionEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Object tenantId) {
|
Object tenantId) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcConnectionAcquisitionEvent jdbcConnectionAcquisitionEvent = (JdbcConnectionAcquisitionEvent) event;
|
final JdbcConnectionAcquisitionEvent jdbcConnectionAcquisitionEvent = (JdbcConnectionAcquisitionEvent) monitoringEvent;
|
||||||
jdbcConnectionAcquisitionEvent.end();
|
jdbcConnectionAcquisitionEvent.end();
|
||||||
if ( jdbcConnectionAcquisitionEvent.shouldCommit() ) {
|
if ( jdbcConnectionAcquisitionEvent.shouldCommit() ) {
|
||||||
jdbcConnectionAcquisitionEvent.sessionIdentifier = getSessionIdentifier( session );
|
jdbcConnectionAcquisitionEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -136,11 +136,11 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcConnectionReleaseEvent(
|
public void completeJdbcConnectionReleaseEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Object tenantId) {
|
Object tenantId) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcConnectionReleaseEvent jdbcConnectionReleaseEvent = (JdbcConnectionReleaseEvent) event;
|
final JdbcConnectionReleaseEvent jdbcConnectionReleaseEvent = (JdbcConnectionReleaseEvent) monitoringEvent;
|
||||||
jdbcConnectionReleaseEvent.end();
|
jdbcConnectionReleaseEvent.end();
|
||||||
if ( jdbcConnectionReleaseEvent.shouldCommit() ) {
|
if ( jdbcConnectionReleaseEvent.shouldCommit() ) {
|
||||||
jdbcConnectionReleaseEvent.sessionIdentifier = getSessionIdentifier( session );
|
jdbcConnectionReleaseEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -166,10 +166,10 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcPreparedStatementCreationEvent(
|
public void completeJdbcPreparedStatementCreationEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
String preparedStatementSql) {
|
String preparedStatementSql) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcPreparedStatementCreationEvent jdbcPreparedStatementCreation = (JdbcPreparedStatementCreationEvent) event;
|
final JdbcPreparedStatementCreationEvent jdbcPreparedStatementCreation = (JdbcPreparedStatementCreationEvent) monitoringEvent;
|
||||||
jdbcPreparedStatementCreation.end();
|
jdbcPreparedStatementCreation.end();
|
||||||
if ( jdbcPreparedStatementCreation.shouldCommit() ) {
|
if ( jdbcPreparedStatementCreation.shouldCommit() ) {
|
||||||
jdbcPreparedStatementCreation.sql = preparedStatementSql;
|
jdbcPreparedStatementCreation.sql = preparedStatementSql;
|
||||||
|
@ -192,10 +192,10 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcPreparedStatementExecutionEvent(
|
public void completeJdbcPreparedStatementExecutionEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
String preparedStatementSql) {
|
String preparedStatementSql) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcPreparedStatementExecutionEvent jdbcPreparedStatementExecutionEvent = (JdbcPreparedStatementExecutionEvent) event;
|
final JdbcPreparedStatementExecutionEvent jdbcPreparedStatementExecutionEvent = (JdbcPreparedStatementExecutionEvent) monitoringEvent;
|
||||||
jdbcPreparedStatementExecutionEvent.end();
|
jdbcPreparedStatementExecutionEvent.end();
|
||||||
if ( jdbcPreparedStatementExecutionEvent.shouldCommit() ) {
|
if ( jdbcPreparedStatementExecutionEvent.shouldCommit() ) {
|
||||||
jdbcPreparedStatementExecutionEvent.sql = preparedStatementSql;
|
jdbcPreparedStatementExecutionEvent.sql = preparedStatementSql;
|
||||||
|
@ -218,10 +218,10 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcBatchExecutionEvent(
|
public void completeJdbcBatchExecutionEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
String statementSql) {
|
String statementSql) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcBatchExecutionEvent jdbcBatchExecutionEvent = (JdbcBatchExecutionEvent) event;
|
final JdbcBatchExecutionEvent jdbcBatchExecutionEvent = (JdbcBatchExecutionEvent) monitoringEvent;
|
||||||
jdbcBatchExecutionEvent.end();
|
jdbcBatchExecutionEvent.end();
|
||||||
if ( jdbcBatchExecutionEvent.shouldCommit() ) {
|
if ( jdbcBatchExecutionEvent.shouldCommit() ) {
|
||||||
jdbcBatchExecutionEvent.sql = statementSql;
|
jdbcBatchExecutionEvent.sql = statementSql;
|
||||||
|
@ -244,13 +244,13 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
boolean cacheContentChanged,
|
boolean cacheContentChanged,
|
||||||
CacheActionDescription description) {
|
CacheActionDescription description) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final CachePutEvent cachePutEvent = (CachePutEvent) event;
|
final CachePutEvent cachePutEvent = (CachePutEvent) monitoringEvent;
|
||||||
cachePutEvent.end();
|
cachePutEvent.end();
|
||||||
if ( cachePutEvent.shouldCommit() ) {
|
if ( cachePutEvent.shouldCommit() ) {
|
||||||
cachePutEvent.sessionIdentifier = getSessionIdentifier( session );
|
cachePutEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -264,14 +264,14 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
boolean cacheContentChanged,
|
boolean cacheContentChanged,
|
||||||
CacheActionDescription description) {
|
CacheActionDescription description) {
|
||||||
completeCachePutEvent(
|
completeCachePutEvent(
|
||||||
event,
|
monitoringEvent,
|
||||||
session,
|
session,
|
||||||
cachedDomainDataAccess,
|
cachedDomainDataAccess,
|
||||||
persister,
|
persister,
|
||||||
|
@ -283,15 +283,15 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
boolean cacheContentChanged,
|
boolean cacheContentChanged,
|
||||||
boolean isNatualId,
|
boolean isNatualId,
|
||||||
CacheActionDescription description) {
|
CacheActionDescription description) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final CachePutEvent cachePutEvent = (CachePutEvent) event;
|
final CachePutEvent cachePutEvent = (CachePutEvent) monitoringEvent;
|
||||||
cachePutEvent.end();
|
cachePutEvent.end();
|
||||||
if ( cachePutEvent.shouldCommit() ) {
|
if ( cachePutEvent.shouldCommit() ) {
|
||||||
cachePutEvent.sessionIdentifier = getSessionIdentifier( session );
|
cachePutEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -307,14 +307,14 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
CollectionPersister persister,
|
CollectionPersister persister,
|
||||||
boolean cacheContentChanged,
|
boolean cacheContentChanged,
|
||||||
CacheActionDescription description) {
|
CacheActionDescription description) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final CachePutEvent cachePutEvent = (CachePutEvent) event;
|
final CachePutEvent cachePutEvent = (CachePutEvent) monitoringEvent;
|
||||||
cachePutEvent.end();
|
cachePutEvent.end();
|
||||||
if ( cachePutEvent.shouldCommit() ) {
|
if ( cachePutEvent.shouldCommit() ) {
|
||||||
cachePutEvent.sessionIdentifier = getSessionIdentifier( session );
|
cachePutEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -341,12 +341,12 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
boolean hit) {
|
boolean hit) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final CacheGetEvent cacheGetEvent = (CacheGetEvent) event;
|
final CacheGetEvent cacheGetEvent = (CacheGetEvent) monitoringEvent;
|
||||||
cacheGetEvent.end();
|
cacheGetEvent.end();
|
||||||
if ( cacheGetEvent.shouldCommit() ) {
|
if ( cacheGetEvent.shouldCommit() ) {
|
||||||
cacheGetEvent.sessionIdentifier = getSessionIdentifier( session );
|
cacheGetEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -359,14 +359,14 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
boolean isNaturalKey,
|
boolean isNaturalKey,
|
||||||
boolean hit) {
|
boolean hit) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final CacheGetEvent cacheGetEvent = (CacheGetEvent) event;
|
final CacheGetEvent cacheGetEvent = (CacheGetEvent) monitoringEvent;
|
||||||
cacheGetEvent.end();
|
cacheGetEvent.end();
|
||||||
if ( cacheGetEvent.shouldCommit() ) {
|
if ( cacheGetEvent.shouldCommit() ) {
|
||||||
cacheGetEvent.sessionIdentifier = getSessionIdentifier( session );
|
cacheGetEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -381,13 +381,13 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
CollectionPersister persister,
|
CollectionPersister persister,
|
||||||
boolean hit) {
|
boolean hit) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final CacheGetEvent cacheGetEvent = (CacheGetEvent) event;
|
final CacheGetEvent cacheGetEvent = (CacheGetEvent) monitoringEvent;
|
||||||
cacheGetEvent.end();
|
cacheGetEvent.end();
|
||||||
if ( cacheGetEvent.shouldCommit() ) {
|
if ( cacheGetEvent.shouldCommit() ) {
|
||||||
cacheGetEvent.sessionIdentifier = getSessionIdentifier( session );
|
cacheGetEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -420,18 +420,18 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeFlushEvent(
|
public void completeFlushEvent(
|
||||||
HibernateMonitoringEvent hibernateMonitoringEvent,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
org.hibernate.event.spi.FlushEvent event,
|
org.hibernate.event.spi.FlushEvent hibernateFlushEvent,
|
||||||
boolean autoFlush) {
|
boolean autoFlush) {
|
||||||
if ( hibernateMonitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final FlushEvent flushEvent = (FlushEvent) hibernateMonitoringEvent;
|
final FlushEvent jfrFlushEvent = (FlushEvent) monitoringEvent;
|
||||||
flushEvent.end();
|
jfrFlushEvent.end();
|
||||||
if ( flushEvent.shouldCommit() ) {
|
if ( jfrFlushEvent.shouldCommit() ) {
|
||||||
flushEvent.sessionIdentifier = getSessionIdentifier( event.getSession() );
|
jfrFlushEvent.sessionIdentifier = getSessionIdentifier( hibernateFlushEvent.getSession() );
|
||||||
flushEvent.numberOfEntitiesProcessed = event.getNumberOfEntitiesProcessed();
|
jfrFlushEvent.numberOfEntitiesProcessed = hibernateFlushEvent.getNumberOfEntitiesProcessed();
|
||||||
flushEvent.numberOfCollectionsProcessed = event.getNumberOfCollectionsProcessed();
|
jfrFlushEvent.numberOfCollectionsProcessed = hibernateFlushEvent.getNumberOfCollectionsProcessed();
|
||||||
flushEvent.isAutoFlush = autoFlush;
|
jfrFlushEvent.isAutoFlush = autoFlush;
|
||||||
flushEvent.commit();
|
jfrFlushEvent.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,17 +450,17 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completePartialFlushEvent(
|
public void completePartialFlushEvent(
|
||||||
HibernateMonitoringEvent hibernateMonitoringEvent,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
AutoFlushEvent event) {
|
AutoFlushEvent hibernateAutoFlushEvent) {
|
||||||
if ( event != null && hibernateMonitoringEvent != null) {
|
if ( monitoringEvent != null) {
|
||||||
final PartialFlushEvent flushEvent = (PartialFlushEvent) hibernateMonitoringEvent;
|
final PartialFlushEvent jfrPartialFlushEvent = (PartialFlushEvent) monitoringEvent;
|
||||||
flushEvent.end();
|
jfrPartialFlushEvent.end();
|
||||||
if ( flushEvent.shouldCommit() ) {
|
if ( jfrPartialFlushEvent.shouldCommit() ) {
|
||||||
flushEvent.sessionIdentifier = getSessionIdentifier( event.getSession() );
|
jfrPartialFlushEvent.sessionIdentifier = getSessionIdentifier( hibernateAutoFlushEvent.getSession() );
|
||||||
flushEvent.numberOfEntitiesProcessed = event.getNumberOfEntitiesProcessed();
|
jfrPartialFlushEvent.numberOfEntitiesProcessed = hibernateAutoFlushEvent.getNumberOfEntitiesProcessed();
|
||||||
flushEvent.numberOfCollectionsProcessed = event.getNumberOfCollectionsProcessed();
|
jfrPartialFlushEvent.numberOfCollectionsProcessed = hibernateAutoFlushEvent.getNumberOfCollectionsProcessed();
|
||||||
flushEvent.isAutoFlush = true;
|
jfrPartialFlushEvent.isAutoFlush = true;
|
||||||
flushEvent.commit();
|
jfrPartialFlushEvent.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -479,13 +479,13 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeDirtyCalculationEvent(
|
public void completeDirtyCalculationEvent(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
EntityEntry entry,
|
EntityEntry entry,
|
||||||
int[] dirtyProperties) {
|
int[] dirtyProperties) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final DirtyCalculationEvent dirtyCalculationEvent = (DirtyCalculationEvent) event;
|
final DirtyCalculationEvent dirtyCalculationEvent = (DirtyCalculationEvent) monitoringEvent;
|
||||||
dirtyCalculationEvent.end();
|
dirtyCalculationEvent.end();
|
||||||
if ( dirtyCalculationEvent.shouldCommit() ) {
|
if ( dirtyCalculationEvent.shouldCommit() ) {
|
||||||
dirtyCalculationEvent.sessionIdentifier = getSessionIdentifier( session );
|
dirtyCalculationEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
@ -511,10 +511,10 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completePrePartialFlush(
|
public void completePrePartialFlush(
|
||||||
HibernateMonitoringEvent event,
|
HibernateMonitoringEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
if ( event != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final PrePartialFlushEvent prePartialFlushEvent = (PrePartialFlushEvent) event;
|
final PrePartialFlushEvent prePartialFlushEvent = (PrePartialFlushEvent) monitoringEvent;
|
||||||
prePartialFlushEvent.end();
|
prePartialFlushEvent.end();
|
||||||
if ( prePartialFlushEvent.shouldCommit() ) {
|
if ( prePartialFlushEvent.shouldCommit() ) {
|
||||||
prePartialFlushEvent.sessionIdentifier = getSessionIdentifier( session );
|
prePartialFlushEvent.sessionIdentifier = getSessionIdentifier( session );
|
||||||
|
|
Loading…
Reference in New Issue