diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRecreateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRecreateAction.java index d6fa2201e8..8fdf106283 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRecreateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRecreateAction.java @@ -7,9 +7,9 @@ package org.hibernate.action.internal; import org.hibernate.HibernateException; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PostCollectionRecreateEvent; import org.hibernate.event.spi.PostCollectionRecreateEventListener; import org.hibernate.event.spi.PreCollectionRecreateEvent; @@ -46,15 +46,15 @@ public final class CollectionRecreateAction extends CollectionAction { final SharedSessionContractImplementor session = getSession(); final CollectionPersister persister = getPersister(); final Object key = getKey(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginCollectionRecreateEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginCollectionRecreateEvent(); boolean success = false; try { persister.recreate( collection, key, session ); success = true; } finally { - eventManager.completeCollectionRecreateEvent( event, key, persister.getRole(), success, session ); + eventMonitor.completeCollectionRecreateEvent( event, key, persister.getRole(), success, session ); } session.getPersistenceContextInternal().getCollectionEntry( collection ).afterAction( collection ); diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRemoveAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRemoveAction.java index fbb4dcb9e3..5c951376a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRemoveAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionRemoveAction.java @@ -8,9 +8,9 @@ import org.hibernate.AssertionFailure; import org.hibernate.HibernateException; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PostCollectionRemoveEvent; import org.hibernate.event.spi.PostCollectionRemoveEventListener; import org.hibernate.event.spi.PreCollectionRemoveEvent; @@ -112,15 +112,15 @@ public final class CollectionRemoveAction extends CollectionAction { // knowing if the collection is actually empty without querying the db) final CollectionPersister persister = getPersister(); final Object key = getKey(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginCollectionRemoveEvent(); boolean success = false; try { persister.remove( key, session ); success = true; } finally { - eventManager.completeCollectionRemoveEvent( event, key, persister.getRole(), success, session ); + eventMonitor.completeCollectionRemoveEvent( event, key, persister.getRole(), success, session ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionUpdateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionUpdateAction.java index 350416d68c..d9b8ce08e7 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionUpdateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/CollectionUpdateAction.java @@ -8,9 +8,9 @@ import org.hibernate.AssertionFailure; import org.hibernate.HibernateException; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PostCollectionUpdateEvent; import org.hibernate.event.spi.PostCollectionUpdateEventListener; import org.hibernate.event.spi.PreCollectionUpdateEvent; @@ -65,8 +65,8 @@ public final class CollectionUpdateAction extends CollectionAction { // Do nothing - we only need to notify the cache } else { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginCollectionUpdateEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginCollectionUpdateEvent(); boolean success = false; try { if ( !affectedByFilters && collection.empty() ) { @@ -93,7 +93,7 @@ public final class CollectionUpdateAction extends CollectionAction { success = true; } finally { - eventManager.completeCollectionUpdateEvent( event, key, persister.getRole(), success, session ); + eventMonitor.completeCollectionUpdateEvent( event, key, persister.getRole(), success, session ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java index 6c91e67dab..33941ec761 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java @@ -13,9 +13,9 @@ import org.hibernate.engine.spi.EntityKey; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.event.service.spi.EventListenerGroup; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PostCommitDeleteEventListener; import org.hibernate.event.spi.PostDeleteEvent; import org.hibernate.event.spi.PostDeleteEventListener; @@ -128,15 +128,15 @@ public class EntityDeleteAction extends EntityAction { final Object ck = lockCacheItem(); if ( !isCascadeDeleteEnabled && !veto ) { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityDeleteEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityDeleteEvent(); boolean success = false; try { persister.getDeleteCoordinator().delete( instance, id, version, session ); success = true; } finally { - eventManager.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, session ); + eventMonitor.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, session ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java index 2e288647aa..744841976c 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityIdentityInsertAction.java @@ -10,9 +10,9 @@ import org.hibernate.engine.spi.EntityKey; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.event.service.spi.EventListenerGroup; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PostCommitInsertEventListener; import org.hibernate.event.spi.PostInsertEvent; import org.hibernate.event.spi.PostInsertEventListener; @@ -82,8 +82,8 @@ public class EntityIdentityInsertAction extends AbstractEntityInsertAction { // else inserted the same pk first, the insert would fail if ( !isVeto() ) { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityInsertEvent(); boolean success = false; final GeneratedValues generatedValues; try { @@ -92,7 +92,7 @@ public class EntityIdentityInsertAction extends AbstractEntityInsertAction { success = true; } finally { - eventManager.completeEntityInsertEvent( event, generatedId, persister.getEntityName(), success, session ); + eventMonitor.completeEntityInsertEvent( event, generatedId, persister.getEntityName(), success, session ); } final PersistenceContext persistenceContext = session.getPersistenceContextInternal(); if ( persister.getRowIdMapping() != null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java index 252d61e07b..fdf790f74c 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java @@ -15,8 +15,8 @@ import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.service.spi.EventListenerGroup; import org.hibernate.event.spi.EventSource; import org.hibernate.event.spi.PostCommitInsertEventListener; @@ -105,8 +105,8 @@ public class EntityInsertAction extends AbstractEntityInsertAction { if ( !veto ) { final EntityPersister persister = getPersister(); final Object instance = getInstance(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityInsertEvent(); boolean success = false; final GeneratedValues generatedValues; try { @@ -114,7 +114,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction { success = true; } finally { - eventManager.completeEntityInsertEvent( event, id, persister.getEntityName(), success, session ); + eventMonitor.completeEntityInsertEvent( event, id, persister.getEntityName(), success, session ); } final PersistenceContext persistenceContext = session.getPersistenceContextInternal(); final EntityEntry entry = persistenceContext.getEntry( instance ); @@ -187,8 +187,8 @@ public class EntityInsertAction extends AbstractEntityInsertAction { protected boolean cacheInsert(EntityPersister persister, Object ck) { final SharedSessionContractImplementor session = getSession(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); final EntityDataAccess cacheAccessStrategy = persister.getCacheAccessStrategy(); boolean insert = false; try { @@ -197,13 +197,13 @@ public class EntityInsertAction extends AbstractEntityInsertAction { return insert; } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, cacheAccessStrategy, getPersister(), insert, - EventManager.CacheActionDescription.ENTITY_INSERT + EventMonitor.CacheActionDescription.ENTITY_INSERT ); session.getEventListenerManager().cachePutEnd(); } @@ -280,8 +280,8 @@ public class EntityInsertAction extends AbstractEntityInsertAction { protected boolean cacheAfterInsert(EntityDataAccess cache, Object ck) { final SharedSessionContractImplementor session = getSession(); final SessionEventListenerManager eventListenerManager = session.getEventListenerManager(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); boolean afterInsert = false; try { eventListenerManager.cachePutStart(); @@ -289,13 +289,13 @@ public class EntityInsertAction extends AbstractEntityInsertAction { return afterInsert; } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, cache, getPersister(), afterInsert, - EventManager.CacheActionDescription.ENTITY_AFTER_INSERT + EventMonitor.CacheActionDescription.ENTITY_AFTER_INSERT ); eventListenerManager.cachePutEnd(); } diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java index 91b3392910..f4b8e329cb 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java @@ -17,8 +17,8 @@ import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.Status; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.service.spi.EventListenerGroup; import org.hibernate.event.spi.EventSource; import org.hibernate.event.spi.PostCommitUpdateEventListener; @@ -164,8 +164,8 @@ public class EntityUpdateAction extends EntityAction { final Object instance = getInstance(); final Object previousVersion = getPreviousVersion(); final Object ck = lockCacheItem( previousVersion ); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityUpdateEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityUpdateEvent(); boolean success = false; final GeneratedValues generatedValues; try { @@ -183,7 +183,7 @@ public class EntityUpdateAction extends EntityAction { success = true; } finally { - eventManager.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, session ); + eventMonitor.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, session ); } final EntityEntry entry = session.getPersistenceContextInternal().getEntry( instance ); if ( entry == null ) { @@ -329,8 +329,8 @@ public class EntityUpdateAction extends EntityAction { protected boolean updateCache(EntityPersister persister, Object previousVersion, Object ck) { final SharedSessionContractImplementor session = getSession(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); final EntityDataAccess cacheAccessStrategy = persister.getCacheAccessStrategy(); boolean update = false; try { @@ -339,13 +339,13 @@ public class EntityUpdateAction extends EntityAction { return update; } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, cacheAccessStrategy, getPersister(), update, - EventManager.CacheActionDescription.ENTITY_UPDATE + EventMonitor.CacheActionDescription.ENTITY_UPDATE ); session.getEventListenerManager().cachePutEnd(); } @@ -455,21 +455,21 @@ public class EntityUpdateAction extends EntityAction { protected void cacheAfterUpdate(EntityDataAccess cache, Object ck, SharedSessionContractImplementor session) { final SessionEventListenerManager eventListenerManager = session.getEventListenerManager(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); boolean put = false; try { eventListenerManager.cachePutStart(); put = cache.afterUpdate( session, ck, cacheEntry, nextVersion, previousVersion, lock ); } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, cache, getPersister(), put, - EventManager.CacheActionDescription.ENTITY_AFTER_UPDATE + EventMonitor.CacheActionDescription.ENTITY_AFTER_UPDATE ); final StatisticsImplementor statistics = session.getFactory().getStatistics(); if ( put && statistics.isStatisticsEnabled() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java index 5ee4371a98..e6910b6d82 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java @@ -15,8 +15,8 @@ import org.hibernate.cache.spi.QueryResultsCache; import org.hibernate.cache.spi.QueryResultsRegion; import org.hibernate.cache.spi.TimestampsCache; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; @@ -61,19 +61,19 @@ public class QueryResultsCacheImpl implements QueryResultsCache { deepCopy( results ) ); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); try { session.getEventListenerManager().cachePutStart(); cacheRegion.putIntoCache( key, cacheItem, session ); } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, cacheRegion, true, - EventManager.CacheActionDescription.QUERY_RESULT + EventMonitor.CacheActionDescription.QUERY_RESULT ); session.getEventListenerManager().cachePutEnd(); } @@ -152,14 +152,14 @@ public class QueryResultsCacheImpl implements QueryResultsCache { private CacheItem getCachedData(QueryKey key, SharedSessionContractImplementor session) { CacheItem cachedItem = null; - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent(); try { session.getEventListenerManager().cacheGetStart(); cachedItem = (CacheItem) cacheRegion.getFromCache( key, session ); } finally { - eventManager.completeCacheGetEvent( + eventMonitor.completeCacheGetEvent( cacheGetEvent, session, cacheRegion, diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/TimestampsCacheEnabledImpl.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/TimestampsCacheEnabledImpl.java index ad6ee62270..3636532d9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/TimestampsCacheEnabledImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/TimestampsCacheEnabledImpl.java @@ -12,8 +12,8 @@ import org.hibernate.cache.spi.TimestampsRegion; import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.stat.spi.StatisticsImplementor; import org.jboss.logging.Logger; @@ -58,8 +58,8 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache { if ( debugEnabled ) { log.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts ); } - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); try { eventListenerManager.cachePutStart(); @@ -68,12 +68,12 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache { timestampsRegion.putIntoCache( space, ts, session ); } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, timestampsRegion, true, - EventManager.CacheActionDescription.TIMESTAMP_PRE_INVALIDATE + EventMonitor.CacheActionDescription.TIMESTAMP_PRE_INVALIDATE ); eventListenerManager.cachePutEnd(); } @@ -100,19 +100,19 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache { } final SessionEventListenerManager eventListenerManager = session.getEventListenerManager(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); try { eventListenerManager.cachePutStart(); timestampsRegion.putIntoCache( space, ts, session ); } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session, timestampsRegion, true, - EventManager.CacheActionDescription.TIMESTAMP_INVALIDATE + EventMonitor.CacheActionDescription.TIMESTAMP_INVALIDATE ); eventListenerManager.cachePutEnd(); @@ -192,14 +192,14 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache { private Long getLastUpdateTimestampForSpace(String space, SharedSessionContractImplementor session) { Long ts = null; - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent(); try { session.getEventListenerManager().cacheGetStart(); ts = (Long) timestampsRegion.getFromCache( space, session ); } finally { - eventManager.completeCacheGetEvent( + eventMonitor.completeCacheGetEvent( cacheGetEvent, session, timestampsRegion, diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/CacheHelper.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/CacheHelper.java index 112a4559c8..3ff16d551a 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/CacheHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/CacheHelper.java @@ -8,8 +8,8 @@ import org.hibernate.cache.MutableCacheKeyBuilder; import org.hibernate.cache.spi.access.CachedDomainDataAccess; import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; @@ -42,13 +42,13 @@ public final class CacheHelper { final SessionEventListenerManager eventListenerManager = session.getEventListenerManager(); Object cachedValue = null; eventListenerManager.cacheGetStart(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent(); try { cachedValue = cacheAccess.get( session, cacheKey ); } finally { - eventManager.completeCacheGetEvent( + eventMonitor.completeCacheGetEvent( cacheGetEvent, session, cacheAccess.getRegion(), @@ -69,13 +69,13 @@ public final class CacheHelper { final SessionEventListenerManager eventListenerManager = session.getEventListenerManager(); Object cachedValue = null; eventListenerManager.cacheGetStart(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent(); try { cachedValue = cacheAccess.get( session, cacheKey ); } finally { - eventManager.completeCacheGetEvent( + eventMonitor.completeCacheGetEvent( cacheGetEvent, session, cacheAccess.getRegion(), diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java index e5ea7f9abd..013af9a253 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java @@ -21,8 +21,8 @@ import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.Resolution; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.metamodel.mapping.NaturalIdLogging; import org.hibernate.metamodel.mapping.NaturalIdMapping; @@ -265,7 +265,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa final SessionFactoryImplementor factory = s.getFactory(); final StatisticsImplementor statistics = factory.getStatistics(); - final EventManager eventManager = s.getEventManager(); + final EventMonitor eventMonitor = s.getEventMonitor(); switch ( source ) { case LOAD: { if ( CacheHelper.fromSharedCache( s, cacheKey, persister, cacheAccess ) != null ) { @@ -273,7 +273,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa return; } boolean put = false; - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); try { put = cacheAccess.putFromLoad( s, @@ -290,14 +290,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa } } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session(), cacheAccess, rootEntityPersister, put, true, - EventManager.CacheActionDescription.ENTITY_LOAD + EventMonitor.CacheActionDescription.ENTITY_LOAD ); } @@ -305,7 +305,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa } case INSERT: { boolean put = false; - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); try { put = cacheAccess.insert( s, cacheKey, id ); @@ -317,14 +317,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa } } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session(), cacheAccess, rootEntityPersister, put, true, - EventManager.CacheActionDescription.ENTITY_INSERT + EventMonitor.CacheActionDescription.ENTITY_INSERT ); } @@ -358,7 +358,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa final SoftLock lock = cacheAccess.lockItem( s, cacheKey, null ); boolean put = false; - final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent(); + final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent(); try { put = cacheAccess.update( s, cacheKey, id ); if ( put && statistics.isStatisticsEnabled() ) { @@ -369,14 +369,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa } } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEvent, session(), cacheAccess, rootEntityPersister, put, true, - EventManager.CacheActionDescription.ENTITY_UPDATE + EventMonitor.CacheActionDescription.ENTITY_UPDATE ); } @@ -385,7 +385,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa cacheAccess.unlockItem( s, previousCacheKey, removalLock ); if (success) { boolean putAfterUpdate = false; - final HibernateMonitoringEvent cachePutEventAfterUpdate = eventManager.beginCachePutEvent(); + final DiagnosticEvent cachePutEventAfterUpdate = eventMonitor.beginCachePutEvent(); try { putAfterUpdate = cacheAccess.afterUpdate( s, @@ -402,14 +402,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa } } finally { - eventManager.completeCachePutEvent( + eventMonitor.completeCachePutEvent( cachePutEventAfterUpdate, session(), cacheAccess, rootEntityPersister, putAfterUpdate, true, - EventManager.CacheActionDescription.ENTITY_AFTER_UPDATE + EventMonitor.CacheActionDescription.ENTITY_AFTER_UPDATE ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchImpl.java index 15c9ca7a81..2d9fbd27d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchImpl.java @@ -21,8 +21,8 @@ import org.hibernate.engine.jdbc.spi.JdbcCoordinator; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.resource.jdbc.spi.JdbcEventHandler; import org.hibernate.resource.jdbc.spi.JdbcSessionOwner; @@ -258,14 +258,14 @@ public class BatchImpl implements Batch { try { if ( statementDetails.getMutatingTableDetails().isIdentifierTable() ) { final int[] rowCounts; - final EventManager eventManager = jdbcSessionOwner.getEventManager(); - final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcBatchExecutionEvent(); + final EventMonitor eventMonitor = jdbcSessionOwner.getEventMonitor(); + final DiagnosticEvent executionEvent = eventMonitor.beginJdbcBatchExecutionEvent(); try { eventHandler.jdbcExecuteBatchStart(); rowCounts = statement.executeBatch(); } finally { - eventManager.completeJdbcBatchExecutionEvent( executionEvent, sql ); + eventMonitor.completeJdbcBatchExecutionEvent( executionEvent, sql ); eventHandler.jdbcExecuteBatchEnd(); } checkRowCounts( rowCounts, statementDetails ); 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 2ed99ad80f..982ff6be53 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 @@ -30,8 +30,8 @@ import org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl; import org.hibernate.engine.jdbc.internal.JdbcServicesImpl; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; -import org.hibernate.event.internal.EmptyEventManager; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.internal.EmptyEventMonitor; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.log.ConnectionInfoLogger; import org.hibernate.internal.util.StringHelper; @@ -619,7 +619,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator 0 || persistenceContext.getCollectionEntriesSize() > 0 ) { - final HibernateMonitoringEvent flushEvent = eventManager.beginFlushEvent(); + final DiagnosticEvent flushEvent = eventMonitor.beginFlushEvent(); try { source.getEventListenerManager().flushStart(); @@ -40,7 +40,7 @@ public class DefaultFlushEventListener extends AbstractFlushingEventListener imp postFlush( source ); } finally { - eventManager.completeFlushEvent( flushEvent, event ); + eventMonitor.completeFlushEvent( flushEvent, event ); source.getEventListenerManager().flushEnd( event.getNumberOfEntitiesProcessed(), event.getNumberOfCollectionsProcessed() diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/EmptyEventManager.java b/hibernate-core/src/main/java/org/hibernate/event/internal/EmptyEventMonitor.java similarity index 53% rename from hibernate-core/src/main/java/org/hibernate/event/internal/EmptyEventManager.java rename to hibernate-core/src/main/java/org/hibernate/event/internal/EmptyEventMonitor.java index ed05ae31f5..ba7de973c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/EmptyEventManager.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/EmptyEventMonitor.java @@ -10,107 +10,107 @@ import org.hibernate.cache.spi.access.CachedDomainDataAccess; import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.event.spi.AutoFlushEvent; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.FlushEvent; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; /** - * An {@link EventManager} that ignores all events. + * An {@link EventMonitor} that ignores all events. */ -public final class EmptyEventManager implements EventManager { +public final class EmptyEventMonitor implements EventMonitor { @Override - public HibernateMonitoringEvent beginSessionOpenEvent() { + public DiagnosticEvent beginSessionOpenEvent() { return null; } @Override - public void completeSessionOpenEvent(HibernateMonitoringEvent sessionOpenEvent, SharedSessionContractImplementor session) { + public void completeSessionOpenEvent(DiagnosticEvent sessionOpenEvent, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginSessionClosedEvent() { + public DiagnosticEvent beginSessionClosedEvent() { return null; } @Override public void completeSessionClosedEvent( - HibernateMonitoringEvent sessionClosedEvent, + DiagnosticEvent sessionClosedEvent, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginJdbcConnectionAcquisitionEvent() { + public DiagnosticEvent beginJdbcConnectionAcquisitionEvent() { return null; } @Override public void completeJdbcConnectionAcquisitionEvent( - HibernateMonitoringEvent jdbcConnectionAcquisitionEvent, + DiagnosticEvent jdbcConnectionAcquisitionEvent, SharedSessionContractImplementor session, Object tenantId) { } @Override - public HibernateMonitoringEvent beginJdbcConnectionReleaseEvent() { + public DiagnosticEvent beginJdbcConnectionReleaseEvent() { return null; } @Override public void completeJdbcConnectionReleaseEvent( - HibernateMonitoringEvent jdbcConnectionReleaseEvent, + DiagnosticEvent jdbcConnectionReleaseEvent, SharedSessionContractImplementor session, Object tenantId) { } @Override - public HibernateMonitoringEvent beginJdbcPreparedStatementCreationEvent() { + public DiagnosticEvent beginJdbcPreparedStatementCreationEvent() { return null; } @Override public void completeJdbcPreparedStatementCreationEvent( - HibernateMonitoringEvent jdbcPreparedStatementCreation, + DiagnosticEvent jdbcPreparedStatementCreation, String preparedStatementSql) { } @Override - public HibernateMonitoringEvent beginJdbcPreparedStatementExecutionEvent() { + public DiagnosticEvent beginJdbcPreparedStatementExecutionEvent() { return null; } @Override public void completeJdbcPreparedStatementExecutionEvent( - HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent, + DiagnosticEvent jdbcPreparedStatementExecutionEvent, String preparedStatementSql) { } @Override - public HibernateMonitoringEvent beginJdbcBatchExecutionEvent() { + public DiagnosticEvent beginJdbcBatchExecutionEvent() { return null; } @Override - public void completeJdbcBatchExecutionEvent(HibernateMonitoringEvent jdbcBatchExecutionEvent, String statementSql) { + public void completeJdbcBatchExecutionEvent(DiagnosticEvent jdbcBatchExecutionEvent, String statementSql) { } @Override - public HibernateMonitoringEvent beginCachePutEvent() { + public DiagnosticEvent beginCachePutEvent() { return null; } @Override public void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, + DiagnosticEvent cachePutEvent, SharedSessionContractImplementor session, Region region, boolean cacheContentChanged, @@ -120,7 +120,7 @@ public final class EmptyEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, + DiagnosticEvent cachePutEvent, SharedSessionContractImplementor session, CachedDomainDataAccess cachedDomainDataAccess, EntityPersister persister, @@ -131,7 +131,7 @@ public final class EmptyEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, + DiagnosticEvent cachePutEvent, SharedSessionContractImplementor session, CachedDomainDataAccess cachedDomainDataAccess, EntityPersister persister, @@ -143,7 +143,7 @@ public final class EmptyEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, + DiagnosticEvent cachePutEvent, SharedSessionContractImplementor session, CachedDomainDataAccess cachedDomainDataAccess, CollectionPersister persister, @@ -153,13 +153,13 @@ public final class EmptyEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginCacheGetEvent() { + public DiagnosticEvent beginCacheGetEvent() { return null; } @Override public void completeCacheGetEvent( - HibernateMonitoringEvent cacheGetEvent, + DiagnosticEvent cacheGetEvent, SharedSessionContractImplementor session, Region region, boolean hit) { @@ -168,7 +168,7 @@ public final class EmptyEventManager implements EventManager { @Override public void completeCacheGetEvent( - HibernateMonitoringEvent cacheGetEvent, + DiagnosticEvent cacheGetEvent, SharedSessionContractImplementor session, Region region, EntityPersister persister, @@ -179,7 +179,7 @@ public final class EmptyEventManager implements EventManager { @Override public void completeCacheGetEvent( - HibernateMonitoringEvent cacheGetEvent, + DiagnosticEvent cacheGetEvent, SharedSessionContractImplementor session, Region region, CollectionPersister persister, @@ -188,38 +188,38 @@ public final class EmptyEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginFlushEvent() { + public DiagnosticEvent beginFlushEvent() { return null; } @Override - public void completeFlushEvent(HibernateMonitoringEvent flushEvent, FlushEvent event) { + public void completeFlushEvent(DiagnosticEvent flushEvent, FlushEvent event) { } @Override - public void completeFlushEvent(HibernateMonitoringEvent flushEvent, FlushEvent event, boolean autoFlush) { + public void completeFlushEvent(DiagnosticEvent flushEvent, FlushEvent event, boolean autoFlush) { } @Override - public HibernateMonitoringEvent beginPartialFlushEvent() { + public DiagnosticEvent beginPartialFlushEvent() { return null; } @Override - public void completePartialFlushEvent(HibernateMonitoringEvent flushEvent, AutoFlushEvent event) { + public void completePartialFlushEvent(DiagnosticEvent flushEvent, AutoFlushEvent event) { } @Override - public HibernateMonitoringEvent beginDirtyCalculationEvent() { + public DiagnosticEvent beginDirtyCalculationEvent() { return null; } @Override public void completeDirtyCalculationEvent( - HibernateMonitoringEvent dirtyCalculationEvent, + DiagnosticEvent dirtyCalculationEvent, SharedSessionContractImplementor session, EntityPersister persister, EntityEntry entry, @@ -228,25 +228,25 @@ public final class EmptyEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginPrePartialFlush() { + public DiagnosticEvent beginPrePartialFlush() { return null; } @Override public void completePrePartialFlush( - HibernateMonitoringEvent prePartialFlush, + DiagnosticEvent prePartialFlush, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginEntityInsertEvent() { + public DiagnosticEvent beginEntityInsertEvent() { return null; } @Override public void completeEntityInsertEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -254,13 +254,13 @@ public final class EmptyEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityUpdateEvent() { + public DiagnosticEvent beginEntityUpdateEvent() { return null; } @Override public void completeEntityUpdateEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -268,23 +268,23 @@ public final class EmptyEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityUpsertEvent() { + public DiagnosticEvent beginEntityUpsertEvent() { return null; } @Override - public void completeEntityUpsertEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { + public void completeEntityUpsertEvent(DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginEntityDeleteEvent() { + public DiagnosticEvent beginEntityDeleteEvent() { return null; } @Override public void completeEntityDeleteEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -292,42 +292,42 @@ public final class EmptyEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityLockEvent() { + public DiagnosticEvent beginEntityLockEvent() { return null; } @Override - public void completeEntityLockEvent(HibernateMonitoringEvent event, Object id, String entityName, LockMode lockMode, boolean success, SharedSessionContractImplementor session) { + public void completeEntityLockEvent(DiagnosticEvent event, Object id, String entityName, LockMode lockMode, boolean success, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginCollectionRecreateEvent() { + public DiagnosticEvent beginCollectionRecreateEvent() { return null; } @Override - public void completeCollectionRecreateEvent(HibernateMonitoringEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { + public void completeCollectionRecreateEvent(DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginCollectionUpdateEvent() { + public DiagnosticEvent beginCollectionUpdateEvent() { return null; } @Override - public void completeCollectionUpdateEvent(HibernateMonitoringEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { + public void completeCollectionUpdateEvent(DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { } @Override - public HibernateMonitoringEvent beginCollectionRemoveEvent() { + public DiagnosticEvent beginCollectionRemoveEvent() { return null; } @Override - public void completeCollectionRemoveEvent(HibernateMonitoringEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { + public void completeCollectionRemoveEvent(DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { } } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/DiagnosticEvent.java b/hibernate-core/src/main/java/org/hibernate/event/spi/DiagnosticEvent.java new file mode 100644 index 0000000000..794ff69df6 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/DiagnosticEvent.java @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.event.spi; + +import org.hibernate.Incubating; + +/** + * An event which may be collected by the {@link EventMonitor}. + *

+ * An implementation of {@code EventMonitor} must define its + * own implementation or implementations of this interface, + * but these subtypes are never visible to the code which + * calls the {@code EventMonitor} to report events. + * + * @since 7.0 + */ +@Incubating +public interface DiagnosticEvent { +} diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/EventManager.java b/hibernate-core/src/main/java/org/hibernate/event/spi/EventManager.java index 2cd50ce59d..c2d0732067 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/EventManager.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/EventManager.java @@ -4,226 +4,10 @@ */ package org.hibernate.event.spi; -import org.hibernate.Incubating; -import org.hibernate.LockMode; -import org.hibernate.cache.spi.Region; -import org.hibernate.cache.spi.access.CachedDomainDataAccess; -import org.hibernate.engine.spi.EntityEntry; -import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.persister.collection.CollectionPersister; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.service.JavaServiceLoadable; - /** - * Defines a contract for reporting and monitoring low-level events - * involving interactions between the {@linkplain org.hibernate.Session - * session} and the database or second-level cache. - *

- * For example, this interface is implemented by Hibernate JFR to report - * events to Java Flight Recorder. - *

- * Note that event reporting is different to aggregate metrics, - * which Hibernate exposes via the {@link org.hibernate.stat.Statistics} - * interface. - * - * @apiNote This an incubating API, subject to change. - * - * @since 6.4 + * @deprecated Renamed {@link EventMonitor}. */ -@JavaServiceLoadable -@Incubating -public interface EventManager { - HibernateMonitoringEvent beginSessionOpenEvent(); +@Deprecated(since = "7", forRemoval = true) +public interface EventManager extends EventMonitor { - void completeSessionOpenEvent( - HibernateMonitoringEvent sessionOpenEvent, - SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginSessionClosedEvent(); - - void completeSessionClosedEvent( - HibernateMonitoringEvent sessionClosedEvent, - SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginJdbcConnectionAcquisitionEvent(); - - void completeJdbcConnectionAcquisitionEvent( - HibernateMonitoringEvent jdbcConnectionAcquisitionEvent, - SharedSessionContractImplementor session, - Object tenantId); - - HibernateMonitoringEvent beginJdbcConnectionReleaseEvent(); - - void completeJdbcConnectionReleaseEvent( - HibernateMonitoringEvent jdbcConnectionReleaseEvent, - SharedSessionContractImplementor session, - Object tenantId); - - HibernateMonitoringEvent beginJdbcPreparedStatementCreationEvent(); - - void completeJdbcPreparedStatementCreationEvent( - HibernateMonitoringEvent jdbcPreparedStatementCreation, - String preparedStatementSql); - - HibernateMonitoringEvent beginJdbcPreparedStatementExecutionEvent(); - - void completeJdbcPreparedStatementExecutionEvent( - HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent, - String preparedStatementSql); - - HibernateMonitoringEvent beginJdbcBatchExecutionEvent(); - - void completeJdbcBatchExecutionEvent( - HibernateMonitoringEvent jdbcBatchExecutionEvent, - String statementSql); - - HibernateMonitoringEvent beginCachePutEvent(); - - void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, - SharedSessionContractImplementor session, - Region region, - boolean cacheContentChanged, - CacheActionDescription description); - - void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, - SharedSessionContractImplementor session, - CachedDomainDataAccess cachedDomainDataAccess, - EntityPersister persister, - boolean cacheContentChanged, - CacheActionDescription description); - - void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, - SharedSessionContractImplementor session, - CachedDomainDataAccess cachedDomainDataAccess, - EntityPersister persister, - boolean cacheContentChanged, - boolean isNatualId, - CacheActionDescription description); - - void completeCachePutEvent( - HibernateMonitoringEvent cachePutEvent, - SharedSessionContractImplementor session, - CachedDomainDataAccess cachedDomainDataAccess, - CollectionPersister persister, - boolean cacheContentChanged, - CacheActionDescription description); - - HibernateMonitoringEvent beginCacheGetEvent(); - - void completeCacheGetEvent( - HibernateMonitoringEvent cacheGetEvent, - SharedSessionContractImplementor session, - Region region, - boolean hit); - - void completeCacheGetEvent( - HibernateMonitoringEvent cacheGetEvent, - SharedSessionContractImplementor session, - Region region, - EntityPersister persister, - boolean isNaturalKey, - boolean hit); - - void completeCacheGetEvent( - HibernateMonitoringEvent cacheGetEvent, - SharedSessionContractImplementor session, - Region region, - CollectionPersister persister, - boolean hit); - - HibernateMonitoringEvent beginFlushEvent(); - - void completeFlushEvent( - HibernateMonitoringEvent flushEvent, - org.hibernate.event.spi.FlushEvent event); - - void completeFlushEvent( - HibernateMonitoringEvent flushEvent, - org.hibernate.event.spi.FlushEvent event, - boolean autoFlush); - - HibernateMonitoringEvent beginPartialFlushEvent(); - - void completePartialFlushEvent( - HibernateMonitoringEvent flushEvent, - AutoFlushEvent event); - - HibernateMonitoringEvent beginDirtyCalculationEvent(); - - void completeDirtyCalculationEvent( - HibernateMonitoringEvent dirtyCalculationEvent, - SharedSessionContractImplementor session, - EntityPersister persister, - EntityEntry entry, - int[] dirtyProperties); - - HibernateMonitoringEvent beginPrePartialFlush(); - - void completePrePartialFlush( - HibernateMonitoringEvent prePartialFlush, - SharedSessionContractImplementor session - ); - - HibernateMonitoringEvent beginEntityInsertEvent(); - - void completeEntityInsertEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginEntityUpdateEvent(); - - void completeEntityUpdateEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginEntityUpsertEvent(); - - void completeEntityUpsertEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginEntityDeleteEvent(); - - void completeEntityDeleteEvent(HibernateMonitoringEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginEntityLockEvent(); - - void completeEntityLockEvent(HibernateMonitoringEvent event, Object id, String entityName, LockMode lockMode, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginCollectionRecreateEvent(); - - void completeCollectionRecreateEvent(HibernateMonitoringEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginCollectionUpdateEvent(); - - void completeCollectionUpdateEvent(HibernateMonitoringEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session); - - HibernateMonitoringEvent beginCollectionRemoveEvent(); - - void completeCollectionRemoveEvent(HibernateMonitoringEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session); - - enum CacheActionDescription { - ENTITY_INSERT( "Entity Insert" ), - ENTITY_AFTER_INSERT( "Entity After Insert" ), - ENTITY_UPDATE( "Entity Update" ), - ENTITY_LOAD( "Entity Load" ), - ENTITY_AFTER_UPDATE( "Entity After Update" ), - TIMESTAMP_PRE_INVALIDATE( "Timestamp Pre Invalidate" ), - TIMESTAMP_INVALIDATE( "Timestamp Invalidate" ), - COLLECTION_INSERT( "Collection Insert" ), - QUERY_RESULT( "Query Result" ); - - - private final String text; - - CacheActionDescription(String text) { - this.text = text; - } - - @Override - public String toString() { - return text; - } - - public String getText() { - return text; - } - } } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/EventMonitor.java b/hibernate-core/src/main/java/org/hibernate/event/spi/EventMonitor.java new file mode 100644 index 0000000000..93c79b2315 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/EventMonitor.java @@ -0,0 +1,230 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.event.spi; + +import org.hibernate.Incubating; +import org.hibernate.LockMode; +import org.hibernate.cache.spi.Region; +import org.hibernate.cache.spi.access.CachedDomainDataAccess; +import org.hibernate.engine.spi.EntityEntry; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.persister.collection.CollectionPersister; +import org.hibernate.persister.entity.EntityPersister; +import org.hibernate.service.JavaServiceLoadable; + +/** + * Contract implemented by services which collect, report, or monitor + * {@linkplain DiagnosticEvent diagnostic events} involving interactions + * between the {@linkplain org.hibernate.Session session} and the database + * or second-level cache. + *

+ * For example, this interface is implemented by Hibernate JFR to report + * events to Java Flight Recorder. + *

+ * Note that event reporting is different to aggregate metrics, + * which Hibernate exposes via the {@link org.hibernate.stat.Statistics} + * interface. + * + * @apiNote This an incubating API, subject to change. + * + * @since 7.0 + */ +@JavaServiceLoadable +@Incubating +public interface EventMonitor { + DiagnosticEvent beginSessionOpenEvent(); + + void completeSessionOpenEvent( + DiagnosticEvent sessionOpenEvent, + SharedSessionContractImplementor session); + + DiagnosticEvent beginSessionClosedEvent(); + + void completeSessionClosedEvent( + DiagnosticEvent sessionClosedEvent, + SharedSessionContractImplementor session); + + DiagnosticEvent beginJdbcConnectionAcquisitionEvent(); + + void completeJdbcConnectionAcquisitionEvent( + DiagnosticEvent jdbcConnectionAcquisitionEvent, + SharedSessionContractImplementor session, + Object tenantId); + + DiagnosticEvent beginJdbcConnectionReleaseEvent(); + + void completeJdbcConnectionReleaseEvent( + DiagnosticEvent jdbcConnectionReleaseEvent, + SharedSessionContractImplementor session, + Object tenantId); + + DiagnosticEvent beginJdbcPreparedStatementCreationEvent(); + + void completeJdbcPreparedStatementCreationEvent( + DiagnosticEvent jdbcPreparedStatementCreation, + String preparedStatementSql); + + DiagnosticEvent beginJdbcPreparedStatementExecutionEvent(); + + void completeJdbcPreparedStatementExecutionEvent( + DiagnosticEvent jdbcPreparedStatementExecutionEvent, + String preparedStatementSql); + + DiagnosticEvent beginJdbcBatchExecutionEvent(); + + void completeJdbcBatchExecutionEvent( + DiagnosticEvent jdbcBatchExecutionEvent, + String statementSql); + + DiagnosticEvent beginCachePutEvent(); + + void completeCachePutEvent( + DiagnosticEvent cachePutEvent, + SharedSessionContractImplementor session, + Region region, + boolean cacheContentChanged, + CacheActionDescription description); + + void completeCachePutEvent( + DiagnosticEvent cachePutEvent, + SharedSessionContractImplementor session, + CachedDomainDataAccess cachedDomainDataAccess, + EntityPersister persister, + boolean cacheContentChanged, + CacheActionDescription description); + + void completeCachePutEvent( + DiagnosticEvent cachePutEvent, + SharedSessionContractImplementor session, + CachedDomainDataAccess cachedDomainDataAccess, + EntityPersister persister, + boolean cacheContentChanged, + boolean isNatualId, + CacheActionDescription description); + + void completeCachePutEvent( + DiagnosticEvent cachePutEvent, + SharedSessionContractImplementor session, + CachedDomainDataAccess cachedDomainDataAccess, + CollectionPersister persister, + boolean cacheContentChanged, + CacheActionDescription description); + + DiagnosticEvent beginCacheGetEvent(); + + void completeCacheGetEvent( + DiagnosticEvent cacheGetEvent, + SharedSessionContractImplementor session, + Region region, + boolean hit); + + void completeCacheGetEvent( + DiagnosticEvent cacheGetEvent, + SharedSessionContractImplementor session, + Region region, + EntityPersister persister, + boolean isNaturalKey, + boolean hit); + + void completeCacheGetEvent( + DiagnosticEvent cacheGetEvent, + SharedSessionContractImplementor session, + Region region, + CollectionPersister persister, + boolean hit); + + DiagnosticEvent beginFlushEvent(); + + void completeFlushEvent( + DiagnosticEvent flushEvent, + org.hibernate.event.spi.FlushEvent event); + + void completeFlushEvent( + DiagnosticEvent flushEvent, + org.hibernate.event.spi.FlushEvent event, + boolean autoFlush); + + DiagnosticEvent beginPartialFlushEvent(); + + void completePartialFlushEvent( + DiagnosticEvent flushEvent, + AutoFlushEvent event); + + DiagnosticEvent beginDirtyCalculationEvent(); + + void completeDirtyCalculationEvent( + DiagnosticEvent dirtyCalculationEvent, + SharedSessionContractImplementor session, + EntityPersister persister, + EntityEntry entry, + int[] dirtyProperties); + + DiagnosticEvent beginPrePartialFlush(); + + void completePrePartialFlush( + DiagnosticEvent prePartialFlush, + SharedSessionContractImplementor session + ); + + DiagnosticEvent beginEntityInsertEvent(); + + void completeEntityInsertEvent(DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginEntityUpdateEvent(); + + void completeEntityUpdateEvent(DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginEntityUpsertEvent(); + + void completeEntityUpsertEvent(DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginEntityDeleteEvent(); + + void completeEntityDeleteEvent(DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginEntityLockEvent(); + + void completeEntityLockEvent(DiagnosticEvent event, Object id, String entityName, LockMode lockMode, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginCollectionRecreateEvent(); + + void completeCollectionRecreateEvent(DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginCollectionUpdateEvent(); + + void completeCollectionUpdateEvent(DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session); + + DiagnosticEvent beginCollectionRemoveEvent(); + + void completeCollectionRemoveEvent(DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session); + + enum CacheActionDescription { + ENTITY_INSERT( "Entity Insert" ), + ENTITY_AFTER_INSERT( "Entity After Insert" ), + ENTITY_UPDATE( "Entity Update" ), + ENTITY_LOAD( "Entity Load" ), + ENTITY_AFTER_UPDATE( "Entity After Update" ), + TIMESTAMP_PRE_INVALIDATE( "Timestamp Pre Invalidate" ), + TIMESTAMP_INVALIDATE( "Timestamp Invalidate" ), + COLLECTION_INSERT( "Collection Insert" ), + QUERY_RESULT( "Query Result" ); + + + private final String text; + + CacheActionDescription(String text) { + this.text = text; + } + + @Override + public String toString() { + return text; + } + + public String getText() { + return text; + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/HibernateMonitoringEvent.java b/hibernate-core/src/main/java/org/hibernate/event/spi/HibernateMonitoringEvent.java index b45d12d824..b001002489 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/HibernateMonitoringEvent.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/HibernateMonitoringEvent.java @@ -4,8 +4,10 @@ */ package org.hibernate.event.spi; -import org.hibernate.Incubating; +/** + * @deprecated Renamed {@link DiagnosticEvent}. + */ +@Deprecated(since = "7", forRemoval = true) +public interface HibernateMonitoringEvent extends DiagnosticEvent { -@Incubating -public interface HibernateMonitoringEvent { } diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 7a3c396968..116b8881cd 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -34,8 +34,8 @@ import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.generator.GeneratorCreationContext; import org.hibernate.id.ExportableColumn; import org.hibernate.id.IdentifierGeneratorHelper; @@ -623,8 +623,8 @@ public class TableGenerator implements PersistentIdentifierGenerator { SessionEventListenerManager listener, SharedSessionContractImplementor session) throws SQLException { logger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent creationEvent = eventManager.beginJdbcPreparedStatementCreationEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent creationEvent = eventMonitor.beginJdbcPreparedStatementCreationEvent(); final StatisticsImplementor stats = session.getFactory().getStatistics(); try { listener.jdbcPrepareStatementStart(); @@ -634,7 +634,7 @@ public class TableGenerator implements PersistentIdentifierGenerator { return connection.prepareStatement( sql ); } finally { - eventManager.completeJdbcPreparedStatementCreationEvent( creationEvent, sql ); + eventMonitor.completeJdbcPreparedStatementCreationEvent( creationEvent, sql ); listener.jdbcPrepareStatementEnd(); if ( stats != null && stats.isStatisticsEnabled() ) { stats.closeStatement(); @@ -647,14 +647,14 @@ public class TableGenerator implements PersistentIdentifierGenerator { SessionEventListenerManager listener, String sql, SharedSessionContractImplementor session) throws SQLException { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { listener.jdbcExecuteStatementStart(); return ps.executeUpdate(); } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); listener.jdbcExecuteStatementEnd(); } } @@ -664,14 +664,14 @@ public class TableGenerator implements PersistentIdentifierGenerator { SessionEventListenerManager listener, String sql, SharedSessionContractImplementor session) throws SQLException { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { listener.jdbcExecuteStatementStart(); return ps.executeQuery(); } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); listener.jdbcExecuteStatementEnd(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java index cfb33a1e14..67888a22a5 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java @@ -23,8 +23,8 @@ import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.id.ExportableColumn; import org.hibernate.id.IdentifierGenerationException; import org.hibernate.id.IntegralDataTypeHolder; @@ -237,8 +237,8 @@ public class TableStructure implements DatabaseStructure { SessionEventListenerManager statsCollector, SharedSessionContractImplementor session) throws SQLException { logger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent creationEvent = eventManager.beginJdbcPreparedStatementCreationEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent creationEvent = eventMonitor.beginJdbcPreparedStatementCreationEvent(); final StatisticsImplementor stats = session.getFactory().getStatistics(); try { statsCollector.jdbcPrepareStatementStart(); @@ -248,7 +248,7 @@ public class TableStructure implements DatabaseStructure { return connection.prepareStatement( sql ); } finally { - eventManager.completeJdbcPreparedStatementCreationEvent( creationEvent, sql ); + eventMonitor.completeJdbcPreparedStatementCreationEvent( creationEvent, sql ); statsCollector.jdbcPrepareStatementEnd(); if ( stats != null && stats.isStatisticsEnabled() ) { stats.closeStatement(); @@ -261,14 +261,14 @@ public class TableStructure implements DatabaseStructure { SessionEventListenerManager statsCollector, String sql, SharedSessionContractImplementor session) throws SQLException { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { statsCollector.jdbcExecuteStatementStart(); return ps.executeUpdate(); } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); statsCollector.jdbcExecuteStatementEnd(); } @@ -279,14 +279,14 @@ public class TableStructure implements DatabaseStructure { SessionEventListenerManager statsCollector, String sql, SharedSessionContractImplementor session) throws SQLException { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { statsCollector.jdbcExecuteStatementStart(); return ps.executeQuery(); } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql ); statsCollector.jdbcExecuteStatementEnd(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java index 55b4733927..93f1666350 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java @@ -49,7 +49,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.transaction.internal.TransactionImpl; import org.hibernate.engine.transaction.spi.TransactionImplementor; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.graph.RootGraph; import org.hibernate.graph.internal.RootGraphImpl; import org.hibernate.graph.spi.RootGraphImplementor; @@ -1435,8 +1435,8 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont } @Override - public EventManager getEventManager() { - return fastSessionServices.eventManager; + public EventMonitor getEventMonitor() { + return fastSessionServices.eventMonitor; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/internal/ContextualJdbcConnectionAccess.java b/hibernate-core/src/main/java/org/hibernate/internal/ContextualJdbcConnectionAccess.java index 3e8ca06042..fd71488d7d 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/ContextualJdbcConnectionAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/ContextualJdbcConnectionAccess.java @@ -13,8 +13,8 @@ import org.hibernate.SessionEventListener; import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; /** * @author Steve Ebersole @@ -43,14 +43,14 @@ public class ContextualJdbcConnectionAccess implements JdbcConnectionAccess, Ser throw new HibernateException( "Tenant identifier required" ); } - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent jdbcConnectionAcquisitionEvent = eventManager.beginJdbcConnectionAcquisitionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent jdbcConnectionAcquisitionEvent = eventMonitor.beginJdbcConnectionAcquisitionEvent(); try { listener.jdbcConnectionAcquisitionStart(); return connectionProvider.getConnection( tenantIdentifier ); } finally { - eventManager.completeJdbcConnectionAcquisitionEvent( + eventMonitor.completeJdbcConnectionAcquisitionEvent( jdbcConnectionAcquisitionEvent, session, tenantIdentifier @@ -65,14 +65,14 @@ public class ContextualJdbcConnectionAccess implements JdbcConnectionAccess, Ser throw new HibernateException( "Tenant identifier required" ); } - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent jdbcConnectionReleaseEvent = eventManager.beginJdbcConnectionReleaseEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent jdbcConnectionReleaseEvent = eventMonitor.beginJdbcConnectionReleaseEvent(); try { listener.jdbcConnectionReleaseStart(); connectionProvider.releaseConnection( tenantIdentifier, connection ); } finally { - eventManager.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, tenantIdentifier ); + eventMonitor.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, tenantIdentifier ); listener.jdbcConnectionReleaseEnd(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java b/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java index 3bcd602f5e..876c385eb6 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java @@ -22,7 +22,7 @@ import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.event.internal.EmptyEventManager; +import org.hibernate.event.internal.EmptyEventMonitor; import org.hibernate.event.service.spi.EventListenerGroup; import org.hibernate.event.service.spi.EventListenerRegistry; import org.hibernate.event.spi.*; @@ -125,7 +125,7 @@ public final class FastSessionServices { final MultiTenantConnectionProvider multiTenantConnectionProvider; final ClassLoaderService classLoaderService; final TransactionCoordinatorBuilder transactionCoordinatorBuilder; - final EventManager eventManager; + final EventMonitor eventMonitor; final boolean isJtaTransactionAccessible; final CacheMode initialSessionCacheMode; final FlushMode initialSessionFlushMode; @@ -235,8 +235,8 @@ public final class FastSessionServices { this.xmlFormatMapper = sessionFactoryOptions.getXmlFormatMapper(); this.batchBuilder = serviceRegistry.getService( BatchBuilder.class ); - final Collection eventManagers = classLoaderService.loadJavaServices( EventManager.class ); - this.eventManager = eventManagers.isEmpty() ? new EmptyEventManager() : eventManagers.iterator().next(); + final Collection eventMonitors = classLoaderService.loadJavaServices( EventMonitor.class ); + this.eventMonitor = eventMonitors.isEmpty() ? new EmptyEventMonitor() : eventMonitors.iterator().next(); } private static FlushMode initializeDefaultFlushMode(Map defaultSessionProperties) { diff --git a/hibernate-core/src/main/java/org/hibernate/internal/NonContextualJdbcConnectionAccess.java b/hibernate-core/src/main/java/org/hibernate/internal/NonContextualJdbcConnectionAccess.java index 40fa4295c2..295a17d0da 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/NonContextualJdbcConnectionAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/NonContextualJdbcConnectionAccess.java @@ -13,8 +13,8 @@ import org.hibernate.SessionEventListener; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; /** * @author Steve Ebersole @@ -37,14 +37,14 @@ public class NonContextualJdbcConnectionAccess implements JdbcConnectionAccess, @Override public Connection obtainConnection() throws SQLException { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent jdbcConnectionAcquisitionEvent = eventManager.beginJdbcConnectionAcquisitionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent jdbcConnectionAcquisitionEvent = eventMonitor.beginJdbcConnectionAcquisitionEvent(); try { listener.jdbcConnectionAcquisitionStart(); return connectionProvider.getConnection(); } finally { - eventManager.completeJdbcConnectionAcquisitionEvent( + eventMonitor.completeJdbcConnectionAcquisitionEvent( jdbcConnectionAcquisitionEvent, session, null @@ -55,14 +55,14 @@ public class NonContextualJdbcConnectionAccess implements JdbcConnectionAccess, @Override public void releaseConnection(Connection connection) throws SQLException { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent jdbcConnectionReleaseEvent = eventManager.beginJdbcConnectionReleaseEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent jdbcConnectionReleaseEvent = eventMonitor.beginJdbcConnectionReleaseEvent(); try { listener.jdbcConnectionReleaseStart(); connectionProvider.closeConnection( connection ); } finally { - eventManager.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, null ); + eventMonitor.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, null ); listener.jdbcConnectionReleaseEnd(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index 1d70643797..3a11ef220d 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -72,8 +72,8 @@ import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.transaction.spi.TransactionImplementor; import org.hibernate.resource.transaction.spi.TransactionObserver; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.AutoFlushEvent; import org.hibernate.event.spi.AutoFlushEventListener; import org.hibernate.event.spi.ClearEvent; @@ -241,7 +241,7 @@ public class SessionImpl public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) { super( factory, options ); - final HibernateMonitoringEvent sessionOpenEvent = getEventManager().beginSessionOpenEvent(); + final DiagnosticEvent sessionOpenEvent = getEventMonitor().beginSessionOpenEvent(); try { persistenceContext = createPersistenceContext(); @@ -280,7 +280,7 @@ public class SessionImpl } } finally { - getEventManager().completeSessionOpenEvent( sessionOpenEvent, this ); + getEventMonitor().completeSessionOpenEvent( sessionOpenEvent, this ); } } @@ -411,8 +411,8 @@ public class SessionImpl log.tracef( "Closing session [%s]", getSessionIdentifier() ); } - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent sessionClosedEvent = eventManager.beginSessionClosedEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent sessionClosedEvent = eventMonitor.beginSessionClosedEvent(); try { if ( isJpaBootstrap() ) { // Original HEM close behavior @@ -437,7 +437,7 @@ public class SessionImpl if ( statistics.isStatisticsEnabled() ) { statistics.closeSession(); } - eventManager.completeSessionClosedEvent( sessionClosedEvent, this ); + eventMonitor.completeSessionClosedEvent( sessionClosedEvent, this ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java index 4338551fa2..7fb79b588f 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java @@ -31,8 +31,8 @@ import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper; import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PostDeleteEvent; import org.hibernate.event.spi.PostDeleteEventListener; import org.hibernate.event.spi.PostInsertEvent; @@ -186,15 +186,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen } else { getInterceptor().onInsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() ); - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityInsertEvent(); boolean success = false; try { persister.getInsertCoordinator().insert( entity, id, state, this ); success = true; } finally { - eventManager.completeEntityInsertEvent( event, id, persister.getEntityName(), success, this ); + eventMonitor.completeEntityInsertEvent( event, id, persister.getEntityName(), success, this ); } } } @@ -210,15 +210,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen private void recreateCollections(Object entity, Object id, EntityPersister persister) { forEachOwnedCollection( entity, id, persister, (descriptor, collection) -> { - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginCollectionRecreateEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginCollectionRecreateEvent(); boolean success = false; try { descriptor.recreate( collection, id, this ); success = true; } finally { - eventManager.completeCollectionRecreateEvent( event, id, descriptor.getRole(), success, this ); + eventMonitor.completeCollectionRecreateEvent( event, id, descriptor.getRole(), success, this ); } final StatisticsImplementor statistics = getFactory().getStatistics(); if ( statistics.isStatisticsEnabled() ) { @@ -257,15 +257,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen if ( !firePreDelete(entity, id, persister) ) { getInterceptor().onDelete( entity, id, persister.getPropertyNames(), persister.getPropertyTypes() ); removeCollections( entity, id, persister ); - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityDeleteEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityDeleteEvent(); boolean success = false; try { persister.getDeleteCoordinator().delete( entity, id, version, this ); success = true; } finally { - eventManager.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, this ); + eventMonitor.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, this ); } firePostDelete(entity, id, persister); final StatisticsImplementor statistics = getFactory().getStatistics(); @@ -278,15 +278,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen private void removeCollections(Object entity, Object id, EntityPersister persister) { forEachOwnedCollection( entity, id, persister, (descriptor, collection) -> { - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginCollectionRemoveEvent(); boolean success = false; try { descriptor.remove( id, this ); success = true; } finally { - eventManager.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this ); + eventMonitor.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this ); } final StatisticsImplementor statistics = getFactory().getStatistics(); @@ -336,15 +336,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen } if ( !firePreUpdate(entity, id, state, persister) ) { getInterceptor().onUpdate( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() ); - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityUpdateEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityUpdateEvent(); boolean success = false; try { persister.getUpdateCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this ); success = true; } finally { - eventManager.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, this ); + eventMonitor.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, this ); } removeAndRecreateCollections( entity, id, persister ); firePostUpdate(entity, id, state, persister); @@ -358,8 +358,8 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen private void removeAndRecreateCollections(Object entity, Object id, EntityPersister persister) { forEachOwnedCollection( entity, id, persister, (descriptor, collection) -> { - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginCollectionRemoveEvent(); boolean success = false; try { // TODO: can we do better here? @@ -368,7 +368,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen success = true; } finally { - eventManager.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this ); + eventMonitor.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this ); } final StatisticsImplementor statistics = getFactory().getStatistics(); if ( statistics.isStatisticsEnabled() ) { @@ -405,15 +405,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen if ( !firePreUpsert(entity, id, state, persister) ) { getInterceptor().onUpsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() ); final Object oldVersion = versionToUpsert( entity, persister, state ); - final EventManager eventManager = getEventManager(); - final HibernateMonitoringEvent event = eventManager.beginEntityUpsertEvent(); + final EventMonitor eventMonitor = getEventMonitor(); + final DiagnosticEvent event = eventMonitor.beginEntityUpsertEvent(); boolean success = false; try { persister.getMergeCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this ); success = true; } finally { - eventManager.completeEntityUpsertEvent( event, id, persister.getEntityName(), success, this ); + eventMonitor.completeEntityUpsertEvent( event, id, persister.getEntityName(), success, this ); } final StatisticsImplementor statistics = getFactory().getStatistics(); if ( statistics.isStatisticsEnabled() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java index 437425036a..9699247b2b 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java @@ -18,9 +18,9 @@ import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SubselectFetch; -import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.event.spi.EventSource; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.loader.LoaderLogging; import org.hibernate.metamodel.mapping.BasicValuedModelPart; import org.hibernate.metamodel.mapping.EntityMappingType; @@ -109,15 +109,15 @@ public class LoaderHelper { } else { if ( entry.isExistsInDatabase() ) { - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent entityLockEvent = eventManager.beginEntityLockEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent entityLockEvent = eventMonitor.beginEntityLockEvent(); boolean success = false; try { persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session ); success = true; } finally { - eventManager.completeEntityLockEvent( entityLockEvent, entry.getId(), + eventMonitor.completeEntityLockEvent( entityLockEvent, entry.getId(), persister.getEntityName(), lockOptions.getLockMode(), success, session ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java index fd0f82095f..bdd4cab39f 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionOwner.java @@ -7,8 +7,12 @@ package org.hibernate.resource.jdbc.spi; import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.event.spi.EventManager; +import org.hibernate.event.spi.EventMonitor; import org.hibernate.resource.transaction.spi.TransactionCoordinator; +import static java.lang.reflect.InvocationHandler.invokeDefault; +import static java.lang.reflect.Proxy.newProxyInstance; + /** * Contract for something that controls a {@link JdbcSessionContext}. *

@@ -70,9 +74,31 @@ public interface JdbcSessionOwner { */ Integer getJdbcBatchSize(); - EventManager getEventManager(); - default SqlExceptionHelper getSqlExceptionHelper() { return getJdbcSessionContext().getJdbcServices().getSqlExceptionHelper(); } + + /** + * Obtain a reference to the {@link EventMonitor}. + * + * @since 7.0 + */ + EventMonitor getEventMonitor(); + + /** + * Obtain a reference to the {@link EventMonitor} + * dressed up as an instance of {@link EventManager}. + * + * @since 6.4 + * + * @deprecated Use {@link #getEventMonitor()}. + */ + @Deprecated(since = "7.0", forRemoval = true) + default EventManager getEventManager() { + final EventMonitor eventMonitor = getEventMonitor(); + return (EventManager) + newProxyInstance( EventManager.class.getClassLoader(), new Class[]{ EventManager.class }, + (instance, method, arguments) + -> invokeDefault( eventMonitor, method, arguments) ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java b/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java index 597979fd93..8e527c84d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java @@ -16,8 +16,8 @@ import java.util.function.Supplier; import org.hibernate.JDBCException; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.CoreLogging; import org.hibernate.procedure.internal.ProcedureCallImpl; import org.hibernate.query.results.ResultSetMapping; @@ -68,8 +68,8 @@ public class OutputsImpl implements Outputs { if ( sqlStatementLogger.getLogSlowQuery() > 0 ) { executeStartNanos = System.nanoTime(); } - final EventManager eventManager = context.getSession().getEventManager(); - final HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = context.getSession().getEventMonitor(); + final DiagnosticEvent jdbcPreparedStatementExecutionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { final boolean isResultSet = jdbcStatement.execute(); currentReturnState = buildCurrentReturnState( isResultSet ); @@ -78,7 +78,7 @@ public class OutputsImpl implements Outputs { throw convert( e, "Error calling CallableStatement.getMoreResults" ); } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, sql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, sql ); sqlStatementLogger.logSlowQuery( sql, executeStartNanos, this.context.getSession().getJdbcSessionContext() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/StandardJdbcMutationExecutor.java b/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/StandardJdbcMutationExecutor.java index bfa75dfaa8..539352a869 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/StandardJdbcMutationExecutor.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/StandardJdbcMutationExecutor.java @@ -12,8 +12,8 @@ import java.util.function.Function; import org.hibernate.JDBCException; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.query.spi.QueryOptions; import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor; @@ -82,15 +82,15 @@ public class StandardJdbcMutationExecutor implements JdbcMutationExecutor { } session.getEventListenerManager().jdbcExecuteStatementStart(); - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent jdbcPreparedStatementExecutionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { int rows = preparedStatement.executeUpdate(); expectationCheck.accept( rows, preparedStatement ); return rows; } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql ); session.getEventListenerManager().jdbcExecuteStatementEnd(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java index 1bfc1a5d61..a14ac84636 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java @@ -34,8 +34,8 @@ import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.Status; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.event.spi.PreLoadEvent; import org.hibernate.event.spi.PreLoadEventListener; import org.hibernate.internal.log.LoggingHelper; @@ -1506,10 +1506,10 @@ public class EntityInitializerImpl extends AbstractInitializer 0 ) { executeStartNanos = System.nanoTime(); } - final EventManager eventManager = session.getEventManager(); - final HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent(); + final EventMonitor eventMonitor = session.getEventMonitor(); + final DiagnosticEvent jdbcPreparedStatementExecutionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent(); try { eventListenerManager.jdbcExecuteStatementStart(); resultSet = wrapResultSet( preparedStatement.executeQuery() ); } finally { - eventManager.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql ); + eventMonitor.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql ); eventListenerManager.jdbcExecuteStatementEnd(); sqlStatementLogger.logSlowQuery( finalSql, executeStartNanos, context() ); } diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CacheGetEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CacheGetEvent.java index d9a17b45d5..b93201fa16 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CacheGetEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CacheGetEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description( "Cache Get Executed" ) @StackTrace @AllowNonPortable -public class CacheGetEvent extends Event implements HibernateMonitoringEvent { +public class CacheGetEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.CacheGet"; @Label( "Session Identifier" ) diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CachePutEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CachePutEvent.java index 151558c1e8..ae718e7647 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CachePutEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CachePutEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description( "Cache Put Executed" ) @StackTrace @AllowNonPortable -public class CachePutEvent extends Event implements HibernateMonitoringEvent { +public class CachePutEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.CachePut"; @Label( "Session Identifier" ) diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRecreateEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRecreateEvent.java index 7f17536e23..eccd993f4a 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRecreateEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRecreateEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(CollectionRecreateEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Collection Recreate") @StackTrace @AllowNonPortable -public class CollectionRecreateEvent extends Event implements HibernateMonitoringEvent { +public class CollectionRecreateEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.CollectionRecreateEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRemoveEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRemoveEvent.java index 96e0b0846c..e03c1986aa 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRemoveEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionRemoveEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(CollectionRemoveEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Collection Remove") @StackTrace @AllowNonPortable -public class CollectionRemoveEvent extends Event implements HibernateMonitoringEvent { +public class CollectionRemoveEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.CollectionRemoveEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionUpdateEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionUpdateEvent.java index 1bd1be07ea..c909e0518f 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionUpdateEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/CollectionUpdateEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(CollectionUpdateEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Collection Update") @StackTrace @AllowNonPortable -public class CollectionUpdateEvent extends Event implements HibernateMonitoringEvent { +public class CollectionUpdateEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.CollectionUpdateEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/DirtyCalculationEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/DirtyCalculationEvent.java index eee777adf0..1fe317debd 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/DirtyCalculationEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/DirtyCalculationEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description("DirtyCalculationEvent Execution") @StackTrace @AllowNonPortable -public class DirtyCalculationEvent extends Event implements HibernateMonitoringEvent { +public class DirtyCalculationEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.DirtyCalculationEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityDeleteEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityDeleteEvent.java index e646919ecc..c39c740271 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityDeleteEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityDeleteEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(EntityDeleteEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Entity Delete") @StackTrace @AllowNonPortable -public class EntityDeleteEvent extends Event implements HibernateMonitoringEvent { +public class EntityDeleteEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.EntityDeleteEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityInsertEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityInsertEvent.java index 7f29378676..b8e7d1eab7 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityInsertEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityInsertEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(EntityInsertEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Entity Insert") @StackTrace @AllowNonPortable -public class EntityInsertEvent extends Event implements HibernateMonitoringEvent { +public class EntityInsertEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.EntityInsertEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityLockEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityLockEvent.java index 3b899b698e..e99d5eb182 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityLockEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityLockEvent.java @@ -11,7 +11,7 @@ import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; import org.hibernate.LockMode; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(EntityLockEvent.NAME) @@ -20,7 +20,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Entity Delete") @StackTrace @AllowNonPortable -public class EntityLockEvent extends Event implements HibernateMonitoringEvent { +public class EntityLockEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.EntityDeleteEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpdateEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpdateEvent.java index a94f378be6..c227b88ad7 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpdateEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpdateEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(EntityUpdateEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Entity Update") @StackTrace @AllowNonPortable -public class EntityUpdateEvent extends Event implements HibernateMonitoringEvent { +public class EntityUpdateEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.EntityUpdateEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpsertEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpsertEvent.java index fec2443903..c801a6a725 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpsertEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/EntityUpsertEvent.java @@ -10,7 +10,7 @@ import jdk.jfr.Event; import jdk.jfr.Label; import jdk.jfr.Name; import jdk.jfr.StackTrace; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; @Name(EntityUpsertEvent.NAME) @@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable; @Description("Entity Upsert") @StackTrace @AllowNonPortable -public class EntityUpsertEvent extends Event implements HibernateMonitoringEvent { +public class EntityUpsertEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.EntityUpsertEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/FlushEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/FlushEvent.java index 1901118dbe..5af24b4cbb 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/FlushEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/FlushEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description("Flush Execution") @StackTrace @AllowNonPortable -public class FlushEvent extends Event implements HibernateMonitoringEvent { +public class FlushEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.FlushEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcBatchExecutionEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcBatchExecutionEvent.java index 1a36999956..a230148a4c 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcBatchExecutionEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcBatchExecutionEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description("JDBC Batch Execution") @StackTrace @AllowNonPortable -public class JdbcBatchExecutionEvent extends Event implements HibernateMonitoringEvent { +public class JdbcBatchExecutionEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.JdbcBatchExecution"; @Label("PreparedStatement SQL") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionAcquisitionEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionAcquisitionEvent.java index b3c6748c20..96db5770d8 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionAcquisitionEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionAcquisitionEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description("JDBC Connection Obtained") @StackTrace @AllowNonPortable -public class JdbcConnectionAcquisitionEvent extends Event implements HibernateMonitoringEvent { +public class JdbcConnectionAcquisitionEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.JdbcConnectionAcquisition"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionReleaseEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionReleaseEvent.java index c2fad01c3b..aebd34836c 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionReleaseEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcConnectionReleaseEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description("JDBC Connection Released") @StackTrace @AllowNonPortable -public class JdbcConnectionReleaseEvent extends Event implements HibernateMonitoringEvent { +public class JdbcConnectionReleaseEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.JdbcConnectionRelease"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementCreationEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementCreationEvent.java index b9a34256a3..434547182a 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementCreationEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementCreationEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description("JDBC PreparedStatement Created") @StackTrace @AllowNonPortable -public class JdbcPreparedStatementCreationEvent extends Event implements HibernateMonitoringEvent { +public class JdbcPreparedStatementCreationEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.JdbcPreparedStatementCreation"; @Label("PreparedStatement SQL") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementExecutionEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementExecutionEvent.java index b15f747f5d..d9af6d6551 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementExecutionEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JdbcPreparedStatementExecutionEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description( "JDBC PreparedStatement Executed" ) @StackTrace @AllowNonPortable -public class JdbcPreparedStatementExecutionEvent extends Event implements HibernateMonitoringEvent { +public class JdbcPreparedStatementExecutionEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.JdbcPreparedStatementExecution"; @Label( "PreparedStatement SQL" ) diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventMonitor.java similarity index 92% rename from hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java rename to hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventMonitor.java index 0678a732c1..a80d06fee7 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventManager.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/JfrEventMonitor.java @@ -10,8 +10,8 @@ import org.hibernate.cache.spi.access.CachedDomainDataAccess; import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.event.spi.AutoFlushEvent; -import org.hibernate.event.spi.EventManager; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.EventMonitor; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; @@ -23,7 +23,7 @@ import java.util.Objects; @AllowNonPortable -public class JfrEventManager implements EventManager { +public class JfrEventMonitor implements EventMonitor { private static final EventType sessionOpenEventType = EventType.getEventType( SessionOpenEvent.class ); private static final EventType sessionClosedEventType = EventType.getEventType( SessionClosedEvent.class ); @@ -65,7 +65,7 @@ public class JfrEventManager implements EventManager { @Override public void completeSessionOpenEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session) { if ( monitoringEvent != null ) { final SessionOpenEvent sessionOpenEvent = (SessionOpenEvent) monitoringEvent; @@ -91,7 +91,7 @@ public class JfrEventManager implements EventManager { @Override public void completeSessionClosedEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session) { if ( monitoringEvent != null ) { final SessionClosedEvent sessionClosedEvent = (SessionClosedEvent) monitoringEvent; @@ -117,7 +117,7 @@ public class JfrEventManager implements EventManager { @Override public void completeJdbcConnectionAcquisitionEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, Object tenantId) { if ( monitoringEvent != null ) { @@ -147,7 +147,7 @@ public class JfrEventManager implements EventManager { @Override public void completeJdbcConnectionReleaseEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, Object tenantId) { if ( monitoringEvent != null ) { @@ -177,7 +177,7 @@ public class JfrEventManager implements EventManager { @Override public void completeJdbcPreparedStatementCreationEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, String preparedStatementSql) { if ( monitoringEvent != null ) { final JdbcPreparedStatementCreationEvent jdbcPreparedStatementCreation = (JdbcPreparedStatementCreationEvent) monitoringEvent; @@ -203,7 +203,7 @@ public class JfrEventManager implements EventManager { @Override public void completeJdbcPreparedStatementExecutionEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, String preparedStatementSql) { if ( monitoringEvent != null ) { final JdbcPreparedStatementExecutionEvent jdbcPreparedStatementExecutionEvent = (JdbcPreparedStatementExecutionEvent) monitoringEvent; @@ -229,7 +229,7 @@ public class JfrEventManager implements EventManager { @Override public void completeJdbcBatchExecutionEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, String statementSql) { if ( monitoringEvent != null ) { final JdbcBatchExecutionEvent jdbcBatchExecutionEvent = (JdbcBatchExecutionEvent) monitoringEvent; @@ -242,7 +242,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginCachePutEvent() { + public DiagnosticEvent beginCachePutEvent() { if ( cachePutEventType.isEnabled() ) { final CachePutEvent cachePutEvent = new CachePutEvent(); cachePutEvent.begin(); @@ -255,7 +255,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, Region region, boolean cacheContentChanged, @@ -275,7 +275,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, CachedDomainDataAccess cachedDomainDataAccess, EntityPersister persister, @@ -294,7 +294,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, CachedDomainDataAccess cachedDomainDataAccess, EntityPersister persister, @@ -318,7 +318,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCachePutEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, CachedDomainDataAccess cachedDomainDataAccess, CollectionPersister persister, @@ -339,7 +339,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginCacheGetEvent() { + public DiagnosticEvent beginCacheGetEvent() { if ( cacheGetEventType.isEnabled() ) { final CacheGetEvent cacheGetEvent = new CacheGetEvent(); cacheGetEvent.begin(); @@ -352,7 +352,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCacheGetEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, Region region, boolean hit) { @@ -370,7 +370,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCacheGetEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, Region region, EntityPersister persister, @@ -392,7 +392,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCacheGetEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, Region region, CollectionPersister persister, @@ -424,14 +424,14 @@ public class JfrEventManager implements EventManager { @Override public void completeFlushEvent( - HibernateMonitoringEvent flushEvent, + DiagnosticEvent flushEvent, org.hibernate.event.spi.FlushEvent event) { completeFlushEvent( flushEvent, event, false ); } @Override public void completeFlushEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, org.hibernate.event.spi.FlushEvent hibernateFlushEvent, boolean autoFlush) { if ( monitoringEvent != null ) { @@ -461,7 +461,7 @@ public class JfrEventManager implements EventManager { @Override public void completePartialFlushEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, AutoFlushEvent hibernateAutoFlushEvent) { if ( monitoringEvent != null) { final PartialFlushEvent jfrPartialFlushEvent = (PartialFlushEvent) monitoringEvent; @@ -490,7 +490,7 @@ public class JfrEventManager implements EventManager { @Override public void completeDirtyCalculationEvent( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session, EntityPersister persister, EntityEntry entry, @@ -522,7 +522,7 @@ public class JfrEventManager implements EventManager { @Override public void completePrePartialFlush( - HibernateMonitoringEvent monitoringEvent, + DiagnosticEvent monitoringEvent, SharedSessionContractImplementor session) { if ( monitoringEvent != null ) { final PrePartialFlushEvent prePartialFlushEvent = (PrePartialFlushEvent) monitoringEvent; @@ -535,7 +535,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityInsertEvent() { + public DiagnosticEvent beginEntityInsertEvent() { if ( entityInsertEventType.isEnabled() ) { final EntityInsertEvent event = new EntityInsertEvent(); event.begin(); @@ -548,7 +548,7 @@ public class JfrEventManager implements EventManager { @Override public void completeEntityInsertEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -566,7 +566,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityUpdateEvent() { + public DiagnosticEvent beginEntityUpdateEvent() { if ( entityUpdateEventType.isEnabled() ) { final EntityUpdateEvent event = new EntityUpdateEvent(); event.begin(); @@ -579,7 +579,7 @@ public class JfrEventManager implements EventManager { @Override public void completeEntityUpdateEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -597,7 +597,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityUpsertEvent() { + public DiagnosticEvent beginEntityUpsertEvent() { if ( entityUpsertEventType.isEnabled() ) { final EntityUpsertEvent event = new EntityUpsertEvent(); event.begin(); @@ -610,7 +610,7 @@ public class JfrEventManager implements EventManager { @Override public void completeEntityUpsertEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -628,7 +628,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityDeleteEvent() { + public DiagnosticEvent beginEntityDeleteEvent() { if ( entityDeleteEventType.isEnabled() ) { final EntityDeleteEvent event = new EntityDeleteEvent(); event.begin(); @@ -641,7 +641,7 @@ public class JfrEventManager implements EventManager { @Override public void completeEntityDeleteEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String entityName, boolean success, SharedSessionContractImplementor session) { @@ -659,7 +659,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginEntityLockEvent() { + public DiagnosticEvent beginEntityLockEvent() { if ( entityLockEventType.isEnabled() ) { final EntityLockEvent event = new EntityLockEvent(); event.begin(); @@ -671,7 +671,7 @@ public class JfrEventManager implements EventManager { } @Override - public void completeEntityLockEvent(HibernateMonitoringEvent event, Object id, String entityName, LockMode lockMode, boolean success, SharedSessionContractImplementor session) { + public void completeEntityLockEvent(DiagnosticEvent event, Object id, String entityName, LockMode lockMode, boolean success, SharedSessionContractImplementor session) { if ( event != null ) { final EntityLockEvent entityLockEvent = (EntityLockEvent) event; entityLockEvent.end(); @@ -687,7 +687,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginCollectionRecreateEvent() { + public DiagnosticEvent beginCollectionRecreateEvent() { if ( collectionRecreateEventType.isEnabled() ) { final CollectionRecreateEvent event = new CollectionRecreateEvent(); event.begin(); @@ -700,7 +700,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCollectionRecreateEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { @@ -718,7 +718,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginCollectionUpdateEvent() { + public DiagnosticEvent beginCollectionUpdateEvent() { if ( collectionUpdateEventType.isEnabled() ) { final CollectionUpdateEvent event = new CollectionUpdateEvent(); event.begin(); @@ -731,7 +731,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCollectionUpdateEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { @@ -749,7 +749,7 @@ public class JfrEventManager implements EventManager { } @Override - public HibernateMonitoringEvent beginCollectionRemoveEvent() { + public DiagnosticEvent beginCollectionRemoveEvent() { if ( collectionRemoveEventType.isEnabled() ) { final CollectionRemoveEvent event = new CollectionRemoveEvent(); event.begin(); @@ -762,7 +762,7 @@ public class JfrEventManager implements EventManager { @Override public void completeCollectionRemoveEvent( - HibernateMonitoringEvent event, + DiagnosticEvent event, Object id, String role, boolean success, SharedSessionContractImplementor session) { diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PartialFlushEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PartialFlushEvent.java index f8ec42285d..20cba8197b 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PartialFlushEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PartialFlushEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description( "PartialFlushEvent Execution" ) @StackTrace @AllowNonPortable -public class PartialFlushEvent extends Event implements HibernateMonitoringEvent { +public class PartialFlushEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.PartialFlushEvent"; @Label( "Session Identifier" ) diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PrePartialFlushEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PrePartialFlushEvent.java index 2a5c99d7f5..2408ca73c3 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PrePartialFlushEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/PrePartialFlushEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -20,7 +20,7 @@ import jdk.jfr.StackTrace; @Description( "PrePartialFlushEvent Execution" ) @StackTrace @AllowNonPortable -public class PrePartialFlushEvent extends Event implements HibernateMonitoringEvent { +public class PrePartialFlushEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.PrePartialFlushEvent"; @Label("Session Identifier") diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionClosedEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionClosedEvent.java index ba4cc3eb30..ba6a158359 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionClosedEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionClosedEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -23,7 +23,7 @@ import jdk.jfr.StackTrace; @Description("Hibernate Session closed") @StackTrace @AllowNonPortable -public class SessionClosedEvent extends Event implements HibernateMonitoringEvent { +public class SessionClosedEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.SessionClosed"; @Label("Session Identifier" ) diff --git a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionOpenEvent.java b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionOpenEvent.java index 8ce1e56685..e66bcca45d 100644 --- a/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionOpenEvent.java +++ b/hibernate-jfr/src/main/java/org/hibernate/event/jfr/internal/SessionOpenEvent.java @@ -4,7 +4,7 @@ */ package org.hibernate.event.jfr.internal; -import org.hibernate.event.spi.HibernateMonitoringEvent; +import org.hibernate.event.spi.DiagnosticEvent; import org.hibernate.internal.build.AllowNonPortable; import jdk.jfr.Category; @@ -23,7 +23,7 @@ import jdk.jfr.StackTrace; @Description("Hibernate Session opened") @StackTrace @AllowNonPortable -public class SessionOpenEvent extends Event implements HibernateMonitoringEvent { +public class SessionOpenEvent extends Event implements DiagnosticEvent { public static final String NAME = "org.hibernate.orm.SessionOpen"; @Label("Session Identifier" ) diff --git a/hibernate-jfr/src/main/resources/META-INF/services/org.hibernate.event.spi.EventManager b/hibernate-jfr/src/main/resources/META-INF/services/org.hibernate.event.spi.EventManager deleted file mode 100644 index 17ed3647b7..0000000000 --- a/hibernate-jfr/src/main/resources/META-INF/services/org.hibernate.event.spi.EventManager +++ /dev/null @@ -1 +0,0 @@ -org.hibernate.event.jfr.internal.JfrEventManager \ No newline at end of file diff --git a/hibernate-jfr/src/main/resources/META-INF/services/org.hibernate.event.spi.EventMonitor b/hibernate-jfr/src/main/resources/META-INF/services/org.hibernate.event.spi.EventMonitor new file mode 100644 index 0000000000..8344c68fb5 --- /dev/null +++ b/hibernate-jfr/src/main/resources/META-INF/services/org.hibernate.event.spi.EventMonitor @@ -0,0 +1 @@ +org.hibernate.event.jfr.internal.JfrEventMonitor \ No newline at end of file diff --git a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityInsertCachePutEventTests.java b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityInsertCachePutEventTests.java index 9eea8c2366..3dc620c179 100644 --- a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityInsertCachePutEventTests.java +++ b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityInsertCachePutEventTests.java @@ -11,7 +11,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.cfg.AvailableSettings; import org.hibernate.event.jfr.internal.CachePutEvent; import org.hibernate.event.jfr.internal.JdbcBatchExecutionEvent; -import org.hibernate.event.jfr.internal.JfrEventManager; +import org.hibernate.event.jfr.internal.JfrEventMonitor; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; @@ -75,7 +75,7 @@ public class EntityInsertCachePutEventTests { // cache strategy is READ_WRITE so no cache insert happened assertThat( event.getBoolean( "cacheChanged" ) ).isFalse(); assertThat( event.getString( "regionName" ) ).isNotNull(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.ENTITY_INSERT.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.ENTITY_INSERT.getText() ); jfrEvents.reset(); AnotherTestEntity anotherTestEntity = new AnotherTestEntity( 1, "name_1" ); @@ -103,7 +103,7 @@ public class EntityInsertCachePutEventTests { assertThat( event.getBoolean( "cacheChanged" ) ).isTrue(); assertThat( event.getString( "regionName" ) ).isNotNull(); assertThat( event.getBoolean( "isNaturalId" ) ).isFalse(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.ENTITY_INSERT.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.ENTITY_INSERT.getText() ); } ); diff --git a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityUpdateCachePutEventTests.java b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityUpdateCachePutEventTests.java index 85a5f87c43..ef75083a4f 100644 --- a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityUpdateCachePutEventTests.java +++ b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/EntityUpdateCachePutEventTests.java @@ -11,7 +11,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.cfg.AvailableSettings; import org.hibernate.event.jfr.internal.CachePutEvent; import org.hibernate.event.jfr.internal.JdbcBatchExecutionEvent; -import org.hibernate.event.jfr.internal.JfrEventManager; +import org.hibernate.event.jfr.internal.JfrEventMonitor; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; @@ -89,7 +89,7 @@ public class EntityUpdateCachePutEventTests { assertThat( event.getBoolean( "cacheChanged" ) ).isFalse(); assertThat( event.getBoolean( "isNaturalId" ) ).isFalse(); assertThat( event.getString( "regionName" ) ).isNotNull(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.ENTITY_UPDATE.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.ENTITY_UPDATE.getText() ); jfrEvents.reset(); @@ -119,7 +119,7 @@ public class EntityUpdateCachePutEventTests { assertThat( event.getBoolean( "cacheChanged" ) ).isTrue(); assertThat( event.getString( "regionName" ) ).isNotNull(); assertThat( event.getBoolean( "isNaturalId" ) ).isFalse(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.ENTITY_UPDATE.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.ENTITY_UPDATE.getText() ); } ); diff --git a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/NaturalIdPutCacheTests.java b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/NaturalIdPutCacheTests.java index 5d2e0b6c6f..3a3f737e61 100644 --- a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/NaturalIdPutCacheTests.java +++ b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/NaturalIdPutCacheTests.java @@ -12,7 +12,7 @@ import org.hibernate.annotations.NaturalId; import org.hibernate.annotations.NaturalIdCache; import org.hibernate.cfg.AvailableSettings; import org.hibernate.event.jfr.internal.CachePutEvent; -import org.hibernate.event.jfr.internal.JfrEventManager; +import org.hibernate.event.jfr.internal.JfrEventMonitor; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; @@ -72,7 +72,7 @@ public class NaturalIdPutCacheTests { assertThat( event.getBoolean( "cacheChanged" ) ).isTrue(); assertThat( event.getBoolean( "isNaturalId" ) ).isFalse(); assertThat( event.getString( "regionName" ) ).isNotNull(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.ENTITY_INSERT.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.ENTITY_INSERT.getText() ); event = events.get( 1 ); assertThat( event.getEventType().getName() ) @@ -85,7 +85,7 @@ public class NaturalIdPutCacheTests { assertThat( event.getBoolean( "cacheChanged" ) ).isTrue(); assertThat( event.getBoolean( "isNaturalId" ) ).isTrue(); assertThat( event.getString( "regionName" ) ).isNotNull(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.ENTITY_INSERT.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.ENTITY_INSERT.getText() ); } ); } diff --git a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/QueryCachePutEventTests.java b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/QueryCachePutEventTests.java index 98949b90d9..376b597469 100644 --- a/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/QueryCachePutEventTests.java +++ b/hibernate-jfr/src/test/java/org/hibernate/event/jfr/cache/QueryCachePutEventTests.java @@ -9,7 +9,7 @@ import java.util.List; import org.hibernate.cfg.AvailableSettings; import org.hibernate.event.jfr.internal.CachePutEvent; import org.hibernate.event.jfr.internal.JdbcBatchExecutionEvent; -import org.hibernate.event.jfr.internal.JfrEventManager; +import org.hibernate.event.jfr.internal.JfrEventMonitor; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; @@ -85,7 +85,7 @@ public class QueryCachePutEventTests { assertThat( event.getBoolean( "cacheChanged" ) ).isTrue(); assertThat( event.getString( "regionName" ) ).isNotNull(); assertThat( event.getBoolean( "isNaturalId" ) ).isFalse(); - assertThat( event.getString( "description" ) ).isEqualTo( JfrEventManager.CacheActionDescription.QUERY_RESULT.getText() ); + assertThat( event.getString( "description" ) ).isEqualTo( JfrEventMonitor.CacheActionDescription.QUERY_RESULT.getText() ); } );