HHH-18948 rename EventManager -> EventMonitor

This commit is contained in:
Gavin King 2024-12-16 19:24:38 +01:00
parent eedcab3c17
commit a3c8fa7a25
69 changed files with 713 additions and 650 deletions

View File

@ -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 );

View File

@ -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 );
}
}

View File

@ -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 );
}
}

View File

@ -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 );
}
}

View File

@ -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 ) {

View File

@ -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();
}

View File

@ -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() ) {

View File

@ -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,

View File

@ -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,

View File

@ -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(),

View File

@ -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
);
}
}

View File

@ -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 );

View File

@ -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<JdbcEn
private final JpaCompliance jpaCompliance;
private final SqlExceptionHelper sqlExceptionHelper;
TransactionCoordinator transactionCoordinator;
private final EmptyEventManager eventManager;
private final EmptyEventMonitor eventManager;
public TemporaryJdbcSessionOwner(
JdbcConnectionAccess jdbcConnectionAccess,
@ -643,7 +643,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
.getDefaultConnectionHandlingMode();
this.jpaCompliance = new MutableJpaComplianceImpl( Collections.emptyMap(), false );
this.eventManager = new EmptyEventManager();
this.eventManager = new EmptyEventMonitor();
}
@Override
@ -692,7 +692,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
}
@Override
public EventManager getEventManager() {
public EventMonitor getEventMonitor() {
return eventManager;
}

View File

@ -12,8 +12,8 @@ import org.hibernate.AssertionFailure;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.MutationStatementPreparer;
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
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.JdbcSessionContext;
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
@ -94,15 +94,15 @@ public class MutationStatementPreparerImpl implements MutationStatementPreparer
final PreparedStatement preparedStatement;
final JdbcSessionOwner jdbcSessionOwner = jdbcCoordinator.getJdbcSessionOwner();
final JdbcEventHandler jdbcEventHandler = jdbcSessionOwner.getJdbcSessionContext().getEventHandler();
final EventManager eventManager = jdbcSessionOwner.getEventManager();
final HibernateMonitoringEvent jdbcPreparedStatementCreation = eventManager.beginJdbcPreparedStatementCreationEvent();
final EventMonitor eventMonitor = jdbcSessionOwner.getEventMonitor();
final DiagnosticEvent jdbcPreparedStatementCreation = eventMonitor.beginJdbcPreparedStatementCreationEvent();
try {
jdbcEventHandler.jdbcPrepareStatementStart();
preparedStatement = doPrepare();
setStatementTimeout( preparedStatement );
}
finally {
eventManager.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
eventMonitor.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
jdbcEventHandler.jdbcPrepareStatementEnd();
}
postProcess( preparedStatement );

View File

@ -14,8 +14,8 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.ResultSetReturn;
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.JdbcSessionContext;
@ -50,15 +50,15 @@ public class ResultSetReturnImpl implements ResultSetReturn {
}
try {
final ResultSet rs;
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent executionEvent =
eventManager.beginJdbcPreparedStatementExecutionEvent();
final EventMonitor eventMonitor = getEventManager();
final DiagnosticEvent executionEvent =
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
try {
jdbcExecuteStatementStart();
rs = statement.executeQuery();
}
finally {
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
jdbcExecuteStatementEnd();
endSlowQueryLogging(sql, executeStartNanos);
}
@ -70,8 +70,8 @@ public class ResultSetReturnImpl implements ResultSetReturn {
}
}
private EventManager getEventManager() {
return jdbcCoordinator.getJdbcSessionOwner().getEventManager();
private EventMonitor getEventManager() {
return jdbcCoordinator.getJdbcSessionOwner().getEventMonitor();
}
private JdbcEventHandler getEventHandler() {
@ -96,15 +96,15 @@ public class ResultSetReturnImpl implements ResultSetReturn {
long executeStartNanos = beginSlowQueryLogging();
try {
final ResultSet rs;
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent executionEvent =
eventManager.beginJdbcPreparedStatementExecutionEvent();
final EventMonitor eventMonitor = getEventManager();
final DiagnosticEvent executionEvent =
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
try {
jdbcExecuteStatementStart();
rs = statement.executeQuery( sql );
}
finally {
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
jdbcExecuteStatementEnd();
endSlowQueryLogging( sql, executeStartNanos );
}
@ -122,9 +122,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
long executeStartNanos = beginSlowQueryLogging();
try {
final ResultSet rs;
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent executionEvent =
eventManager.beginJdbcPreparedStatementExecutionEvent();
final EventMonitor eventMonitor = getEventManager();
final DiagnosticEvent executionEvent =
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
try {
jdbcExecuteStatementStart();
if ( !statement.execute() ) {
@ -135,7 +135,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
rs = statement.getResultSet();
}
finally {
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
jdbcExecuteStatementEnd();
endSlowQueryLogging( sql, executeStartNanos );
}
@ -153,9 +153,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
long executeStartNanos = beginSlowQueryLogging();
try {
final ResultSet rs;
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent executionEvent =
eventManager.beginJdbcPreparedStatementExecutionEvent();
final EventMonitor eventMonitor = getEventManager();
final DiagnosticEvent executionEvent =
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
try {
jdbcExecuteStatementStart();
if ( !statement.execute( sql ) ) {
@ -166,7 +166,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
rs = statement.getResultSet();
}
finally {
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
jdbcExecuteStatementEnd();
endSlowQueryLogging( sql, executeStartNanos );
}
@ -182,9 +182,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
public int executeUpdate(PreparedStatement statement, String sql) {
assert statement != null;
long executeStartNanos = beginSlowQueryLogging();
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent executionEvent =
eventManager.beginJdbcPreparedStatementExecutionEvent();
final EventMonitor eventMonitor = getEventManager();
final DiagnosticEvent executionEvent =
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
try {
jdbcExecuteStatementStart();
return statement.executeUpdate();
@ -193,7 +193,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
throw sqlExceptionHelper.convert( e, "could not execute statement", sql );
}
finally {
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
jdbcExecuteStatementEnd();
endSlowQueryLogging( sql, executeStartNanos );
}
@ -203,9 +203,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
public int executeUpdate(Statement statement, String sql) {
sqlStatementLogger.logStatement( sql );
long executeStartNanos = beginSlowQueryLogging();
final EventManager eventManager = getEventManager();
final HibernateMonitoringEvent executionEvent =
eventManager.beginJdbcPreparedStatementExecutionEvent();
final EventMonitor eventMonitor = getEventManager();
final DiagnosticEvent executionEvent =
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
try {
jdbcExecuteStatementStart();
return statement.executeUpdate( sql );
@ -214,7 +214,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
throw sqlExceptionHelper.convert( e, "could not execute statement", sql );
}
finally {
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
jdbcExecuteStatementEnd();
endSlowQueryLogging( sql, executeStartNanos );
}

View File

@ -15,8 +15,8 @@ import org.hibernate.ScrollMode;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
import org.hibernate.engine.jdbc.spi.StatementPreparer;
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.JdbcSessionContext;
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
@ -171,15 +171,15 @@ class StatementPreparerImpl implements StatementPreparer {
final PreparedStatement preparedStatement;
final JdbcSessionOwner jdbcSessionOwner = jdbcCoordinator.getJdbcSessionOwner();
final JdbcEventHandler observer = jdbcSessionOwner.getJdbcSessionContext().getEventHandler();
final EventManager eventManager = jdbcSessionOwner.getEventManager();
final HibernateMonitoringEvent jdbcPreparedStatementCreation = eventManager.beginJdbcPreparedStatementCreationEvent();
final EventMonitor eventMonitor = jdbcSessionOwner.getEventMonitor();
final DiagnosticEvent jdbcPreparedStatementCreation = eventMonitor.beginJdbcPreparedStatementCreationEvent();
try {
observer.jdbcPrepareStatementStart();
preparedStatement = doPrepare();
setStatementTimeout( preparedStatement );
}
finally {
eventManager.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
eventMonitor.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
observer.jdbcPrepareStatementEnd();
}
postProcess( preparedStatement );

View File

@ -34,7 +34,7 @@ import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.event.spi.EventManager;
import org.hibernate.event.spi.EventMonitor;
import org.hibernate.event.spi.EventSource;
import org.hibernate.graph.RootGraph;
import org.hibernate.graph.spi.RootGraphImplementor;
@ -1168,8 +1168,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
}
@Override
public EventManager getEventManager() {
return delegate.getEventManager();
public EventMonitor getEventMonitor() {
return delegate.getEventMonitor();
}
@Override

View File

@ -25,7 +25,7 @@ import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.event.spi.EventManager;
import org.hibernate.event.spi.EventMonitor;
import org.hibernate.graph.RootGraph;
import org.hibernate.jdbc.ReturningWork;
import org.hibernate.jdbc.Work;
@ -329,8 +329,8 @@ public class SharedSessionDelegatorBaseImpl implements SharedSessionContractImpl
}
@Override
public EventManager getEventManager() {
return delegate.getEventManager();
public EventMonitor getEventMonitor() {
return delegate.getEventMonitor();
}
@Override

View File

@ -11,8 +11,8 @@ import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SessionEventListenerManager;
import org.hibernate.event.spi.AutoFlushEvent;
import org.hibernate.event.spi.AutoFlushEventListener;
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.EventSource;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.stat.spi.StatisticsImplementor;
@ -40,8 +40,8 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
public void onAutoFlush(AutoFlushEvent event) throws HibernateException {
final EventSource source = event.getSession();
final SessionEventListenerManager eventListenerManager = source.getEventListenerManager();
final EventManager eventManager = source.getEventManager();
final HibernateMonitoringEvent partialFlushEvent = eventManager.beginPartialFlushEvent();
final EventMonitor eventMonitor = source.getEventMonitor();
final DiagnosticEvent partialFlushEvent = eventMonitor.beginPartialFlushEvent();
try {
eventListenerManager.partialFlushStart();
@ -62,7 +62,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
// note: performExecutions() clears all collectionXxxxtion
// collections (the collection actions) in the session
final HibernateMonitoringEvent flushEvent = eventManager.beginFlushEvent();
final DiagnosticEvent flushEvent = eventMonitor.beginFlushEvent();
try {
performExecutions( source );
postFlush( source );
@ -70,7 +70,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
postPostFlush( source );
}
finally {
eventManager.completeFlushEvent( flushEvent, event, true );
eventMonitor.completeFlushEvent( flushEvent, event, true );
}
final StatisticsImplementor statistics = source.getFactory().getStatistics();
if ( statistics.isStatisticsEnabled() ) {
@ -85,7 +85,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
}
}
finally {
eventManager.completePartialFlushEvent( partialFlushEvent, event );
eventMonitor.completePartialFlushEvent( partialFlushEvent, event );
eventListenerManager.partialFlushEnd(
event.getNumberOfEntitiesProcessed(),
event.getNumberOfEntitiesProcessed()
@ -97,15 +97,15 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
public void onAutoPreFlush(EventSource source) throws HibernateException {
final SessionEventListenerManager eventListenerManager = source.getEventListenerManager();
eventListenerManager.prePartialFlushStart();
final EventManager eventManager = source.getEventManager();
HibernateMonitoringEvent hibernateMonitoringEvent = eventManager.beginPrePartialFlush();
final EventMonitor eventMonitor = source.getEventMonitor();
DiagnosticEvent diagnosticEvent = eventMonitor.beginPrePartialFlush();
try {
if ( flushMightBeNeeded( source ) ) {
preFlush( source, source.getPersistenceContextInternal() );
}
}
finally {
eventManager.completePrePartialFlush( hibernateMonitoringEvent, source );
eventMonitor.completePrePartialFlush( diagnosticEvent, source );
eventListenerManager.prePartialFlushEnd();
}
}

View File

@ -23,8 +23,8 @@ import org.hibernate.engine.spi.SelfDirtinessTracker;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
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.EventSource;
import org.hibernate.event.spi.FlushEntityEvent;
import org.hibernate.event.spi.FlushEntityEventListener;
@ -472,8 +472,8 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
final SessionImplementor session = event.getSession();
final boolean dirtyCheckPossible;
int[] dirtyProperties = null;
final EventManager eventManager = session.getEventManager();
final HibernateMonitoringEvent dirtyCalculationEvent = eventManager.beginDirtyCalculationEvent();
final EventMonitor eventMonitor = session.getEventMonitor();
final DiagnosticEvent dirtyCalculationEvent = eventMonitor.beginDirtyCalculationEvent();
final EntityEntry entry = event.getEntityEntry();
final EntityPersister persister = entry.getPersister();
try {
@ -524,7 +524,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
event.setDirtyCheckPossible( dirtyCheckPossible );
}
finally {
eventManager.completeDirtyCalculationEvent( dirtyCalculationEvent, session, persister, entry, dirtyProperties );
eventMonitor.completeDirtyCalculationEvent( dirtyCalculationEvent, session, persister, entry, dirtyProperties );
session.getEventListenerManager().dirtyCalculationEnd( dirtyProperties != null );
}
return dirtyProperties;

View File

@ -6,8 +6,8 @@ package org.hibernate.event.internal;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.PersistenceContext;
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.EventSource;
import org.hibernate.event.spi.FlushEvent;
import org.hibernate.event.spi.FlushEventListener;
@ -28,10 +28,10 @@ public class DefaultFlushEventListener extends AbstractFlushingEventListener imp
public void onFlush(FlushEvent event) throws HibernateException {
final EventSource source = event.getSession();
final PersistenceContext persistenceContext = source.getPersistenceContextInternal();
final EventManager eventManager = source.getEventManager();
final EventMonitor eventMonitor = source.getEventMonitor();
if ( persistenceContext.getNumberOfManagedEntities() > 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()

View File

@ -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) {
}
}

View File

@ -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}.
* <p>
* 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 {
}

View File

@ -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.
* <p>
* For example, this interface is implemented by Hibernate JFR to report
* events to Java Flight Recorder.
* <p>
* Note that event reporting is different to aggregate <em>metrics</em>,
* 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;
}
}
}

View File

@ -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.
* <p>
* For example, this interface is implemented by Hibernate JFR to report
* events to Java Flight Recorder.
* <p>
* Note that event reporting is different to aggregate <em>metrics</em>,
* 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;
}
}
}

View File

@ -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 {
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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();
}
}

View File

@ -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<Object> 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<EventManager> eventManagers = classLoaderService.loadJavaServices( EventManager.class );
this.eventManager = eventManagers.isEmpty() ? new EmptyEventManager() : eventManagers.iterator().next();
final Collection<EventMonitor> eventMonitors = classLoaderService.loadJavaServices( EventMonitor.class );
this.eventMonitor = eventMonitors.isEmpty() ? new EmptyEventMonitor() : eventMonitors.iterator().next();
}
private static FlushMode initializeDefaultFlushMode(Map<String, Object> defaultSessionProperties) {

View File

@ -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();
}
}

View File

@ -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 );
}
}

View File

@ -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() ) {

View File

@ -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 );
}
}

View File

@ -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}.
* <p>
@ -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) );
}
}

View File

@ -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() );
}
}

View File

@ -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();
}
}

View File

@ -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<EntityInitializer
// 2) Session#clear + some form of load
//
// we need to be careful not to clobber the lock here in the cache so that it can be rolled back if need be
final EventManager eventManager = session.getEventManager();
final EventMonitor eventMonitor = session.getEventMonitor();
if ( persistenceContext.wasInsertedDuringTransaction( data.concreteDescriptor, data.entityKey.getIdentifier() ) ) {
boolean cacheContentChanged = false;
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
try {
// Updating the cache entry for entities that were inserted in this transaction
// only makes sense for transactional caches. Other implementations no-op for #update
@ -1530,20 +1530,20 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
}
}
finally {
eventManager.completeCachePutEvent(
eventMonitor.completeCachePutEvent(
cachePutEvent,
session,
cacheAccess,
data.concreteDescriptor,
cacheContentChanged,
EventManager.CacheActionDescription.ENTITY_UPDATE
EventMonitor.CacheActionDescription.ENTITY_UPDATE
);
}
}
else {
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
boolean put = false;
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
try {
eventListenerManager.cachePutStart();
put = cacheAccess.putFromLoad(
@ -1556,13 +1556,13 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
);
}
finally {
eventManager.completeCachePutEvent(
eventMonitor.completeCachePutEvent(
cachePutEvent,
session,
cacheAccess,
data.concreteDescriptor,
put,
EventManager.CacheActionDescription.ENTITY_LOAD
EventMonitor.CacheActionDescription.ENTITY_LOAD
);
final StatisticsImplementor statistics = factory.getStatistics();
if ( put && statistics.isStatisticsEnabled() ) {

View File

@ -16,8 +16,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.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
@ -199,8 +199,8 @@ public class ResultsHelper {
// CollectionRegionAccessStrategy has no update, so avoid putting uncommitted data via putFromLoad
if ( isPutFromLoad ) {
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();
@ -214,13 +214,13 @@ public class ResultsHelper {
);
}
finally {
eventManager.completeCachePutEvent(
eventMonitor.completeCachePutEvent(
cachePutEvent,
session,
cacheAccess,
collectionDescriptor,
put,
EventManager.CacheActionDescription.COLLECTION_INSERT
EventMonitor.CacheActionDescription.COLLECTION_INSERT
);
eventListenerManager.cachePutEnd();

View File

@ -18,8 +18,8 @@ import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
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.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.query.spi.Limit;
@ -240,14 +240,14 @@ public class DeferredResultSetAccess extends AbstractResultSetAccess {
if ( sqlStatementLogger.getLogSlowQuery() > 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() );
}

View File

@ -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" )

View File

@ -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" )

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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" )

View File

@ -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) {

View File

@ -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" )

View File

@ -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")

View File

@ -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" )

View File

@ -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" )

View File

@ -1 +0,0 @@
org.hibernate.event.jfr.internal.JfrEventManager

View File

@ -0,0 +1 @@
org.hibernate.event.jfr.internal.JfrEventMonitor

View File

@ -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() );
}
);

View File

@ -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() );
}
);

View File

@ -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() );
}
);
}

View File

@ -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() );
}
);